public override ActionResult EditBasketForAccount(int customerAccountId) { BasketId = _accountService.GetBaskets().Single(c => c.CustomerAccountId == customerAccountId).BasketId; BuildRentAccountStepper(); //Stepper2.DeleteStep(1); return(RedirectToAction(Stepper2.FirstStep())); }
public ActionResult AddRentAccountStep5(AddRentAccountVM mAddRentAccountVm) { if (ModelState.IsValid) { var rentAcc = TempAccountAsAddRentAccountVM(); if (TryUpdateModel(rentAcc)) { var newAccount = new RentalAccount { AlternateAddressInstructions = rentAcc.AlternateAddressInstructions, AlternateAddress = rentAcc.AlternateAddress, CustomerId = rentAcc.CustomerId, AttachedContracts = new List <Contract>(), RentedUnits = new List <RentedUnit>(), OneOffItems = new List <OneOffItem>(), }; foreach (RentedUnit mRentedUnit in rentAcc.RentedUnits) { var rentedUnit = new RentedUnit { Amount = mRentedUnit.Amount, RentedDate = mRentedUnit.RentedDate, StockId = mRentedUnit.StockId, Stock = _stockService.GetStock(mRentedUnit.StockId), Deposit = mRentedUnit.Deposit, }; newAccount.AddRentedUnitAndUpdateContract(rentedUnit); } foreach (var oneOffItem in rentAcc.OneOffItems) { var newOneOffItem = new OneOffItem { Description = oneOffItem.Description, Charge = oneOffItem.Charge, Date = rentAcc.StartDate, Quantity = oneOffItem.Quantity, OneOffTypeId = oneOffItem.OneOffTypeId }; newAccount.OneOffItems.Add(newOneOffItem); } if (ExecuteRepositoryAction(() => { _accountService.AddTempAccount(newAccount); _accountService.CommitChanges(); })) { var acceptAccount = new AcceptAccountVM { CustomerAccountId = newAccount.CustomerAccountId, FullPayment = (mAddRentAccountVm.Payment > 0) }; Session["_accountId"] = acceptAccount; return(RedirectToAction(Stepper2.NextStep())); } } } return(View(mAddRentAccountVm)); }
public ActionResult AddPurchaseUnitStep4(PurchaseBasketVM mPurchaseBasketVM) { if (ModelState.IsValid) { return(RedirectToAction(Stepper2.NextStep())); } return(View(mPurchaseBasketVM)); }
public ActionResult AddPurchaseAccountStep5(AddPurchaseAccountVM mAddPurchaseAccountVm) { if (ModelState.IsValid) { return(RedirectToAction(Stepper2.NextStep())); } return(View(mAddPurchaseAccountVm)); }
public ActionResult AddRentUnitStep3(RentalBasketVM mRentalBasketVM) { if (ModelState.IsValid) { return(RedirectToAction(Stepper2.NextStep())); } return(View(mRentalBasketVM)); }
public ActionResult AddPurchaseUnitStep1(PurchaseBasketVM mBasketVM) { PurchaseBasket basket = GetPurchaseBasket(); basket.StartDate = mBasketVM.StartDate; UpdateBasket(basket); return(RedirectToAction(Stepper2.NextStep())); }
public ActionResult AddRentUnitStep1(RentalBasketVM mRentalBasketVM) { var basket = GetRentalBasket(); basket.StartDate = mRentalBasketVM.StartDate; UpdateBasket(basket); return(RedirectToAction(Stepper2.NextStep())); }
public ActionResult CreateCustomerStep1(Customer mCustomer) { if (ModelState.IsValid) { if (TryUpdateModel(TempCustomer)) { return(RedirectToAction(Stepper2.NextStep())); } } return(View(mCustomer)); }
public ActionResult AddPurchaseUnitStep6(PurchaseBasketVM mPurchaseBasketVM) { var basket = GetPurchaseBasket(); if (TryUpdateModel(basket)) { UpdateBasket(basket); return(RedirectToAction(Stepper2.NextStep())); } return(View(mPurchaseBasketVM)); }
private void BuildPurchaseAccountStepper() { Stepper2.Header = string.Format("Customer {0} - Add Purchase Account", _customerService.GetCustomer(TempAccount.CustomerId).SurnameFirstName); Stepper2.ClearSteps(); Stepper2.AddStep("AddAccountStep1"); Stepper2.AddStep("AddPurchaseAccountStep3"); Stepper2.AddStep("AddPurchaseAccountStep4"); Stepper2.AddStep("AddPurchaseAccountStep5"); Stepper2.AddStep("AddPurchaseAccountStep6"); Stepper2.AddStep("AddPurchaseAccountStep7"); }
public ActionResult AddPurchaseUnitBasket(int customerAccountId) { var basket = new PurchaseBasket { CustomerAccountId = customerAccountId }; _accountService.AddBasket(basket); _accountService.CommitChanges(); BasketId = basket.BasketId; BuildPurchaseAccountStepper(); return(RedirectToAction(Stepper2.FirstStep())); }
private void BuildRentAccountStepper() { Stepper2.CreatePageStepper("CancelStepper", null); Stepper2.Header = string.Format("Customer {0} - Add Rental Units (basket)", _customerService.GetCustomer(GetRentalBasket().CustomerAccountId).SurnameFirstName); Stepper2.ClearSteps(); Stepper2.AddStep("AddRentUnitStep1"); Stepper2.AddStep("AddRentUnitStep2"); Stepper2.AddStep("AddRentUnitStep3"); Stepper2.AddStep("AddRentUnitStep5"); Stepper2.AddStep("AddRentUnitStep6"); }
public override ActionResult AddUnitBasket(int customerAccountId) { var basket = new RentalBasket { CustomerAccountId = customerAccountId }; _accountService.AddBasket(basket); _accountService.CommitChanges(); BasketId = basket.BasketId; BuildRentAccountStepper(); return(RedirectToAction(Stepper2.FirstStep())); }
public ActionResult AddNewAccount(int customerId) { TempRepository <NewAccountVM> .Entity = new NewAccountVM { CustomerId = customerId, StartDate = DateTime.Today }; var header = string.Format("Customer {0} - Add Account", _customerService.GetCustomer(customerId).SurnameFirstName); Stepper2.CreatePageStepper("CancelStepper", header); Stepper2.AddStep("AddAccount"); TempAccount = null; return(RedirectToAction(Stepper2.NextStep())); }
public ActionResult AddRentUnitStep5(RentalBasketVM mRentalBasketVM) { if (ModelState.IsValid) { var basket = GetRentalBasket(); if (TryUpdateModel(basket)) { UpdateBasket(basket); return(RedirectToAction(Stepper2.NextStep())); } } return(View(mRentalBasketVM)); }
public ActionResult CreateCustomer() { Stepper2.CreatePageStepper("Index", "Add Customer"); Stepper2.AddStep("CreateCustomerStep1"); Stepper2.AddStep("CreateCustomerStep2"); Stepper2.AddStep("CreateCustomerStep3"); TempCustomer = new Customer { CustomerEmployer = new CustomerEmployer { EmployerId = -1 } }; return(RedirectToAction(Stepper2.NextStep())); }
public ActionResult AddRentUnitStep2(RentalBasketVM mRentalBasketVM) { var rentAcc = GetRentalBasket(); if (rentAcc.RentedUnits == null || rentAcc.RentedUnits.Count == 0) { ModelState.AddModelError("", "No Unit has been selected!"); return(View(mRentalBasketVM)); } //rentAcc.AttachedContracts = new List<Contract>(); rentAcc.OneOffItems.ForEach(c => c.Quantity = rentAcc.RentedUnits.Count); return(RedirectToAction(Stepper2.NextStep())); }
public ActionResult AddPurchaseUnitStep3(PurchaseBasketVM mPurchaseBasketVM) { if (!ModelState.IsValid) { return(View(mPurchaseBasketVM)); } PurchaseBasket basket = GetPurchaseBasket(); if (basket.PurchasedUnits == null || basket.PurchasedUnits.Count == 0) { ModelState.AddModelError("", "No Unit has been selected!"); return(View(mPurchaseBasketVM)); } return(RedirectToAction(Stepper2.NextStep())); }
public ActionResult AddPurchaseAccountStep3(AddPurchaseAccountVM mAddPurchaseAccountVm) { if (!ModelState.IsValid) { return(View(mAddPurchaseAccountVm)); } var purchaseAcc = TempAccountAsAddPurchaseAccountVM(); if (purchaseAcc.PurchasedUnits == null || purchaseAcc.PurchasedUnits.Count == 0) { ModelState.AddModelError("", "No Unit has been selected!"); return(View(mAddPurchaseAccountVm)); } return(RedirectToAction(Stepper2.NextStep())); }
public ActionResult CreateCustomerStep2(CustomerEmployer mCustomerEmployer) { if (ModelState.IsValid) { if (TryUpdateModel(TempCustomer.CustomerEmployer)) { if (TempCustomer.CustomerEmployer.EmployerId == -1) { TempCustomer.CustomerEmployer = null; TempCustomer.CustomerEmployerId = null; } return(RedirectToAction(Stepper2.NextStep())); } } ViewBag.Employers = AddAllSelector <Employer>(new Employer { EmployerId = -1, EmployerName = " ---" }, ViewBag.Employers); return(View(mCustomerEmployer)); }
public ActionResult AddPurchaseAccountStep6(AddPurchaseAccountVM mAddPurchaseAccountVm) { if (ModelState.IsValid) { var purAcc = TempAccountAsAddPurchaseAccountVM(); if (TryUpdateModel(purAcc)) { var newAccount = new PurchaseAccount { AlternateAddressInstructions = purAcc.AlternateAddressInstructions, AlternateAddress = purAcc.AlternateAddress, CustomerId = purAcc.CustomerId, Customer = _customerService.GetCustomer(purAcc.CustomerId), OneOffItems = new List <OneOffItem>(), PurchasedUnits = new List <PurchaseUnit>(), }; foreach (var unit in purAcc.PurchasedUnits) { var newUnit = new PurchaseUnit { PurchasedDate = unit.PurchasedDate, RetailCost = unit.RetailCost, DiscountedAmount = unit.DiscountedAmount, //Stock = unit.Stock, StockId = unit.StockId, Contracts = unit.Contracts.Select(c => new ServiceContract { ContractTypeId = c.ContractTypeId, //ContractType = c.ContractType, ContractLengthInMonths = c.ContractLengthInMonths, StartDate = c.StartDate, Charge = c.Charge, ExpiryDate = c.ExpiryDate, PaymentPeriodId = c.PaymentPeriodId, }).ToList(), }; newAccount.PurchasedUnits.Add(newUnit); } foreach (var oneOffItem in purAcc.OneOffItems) { var newOneOffItem = new OneOffItem { Description = oneOffItem.Description, Charge = oneOffItem.Charge, Date = purAcc.StartDate, Quantity = oneOffItem.Quantity, OneOffTypeId = oneOffItem.OneOffTypeId }; newAccount.OneOffItems.Add(newOneOffItem); } if (ExecuteRepositoryAction(() => { _accountService.AddTempAccount(newAccount); _accountService.CommitChanges(); })) { Session["_accountId"] = newAccount.CustomerAccountId; return(RedirectToAction(Stepper2.NextStep())); } } } return(View(mAddPurchaseAccountVm)); }
public ActionResult StepperMoveToPreviousStep() { return(RedirectToAction(Stepper2.PreviousStep())); }