Last change
on this file since 9573 was
9556,
checked in by fschoepp, 12 years ago
|
#1888:
- Added views for the billing component (Register users, Create orders and Activate Orders view)
- Added a mockup for the billing back-end .
|
File size:
1.2 KB
|
Rev | Line | |
---|
[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 {
|
---|
| 10 | public string BillingType { get; set; }
|
---|
| 11 | public string BillingPeriod { get; set; }
|
---|
| 12 | public DateTime ActiveSince { get; set; }
|
---|
| 13 | public DateTime ActiveUntil { get; set; }
|
---|
| 14 | // product id to quantity mapping
|
---|
| 15 | public IDictionary<long, int> ProductQuantities { get; set; }
|
---|
| 16 | public IDictionary<long, Product> Products { 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 ProductsModel {
|
---|
| 38 | public IList<Product> Products { get; set; }
|
---|
| 39 | public int Quantity { get; set; }
|
---|
| 40 | public long ProductId { get; set; }
|
---|
| 41 | }
|
---|
| 42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.