private void button3_Click(object sender, EventArgs e) { if (OldPassTB.Text == "") { OldPassTB.BackColor = Color.DodgerBlue; MessageBox.Show("Old Password Is Required", "Empty", MessageBoxButtons.OK, MessageBoxIcon.Warning); OldPassTB.Focus(); return; } if (OldPassTB.Text != Pass) { MessageBox.Show("Please Enter Your Valid Password", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Error); OldPassTB.BackColor = Color.DodgerBlue; OldPassTB.Focus(); return; } if (NewPassTB.Text == "") { NewPassTB.BackColor = Color.DodgerBlue; MessageBox.Show("New Password Is Required", "Empty", MessageBoxButtons.OK, MessageBoxIcon.Warning); NewPassTB.Focus(); return; } if (ConPassTB.Text == "") { ConPassTB.BackColor = Color.DodgerBlue; MessageBox.Show("Please Confirm Your Password", "Empty", MessageBoxButtons.OK, MessageBoxIcon.Warning); ConPassTB.Focus(); return; } if (NewPassTB.Text != ConPassTB.Text) { MessageBox.Show("You Must Enter The Same Password Twince in Order to Confirm it", "Entre Same Password", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString; SqlConnection conn = new SqlConnection(ConnString); try { if (fn == 1) { UpdateEmpPassword(conn); } else { UpdateCompanyPass(conn); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void ClearMethod() { OldPassTB.Clear(); NewPassTB.Clear(); ConPassTB.Clear(); }