private void btnLogin_Click(object sender, EventArgs e) { try { string[] loginDetails = LoginRepo.VerifyLogin(this.txtUserName.Text, this.txtPassword.Text); if (loginDetails.Length > 0) { if (loginDetails[1] == "Active") { this.Hide(); if (loginDetails[0] == "Admin") { new frmAdminDashboard(this).Show(); } else if (loginDetails[0] == "Cashier") { MainControl.cashierId = this.txtUserName.Text; new frmCashierDashboard(this).Show(); } else if (loginDetails[0] == "Accountant") { new frmAccountDashboard(this).Show(); } this.txtUserName.Text = ""; this.txtPassword.Text = ""; btnViewPassword.BackgroundImage = Properties.Resources.s1; txtPassword.UseSystemPasswordChar = true; } else { MessageBox.Show("Your account is not activated \nPlease contact to Admin", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Invalid Username or Password!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { MessageBox.Show("Invalid Username or Password!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }