示例#1
0
        protected void ctlUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                SuUser user = UserEngine.ChangePassword(UserAccount.UserID, ctlOldPasswordTextbox.Text, ctlNewPasswordTextbox.Text, ctlConfirmPasswordTextbox.Text, ProgramCode);
            }
            catch (ServiceValidationException ex)
            {
                this.ValidationErrors.MergeErrors(ex.ValidationErrors);
            }

            if (this.ValidationErrors.IsEmpty)
            {
                ctlPanelModalPopupExtender.Hide();
            }
            else
            {
                ctlPanelModalPopupExtender.Show();
            }
            #region Old Code Comment By Pichai C. on 2-Feb-2009
            //if (ctlNewPasswordTextbox.Text != ctlConfirmPasswordTextbox.Text)
            //{
            //    ctlErrorValidationLabel.Text = "New password not same Confirm password";
            //    ctlPanelModalPopupExtender.Show();

            //}
            //else
            //{
            //    SuUser user  = UserEngine.ChangePassword(UserAccount.UserID, ctlOldPasswordTextbox.Text, ctlNewPasswordTextbox.Text, ctlConfirmPasswordTextbox.Text, "UserInfo");
            //    if (flag.Equals("sucessfull"))
            //    {
            //        ctlErrorValidationLabel.Text = "Change password successfull";
            //        Thread.Sleep(1000);
            //        ctlPanelModalPopupExtender.Hide();
            //    }
            //    else
            //    {
            //        ctlErrorValidationLabel.Text = flag;
            //        ctlPanelModalPopupExtender.Show();
            //    }

            //}
            #endregion
        }
        protected void ctlUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                SuUser user;

                if (UserAccount.UserID > 0)
                {
                    user = UserEngine.ChangePassword(UserAccount.UserID, ctlOldPasswordTextbox.Text.Trim(), ctlNewPasswordTextbox.Text.Trim(), ctlConfirmPasswordTextbox.Text.Trim(), ProgramCode);
                }
                else
                {
                    user = UserEngine.ChangePassword(userName, ctlOldPasswordTextbox.Text.Trim(), ctlNewPasswordTextbox.Text.Trim(), ctlConfirmPasswordTextbox.Text.Trim(), ProgramCode);
                }

                if (user != null)
                {
                    UserEngine.SyncUpdateUserData(user.UserName);
                }

                if (isResponseMenu && user != null && user.Userid > 0)
                {
                    Response.Redirect(ResolveUrl("~/Menu.aspx"), true);
                }
            }
            catch (ServiceValidationException ex)
            {
                this.ValidationErrors.MergeErrors(ex.ValidationErrors);
            }

            if (this.ValidationErrors.IsEmpty)
            {
                ctlPanelModalPopupExtender.Hide();
            }
            else
            {
                vsSummary.Visible = true;
                ctlPanelModalPopupExtender.Show();
            }
        }