Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            tbluseraccess employee = _userAccessService.GetAccess(Global.loggedUserId);

            //check if no blanks
            if (txtCurrentPassword.Text != string.Empty &&
                txtNewPassword.Text != string.Empty &&
                txtRepeatPassword.Text != string.Empty
                )
            {
                if (txtCurrentPassword.Text.Trim() != employee.Password)
                {
                    MessageBox.Show("Incorrect Password");
                }
                else
                {
                    if (txtNewPassword.Text.Trim() != txtRepeatPassword.Text.Trim())
                    {
                        MessageBox.Show("Passwords do not match");
                        txtNewPassword.Focus();
                    }
                    else
                    {
                        _userAccessService.UpdatePassword(Global.loggedUserId, txtNewPassword.Text.Trim());
                        MessageBox.Show("Password Updated");
                        this.Close();
                    }
                }
            } //else do not insert
            else
            {
            }
        }