private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Length == 8) { if (abl.IsValidAdmin(textBox1.Text, textBox2.Text)) { loginUserName = textBox1.Text; this.Hide(); AdminPage obj = new AdminPage(loginUserName); obj.Show(); MessageBox.Show("LogIn Successful"); } else { MessageBox.Show("Please check your UserName and Password"); textBox1.Text = ""; textBox2.Text = ""; } } else if (textBox1.Text.Length == 7) { if (fbl.IsValidCSFaculty(textBox1.Text, textBox2.Text)) { loginUserName = textBox1.Text; department = "CS"; this.Hide(); FacultyPage fp = new FacultyPage(loginUserName, department); fp.Show(); MessageBox.Show("LogIn Successful"); } else if (fbl.IsValidEEEFaculty(textBox1.Text, textBox2.Text)) { loginUserName = textBox1.Text; department = "EEE"; this.Hide(); FacultyPage fp = new FacultyPage(loginUserName, department); fp.Show(); MessageBox.Show("LogIn Successful"); } else if (fbl.IsValidBBAFaculty(textBox1.Text, textBox2.Text)) { loginUserName = textBox1.Text; department = "BBA"; this.Hide(); FacultyPage fp = new FacultyPage(loginUserName, department); fp.Show(); MessageBox.Show("LogIn Successful"); } else { MessageBox.Show("Please check your UserName and Password"); textBox1.Text = ""; textBox2.Text = ""; } } else if (textBox1.Text.Length == 6) { if (sbl.IsValidCSStudent(textBox1.Text, textBox2.Text)) { loginUserName = textBox1.Text; department = "CS"; this.Hide(); StudentPage sp = new StudentPage(loginUserName, department); sp.Show(); MessageBox.Show("LogIn Successful"); } else if (sbl.IsValidEEEStudent(textBox1.Text, textBox2.Text)) { loginUserName = textBox1.Text; department = "EEE"; this.Hide(); StudentPage sp = new StudentPage(loginUserName, department); sp.Show(); MessageBox.Show("LogIn Successful"); } else if (sbl.IsValidBBAStudent(textBox1.Text, textBox2.Text)) { loginUserName = textBox1.Text; department = "BBA"; this.Hide(); StudentPage sp = new StudentPage(loginUserName, department); sp.Show(); MessageBox.Show("LogIn Successful"); } else { MessageBox.Show("Please check your UserName and Password"); textBox1.Text = ""; textBox2.Text = ""; } } else { MessageBox.Show("Please check your UserName and Password"); textBox1.Text = ""; textBox2.Text = ""; } }