Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1888_OaaS/HeuristicLab.Services.Optimization.Web/Models/OrderModel.cs

Last change on this file was 9654, checked in by spimming, 11 years ago

#1888:

  • Added model and view for contact information
  • Insert contact information on SaveOrder page
  • Set correct entity state
File size: 2.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using HeuristicLab.Services.Optimization.Billing.Model;
4
5namespace HeuristicLab.Services.Optimization.Web.Models {
6
7  public class OrderModel {
8    public BillingType BillingType { get; set; }
9    public BillingPeriod BillingPeriod { get; set; }
10    public DateTime? ActiveSince { get; set; }
11    public DateTime? ActiveUntil { get; set; }
12    public User User { get; set; }
13    // product id to quantity mapping
14    public IDictionary<long, int> ProductQuantities { get; set; }
15    public IDictionary<long, Product> Products { get; set; }
16    public long PaymentInformationId { get; set; }
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
37  public class PaymentModel {
38    public PaymentMethod Method { get; set; }
39    public string CardNumber { get; set; }
40    public string AdditionalInformation { get; set; }
41  }
42
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
55  public class ProductsModel {
56    public IList<Product> Products { get; set; }
57    public int Quantity { get; set; }
58    public long ProductId { get; set; }
59  }
60
61  public class OverviewModel {
62    public IList<Order> Orders { get; set; }
63  }
64}
Note: See TracBrowser for help on using the repository browser.