Changeset 9619
- Timestamp:
- 06/12/13 16:34:04 (11 years ago)
- Location:
- branches/OaaS
- Files:
-
- 5 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing.Test/App.config
r9579 r9619 5 5 <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 6 6 </configSections> 7 <appSettings> 8 <add key="BillingEngineInterval" value ="00:01:00"/> 9 </appSettings> 7 10 <connectionStrings> 8 11 <add name="BillingContext" connectionString="ADJUST_ME" providerName="System.Data.SqlClient" /> -
branches/OaaS/HeuristicLab.Services.Optimization.Billing.Test/DDLScript.sql
r9602 r9619 15 15 [UserId] [bigint] not null, 16 16 [OrderId] [bigint] not null, 17 [InvoiceDate] [datetime] not null, 17 18 [Due] [datetime] not null, 18 19 [StatusValue] [int] not null, 20 [Total] [float] not null, 21 [Tax] [float] not null, 19 22 [InvoiceDocument] [nvarchar](max) null, 20 23 primary key ([InvoiceId]) … … 36 39 [ActiveSince] [datetime] null, 37 40 [ActiveUntil] [datetime] null, 41 [LastBillableDay] [datetime] null, 42 [NextBillableDay] [datetime] null, 38 43 primary key ([OrderId]) 39 44 ); -
branches/OaaS/HeuristicLab.Services.Optimization.Billing.Test/Program.cs
r9602 r9619 1 1 using System; 2 2 using System.Data.Entity.Infrastructure; 3 using System.Diagnostics; 3 4 using System.IO; 5 using System.Threading; 4 6 using HeuristicLab.Services.Optimization.Billing.DataAccess; 5 7 using HeuristicLab.Services.Optimization.Billing.Model; … … 7 9 namespace HeuristicLab.Services.Optimization.Billing.Test { 8 10 class Program { 11 private static BillingEngine.BillingEngine billingEngine; 12 private static Thread billingEngineThread; 13 9 14 static void Main(string[] args) { 10 15 string ddlScript; … … 25 30 } 26 31 32 // Start BillingEngine Service: 33 Trace.WriteLine("Starting BillingEngine ..."); 34 try { 35 billingEngine = new BillingEngine.BillingEngine(); 36 billingEngineThread = new Thread(billingEngine.Run); 37 billingEngineThread.IsBackground = true; //dont keep app alive 38 billingEngineThread.Start(); 39 } 40 catch (Exception e) { 41 Trace.WriteLine("Error during BillingEngine startup: " + e.Message); 42 } 43 27 44 Console.WriteLine("Press any key to exit..."); 28 45 Console.ReadKey(); -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/App.config
r9577 r9619 8 8 <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 9 9 </configSections> 10 <appSettings> 11 <add key="BillingEngineInterval" value ="00:01:00"/> 12 </appSettings> 10 13 <entityFramework> 11 14 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs
r9602 r9619 29 29 } 30 30 31 public IList<Product> GetProductByName(string productName) { 32 //TODO: Authentication 33 //TODO: Enable Transaction 34 return BillingDao.FindProdcutBy(prod => prod.Name == productName).ToList(); 35 } 36 31 37 #endregion 32 38 … … 42 48 //TODO: Authentication 43 49 //TODO: Enable Transaction 44 return BillingDao.FindOrderBy(order => order.State ==state).ToList();50 return BillingDao.FindOrderBy(order => order.StateValue == (int)state).ToList(); 45 51 } 46 52 … … 50 56 User user = GetUser(userName); 51 57 return BillingDao.FindOrderBy(order => order.User == user).ToList(); 58 } 59 60 public void UpdateOrder(Order order) { 61 throw new System.NotImplementedException(); 52 62 } 53 63 … … 79 89 } 80 90 91 public IList<UsageRecord> GetUsageRecords(string username, System.DateTime from, System.DateTime to) { 92 throw new System.NotImplementedException(); 93 } 94 81 95 #endregion 82 96 -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/MockupBillingService.cs
r9602 r9619 118 118 return null; 119 119 } 120 121 #region IOptimizationBilling Members 122 123 124 public IList<Model.Product> GetProductByName(string productName) { 125 throw new NotImplementedException(); 126 } 127 128 public void UpdateOrder(Model.Order order) { 129 throw new NotImplementedException(); 130 } 131 132 public IList<Model.UsageRecord> GetUsageRecords(string username, DateTime from, DateTime to) { 133 throw new NotImplementedException(); 134 } 135 136 #endregion 120 137 } 121 138 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingContext.cs
r9602 r9619 28 28 public BillingContext(string connectionString) 29 29 : base(connectionString) { 30 30 this.Configuration.LazyLoadingEnabled = false; 31 this.Configuration.ProxyCreationEnabled = false; 31 32 } 32 33 … … 96 97 protected override void Seed(BillingContext context) { 97 98 Product p1 = new Product() { 98 Name = "O ptimization-as-a-Service - Experiment execution",99 Name = "OaaS BAsic Service Charge", 99 100 Description = "Create and run your experiments within HeuristicLab Hive", 100 ProductId = 1, 101 Price = 10.0, 101 Price = 20.0, 102 102 ProductType = "Optimization Service" 103 103 }; 104 105 Product p2 = new Product() { 106 Name = "Oaas Usage Charges", 107 Description = "Charges for OaaS based on usage data", 108 Price = 0.0, 109 ProductType = "Optimization Service" 110 }; 111 112 Product p3 = new Product() { 113 Name = "Oaas Support Package", 114 Description = "Charges for OaaS based on usage data", 115 Price = 50.0, 116 ProductType = "Optimization Service" 117 }; 118 104 119 p1 = context.Products.Add(p1); 120 p2 = context.Products.Add(p2); 121 p3 = context.Products.Add(p3); 105 122 106 123 User u1 = new Model.User() { Name = "spimming" }; -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/DataAccess/BillingDao.cs
r9602 r9619 2 2 using System; 3 3 using System.Collections.Generic; 4 using System.Data.Entity; 4 5 using System.Linq; 5 6 using System.Linq.Expressions; … … 105 106 public IEnumerable<Order> FindOrderBy(Expression<Func<Order, bool>> predicate) { 106 107 using (var context = CreateContext()) { 107 var orders = context.Orders.Where(predicate).ToList(); 108 var orders = context.Orders 109 .Include(o => o.OrderLines) 110 .Include(o => o.User) 111 .Include(o => o.Invoices) 112 .Include(o => o.OrderLines.Select(ol => ol.Product)) 113 .Where(predicate).ToList(); 108 114 return orders; 109 115 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/HeuristicLab.Services.Optimization.Billing.csproj
r9602 r9619 40 40 <Reference Include="System.Core" /> 41 41 <Reference Include="System.Data.Entity" /> 42 <Reference Include="System.Drawing" /> 42 43 <Reference Include="System.ServiceModel" /> 44 <Reference Include="System.Windows.Forms" /> 43 45 <Reference Include="System.Xml.Linq" /> 44 46 <Reference Include="System.Data.DataSetExtensions" /> … … 48 50 </ItemGroup> 49 51 <ItemGroup> 52 <Compile Include="BillingEngine\BillingEngine.cs" /> 53 <Compile Include="BillingEngine\PlainTextInvoiceFormattingEngine.cs" /> 50 54 <Compile Include="Business\BillingService.cs" /> 51 55 <Compile Include="Business\BillingServiceProvider.cs" /> … … 54 58 <Compile Include="Interfaces\IEntity.cs" /> 55 59 <Compile Include="Interfaces\IGenericDao.cs" /> 60 <Compile Include="Interfaces\IInvoiceFormattingEngine.cs" /> 56 61 <Compile Include="Interfaces\IOptimizationBilling.cs" /> 57 62 <Compile Include="Business\MockupBillingService.cs" /> … … 63 68 <None Include="packages.config" /> 64 69 </ItemGroup> 65 <ItemGroup /> 70 <ItemGroup> 71 <Content Include="BillingEngine\InvoiceTemplate.txt"> 72 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 73 </Content> 74 </ItemGroup> 66 75 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 67 76 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Interfaces/IOptimizationBilling.cs
r9586 r9619 1 using System.Collections.Generic; 1 using System; 2 using System.Collections.Generic; 2 3 using System.Net.Security; 3 4 using System.ServiceModel; … … 9 10 [OperationContract] 10 11 IList<Product> GetProducts(); 12 IList<Product> GetProductByName(string productName); 11 13 12 14 // payment methods via enumeration … … 18 20 IList<Order> GetOrdersByState(OrderState state); 19 21 IList<Order> GetOrders(string userName); 22 void UpdateOrder(Order order); 23 24 IList<Invoice> GetInvoices(string userName); 20 25 21 26 User GetUser(string userName); … … 23 28 24 29 IList<UsageRecord> GetUsageRecords(string userName); 25 IList<Invoice> GetInvoices(string userName); 30 IList<UsageRecord> GetUsageRecords(string username, DateTime from, DateTime to); 31 26 32 } 27 33 } -
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Model/Model.cs
r9602 r9619 92 92 public DateTime? ActiveSince { get; set; } 93 93 public DateTime? ActiveUntil { get; set; } 94 public DateTime? LastBillableDay { get; set; } 95 public DateTime? NextBillableDay { get; set; } 94 96 95 97 public virtual User User { get; set; } … … 130 132 public long UserId { get; set; } 131 133 public long OrderId { get; set; } 134 public DateTime InvoiceDate { get; set; } 132 135 public DateTime Due { get; set; } 133 136 public int StatusValue { get; set; } 137 public double Total { get; set; } 138 public double Tax { get; set; } 134 139 public string InvoiceDocument { get; set; } 135 140
Note: See TracChangeset
for help on using the changeset viewer.