- Timestamp:
- 10/01/13 13:18:19 (11 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs
r9645 r10013 19 19 } 20 20 21 private ITransactionManager transaction; 22 private ITransactionManager Transaction { 23 get { 24 if (transaction == null) transaction = new TransactionManager(); 25 return transaction; 26 } 27 } 28 21 29 #endregion 22 30 … … 25 33 public IList<Product> GetProducts() { 26 34 //TODO: Authentication 27 //TODO: Enable Transaction 28 return BillingDao.FindAllProducts().ToList(); 35 return Transaction.UseTransaction(() => { 36 return BillingDao.FindAllProducts().ToList(); 37 }); 29 38 } 30 39 31 40 public IList<Product> GetProductByName(string productName) { 32 41 //TODO: Authentication 33 //TODO: Enable Transaction 34 return BillingDao.FindProdcutBy(prod => prod.Name == productName).ToList(); 42 return Transaction.UseTransaction(() => { 43 return BillingDao.FindProdcutBy(prod => prod.Name == productName).ToList(); 44 }); 35 45 } 36 46 … … 41 51 public void SaveOrder(Order order) { 42 52 //TODO: Authentication 43 //TODO: Enable Transaction 44 BillingDao.InsertOrUpdateOrder(order); 53 Transaction.UseTransaction(() => { 54 BillingDao.InsertOrUpdateOrder(order); 55 }); 45 56 } 46 57 47 58 public IList<Order> GetOrdersByState(OrderState state) { 48 59 //TODO: Authentication 49 //TODO: Enable Transaction 50 return BillingDao.FindOrderBy(order => order.StateValue == (int)state).ToList(); 60 return Transaction.UseTransaction(() => { 61 return BillingDao.FindOrderBy(order => order.StateValue == (int)state).ToList(); 62 }); 51 63 } 52 64 53 65 public IList<Order> GetOrders(string userName) { 54 66 //TODO: Authentication 55 //TODO: Enable Transaction 56 User user = GetUser(userName); 57 return BillingDao.FindOrderBy(order => order.User == user).ToList(); 67 return Transaction.UseTransaction(() => { 68 User user = GetUser(userName); 69 return BillingDao.FindOrderBy(order => order.User == user).ToList(); 70 }); 58 71 } 59 72 60 73 public void UpdateOrder(Order order) { 61 74 //TODO: Authentication 62 //TODO: Enable Transaction 63 BillingDao.InsertOrUpdateOrder(order); 75 Transaction.UseTransaction(() => { 76 BillingDao.InsertOrUpdateOrder(order); 77 }); 64 78 } 65 79 … … 70 84 public User GetUser(string userName) { 71 85 //TODO: Authentication 72 //TODO: Enable Transaction 73 return BillingDao.FindUserBy(u => u.Name == userName).First(); 86 return Transaction.UseTransaction(() => { 87 return BillingDao.FindUserBy(u => u.Name == userName).First(); 88 }); 74 89 } 75 90 76 91 public void SaveUser(User user) { 77 92 //TODO: Authentication 78 //TODO: Enable Transaction 79 BillingDao.InsertOrUpdateUser(user); 93 Transaction.UseTransaction(() => { 94 BillingDao.InsertOrUpdateUser(user); 95 }); 80 96 } 81 97 … … 86 102 public IList<UsageRecord> GetUsageRecords(string userName) { 87 103 //TODO: Authentication 88 //TODO: Enable Transaction 89 User user = GetUser(userName); 90 return BillingDao.FindUsageRecordsBy(ur => ur.User == user).ToList(); 104 return Transaction.UseTransaction(() => { 105 User user = GetUser(userName); 106 return BillingDao.FindUsageRecordsBy(ur => ur.User == user).ToList(); 107 }); 91 108 } 92 109 … … 101 118 public IList<Invoice> GetInvoices(string userName) { 102 119 //TODO: Authentication 103 //TODO: Enable Transaction 104 User user = GetUser(userName); 105 return BillingDao.FindInvoiceBy(inv => inv.User == user).ToList(); 120 return Transaction.UseTransaction(() => { 121 User user = GetUser(userName); 122 return BillingDao.FindInvoiceBy(inv => inv.User == user).ToList(); 123 }); 106 124 } 107 125 108 126 public void SaveInvoice(Invoice invoice) { 109 127 //TODO: Authentication 110 //TODO: Enable Transaction 111 BillingDao.InsertOrUpdateInvoice(invoice); 128 Transaction.UseTransaction(() => { 129 BillingDao.InsertOrUpdateInvoice(invoice); 130 }); 112 131 } 113 132
Note: See TracChangeset
for help on using the changeset viewer.