using System; using System.Collections.Generic; using HeuristicLab.Services.Optimization.Billing.Model; namespace HeuristicLab.Services.Optimization.Web.Models { public class OrderModel { public BillingType BillingType { get; set; } public BillingPeriod BillingPeriod { get; set; } public DateTime? ActiveSince { get; set; } public DateTime? ActiveUntil { get; set; } public User User { get; set; } // product id to quantity mapping public IDictionary ProductQuantities { get; set; } public IDictionary Products { get; set; } public long PaymentInformationId { get; set; } public double TotalSum() { double sum = 0; foreach (var key in ProductQuantities.Keys) { sum += ProductQuantities[key] * Products[key].Price; } return sum; } public double ProductSum(long productId) { return Products[productId].Price * ProductQuantities[productId]; } public OrderModel() { ProductQuantities = new Dictionary(); Products = new Dictionary(); } } public class PaymentModel { public PaymentMethod Method { get; set; } public string CardNumber { get; set; } public string AdditionalInformation { get; set; } } public class ContactInformationModel { public long ContactInformationId { get; set; } public string OrganizationName { get; set; } public string Street { get; set; } public string City { get; set; } public string State { get; set; } public string PostalCode { get; set; } public string LastName { get; set; } public string FirstName { get; set; } public string Email { get; set; } } public class ProductsModel { public IList Products { get; set; } public int Quantity { get; set; } public long ProductId { get; set; } } public class OverviewModel { public IList Orders { get; set; } } }