Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/04/13 16:30:39 (12 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
Files:
4 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}
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Interfaces/IOptimizationBilling.cs

    r9576 r9582  
    1717    [OperationContract]
    1818    IList<Order> GetOrdersByState(OrderState state);
     19    IList<Order> GetOrders(string userName);
     20
     21    User GetUser(string userName);
     22    void SaveUser(User user);
    1923  }
    2024}
  • branches/OaaS/HeuristicLab.Services.Optimization.Billing/Model/Model.cs

    r9579 r9582  
    1515  }
    1616
     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
    1724  public enum PaymentMethod {
    1825    Cheque,
     
    2128    PayPal,
    2229    Diners
     30  }
     31
     32  public enum BillingType {
     33    Pre,
     34    Post
     35  }
     36
     37  public enum BillingPeriod {
     38    Weekly,
     39    Monthly,
     40    Yearly
    2341  }
    2442
     
    3452    public long UserId { get; set; }
    3553    public string Name { get; set; }
     54    public virtual IList<PaymentInformation> PaymentInformation { get; set; }
    3655  }
    3756
     
    4766    public long OrderId { get; set; }
    4867    public long UserId { get; set; }
    49     public string BillingType { get; set; }
     68    public BillingType BillingType { get; set; }
    5069    public long OrderStateId { get; set; }
    51     public string BillingPeriod { 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; }
    5473
    5574
Note: See TracChangeset for help on using the changeset viewer.