public ActionResult AddBankDetails(string payee_first_name, string payee_last_name, string payee_bank_name, string payee_bank_account, string payee_bank_ifsc, string payee_bank_branch) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); string email = Session["LoginEmail"].ToString(); //string email = "*****@*****.**"; var result = businessLogics.FindAccountByEmail(email); if (result != null) { List <string> inputDetails = new List <string> { payee_first_name, payee_last_name, payee_bank_name, email, payee_bank_account, payee_bank_ifsc, payee_bank_branch }; if (logics.ContainsAnyNullorWhiteSpace(inputDetails)) { ViewBag.ErrorMsg = "No Field Should be left blank"; } if (!logics.ContainsOnlyDigits(payee_bank_account)) { ViewBag.ErrorMsg = "Invalid bank account number"; } if (payee_bank_ifsc.Length != 11 && !logics.ContainsOnlyAlphabets(payee_bank_ifsc.Substring(0, 4))) { ViewBag.ErrorMsg = "Invalid bank IFSC number"; } if (!logics.ContainsOnlyAlphabets(payee_first_name) && !logics.ContainsOnlyAlphabets(payee_last_name)) { ViewBag.ErrorMsg = "Invalid Payee name invalid"; } var bankaccountCreationResult = businessLogics.AddBankDetails(result.Id, payee_first_name, payee_last_name, payee_bank_name, payee_bank_account, payee_bank_ifsc, payee_bank_branch); if (bankaccountCreationResult == 1) { //Bank details created successfully return(RedirectToAction("Index", "UserProfile")); } //else if (bankaccountCreationResult == 2) //{ // ViewBag.ErrorMsg = "Internal server error occured while inserting data to the database"; //} else { ViewBag.ErrorMsg = "Internal server error occured while inserting data to the database"; } } else { ViewBag.ErrorMsg = "Account information retreval failed"; } return(View()); }
public ActionResult EditRole(int roleId, string roleName) { logics = new GeneralLogics(); if (logics.ContainsOnlyAlphabets(roleName)) { businessLogics = new BusinessLogics(); var result = businessLogics.EditRole(roleId, roleName); if (result == 1) { return(RedirectToAction("Index", "SiteRoleManagement")); } else if (result == 0) { ViewBag.ErrorMsg = "No role found with the associated Id."; } else if (result == 3) { ViewBag.ErrorMsg = "Role already exists"; } else { ViewBag.ErrorMsg = "Internal Error occured while modifying role."; } } else { ViewBag.ErrorMsg = "Invalid Role name entered"; } return(RedirectToAction("Index", "SiteRoleManagement")); }
public ActionResult AddRole(string roleName) { logics = new GeneralLogics(); if (logics.ContainsOnlyAlphabets(roleName)) { businessLogics = new BusinessLogics(); var result = businessLogics.Addrole(roleName); if (result == 1) { return(RedirectToAction("Index", "SiteRoleManagement")); } else if (result == 0) { ViewBag.ErrorMsg = "Role already exists."; } else { ViewBag.ErrorMsg = "Internal Error occured while adding new role"; } } else { ViewBag.ErrorMsg = "Invalid Role name entered"; } return(View("AddorEditRole")); }
public ActionResult SignUp(string first_name, string last_name, string mobile, string email, string address1, string address2, string pincode, string password, string con_password) { logics = new GeneralLogics(); businessLogics = new BusinessLogics(); List <string> inputValues = new List <string> { first_name, last_name, mobile, email, address1, address2, pincode, password, con_password }; if (logics.ContainsAnyNullorWhiteSpace(inputValues)) { ViewBag.ErrorMsg = "No Field Should be left blank"; } else { if (!logics.ContainsOnlyDigits(mobile) && mobile.Length != 10 && pincode.Length != 6 && !logics.ContainsOnlyDigits(pincode)) { ViewBag.ErrorMsg = "Mobile or Pincode invalid "; } else if (!logics.ValidEmail(email)) { ViewBag.ErrorMsg = "Invalid Email provided"; } else { if (!logics.ContainsOnlyAlphabets(first_name) && !logics.ContainsOnlyAlphabets(last_name)) { ViewBag.ErrorMsg = "First name and Last name is invalid"; } else { if (password.Length < 6) { ViewBag.ErrorMsg = "Password length must be of minimum 6"; } else { if (password != con_password) { ViewBag.ErrorMsg = "Password and Confirm paswword field must contain same value"; } else { //Formatting Address string Address = "AddressLine1: " + address1 + ", AddressLine2: " + address2 + ", Pin: " + pincode; var account = businessLogics.SignUp(first_name, last_name, email, mobile, Address, password); /* 0 = duplicate record found * 1 = Operation done successfully * 2 = Account creation failed * 3 = Account removal failed and user details could not be created * 4 = Account deleted parmanantly */ if (account == 1) { return(RedirectToAction("Login", "Authentication")); } else if (account == 2 || account == 3 || account == 4) { ViewBag.ErrorMsg = "Internal server error occured. Couldn't create your account"; } else if (account == 0) { ViewBag.ErrorMsg = "An account already exists with same email."; } } } } } } return(View()); }