/// <summary> /// Change password /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChange_Click(object sender, EventArgs e) { //Get ID by username that user has been inputted id = am.getIDByUsername(username); //check old Password of account //If true, continue processing. If not, send error message if (am.isOldPassword(id, txtOldPassword.Text)) { //new password and re-new password if (isSamePassword()) { //Change pasword am.ChangePassword(username, txtNewPassword.Text); //send notify the user MessageBox.Show("Change password successfully!!!", "Pet Shop", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else //send error message for user { MessageBox.Show("The Old Password is not correct!!!\n" + "Please enter again!!!", "Pet Shop", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }