Changeset 9586 for branches/OaaS/HeuristicLab.Services.Optimization.Billing
- Timestamp:
- 06/05/13 14:09:51 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Billing
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing
-
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
Note: See TracChangeset
for help on using the changeset viewer.