private void loginBtn_Click(object sender, EventArgs e) { if (usernameTxt.Text == "") { usernameErrorLabel.Visible = true; } else { usernameErrorLabel.Visible = false; } if (passwordtxt.Text == "") { passwordErrorLabel.Visible = true; } else { passwordErrorLabel.Visible = false; } if (usernameErrorLabel.Visible || passwordErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error", "Error"); } else { if (mai.getStaffLogin(usernameTxt.Text, passwordtxt.Text)) { if (MainClass.STAFFROLE == "Faculty") { FacultyDB hs = new FacultyDB(); MainClass.showWindow(hs, this, MDI.ActiveForm); MDI.mdiobj.logoutToolStripMenuItem.Enabled = true; this.Close(); } else if (MainClass.STAFFROLE == "Admin") { HomeScreen hs = new HomeScreen(); MainClass.showWindow(hs, this, MDI.ActiveForm); MDI.mdiobj.logoutToolStripMenuItem.Enabled = true; this.Close(); } } else { MainClass.ShowMSG("Invalid login details.", "Error", "Error"); } } }