Exemplo n.º 1
0
        /// <summary>
        /// Handles the Click event of the btnchPwd control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void btnchPwd_Click(object sender, EventArgs e)
        {
            ViewState["ModifyPassword"] = null;
            if (cmpConfirmPassowrd.IsValid && reqConfirmPassword.IsValid && reqNewPassword.IsValid)
            {
                ViewState["ModifyPassword"] = txtNewPassword.Text.Trim();
            }
            else
            {
                throw new Exception(Constants.incorrectPWd);
            }

            try
            {
                if (Session["Acc_Num"] != null && ViewState["ModifyPassword"] != null)
                {
                    CardHolderManager um   = new CardHolderManager();
                    CardHolder_MstDTO user = um.FindUserByCrNumber(Session["Acc_Num"].ToString());
                    if (user.User_pwd == ViewState["ModifyPassword"].ToString())
                    {
                        lblErrpwd.Text = Constants.NotEqualPwd;
                        DivPwd.Attributes.CssStyle.Add("display", "block");
                    }
                    else
                    {
                        user.User_pwd = ViewState["ModifyPassword"].ToString();
                        um.UpdateCardHolder(user);
                        ClearControls();
                        // Response.Redirect("login.aspx");
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + Constants.GeneralRequestError + "');", true);
                    ClearControls();
                }
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + Constants.GeneralRequestError + "');", true);
                ClearControls();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handles the Click event of the btnSubmit control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 /// <remarks></remarks>
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtOTP.Text == hdnOTP.Value.ToString() && ViewState["ModifyPassword"] != null)
         {
             LabelOTPErrorMessage.Text = string.Empty;
             DivOTPErrorMessage.Attributes.CssStyle.Add("display", "none");
             //MsgStep2.Text = string.Empty;
             LabelOTPMessage.Text = String.Empty;
             DivOTPMessage.Attributes.CssStyle.Add("display", "none");
             CardHolderManager um   = new CardHolderManager();
             CardHolder_MstDTO user = Session.GetUserDto();
             user.User_pwd = ViewState["ModifyPassword"].ToString();
             um.UpdateCardHolder(user);
             LblSuccessMessage.Text = Constants.PwdSuccess;
             DivSuccess.Attributes.CssStyle.Add("display", "block");
             hdnOTP.Value = string.Empty;
             //mvPasswordChange.ActiveViewIndex = 0;
             SessionLogout();
             ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "redirectJS",
                                                     "setTimeout(function() { window.location='../Login.aspx' }, 5000);", true);
         }
         else
         {
             StartOTPTimer();
             LabelOTPMessage.Text = Constants.IncorrectOTP;
             DivOTPMessage.Attributes.CssStyle.Add("display", "block");
         }
     }
     catch (Exception)
     {
         LabelOTPErrorMessage.Text = Constants.GeneralErrorMessage;
         DivOTPErrorMessage.Attributes.CssStyle.Add("display", "block");
     }
 }