[9556] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using HeuristicLab.Services.Optimization.Billing.Model;
|
---|
| 4 |
|
---|
| 5 | namespace HeuristicLab.Services.Optimization.Web.Models {
|
---|
| 6 |
|
---|
| 7 | public class OrderModel {
|
---|
[9582] | 8 | public BillingType BillingType { get; set; }
|
---|
[9654] | 9 | public BillingPeriod BillingPeriod { get; set; }
|
---|
[9582] | 10 | public DateTime? ActiveSince { get; set; }
|
---|
| 11 | public DateTime? ActiveUntil { get; set; }
|
---|
| 12 | public User User { get; set; }
|
---|
[9556] | 13 | // product id to quantity mapping
|
---|
| 14 | public IDictionary<long, int> ProductQuantities { get; set; }
|
---|
| 15 | public IDictionary<long, Product> Products { get; set; }
|
---|
[9582] | 16 | public long PaymentInformationId { get; set; }
|
---|
[9556] | 17 |
|
---|
| 18 | public double TotalSum() {
|
---|
| 19 | double sum = 0;
|
---|
| 20 | foreach (var key in ProductQuantities.Keys) {
|
---|
| 21 | sum += ProductQuantities[key] * Products[key].Price;
|
---|
| 22 | }
|
---|
| 23 | return sum;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public double ProductSum(long productId) {
|
---|
| 27 | return Products[productId].Price * ProductQuantities[productId];
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 |
|
---|
| 31 | public OrderModel() {
|
---|
| 32 | ProductQuantities = new Dictionary<long, int>();
|
---|
| 33 | Products = new Dictionary<long, Product>();
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[9582] | 37 | public class PaymentModel {
|
---|
| 38 | public PaymentMethod Method { get; set; }
|
---|
| 39 | public string CardNumber { get; set; }
|
---|
| 40 | public string AdditionalInformation { get; set; }
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[9654] | 43 | public class ContactInformationModel {
|
---|
| 44 | public long ContactInformationId { get; set; }
|
---|
| 45 | public string OrganizationName { get; set; }
|
---|
| 46 | public string Street { get; set; }
|
---|
| 47 | public string City { get; set; }
|
---|
| 48 | public string State { get; set; }
|
---|
| 49 | public string PostalCode { get; set; }
|
---|
| 50 | public string LastName { get; set; }
|
---|
| 51 | public string FirstName { get; set; }
|
---|
| 52 | public string Email { get; set; }
|
---|
| 53 | }
|
---|
| 54 |
|
---|
[9556] | 55 | public class ProductsModel {
|
---|
| 56 | public IList<Product> Products { get; set; }
|
---|
| 57 | public int Quantity { get; set; }
|
---|
| 58 | public long ProductId { get; set; }
|
---|
| 59 | }
|
---|
[9582] | 60 |
|
---|
| 61 | public class OverviewModel {
|
---|
| 62 | public IList<Order> Orders { get; set; }
|
---|
| 63 | }
|
---|
[9556] | 64 | } |
---|