Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/04/13 16:30:39 (11 years ago)
Author:
fschoepp
Message:

#1888:

  • Added an overview for users to inspect their orders
  • Order Administrators may now suspend or reactivate orders
  • When creating an order, its necessary to enter payment information (paypal, credit card,...) before
  • Also, the billing period and type must be entered during the creation of an order.
Location:
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs

    r9577 r9582  
    4646
    4747    #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    }
    4862  }
    4963}
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/MockupBillingService.cs

    r9577 r9582  
    99    private static IDictionary<string, IList<Model.Order>> userToOrders;
    1010    private static IList<Model.Order> allOrders;
     11    private static IDictionary<string, Model.User> users;
     12    private static long maxId = 1;
    1113
    1214    static MockupBillingService() {
     
    2931      userToOrders = new Dictionary<string, IList<Model.Order>>();
    3032      allOrders = new List<Model.Order>();
     33      users = new Dictionary<string, Model.User>();
    3134    }
    3235
     
    3841      IList<Model.Order> orders;
    3942      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>();       
    4144      }
    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      }
    4461    }
    4562
     
    4764      return (from o in allOrders where o.State == state select o).ToList();
    4865    }
     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    }
    4983  }
    5084}
Note: See TracChangeset for help on using the changeset viewer.