Пример #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (loginUserName.Length == 6)
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
         {
             MessageBox.Show("Please fill all the information correctly");
         }
         else if (textBox2.Text != textBox3.Text)
         {
             MessageBox.Show("The new password and confirmation password do not match");
         }
         else if (department == "CS")
         {
             if (sbl.IsValidCSStudent(loginUserName, textBox1.Text))
             {
                 sbl.ChangePassword(loginUserName, textBox3.Text, department);
                 MessageBox.Show("Password Changed Successfully");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("Wrong Current Password");
             }
         }
         else if (department == "EEE")
         {
             if (sbl.IsValidEEEStudent(loginUserName, textBox1.Text))
             {
                 sbl.ChangePassword(loginUserName, textBox3.Text, department);
                 MessageBox.Show("Password Changed Successfully");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("Wrong Current Password");
             }
         }
         else if (department == "BBA")
         {
             if (sbl.IsValidBBAStudent(loginUserName, textBox1.Text))
             {
                 sbl.ChangePassword(loginUserName, textBox3.Text, department);
                 MessageBox.Show("Password Changed Successfully");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("Wrong Current Password");
             }
         }
     }
     else if (loginUserName.Length == 7)
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
         {
             MessageBox.Show("Please fill all the information correctly");
         }
         else if (textBox2.Text != textBox3.Text)
         {
             MessageBox.Show("The new password and confirmation password do not match");
         }
         else if (department == "CS")
         {
             if (fbl.IsValidCSFaculty(loginUserName, textBox1.Text))
             {
                 fbl.ChangePassword(loginUserName, textBox3.Text, department);
                 MessageBox.Show("Password Changed Successfully");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("Wrong Current Password");
             }
         }
         else if (department == "EEE")
         {
             if (fbl.IsValidEEEFaculty(loginUserName, textBox1.Text))
             {
                 fbl.ChangePassword(loginUserName, textBox3.Text, department);
                 MessageBox.Show("Password Changed Successfully");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("Wrong Current Password");
             }
         }
         else if (department == "BBA")
         {
             if (fbl.IsValidBBAFaculty(loginUserName, textBox1.Text))
             {
                 fbl.ChangePassword(loginUserName, textBox3.Text, department);
                 MessageBox.Show("Password Changed Successfully");
                 textBox1.Text = "";
                 textBox2.Text = "";
                 textBox3.Text = "";
             }
             else
             {
                 MessageBox.Show("Wrong Current Password");
             }
         }
     }
 }