public ActionResult Signup(FormCollection form, DataAccessA.Classes.LoanApplication lApObj) { try { var Refid = Convert.ToInt16(TempData["Refid"]); string referralCode = Request.QueryString["Regid"]; WebLog.Log("Ref" + Refid); if (Refid == 0) { return(RedirectToAction("HomePage", "Home")); } string respMsg = ""; TempData["ErrMsg"] = ""; TempData["SucMsg"] = ""; User Users = new User(); string password = Convert.ToString(form["password"]); string rpassword = Convert.ToString(form["cpassword"]); Users.EmailAddress = Convert.ToString(form["email"]); Users.Firstname = Convert.ToString(form["fname"]); // Users.Lastname = Convert.ToString(form["lname"]); Users.PhoneNumber = Convert.ToString(form["phone"]); Users.UserAddress = Convert.ToString(form["address"]); Users.ValueDate = MyUtility.getCurrentLocalDateTime(); //Users.ValueDate = MyUtility.getCurrentLocalDateTime("dddd, dd MMMM yyyy"); Users.ReferralCode = Convert.ToString(form["ReferralCode"]); Users.StateofResidence_FK = lApObj.StateofResidence_FK; Users.LGA_FK = Convert.ToInt16(form["lgaList"]); Users.ContactAddress = Convert.ToString(form["address"]); Users.PaswordVal = password; //var EncrypPassword = new HelperClasses.CryptographyManager().ComputeHash(password, HashName.SHA256); var EncrypPassword = new HelperClasses.CryptographyManager().ComputeHash(Users.PaswordVal, HashName.SHA256); Users.PaswordVal = EncrypPassword; bool validatepas = ValidatePassword(password, rpassword); if (validatepas == false) { TempData["ErrMsg"] = "Password And Confirm Password Must Match"; } if (validatepas == true) { bool val = _DR.Validate(Users.EmailAddress); if (val == true) { TempData["ErrMsg"] = "User Already Exist"; TempData["SucMsg"] = ""; int val1 = 0; ViewData["nLGAs"] = new SelectList(_DR.GetAllLGAs(), "ID", "NAME", val1); ViewData["nStates"] = new SelectList(_DR.GetNigerianStates(), "ID", "NAME", val1); return(View("Signup")); } else if (val == false) { password = EncrypPassword; Users.PaswordVal = password; //Users.ReferralCode = "new"; if (Users.ReferralCode != null) { Users.ReferralLevel = Helper.ValidateReferralCode(Users.ReferralCode); } else { Users.ReferralLevel = 1; } var Userid = _DM.InsertUser(Users); if (Userid != 0) { Users.MyReferralCode = DataAccessA.MyUtility.getReferralCode(Userid.ToString()); var id = _DM.CreateReferalCode(Users); TempData["ErrMsg"] = "User Created Succesfully"; Session["id"] = LoggedInEmail(Users.EmailAddress); Session["User"] = Session["id"]; if (Refid == 1) { // Referrel CreateUserRole(Users, Refid); } else if (Refid == 2) { //NyscLoanApplication Apllicant CreateUserRole(Users, Refid); } /* UserRole UserRoles = new UserRole(); * UserRoles.User_FK = Users.ID; * UserRoles.Role_FK = Convert.ToInt16(ConfigurationManager.AppSettings["NYSCAgentRole"]); * UserRoles.IsVisible = 1; * _DM.InsertUserRoles(UserRoles);*/ SendEmail(Users, rpassword); // var referralcode = _DR.GetReferralCode(Userid); return(RedirectToAction("index", "AdminA")); } } } return(View()); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(View("Signup")); } }