Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/OrderModel.cs @ 9596

Last change on this file since 9596 was 9582, checked in by fschoepp, 12 years ago

#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.
File size: 1.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using HeuristicLab.Services.Optimization.Billing.Model;
6
7namespace HeuristicLab.Services.Optimization.Web.Models {
8
9  public class OrderModel {
10    public BillingType BillingType { get; set; }
11    public BillingPeriod BillingPeriod { get; set; }   
12    public DateTime? ActiveSince { get; set; }
13    public DateTime? ActiveUntil { get; set; }
14    public User User { get; set; }
15    // product id to quantity mapping
16    public IDictionary<long, int> ProductQuantities { get; set; }
17    public IDictionary<long, Product> Products { get; set; }
18    public long PaymentInformationId { get; set; }
19
20    public double TotalSum() {
21      double sum = 0;
22      foreach (var key in ProductQuantities.Keys) {
23        sum += ProductQuantities[key] * Products[key].Price;
24      }
25      return sum;
26    }
27
28    public double ProductSum(long productId) {
29      return Products[productId].Price * ProductQuantities[productId];
30    }
31
32
33    public OrderModel() {
34      ProductQuantities = new Dictionary<long, int>();
35      Products = new Dictionary<long, Product>();
36    }
37  }
38
39  public class PaymentModel {
40    public PaymentMethod Method { get; set; }
41    public string CardNumber { get; set; }
42    public string AdditionalInformation { get; set; }
43  }
44
45  public class ProductsModel {
46    public IList<Product> Products { get; set; }
47    public int Quantity { get; set; }
48    public long ProductId { get; set; }
49  }
50
51  public class OverviewModel {
52    public IList<Order> Orders { get; set; }
53  }
54}
Note: See TracBrowser for help on using the repository browser.