Changeset 9586
- Timestamp:
- 06/05/13 14:09:51 (11 years ago)
- Location:
- branches/OaaS
- Files:
-
- 10 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Hive.Scaler
-
Property
svn:ignore
set to
bin
obj
-
Property
svn:ignore
set to
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing
-
Property
svn:ignore
set to
bin
obj
-
Property
svn:ignore
set to
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing.Test
-
Property
svn:ignore
set to
bin
obj
-
Property
svn:ignore
set to
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs
r9582 r9586 60 60 throw new System.NotImplementedException(); 61 61 } 62 63 64 public IList<UsageRecord> GetUsageRecords(string userName) { 65 throw new System.NotImplementedException(); 66 } 67 68 69 public IList<Invoice> GetInvoices(string userName) { 70 throw new System.NotImplementedException(); 71 } 62 72 } 63 73 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingServiceProvider.cs
r9577 r9586 3 3 namespace HeuristicLab.Services.Optimization.Billing.Business { 4 4 public static class BillingServiceProvider { 5 private static IOptimizationBilling instance = new BillingService();5 private static IOptimizationBilling instance = new MockupBillingService(); 6 6 7 7 public static IOptimizationBilling Instance { -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/MockupBillingService.cs
r9582 r9586 2 2 using System.Linq; 3 3 using HeuristicLab.Services.Optimization.Billing.Interfaces; 4 using System; 4 5 5 6 namespace HeuristicLab.Services.Optimization.Billing.Business { … … 10 11 private static IList<Model.Order> allOrders; 11 12 private static IDictionary<string, Model.User> users; 13 private static IDictionary<string, IList<Model.UsageRecord>> records; 14 private static IDictionary<string, IList<Model.Invoice>> invoices; 12 15 private static long maxId = 1; 13 16 14 17 static MockupBillingService() { 18 Model.Product oaas; 15 19 products = new List<Model.Product>(); 16 products.Add(new Model.Product() { 20 21 products.Add(oaas = new Model.Product() { 17 22 Name = "Optimization-as-a-Service - Experiment execution", 18 23 Description = "Create and run your experiments within HeuristicLab Hive", … … 32 37 allOrders = new List<Model.Order>(); 33 38 users = new Dictionary<string, Model.User>(); 39 records = new Dictionary<string, IList<Model.UsageRecord>>(); 40 records["fschoeppl"] = new List<Model.UsageRecord>() { 41 new Model.UsageRecord() { ProductId = 1, Product = oaas, UsageRecordId = 1, User = new Model.User() { Name = "fschoeppl", UserId = 1 }, Begin = DateTime.Now, End = DateTime.Now.AddHours(2), UserId = 1, ResourceIdentifier = 0, ServiceIdentifier = 1 } 42 }; 43 invoices = new Dictionary<string, IList<Model.Invoice>>(); 44 invoices["fschoeppl"] = new List<Model.Invoice>() { 45 new Model.Invoice() { 46 Due = DateTime.Now.AddDays(-1), 47 Status = Model.InvoiceStatus.Overdue, 48 InvoiceId = 1, OrderId = 1, 49 InvoiceLines = new List<Model.InvoiceLine>() { 50 new Model.InvoiceLine() { Product = oaas, ProductId = oaas.ProductId, ProductPrice = oaas.Price, Quantity = 2, InvoiceLineId = 1, InvoiceId = 1 } 51 }, 52 UserId = 1, User = new Model.User() { UserId = 1, Name = "fschoeppl" } 53 } 54 }; 34 55 } 35 56 … … 41 62 IList<Model.Order> orders; 42 63 if (!userToOrders.TryGetValue(order.User.Name, out orders)) { 43 userToOrders[order.User.Name] = orders = new List<Model.Order>(); 64 userToOrders[order.User.Name] = orders = new List<Model.Order>(); 44 65 } 45 66 var oldOrder = (from o in orders where o.OrderId == order.OrderId select o).FirstOrDefault(); … … 81 102 users[user.Name] = user; 82 103 } 104 105 106 public IList<Model.UsageRecord> GetUsageRecords(string userName) { 107 IList<Model.UsageRecord> foundRecords; 108 if (records.TryGetValue(userName, out foundRecords)) { 109 return foundRecords; 110 } 111 return null; 112 } 113 114 115 public IList<Model.Invoice> GetInvoices(string userName) { 116 IList<Model.Invoice> foundInvoices; 117 if (invoices.TryGetValue(userName, out foundInvoices)) { 118 return foundInvoices; 119 } 120 return null; 121 } 83 122 } 84 123 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Interfaces/IOptimizationBilling.cs
r9582 r9586 21 21 User GetUser(string userName); 22 22 void SaveUser(User user); 23 24 IList<UsageRecord> GetUsageRecords(string userName); 25 IList<Invoice> GetInvoices(string userName); 23 26 } 24 27 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Model/Model.cs
r9582 r9586 90 90 } 91 91 92 public enum InvoiceStatus { 93 Open, Overdue, Paid 94 } 95 92 96 public class Invoice { 93 97 public long InvoiceId { get; set; } … … 95 99 public long OrderId { get; set; } 96 100 public DateTime Due { get; set; } 97 public stringStatus { get; set; }101 public InvoiceStatus Status { get; set; } 98 102 public string InvoiceDocument { get; set; } 99 103 -
branches/OaaS/HeuristicLab.Services.Optimization.Web
- Property svn:ignore
-
old new 1 1 bin 2 2 obj 3 Bin
-
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/BaseController.cs
r9582 r9586 34 34 return true; 35 35 } 36 if (orderNecessary )36 if (orderNecessary && BillingComponent.Enabled) 37 37 return RedirectToCreateOrderIfNecessary(); 38 38 return false; -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OrderAdminController.cs
r9582 r9586 4 4 using HeuristicLab.Services.Optimization.Billing.Interfaces; 5 5 using HeuristicLab.Services.Optimization.Web.Models; 6 using HeuristicLab.Services.Optimization.Web.Helpers; 6 7 7 8 namespace HeuristicLab.Services.Optimization.Web.Controllers { 8 9 [Authorize(Roles = "Web User")] 10 [BillingFilterActionAttribute] 9 11 public class OrderAdminController : Controller { 10 12 private IOptimizationBilling billing = BillingServiceProvider.Instance; -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/OrderController.cs
r9582 r9586 7 7 using HeuristicLab.Services.Optimization.Billing.Model; 8 8 using HeuristicLab.Services.Optimization.Web.Models; 9 using HeuristicLab.Services.Optimization.Web.Helpers; 9 10 10 11 namespace HeuristicLab.Services.Optimization.Web.Controllers { 11 12 [Authorize(Roles = "Web User")] 13 [BillingFilterActionAttribute] 12 14 public class OrderController : BaseController { 13 15 private IOptimizationBilling billing = BillingServiceProvider.Instance; -
branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj
r9582 r9586 127 127 <Compile Include="Controllers\ExperimentController.cs" /> 128 128 <Compile Include="Controllers\HomeController.cs" /> 129 <Compile Include="Controllers\InvoiceController.cs" /> 129 130 <Compile Include="Controllers\JobController.cs" /> 130 131 <Compile Include="Controllers\OrderAdminController.cs" /> 131 132 <Compile Include="Controllers\OrderController.cs" /> 133 <Compile Include="Controllers\UsageController.cs" /> 132 134 <Compile Include="Global.asax.cs"> 133 135 <DependentUpon>Global.asax</DependentUpon> 134 136 </Compile> 137 <Compile Include="Helpers\BillingComponent.cs" /> 138 <Compile Include="Helpers\BillingFilterActionAttribute.cs" /> 135 139 <Compile Include="Helpers\ControllerService.cs" /> 136 140 <Compile Include="Helpers\HtmlExtensions.cs" /> … … 139 143 <Compile Include="Models\AdminModels.cs" /> 140 144 <Compile Include="Models\ChartModels.cs" /> 145 <Compile Include="Models\InvoiceModel.cs" /> 141 146 <Compile Include="Models\OrderAdminModel.cs" /> 142 147 <Compile Include="Models\ExperimentModel.cs" /> … … 144 149 <Compile Include="Models\OrderModel.cs" /> 145 150 <Compile Include="Models\StatusModel.cs" /> 151 <Compile Include="Models\UsageModel.cs" /> 146 152 <Compile Include="Properties\AssemblyInfo.cs" /> 147 153 <Compile Include="WebRole.cs" /> … … 400 406 <Content Include="Views\Order\Overview.cshtml" /> 401 407 <Content Include="Views\Order\Payment.cshtml" /> 408 <Content Include="Views\Usage\Index.cshtml" /> 409 <Content Include="Views\Invoice\Index.cshtml" /> 402 410 </ItemGroup> 403 411 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Order/SaveOrder.cshtml
r9582 r9586 28 28 } 29 29 else { 30 <h2>Choose one of your payment options:</h2> 30 31 foreach (var pi in Model.User.PaymentInformation) { 32 <p> 31 33 @Html.Label("PaymentInformationId", string.Format("{0} ({1})", pi.PaymentMethod, pi.CardNumber)) 32 @Html.RadioButton("PaymentInformationId", pi.PaymentInformationId); 34 @Html.RadioButton("PaymentInformationId", pi.PaymentInformationId) 35 </p> 33 36 } 34 <h 2>Or add payment information by clicking @Html.ActionLink("here", "Payment").</h2>37 <h3>Or add payment information by clicking @Html.ActionLink("here", "Payment").</h3> 35 38 36 39 using (Html.BeginForm("SaveOrder", "Order")) { 37 40 <h2>How often would you like to be billed?</h2> 38 41 <p> 39 42 @Html.RadioButtonForEnum(m => m.BillingPeriod) 40 43 </p> 41 44 <h2>Would you like to pay upfront or at the end of the period?</h2> 42 45 <p> 43 46 @Html.RadioButtonForEnum(m => m.BillingType) 44 45 <div> 47 </p> 46 48 <p> 47 49 <input type="submit" value="Save order" /> 48 50 </p> 49 </div>50 51 } 51 52 } -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Shared/_Layout.cshtml
r9582 r9586 1 <!DOCTYPE html> 1 @using HeuristicLab.Services.Optimization.Web.Helpers 2 <!DOCTYPE html> 2 3 <html> 3 4 <head> … … 62 63 <div id="master-mainmenu"> 63 64 <ul id="menu"> 64 <li>@Html.ActionLink("Home", "Index", "Home")</li> 65 <li>@Html.ActionLink("Experiment", "Index", "Experiment")</li> 66 <li>@Html.ActionLink("Orders", "Overview", "Order")</li> 67 <li>@Html.ActionLink("Admin", "Index", "Admin")</li> 65 <li>@Html.ActionLink("Home", "Index", "Home")</li> 66 <li>@Html.ActionLink("Experiment", "Index", "Experiment")</li> 67 <li>@Html.ActionLink("Experiment Administrator", "Index", "Admin")</li> 68 @if (BillingComponent.Enabled) { 69 <li>@Html.ActionLink("My Orders", "Overview", "Order")</li> 70 <li>@Html.ActionLink("My Usages", "Index", "Usage")</li> 71 <li>@Html.ActionLink("My Invoices", "Index", "Invoice")</li> 68 72 <li>@Html.ActionLink("Order Administration", "Index", "OrderAdmin")</li> 73 } 69 74 <li>@Html.ActionLink("About", "About", "Home")</li> 70 75 </ul> -
branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.build.csdef
r9508 r9586 32 32 <Setting name="HiveEndpointName" /> 33 33 <Setting name="ControllerEndpointName" /> 34 <Setting name="BillingEnabled" /> 34 35 </ConfigurationSettings> 35 36 </WebRole> -
branches/OaaS/HeuristicLab.Services.Optimization/ServiceDefinition.csdef
r9508 r9586 23 23 <Setting name="HiveEndpointName" /> 24 24 <Setting name="ControllerEndpointName" /> 25 <Setting name="BillingEnabled" /> 25 26 </ConfigurationSettings> 26 27 </WebRole>
Note: See TracChangeset
for help on using the changeset viewer.