protected void ForgetPassword(object sender, EventArgs e) { try { if (forget.Text == "OTP") { DataTable dt = new DataTable(); objML_Login.ID = txtUserName.Text != "" ? txtUserName.Text : null; objML_Login.EmailID = txtForgetEmail.Text != "" ? txtForgetEmail.Text : null; dt = objBL_Login.BL_ForgetOTP(objML_Login); if (dt.Rows.Count > 0) { GenerateOTP(); objCommonClass.LoginOTPLayout(txtUserName.Text, lblOTP.Text, txtForgetEmail.Text); ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Please check you Email ID for OTP')", true); OTPVerify.Visible = true; forget.Text = "Verify"; } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Invalid Email ID')", true); } } else if (forget.Text == "Verify") { if (lblOTP.Text == txtOTP.Text) { forgetpassword.Visible = true; OTPVerify.Visible = false; forget.Text = "Forget Password"; } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('OTP not Match')", true); } } else { objML_Login.UserName = txtUserName.Text != "" ? txtUserName.Text : null; objML_Login.Password = objCommonClass.GetEncrptPassword(txtNewPwd.Text); objML_Login.CPwd = objCommonClass.GetEncrptPassword(txtConformPwd.Text); int x = objBL_Login.BL_ChangePassword(objML_Login); if (x == 1) { BackToLogin(sender, e); ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Password Change successfully')", true); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('" + ex.Message.ToString() + "')", true); } }
protected void Save(object sender, EventArgs e) { try { if (txtCategory.Text == "") { txtCategory.Focus(); ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Fill Old Password')", true); } else if (txtNew.Text == "") { txtNew.Focus(); ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Fill New Password')", true); } else if (txtConform.Text == "") { txtConform.Focus(); ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Fill Conform Password')", true); } else { objML_Logn.UserName = Session["UserName"].ToString(); objML_Logn.UserID = objCommonClass.GetEncrptPassword(txtCategory.Text); objML_Logn.Password = objCommonClass.GetEncrptPassword(txtNew.Text); objML_Logn.CPwd = objCommonClass.GetEncrptPassword(txtConform.Text); int x = objBL_Login.BL_ChangePassword(objML_Logn); if (x == 1) { ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Data Saved')", true); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('" + ex.Message.ToString() + "')", true); } }