public ActionResult TransferFunds(FundTransferViewModel model) { long customerID = (Session["User"] as UserRole).customerID; BankerDAL objBDAL = new BankerDAL(); CustomerDAL objCDAL = new CustomerDAL(); ViewBag.savingsAccountList = objCDAL.GetAllSavingsAccountByCustomerID(customerID); ViewBag.payeeAccounts = objCDAL.GetAllPayeeAccountByCustomerID(customerID); string message=""; if (model.Amount <= 0) { //ModelState.AddModelError("", "Source and Dest cant be same"); message = "Amount must be positive"; @ViewBag.message = message; return View(model); } if (model.FromAccount == model.ToAccount) { //ModelState.AddModelError("", "Source and Dest cant be same"); message = "Source and Destination account can't be same"; @ViewBag.message = message; return View(model); } if (model.Amount > objBDAL.GetAccountBalance(model.FromAccount)) { message = "Insufficient funds. Please check balance"; @ViewBag.message = message; return View(model); } if (objCDAL.ValidateTransactionPassword(customerID, model.TransactionPassword) == false) { message = "Password is not valid"; @ViewBag.message = message; return View(model); } if (objBDAL.GetAccountType(model.ToAccount) == 'L') { if (model.Amount > objBDAL.GetAccountBalance(model.ToAccount)) { message = "Invalid transaction"; @ViewBag.message = message; return View(model); } } objCDAL.DoFundTransfer(model); message = "Transaction Successful"; @ViewBag.message = message; return View(model); }
public ActionResult TransferFunds() { string result = (new CommonDAL()).CheckValidation("Customer", this.Session); if (result.Equals("LogIn")) return RedirectToAction("Login", "CommonBiz"); else if (result.Equals("Unauthorised")) return RedirectToAction("Unauthorised", "CommonBiz"); long customerID = (Session["User"] as UserRole).customerID; CustomerDAL objCustomerDAL = new CustomerDAL(); //List<int> savingsAccounts = new List<int>(){4,8,9}; //ViewBag.savingsAccountList = savingsAccounts; List<long> savingsAccountList = objCustomerDAL.GetAllSavingsAccountByCustomerID(customerID); if (savingsAccountList == null) { ViewBag.savingsAccountList = new List<long>(); } else { ViewBag.savingsAccountList = savingsAccountList; } //ViewBag.savingsAccountList = objCustomerDAL.GetAllSavingsAccountByCustomerID(customerID); //List<SelectListItem> payeeAccounts = new List<SelectListItem>() //{ // new SelectListItem(){Text = "sham",Value="4"}, // new SelectListItem(){Text = "ram",Value="8"}, // new SelectListItem(){Text = "suresh",Value="12"}, //}; //ViewBag.payeeAccounts = payeeAccounts; List<FundTransferPayeeModel> payeeAccounts = objCustomerDAL.GetAllPayeeAccountByCustomerID(customerID); if (payeeAccounts == null) { ViewBag.payeeAccounts = new List<FundTransferPayeeModel>(); } else { ViewBag.payeeAccounts = payeeAccounts; } //ViewBag.payeeAccounts = objCustomerDAL.GetAllPayeeAccountByCustomerID(customerID); ViewBag.message = ""; return View(); }