Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public char GetAccountType(int accountNumber)
 {
     BankerDAL objBankerDal = new BankerDAL();
     char accountType = objBankerDal.GetAccountType(accountNumber);
     ViewBag.accountType = accountType;
     return accountType;
 }