Exemplo n.º 1
0
 /// <summary>
 /// btnSubmit_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         Utilities objPwd = new Utilities();
         _usersDL             = new UsersDL();
         _usersDL.UserName    = Convert.ToInt32(Session["UserName"].ToString());
         _usersDL.OldPassword = objPwd.EncryptText(txtOldPwd.Text);
         _usersDL.Password    = objPwd.EncryptText(txtpwd.Text);
         if (_usersDL.ChangePassword())
         {
             lblmsg.Text = "Password Successfully Updated.";
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append("<script>alert('Password Successfully Updated.');");
             sb.Append("</script>");
             ScriptManager.RegisterStartupScript(this.Page, typeof(string), "MyScript", sb.ToString(), false);
         }
         else
         {
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append("<script>alert('Incorrect existing password!');");
             sb.Append("</script>");
             ScriptManager.RegisterStartupScript(this.Page, typeof(string), "MyScript", sb.ToString(), false);
         }
     }
     catch (Exception ex)
     {
         ErrorLog.LogErrorMessageToDB("ChangePassword.aspx", "", "btnSubmit_Click", ex.Message.ToString(), new ACEConnection());
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// ibtnChangePasswordSubmit_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ibtnChangePasswordSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         Utilities objPwd = new Utilities();
         _usersLogin             = new UsersDL();
         _usersLogin.UserName    = Convert.ToInt32(txtUserName.Text);
         _usersLogin.OldPassword = objPwd.EncryptText(txtOldPwd.Text);
         _usersLogin.Password    = objPwd.EncryptText(txtpwd.Text);
         if (_usersLogin.ChangePassword())
         {
             lblmsg.Text = "Password Successfully Updated.";
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append("<script>alert('Password Successfully Updated.');");
             sb.Append("</script>");
             ScriptManager.RegisterStartupScript(this.Page, typeof(string), "MyScript", sb.ToString(), false);
             mvLogin.ActiveViewIndex = 0;
             Response.Redirect("~/Login.aspx", false);
         }
         else
         {
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             sb.Append("<script>alert('Incorrect existing password!');");
             sb.Append("</script>");
             ScriptManager.RegisterStartupScript(this.Page, typeof(string), "MyScript", sb.ToString(), false);
         }
     }
     catch (Exception ex)
     {
         ErrorLog.LogErrorMessageToDB("Login.aspx", "", "ibtnChangePasswordSubmit_Click", ex.Message, new ACEConnection());
     }
 }