Changeset 9582 for branches/OaaS/HeuristicLab.Services.Optimization.Billing
- Timestamp:
- 06/04/13 16:30:39 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Billing
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs
r9577 r9582 46 46 47 47 #endregion 48 49 50 public IList<Order> GetOrders(string userName) { 51 throw new System.NotImplementedException(); 52 } 53 54 55 public User GetUser(string userName) { 56 throw new System.NotImplementedException(); 57 } 58 59 public void SaveUser(User user) { 60 throw new System.NotImplementedException(); 61 } 48 62 } 49 63 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/MockupBillingService.cs
r9577 r9582 9 9 private static IDictionary<string, IList<Model.Order>> userToOrders; 10 10 private static IList<Model.Order> allOrders; 11 private static IDictionary<string, Model.User> users; 12 private static long maxId = 1; 11 13 12 14 static MockupBillingService() { … … 29 31 userToOrders = new Dictionary<string, IList<Model.Order>>(); 30 32 allOrders = new List<Model.Order>(); 33 users = new Dictionary<string, Model.User>(); 31 34 } 32 35 … … 38 41 IList<Model.Order> orders; 39 42 if (!userToOrders.TryGetValue(order.User.Name, out orders)) { 40 userToOrders[order.User.Name] = orders = new List<Model.Order>(); 43 userToOrders[order.User.Name] = orders = new List<Model.Order>(); 41 44 } 42 orders.Add(order); 43 allOrders.Add(order); 45 var oldOrder = (from o in orders where o.OrderId == order.OrderId select o).FirstOrDefault(); 46 if (oldOrder == null) { 47 order.OrderId = maxId++; 48 orders.Add(order); 49 allOrders.Add(order); 50 } 51 else { 52 oldOrder.Invoices = order.Invoices; 53 oldOrder.OrderLines = order.OrderLines; 54 oldOrder.OrderStateId = order.OrderStateId; 55 oldOrder.State = order.State; 56 oldOrder.ActiveSince = order.ActiveSince; 57 oldOrder.ActiveUntil = order.ActiveUntil; 58 oldOrder.BillingPeriod = order.BillingPeriod; 59 oldOrder.BillingType = order.BillingType; 60 } 44 61 } 45 62 … … 47 64 return (from o in allOrders where o.State == state select o).ToList(); 48 65 } 66 67 68 public IList<Model.Order> GetOrders(string userName) { 69 return (from o in allOrders where o.User.Name == userName select o).ToList(); 70 } 71 72 73 public Model.User GetUser(string userName) { 74 Model.User user; 75 if (!users.TryGetValue(userName, out user)) 76 return null; 77 return user; 78 } 79 80 public void SaveUser(Model.User user) { 81 users[user.Name] = user; 82 } 49 83 } 50 84 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Interfaces/IOptimizationBilling.cs
r9576 r9582 17 17 [OperationContract] 18 18 IList<Order> GetOrdersByState(OrderState state); 19 IList<Order> GetOrders(string userName); 20 21 User GetUser(string userName); 22 void SaveUser(User user); 19 23 } 20 24 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Model/Model.cs
r9579 r9582 15 15 } 16 16 17 public class PaymentInformation { 18 public long PaymentInformationId { get; set; } 19 public string CardNumber { get; set; } 20 public PaymentMethod PaymentMethod { get; set; } 21 public string AdditionalInformation { get; set; } 22 } 23 17 24 public enum PaymentMethod { 18 25 Cheque, … … 21 28 PayPal, 22 29 Diners 30 } 31 32 public enum BillingType { 33 Pre, 34 Post 35 } 36 37 public enum BillingPeriod { 38 Weekly, 39 Monthly, 40 Yearly 23 41 } 24 42 … … 34 52 public long UserId { get; set; } 35 53 public string Name { get; set; } 54 public virtual IList<PaymentInformation> PaymentInformation { get; set; } 36 55 } 37 56 … … 47 66 public long OrderId { get; set; } 48 67 public long UserId { get; set; } 49 public stringBillingType { get; set; }68 public BillingType BillingType { get; set; } 50 69 public long OrderStateId { get; set; } 51 public stringBillingPeriod { get; set; }52 public DateTime ActiveSince { get; set; }53 public DateTime ActiveUntil { get; set; }70 public BillingPeriod BillingPeriod { get; set; } 71 public DateTime? ActiveSince { get; set; } 72 public DateTime? ActiveUntil { get; set; } 54 73 55 74
Note: See TracChangeset
for help on using the changeset viewer.