/// <summary> /// Clears all user input fields and sets the ErrorProvider errors to null. /// </summary> private void ClearAllFields() { TextBoxOldPassword.Clear(); TextBoxNewPassword.Clear(); TextBoxReTypePassword.Clear(); ErrorProvider.SetError(TextBoxOldPassword, null); ErrorProvider.SetError(TextBoxNewPassword, null); ErrorProvider.SetError(TextBoxReTypePassword, null); }
private void ButtonUpdatePassword_Click(object sender, EventArgs e) { if (SqlService.GetDataTable("select * from users where id ='" + MYAPPCS.Properties.Settings.Default.id_user + "' and password = '******'").Rows.Count == 0) { MessageBox.Show("Old Password Wrong"); } else { if (TextBoxNewPassword.Text != TextBoxConfirmPasssword.Text) { MessageBox.Show("New Password and Confirm Password Not Match"); } else { SqlService.ExecuteQuery("Update users set password_noencrypt='" + TextBoxNewPassword.Text + "', password='******' where id = '" + MYAPPCS.Properties.Settings.Default.id_user + "'"); MessageBox.Show("Change Password Success"); TextBoxConfirmPasssword.Clear(); TextBoxNewPassword.Clear(); TextBoxOldPassword.Clear(); } } }