Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Optimization.Billing/Model/Model.cs @ 9641

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

#1888:

  • Users now contain ContactInformation
  • Fixed formatting in invoice template
  • Fixed calculation for next invoice date
  • Worked on indentation for invoice fields
File size: 5.3 KB
Line 
1
2using System;
3using System.Collections.Generic;
4namespace HeuristicLab.Services.Optimization.Billing.Model {
5
6  /*
7   * Note: enum support
8   * Although we use EF5 enums are not supported as we target .NET 4.0.
9   * Therefore we use the following workaround:
10   * Just create an int property on your class to represent the int value of the enum.
11   * That's the property that EF should map, then have a "mini wrapper" property to allow you to use the enum
12   * For example see class PaymentInformation
13   * See also: http://stackoverflow.com/questions/6344032/enums-with-ef-code-first-standard-method-to-seeding-db-and-then-using
14   */
15
16  public class ContactInformation {
17    public long ContactInformationId { get; set; }
18    public string OrganizationName { get; set; }
19    public string Street { get; set; }
20    public string City { get; set; }
21    public string State { get; set; }
22    public string PostalCode { get; set; }
23    public string LastName { get; set; }
24    public string FirstName { get; set; }
25    public string Email { get; set; }
26  }
27
28  public class PaymentInformation {
29    public long PaymentInformationId { get; set; }
30    public long UserId { get; set; }
31    public string CardNumber { get; set; }
32    public int PaymentMethodValue { get; set; }
33    public string AdditionalInformation { get; set; }
34
35    public virtual User User { get; set; }
36
37    public PaymentMethod PaymentMethod {
38      get { return (PaymentMethod)PaymentMethodValue; }
39      set { PaymentMethodValue = (int)value; }
40    }
41  }
42
43  public enum PaymentMethod {
44    Cheque,
45    Visa,
46    MasterCard,
47    PayPal,
48    Diners
49  }
50
51  public enum BillingType {
52    Pre,
53    Post
54  }
55
56  public enum BillingPeriod {
57    Weekly,
58    Monthly,
59    Yearly
60  }
61
62  public class Product {
63    public long ProductId { get; set; }
64    public string Name { get; set; }
65    public string Description { get; set; }
66    public string ProductType { get; set; }
67    public double Price { get; set; }
68  }
69
70  public class User {
71    public long UserId { get; set; }
72    public long ContactInformationId { get; set; }
73    public string Name { get; set; }
74
75    public virtual IList<PaymentInformation> PaymentInformation { get; set; }
76    public virtual ContactInformation ContactInformation { get; set; }
77  }
78
79  public enum OrderState {
80    Created,
81    Active,
82    Suspended,
83    Overdue,
84    Finished
85  }
86
87  public class Order {
88    public long OrderId { get; set; }
89    public long UserId { get; set; }
90    public int StateValue { get; set; }
91    public int BillingTypeValue { get; set; }
92    public int BillingPeriodValue { get; set; }
93    public DateTime? ActiveSince { get; set; }
94    public DateTime? ActiveUntil { get; set; }
95    public DateTime? LastBillableDay { get; set; }
96    public DateTime? NextBillableDay { get; set; }
97
98    public virtual User User { get; set; }
99    public virtual IList<Invoice> Invoices { get; set; }
100    public virtual IList<OrderLine> OrderLines { get; set; }
101
102    public OrderState State {
103      get { return (OrderState)StateValue; }
104      set { StateValue = (int)value; }
105    }
106    public BillingType BillingType {
107      get { return (BillingType)BillingTypeValue; }
108      set { BillingTypeValue = (int)value; }
109    }
110    public BillingPeriod BillingPeriod {
111      get { return (BillingPeriod)BillingPeriodValue; }
112      set { BillingPeriodValue = (int)value; }
113    }
114  }
115
116  public class OrderLine {
117    public long OrderLineId { get; set; }
118    public long OrderId { get; set; }
119    public long ProductId { get; set; }
120    public int Quantity { get; set; }
121    public double ProductPrice { get; set; }
122
123    public virtual Order Order { get; set; }
124    public virtual Product Product { get; set; }
125  }
126
127  public enum InvoiceStatus {
128    Open, Overdue, Paid
129  }
130
131  public class Invoice {
132    public long InvoiceId { get; set; }
133    public long UserId { get; set; }
134    public long OrderId { get; set; }
135    public DateTime InvoiceDate { get; set; }
136    public DateTime Due { get; set; }
137    public int StatusValue { get; set; }
138    public double Total { get; set; }
139    public double Tax { get; set; }
140    public string InvoiceDocument { get; set; }
141
142    public virtual User User { get; set; }
143    public virtual Order Order { get; set; }
144    public virtual IList<InvoiceLine> InvoiceLines { get; set; }
145
146    public InvoiceStatus Status {
147      get { return (InvoiceStatus)StatusValue; }
148      set { StatusValue = (int)value; }
149    }
150  }
151
152  public class InvoiceLine {
153    public long InvoiceLineId { get; set; }
154    public long InvoiceId { get; set; }
155    public long ProductId { get; set; }
156    public int Quantity { get; set; }
157    public double ProductPrice { get; set; }
158
159    public virtual Invoice Invoice { get; set; }
160    public virtual Product Product { get; set; }
161  }
162
163  public class UsageRecord {
164    public long UsageRecordId { get; set; }
165    public long UserId { get; set; }
166    public long ProductId { get; set; }
167    public DateTime Begin { get; set; }
168    public DateTime End { get; set; }
169    public int ServiceIdentifier { get; set; }
170    public int ResourceIdentifier { get; set; }
171
172    public virtual User User { get; set; }
173    public virtual Product Product { get; set; }
174  }
175}
Note: See TracBrowser for help on using the repository browser.