public string GetSchoolByEMISNo(string emisNo) { string results = string.Empty; JavaScriptSerializer js = new JavaScriptSerializer(); try { UserVerificationRepository _repo = new UserVerificationRepository(); SchoolModel data = _repo.GetSchoolByEMISNo(emisNo); if (data != null) { if (data.IsSurveySubmitted) { throw new Exception("Survey Already Submitted to the GDE."); } // string encryptedData = HttpContext.Current.Server.UrlEncode(EncryptionHelper.EncryptData(data.ID.ToString())); string encryptedData = CryptorEngine.Encrypt(data.ID.ToString()); results = js.Serialize(new { School = data, Data = encryptedData }); } } catch (Exception ex) { results = js.Serialize(string.Format("Error - {0}", ex.Message)); } return(results); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserVerificationRepository _repo = new UserVerificationRepository(); SchoolModel data = _repo.GetSchoolByID(SchoolID); if (data != null) { hdfSchoolID.Value = SchoolID.ToString(); lblSchoolName.InnerText = data.Name; lblSchoolLevel.InnerText = data.Level; lblEMISNo.InnerText = data.EMISNo; lblEducationalDistrict.InnerText = data.DistrictName; lblRelationWithState.InnerText = data.RelationWithState; lblEmailAddress.InnerText = data.PrincipalEmailAddress; lblPrincipalName.InnerText = data.PrincipalName; lblPrincipalIDNo.InnerText = data.PrincipalIdentityNo; lblPrincipalCellphoneNo.InnerText = data.PrincipalMobileNo; lblPrincipalPersalNo.InnerText = data.PrincipalPersalNo; Session["CurrentUser"] = data.PrincipalName; } } }
public string VerifyUser(string emisNo, string persalNo, string identityNo) { string results = string.Empty; JavaScriptSerializer js = new JavaScriptSerializer(); try { string[] args = { emisNo, persalNo, identityNo }; UserVerificationRepository _repo = new UserVerificationRepository(); SchoolModel data = _repo.GetSchoolByPrincipalDetails(emisNo, persalNo, identityNo); if (data != null) { Random rnd = new Random(); string otp = rnd.Next(1000, 9999).ToString(); string emailAddress = data.PrincipalEmailAddress; // string cellphoneNo = data.PrincipalMobileNo; string cellphoneNo = "0826793366"; //HttpContext.Current.Session["CurrentUser"] = data.PrincipalName; //if (!string.IsNullOrEmpty(emailAddress)) //{ // string[] emailArgs = { data.PrincipalName, otp }; // NotificationHelper.SendEmail(emailAddress, "User Verification", DataLibrary.Notification.Message.UserVerificationEmailMessage(emailArgs)); //} string[] smsArgs = { otp }; NotificationHelper.SMS(cellphoneNo.Trim(), DataLibrary.Notification.Message.UserVerificationSMSMessage(smsArgs)); // string encryptedData = HttpContext.Current.Server.UrlEncode(EncryptionHelper.EncryptData(string.Format("{0}-{1}", data.ID, otp))); string encryptedData = CryptorEngine.Encrypt(string.Format("{0}-{1}", data.ID, otp)); results = js.Serialize(new { School = data, Data = encryptedData }); } } catch (Exception ex) { results = js.Serialize(string.Format("Error - {0}", ex.Message)); } return(results); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string schoolID = CryptorEngine.Decrypt(Request.QueryString["Data"]); UserVerificationRepository _repo = new UserVerificationRepository(); SchoolModel data = _repo.GetSchoolByID(Convert.ToInt32(schoolID)); if (data != null) { hdfSchoolID.Value = schoolID.ToString(); lblSchoolName.InnerText = data.Name; lblSchoolLevel.InnerText = data.Level; lblEMISNo.InnerText = data.EMISNo; lblEducationalDistrict.InnerText = data.DistrictName; lblRelationWithState.InnerText = data.RelationWithState; } } }
public string ResetOTP(string schoolID) { string results = string.Empty; JavaScriptSerializer js = new JavaScriptSerializer(); try { string lSchoolID = CryptorEngine.Decrypt(schoolID); UserVerificationRepository _repo = new UserVerificationRepository(); var data = _repo.GetSchoolByID(Convert.ToInt32(lSchoolID)); if (data != null) { Random rnd = new Random(); string otp = rnd.Next(1000, 9999).ToString(); string emailAddress = data.PrincipalEmailAddress; string cellphoneNo = data.PrincipalMobileNo; string[] smsArgs = { otp }; NotificationHelper.SMS(cellphoneNo.Trim(), DataLibrary.Notification.Message.UserVerificationSMSMessage(smsArgs)); string encryptedData = CryptorEngine.Encrypt(string.Format("{0}-{1}", data.ID, otp)); results = js.Serialize(new { Message = "Success", Data = encryptedData }); } else { results = js.Serialize(new { Message = "There was an error when resetting OTP.", Data = data }); } } catch (Exception ex) { results = js.Serialize(new { Message = string.Format("Error - {0}", ex.Message) }); results = js.Serialize(string.Format("Error - {0}", ex.Message)); } return(results); }
public UserServices() { _userRepository = new UserRepository(); _userVerificationRepository = new UserVerificationRepository(); }