[9556] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Web;
|
---|
| 5 | using HeuristicLab.Services.Optimization.Billing.Model;
|
---|
| 6 |
|
---|
| 7 | namespace HeuristicLab.Services.Optimization.Web.Models {
|
---|
| 8 |
|
---|
| 9 | public class OrderModel {
|
---|
[9582] | 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; }
|
---|
[9556] | 15 | // product id to quantity mapping
|
---|
| 16 | public IDictionary<long, int> ProductQuantities { get; set; }
|
---|
| 17 | public IDictionary<long, Product> Products { get; set; }
|
---|
[9582] | 18 | public long PaymentInformationId { get; set; }
|
---|
[9556] | 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 |
|
---|
[9582] | 39 | public class PaymentModel {
|
---|
| 40 | public PaymentMethod Method { get; set; }
|
---|
| 41 | public string CardNumber { get; set; }
|
---|
| 42 | public string AdditionalInformation { get; set; }
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[9556] | 45 | public class ProductsModel {
|
---|
| 46 | public IList<Product> Products { get; set; }
|
---|
| 47 | public int Quantity { get; set; }
|
---|
| 48 | public long ProductId { get; set; }
|
---|
| 49 | }
|
---|
[9582] | 50 |
|
---|
| 51 | public class OverviewModel {
|
---|
| 52 | public IList<Order> Orders { get; set; }
|
---|
| 53 | }
|
---|
[9556] | 54 | } |
---|