public ActionResult AddPayee(AddPayeeViewModel model) { CustomerDAL objOfCustomerDAL = new CustomerDAL(); 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"); ModelState.Clear(); long customerID = (Session["User"] as UserRole).customerID; if (objOfCustomerDAL.ValidatePayeeAccountNumber(model.payeeAccountNumber, customerID) != null) { objOfCustomerDAL.AddPayee(model, customerID); ViewBag.message = "success"; return View(); } else { ViewBag.message = "Operation failed"; return View(); } }
public ActionResult Index() { CustomerDAL newObj = new CustomerDAL(); AdminDAL adminObj = new AdminDAL(); List<BranchViewModel> list= adminObj.GetAllBranchDetails(); foreach(var v in list) MessageBox.Show(v.branchCode); return View(); }
public ActionResult ApplyForLoan() { CommonDAL objCommonDal = new CommonDAL(); ViewBag.cityList = objCommonDal.GetCityList(); long customerID = (Session["User"] as UserRole).customerID; CustomerDAL objCustomerDal = new CustomerDAL(); LoanRequestViewModel objLoanRequest = new LoanRequestViewModel(); objLoanRequest.customerID = customerID; objLoanRequest.age = objCustomerDal.GetAgeByCustomerID(customerID); objLoanRequest.salaryProof = new byte[1024]; objLoanRequest.addressProof = new byte[1024]; @ViewBag.loanTypeList = new List<SelectListItem>() { new SelectListItem(){Text = "Personal",Value="P"}, new SelectListItem(){Text = "Home",Value="H"}, new SelectListItem(){Text = "Vehicle",Value="V"}, }; return View(objLoanRequest); }
public ActionResult MiniDetailedstatements() { 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"); List<TransactionStatementViewModel> transactionsList = new List<TransactionStatementViewModel>(); List<long> accountsList = new List<long>(); CustomerDAL customerDALObject = new CustomerDAL(); long customerID = (Session["User"] as UserRole).customerID; accountsList = customerDALObject.GetAccountsListAsLongListByCustomerID(customerID); ViewBag.accountsList = accountsList; if (accountsList != null) ViewBag.transactionDetails = customerDALObject.GetLastFiveTransactions(accountsList[0]); return View(); }
public JsonResult UploadSalaryProof() { string imgPath = string.Empty; long requestID; CustomerDAL customerDALObj = new CustomerDAL(); for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase file = Request.Files[i]; //Uploaded file //Use the following properties to get file's name, size and MIMEType int fileSize = file.ContentLength; string fileName = file.FileName; string mimeType = file.ContentType; System.IO.Stream fileContent = file.InputStream; requestID = customerDALObj.GetNextLoanAccountRequestID(); //To save file, use SaveAs method imgPath = "Images/ApplyForLoan/" + "AFL_SP_" + requestID + ".jpg"; file.SaveAs(Server.MapPath("~/") + imgPath); //File will be saved in directory } return Json("Image uploaded successfully !"); }
public JsonResult ValidateAccountNumber(int accountNumber) { CustomerDAL objOfCustomerDAL = new CustomerDAL(); long customerID = (Session["User"] as UserRole).customerID; AddPayeeViewModel obj = objOfCustomerDAL.ValidatePayeeAccountNumber(accountNumber, customerID); //if(accountNumber==0) // return null; //AddPayeeViewModel obj = new AddPayeeViewModel {payeeName="virat",branchName="kormangala" }; ViewBag.message = ""; return Json(obj); }
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 JsonResult UploadPhotoIDProof(string Token) { string imgPath = string.Empty; CustomerDAL customerDALObj = new CustomerDAL(); Customer customer; for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase file = Request.Files[i]; //Uploaded file //Use the following properties to get file's name, size and MIMEType int fileSize = file.ContentLength; string fileName = file.FileName; string mimeType = file.ContentType; System.IO.Stream fileContent = file.InputStream; customer = customerDALObj.GetUserByTokenID(Token); //To save file, use SaveAs method imgPath = "Images/FinishRegistration/" + "CID_" + customer.CustomerID + ".jpg"; file.SaveAs(Server.MapPath("~/") + imgPath); //File will be saved in directory } return Json("Image uploaded successfully !"); }
public ActionResult CreateNewAccount(NewAccountRequestView model, HttpPostedFileBase Image) { CustomerDAL customerDALobject = new CustomerDAL(); // ModelState.Clear(); CommonDAL obj = new CommonDAL(); ViewBag.cityList = obj.GetCityList(); if (Image == null) { ViewBag.message = "Please upload image first ! "; return View(model); } if (customerDALobject.AddNewAccountRequest(model)) { ViewBag.message = "Request Submitted. Thank You !"; return View(model); } else { ViewBag.message = "Oops... Error in submitting request."; 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(); }
public ActionResult ValidateToken(string token) { bool IsValid = true; CustomerDAL cd = new CustomerDAL(); IsValid = cd.ValidateToken(token); if (IsValid) { return RedirectToAction("FinishRegistration", "Customer", new { token=token}); } else { ModelState.AddModelError("", "Token is not valid."); return RedirectToAction("Index"); } //MessageBox.Show("Token is: " + token); }
public ActionResult RequestClosureOfAccount(CloseAccountCustomerViewModel model) { long customerID = (Session["User"] as UserRole).customerID; CustomerDAL objCustomerDAL = new CustomerDAL(); //List<long> savingsAccountList = new List<long>() { 121212, 12123123421 }; ViewBag.savingsAccountList = objCustomerDAL.GetAccountsListAsLongListByCustomerID(customerID); if (objCustomerDAL.AddCloseAccountRequest(model.accountNumber, customerID)) { ViewBag.message = "Request for closure of account is successful"; } else { ViewBag.message = "Request already exist"; } return View(); }
public JsonResult GetListOfNewAccountRequests() { CustomerDAL objCustomerDal = new CustomerDAL(); long customerID = (Session["User"] as UserRole).customerID; return Json(objCustomerDal.ViewNewAccountRequest(customerID)); }
public ActionResult ApplyForLoan(LoanRequestViewModel model) { CommonDAL objCommonDal = new CommonDAL(); CustomerDAL objCustomerDal = new CustomerDAL(); ViewBag.cityList = objCommonDal.GetCityList(); @ViewBag.loanTypeList = new List<SelectListItem>() { new SelectListItem(){Text = "Personal",Value="P"}, new SelectListItem(){Text = "Home",Value="H"}, new SelectListItem(){Text = "Vehicle",Value="V"}, }; if(objCustomerDal.AddLoanAccountRequest(model) ) { ModelState.AddModelError("", "You request for loan was successful. You may apply for yet another loan"); } else { ModelState.AddModelError("", "Operation failed"); } return View(model); }
public ActionResult GetLastFiveTransactions(long accountNumber) { List<TransactionStatementViewModel> transactionsList = new List<TransactionStatementViewModel>(); if (Session["User"] == null) return RedirectToAction("Login", "CommonBiz"); CustomerDAL customerDALObject = new CustomerDAL(); long customerID = (Session["User"] as UserRole).customerID; return Json(customerDALObject.GetLastFiveTransactions(accountNumber)); }
public ActionResult GetDetailedTransactions(long accountNumber, int fromDate, int fromMonth, int fromYear, int toDate, int toMonth, int toYear) { List<TransactionStatementViewModel> transactionsList = new List<TransactionStatementViewModel>(); DateTime startDate = new DateTime(fromYear, fromMonth, fromDate); DateTime endDate = new DateTime(toYear, toMonth, toDate); if (Session["User"] == null) return RedirectToAction("Login", "CommonBiz"); CustomerDAL customerDALObject = new CustomerDAL(); long customerID = (Session["User"] as UserRole).customerID; return Json(customerDALObject.GetDetailedTransactions(accountNumber, startDate, endDate)); }
public ActionResult FinishRegistration(Customer model, HttpPostedFileBase Image) { //MessageBox.Show("I am in POST"); CustomerDAL obj = new CustomerDAL(); if (obj.IsUniqueUserID(model.UserID) && ModelState.IsValid) { if (Image != null) { // product.ImageMimeType = image.ContentType; model.PhotoIDProof = new byte[Image.ContentLength]; Image.InputStream.Read(model.PhotoIDProof, 0, Image.ContentLength); } obj.FinishReg(model); return RedirectToAction("Login", "CommonBiz"); } else { ModelState.AddModelError("", "User Id not available"); return View(model); } }
public ActionResult FinishRegistration(string token) { //MessageBox.Show("I am in GET Now get user details according to token"+token); CustomerDAL obj = new CustomerDAL(); Customer customer = obj.GetUserByTokenID(token); customer.DOB = Convert.ToDateTime(customer.DOB.ToShortDateString()); return View(customer); }
// // GET: /Customer/ public ActionResult DashBoard() { 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"); CustomerDAL customerDALObject = new CustomerDAL(); long customerID = (Session["User"] as UserRole).customerID; ViewBag.approvedRequests = customerDALObject.GetNoOfApprovedRequests(customerID); ViewBag.rejectedRequests = customerDALObject.GetNoOfRejectedRequests(customerID); ViewBag.pendingRequests = customerDALObject.GetNoOfPendingRequests(customerID); return View(); }
public List<SearchCustomerViewModel> GetLockedCustomers() { List<SearchCustomerViewModel> customersList = new List<SearchCustomerViewModel>(); long customerID; CustomerDAL customerDALObj = new CustomerDAL(); using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ToString()), connection2 = new SqlConnection(ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ToString()), connection3 = new SqlConnection(ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ToString())) { connection.Open(); connection2.Open(); connection3.Open(); SqlCommand command = new SqlCommand(String.Format("SELECT UserID FROM UserRoles WHERE Status = 'L' "), connection); SqlDataReader reader = command.ExecuteReader(), reader2, reader3; SqlCommand command2 = new SqlCommand("", connection2); SqlCommand command3 = new SqlCommand("", connection3); if (!reader.HasRows) return null; while (reader.Read()) { var userID = reader[0].ToString(); customerID = customerDALObj.GetCustomerIDbyUserID(userID); command2.CommandText = String.Format("SELECT CustomerName, PermanentAddress, CommunicationAddress, ContactNumber, Email FROM Customer WHERE CustomerID = {0} ", customerID.ToString()); reader2 = command2.ExecuteReader(); reader2.Read(); string customerName = reader2[0].ToString(); string permanentAddress = reader2[1].ToString(); string communicationAddress = reader2[2].ToString(); string contactNumber = reader2[3].ToString(); string email = reader2[4].ToString(); reader2.Close(); command3.CommandText = "SELECT AccountNumber FROM Account WHERE CustomerID = " + customerID.ToString(); reader3 = command3.ExecuteReader(); if (reader3.HasRows) while (reader3.Read()) { SearchCustomerViewModel customerDetails = new SearchCustomerViewModel(); customerDetails.accountNumber = reader3[0].ToString(); customerDetails.customerName = String.Copy(customerName); customerDetails.permanentAddress = String.Copy(permanentAddress); customerDetails.communicationAddress = String.Copy(communicationAddress); customerDetails.contactNumber = String.Copy(contactNumber); customerDetails.email = String.Copy(email); customersList.Add(customerDetails); } reader3.Close(); } reader.Close(); } return customersList; }
public ActionResult RequestClosureOfAccount() { 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(); ViewBag.savingsAccountList = objCustomerDAL.GetAccountsListAsLongListByCustomerID(customerID); ViewBag.message = ""; return View(); }