[9602] | 1 |
|
---|
| 2 | using System;
|
---|
[9550] | 3 | using System.Collections.Generic;
|
---|
[9602] | 4 | namespace HeuristicLab.Services.Optimization.Billing.Model {
|
---|
[9550] | 5 |
|
---|
[9602] | 6 | /*
|
---|
| 7 | * Note: enum support
|
---|
| 8 | * Although we use EF5 enums are not supported as we target .NET 4.0.
|
---|
[9641] | 9 | * Therefore we use the following workaround:
|
---|
[9602] | 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 |
|
---|
[9550] | 16 | public class ContactInformation {
|
---|
[9576] | 17 | public long ContactInformationId { get; set; }
|
---|
[9550] | 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 |
|
---|
[9582] | 28 | public class PaymentInformation {
|
---|
| 29 | public long PaymentInformationId { get; set; }
|
---|
[9602] | 30 | public long UserId { get; set; }
|
---|
[9582] | 31 | public string CardNumber { get; set; }
|
---|
[9602] | 32 | public int PaymentMethodValue { get; set; }
|
---|
[9582] | 33 | public string AdditionalInformation { get; set; }
|
---|
[9602] | 34 |
|
---|
| 35 | public virtual User User { get; set; }
|
---|
| 36 |
|
---|
| 37 | public PaymentMethod PaymentMethod {
|
---|
| 38 | get { return (PaymentMethod)PaymentMethodValue; }
|
---|
| 39 | set { PaymentMethodValue = (int)value; }
|
---|
| 40 | }
|
---|
[9582] | 41 | }
|
---|
| 42 |
|
---|
[9550] | 43 | public enum PaymentMethod {
|
---|
| 44 | Cheque,
|
---|
| 45 | Visa,
|
---|
| 46 | MasterCard,
|
---|
| 47 | PayPal,
|
---|
| 48 | Diners
|
---|
| 49 | }
|
---|
| 50 |
|
---|
[9582] | 51 | public enum BillingType {
|
---|
| 52 | Pre,
|
---|
| 53 | Post
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | public enum BillingPeriod {
|
---|
| 57 | Weekly,
|
---|
| 58 | Monthly,
|
---|
| 59 | Yearly
|
---|
| 60 | }
|
---|
| 61 |
|
---|
[9550] | 62 | public class Product {
|
---|
[9576] | 63 | public long ProductId { get; set; }
|
---|
[9550] | 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 {
|
---|
[9576] | 71 | public long UserId { get; set; }
|
---|
[9641] | 72 | public long ContactInformationId { get; set; }
|
---|
[9556] | 73 | public string Name { get; set; }
|
---|
[9602] | 74 |
|
---|
[9582] | 75 | public virtual IList<PaymentInformation> PaymentInformation { get; set; }
|
---|
[9641] | 76 | public virtual ContactInformation ContactInformation { get; set; }
|
---|
[9550] | 77 | }
|
---|
| 78 |
|
---|
| 79 | public enum OrderState {
|
---|
| 80 | Created,
|
---|
| 81 | Active,
|
---|
| 82 | Suspended,
|
---|
| 83 | Overdue,
|
---|
| 84 | Finished
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | public class Order {
|
---|
[9576] | 88 | public long OrderId { get; set; }
|
---|
| 89 | public long UserId { get; set; }
|
---|
[9602] | 90 | public int StateValue { get; set; }
|
---|
| 91 | public int BillingTypeValue { get; set; }
|
---|
| 92 | public int BillingPeriodValue { get; set; }
|
---|
[9582] | 93 | public DateTime? ActiveSince { get; set; }
|
---|
| 94 | public DateTime? ActiveUntil { get; set; }
|
---|
[9619] | 95 | public DateTime? LastBillableDay { get; set; }
|
---|
| 96 | public DateTime? NextBillableDay { get; set; }
|
---|
[9576] | 97 |
|
---|
| 98 | public virtual User User { get; set; }
|
---|
| 99 | public virtual IList<Invoice> Invoices { get; set; }
|
---|
| 100 | public virtual IList<OrderLine> OrderLines { get; set; }
|
---|
[9602] | 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 | }
|
---|
[9550] | 114 | }
|
---|
| 115 |
|
---|
| 116 | public class OrderLine {
|
---|
[9576] | 117 | public long OrderLineId { get; set; }
|
---|
| 118 | public long OrderId { get; set; }
|
---|
| 119 | public long ProductId { get; set; }
|
---|
[9550] | 120 | public int Quantity { get; set; }
|
---|
| 121 | public double ProductPrice { get; set; }
|
---|
[9576] | 122 |
|
---|
| 123 | public virtual Order Order { get; set; }
|
---|
| 124 | public virtual Product Product { get; set; }
|
---|
[9550] | 125 | }
|
---|
| 126 |
|
---|
[9586] | 127 | public enum InvoiceStatus {
|
---|
| 128 | Open, Overdue, Paid
|
---|
| 129 | }
|
---|
| 130 |
|
---|
[9550] | 131 | public class Invoice {
|
---|
[9576] | 132 | public long InvoiceId { get; set; }
|
---|
| 133 | public long UserId { get; set; }
|
---|
| 134 | public long OrderId { get; set; }
|
---|
[9619] | 135 | public DateTime InvoiceDate { get; set; }
|
---|
[9550] | 136 | public DateTime Due { get; set; }
|
---|
[9602] | 137 | public int StatusValue { get; set; }
|
---|
[9619] | 138 | public double Total { get; set; }
|
---|
| 139 | public double Tax { get; set; }
|
---|
[9550] | 140 | public string InvoiceDocument { get; set; }
|
---|
[9576] | 141 |
|
---|
| 142 | public virtual User User { get; set; }
|
---|
| 143 | public virtual Order Order { get; set; }
|
---|
[9579] | 144 | public virtual IList<InvoiceLine> InvoiceLines { get; set; }
|
---|
[9602] | 145 |
|
---|
| 146 | public InvoiceStatus Status {
|
---|
| 147 | get { return (InvoiceStatus)StatusValue; }
|
---|
| 148 | set { StatusValue = (int)value; }
|
---|
| 149 | }
|
---|
[9550] | 150 | }
|
---|
| 151 |
|
---|
| 152 | public class InvoiceLine {
|
---|
[9576] | 153 | public long InvoiceLineId { get; set; }
|
---|
| 154 | public long InvoiceId { get; set; }
|
---|
| 155 | public long ProductId { get; set; }
|
---|
[9550] | 156 | public int Quantity { get; set; }
|
---|
| 157 | public double ProductPrice { get; set; }
|
---|
[9576] | 158 |
|
---|
| 159 | public virtual Invoice Invoice { get; set; }
|
---|
| 160 | public virtual Product Product { get; set; }
|
---|
[9550] | 161 | }
|
---|
| 162 |
|
---|
[9576] | 163 | public class UsageRecord {
|
---|
| 164 | public long UsageRecordId { get; set; }
|
---|
| 165 | public long UserId { get; set; }
|
---|
[9579] | 166 | public long ProductId { get; set; }
|
---|
[9558] | 167 | public DateTime Begin { get; set; }
|
---|
| 168 | public DateTime End { get; set; }
|
---|
[9579] | 169 | public int ServiceIdentifier { get; set; }
|
---|
| 170 | public int ResourceIdentifier { get; set; }
|
---|
[9576] | 171 |
|
---|
[9579] | 172 | public virtual User User { get; set; }
|
---|
| 173 | public virtual Product Product { get; set; }
|
---|
[9558] | 174 | }
|
---|
[9550] | 175 | }
|
---|