public ActionResult AddRentAccountStep6(AcceptAccountVM mAcceptAccountVm) // Accept Contract View/Print and finish { if (ModelState.IsValid) { var newAccount = _accountService.GetAccount(mAcceptAccountVm.CustomerAccountId) as RentalAccount; if (ExecuteRepositoryAction(() => { newAccount.IsTemp = false; _accountService.UpdateAccount(newAccount); foreach (var rental in newAccount.RentedUnits) { _accountTransactionService.AddAccountTransaction(newAccount.CustomerAccountId, AccountTransactionType.Rental, rental.Amount, AccountTransactionInputType.Charge, rental.StockId, rental.Stock.ManufacturerModel); _accountTransactionService.AddAccountTransaction(newAccount.CustomerAccountId, AccountTransactionType.Deposit, rental.Deposit, AccountTransactionInputType.Charge, rental.StockId, rental.Stock.ManufacturerModel); if (mAcceptAccountVm.FullPayment) { _accountTransactionService.AddAccountTransaction(newAccount.CustomerAccountId, AccountTransactionType.Rental, -rental.Amount, AccountTransactionInputType.Payment, rental.StockId, rental.Stock.ManufacturerModel); _accountTransactionService.AddAccountTransaction(newAccount.CustomerAccountId, AccountTransactionType.Deposit, -rental.Deposit, AccountTransactionInputType.Payment, rental.StockId, rental.Stock.ManufacturerModel); } } _accountTransactionService.AddAccountTransaction(newAccount.CustomerAccountId, AccountTransactionType.OneOff, newAccount.TotalOneOffItems, AccountTransactionInputType.Charge); if (mAcceptAccountVm.FullPayment) { _accountTransactionService.AddAccountPaymentTransaction(newAccount.CustomerAccountId, AccountTransactionType.OneOff, -newAccount.TotalOneOffItems); } _accountService.CommitChanges(); })) { return(RedirectToAction("Edit", "Customer", new { id = newAccount.CustomerId, moveOnToEditAccount = newAccount.CustomerAccountId })); } } return(View(mAcceptAccountVm)); }
private void UpdateTransactionsFromBasket(RentalBasket basket) { foreach (var rental in basket.RentedUnits) { _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Rental, rental.Amount, AccountTransactionInputType.Charge, rental.StockId, rental.Stock.ManufacturerModel); _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Deposit, rental.Deposit, AccountTransactionInputType.Charge, rental.StockId, rental.Stock.ManufacturerModel); if (basket.FullPayment) { _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Rental, -rental.Amount, AccountTransactionInputType.Payment, rental.StockId, rental.Stock.ManufacturerModel); _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Deposit, -rental.Deposit, AccountTransactionInputType.Payment, rental.StockId, rental.Stock.ManufacturerModel); } } _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.OneOff, basket.TotalOneOffItems, AccountTransactionInputType.Charge); if (basket.FullPayment) { _accountTransactionService.AddAccountPaymentTransaction(basket.CustomerAccountId, AccountTransactionType.OneOff, -basket.TotalOneOffItems); } }
private void UpdateTransactionsFromBasket(PurchaseBasket basket) { foreach (var purchase in basket.PurchasedUnits) { _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Purchase, purchase.Total, AccountTransactionInputType.Charge, purchase.StockId, purchase.Stock.ManufacturerModel); _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Service, purchase.TotalContracts, AccountTransactionInputType.Charge, purchase.StockId, purchase.Stock.ManufacturerModel); if (basket.FullPayment) { _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Purchase, -purchase.Total, AccountTransactionInputType.Payment, purchase.StockId, purchase.Stock.ManufacturerModel); _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.Service, -purchase.TotalContracts, AccountTransactionInputType.Payment, purchase.StockId, purchase.Stock.ManufacturerModel); } } _accountTransactionService.AddAccountTransaction(basket.CustomerAccountId, AccountTransactionType.OneOff, basket.TotalOneOffItems, AccountTransactionInputType.Charge); if (basket.FullPayment) { _accountTransactionService.AddAccountPaymentTransaction(basket.CustomerAccountId, AccountTransactionType.OneOff, basket.TotalOneOffItems); } }