public ActionResult UpdateOTP(Int64 PhoneNumber) { int otp; Utility en = new Utility(); UserDetailsModel objModel = new UserDetailsModel(); objModel.txtPhoneNumber = PhoneNumber; ManagementServiceWrapper ObjService = new ManagementServiceWrapper(); InformationServiceWrapper infoObj = new InformationServiceWrapper(); GDictionaryModel GDOBJ = new GDictionaryModel(); GDOBJ = infoObj.MobileNumberVerification(PhoneNumber); if (GDOBJ.ID == 0) { otp = ObjService.UpdateOtp(objModel); HttpCookie OTPCookie = new HttpCookie("_ROTP_"); OTPCookie.Values["_ROTP_"] = en.Encrypt(otp.ToString()); OTPCookie.Expires = DateTime.Now.AddMinutes(30); Response.Cookies.Add(OTPCookie); return(Json(1, JsonRequestBehavior.AllowGet)); } else { return(Json(0, JsonRequestBehavior.AllowGet)); } }
public ActionResult UpdatePhoneNumber(FormCollection fnRegistration) { int UserId; HttpCookie UserIdCookie = Request.Cookies["_RRUID"]; HttpCookie PhoneNumberCookie = Request.Cookies["_RRUPn"]; if (UserIdCookie != null) { GDictionaryModel GDModel = new GDictionaryModel(); UserDetailsModel objModel = new UserDetailsModel(); ManagementServiceWrapper ObjService = new ManagementServiceWrapper(); InformationServiceWrapper InfoService = new InformationServiceWrapper(); Utility en = new Utility(); objModel.intUserId = Convert.ToInt32(en.Decrypt(UserIdCookie["_RRUID"])); objModel.txtPhoneNumber = Convert.ToInt64(fnRegistration["txtPhoneNumber"]); objModel.KeyForUserSettings = Convert.ToString(UserSettings.PHONENUMBER); GDModel = InfoService.MobileNumberVerification(objModel.txtPhoneNumber); if (GDModel.ID == 0) { ViewBag.MobileError = "Entered Mobiler Number is already registered"; return(Json(0, JsonRequestBehavior.AllowGet)); } else if (GDModel.ID == 1 && Regex.Match(objModel.txtPhoneNumber.ToString(), @"^([5-9]{1}[0-9]{9})$").Success) { UserId = ObjService.UpdateUserDetails(objModel); if (UserId != 0) { PhoneNumberCookie.Values["_RRUPn"] = en.Encrypt(objModel.txtPhoneNumber.ToString()); PhoneNumberCookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(PhoneNumberCookie); } return(Json(UserId, JsonRequestBehavior.AllowGet)); } else { return(Json(-99, JsonRequestBehavior.AllowGet)); } } else { return(Json(-99, JsonRequestBehavior.AllowGet)); } }
public ActionResult Registration(FormCollection fnRegistration) { int count = 0; int UserId; //=(Int32)Session["_RRUID"]; UserDetailsModel objModel = new UserDetailsModel(); objModel.txtUserName = fnRegistration["txtUserName"]; objModel.txtPhoneNumber = Convert.ToInt64(fnRegistration["txtPhoneNumber"]); Utility en = new Utility(); objModel.txtPassword = en.Encrypt(fnRegistration["txtPassword"]); objModel.ddlState = fnRegistration["ddlStateText"]; objModel.ddlDistrict = fnRegistration["ddlDistrict"]; objModel.ddlMandal = fnRegistration["ddlMandal"]; objModel.txtVillage = fnRegistration["txtVillage"]; // objModel.txtMailId = fnRegistration["txtMailId"]; objModel.OTP = fnRegistration[""]; string s = "[^<>'\"/`%-]"; if (System.Text.RegularExpressions.Regex.IsMatch(objModel.txtUserName, s)) { count = count + 1; } if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlState, "^[a-zA-Z0-9 .]{1,50}")) { count = count + 1; } if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlDistrict, "^[a-zA-Z0-9 .]{1,50}")) { count = count + 1; } if (System.Text.RegularExpressions.Regex.IsMatch(objModel.ddlMandal, "^[a-zA-Z0-9 .]{1,50}")) { count = count + 1; } if (System.Text.RegularExpressions.Regex.IsMatch(en.Decrypt(objModel.txtPassword), s)) { count = count + 1; } if (System.Text.RegularExpressions.Regex.Match(objModel.txtPhoneNumber.ToString(), "[5-9]{1}[0-9]{9}").Success) { count = count + 1; } if (System.Text.RegularExpressions.Regex.IsMatch(objModel.txtVillage, s)) { count = count + 1; } GDictionaryModel GDOBJ = new GDictionaryModel(); if (count == 7) { ManagementServiceWrapper ObjService = new ManagementServiceWrapper(); InformationServiceWrapper infoObj = new InformationServiceWrapper(); GDOBJ = infoObj.MobileNumberVerification(objModel.txtPhoneNumber); if (GDOBJ.ID == 1) { UserId = ObjService.InsertAddUserDetails(objModel); if (UserId != 0) { HttpCookie KeyCookie = new HttpCookie("_RRPS"); KeyCookie.Values["_RRPS"] = en.Encrypt(objModel.txtPassword); KeyCookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(KeyCookie); } return(Json(UserId, JsonRequestBehavior.AllowGet)); } else { ViewBag.MobileError = "Entered Mobiler Number is already registered"; return(Json(GDOBJ.ID, JsonRequestBehavior.AllowGet)); } } else { GDOBJ.ID = -1; return(Json(GDOBJ.ID, JsonRequestBehavior.AllowGet)); } }