Пример #1
0
        private void btnChangePassword_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                try
                {
                    int             RowsAffected = 0;
                    BusinessManager BM           = new BusinessManager();
                    BOAddUser       bo           = new BOAddUser();
                    bo.NewPassword = txtNewPassword.Text.Trim();
                    bo.Username    = txtUsername.Text.Trim();

                    RowsAffected = BM.BALChangeUserPasswordbyAdmin(bo);
                    if (RowsAffected > 0)
                    {
                        MessageBox.Show("Password successfully changed!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Hide();
                        txtUsername.Text        = "";
                        txtNewPassword.Text     = "";
                        txtConfirmPassword.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("Invalid Username or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtUsername.Text        = "";
                        txtNewPassword.Text     = "";
                        txtConfirmPassword.Text = "";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }