private void buttonLogin_Click(object sender, EventArgs e) { login.username = textBoxUserName.Text.Trim(); login.password = textBoxPassword.Text.Trim(); login.user_type = comboBoxUserType.Text.Trim(); //Checking the login credentials bool success = loginDAL.LoginCheck(login); if (success == true) { //Login successful MessageBox.Show("Login Successful"); //Open respective forms based on user type switch (login.user_type) { case "Admin": { //Display admin dashboard MainAdminDashboard admin = new MainAdminDashboard(); admin.Show(); this.Hide(); } break; case "User": { //Display user dashboard UserDashboard user = new UserDashboard(); user.Show(); this.Hide(); } break; default: { //Display error message MessageBox.Show("Invalid user type"); } break; } } else { //Login failed MessageBox.Show("Login failed. Try again"); } }
private void btnLogin_Click(object sender, EventArgs e) { l.username = txtUsername.Text.Trim(); l.password = txtPassword.Text.Trim(); l.user_type = cmbUserType.Text.Trim(); //Checking the login credentials bool success = dal.loginCheck(l); if (success == true) { MessageBox.Show("Login Successfull"); loggedIn = l.username; //Need to open forms based on usertype switch (l.user_type) { case "Admin": { AdminDashboard admin = new AdminDashboard(); admin.Show(); this.Hide(); } break; case "User": { UserDashboard user = new UserDashboard(); user.Show(); this.Hide(); } break; default: { MessageBox.Show("Invalid User Type"); } break; } } else { MessageBox.Show("Login Failed.Try again"); } }
private void btnLogin_Click(object sender, EventArgs e) { l.username = txtUsername.Text.Trim(); l.password = txtPassword.Text.Trim(); l.user_type = cmbUserType.Text.Trim(); bool success = dal.loginCheck(l); if (success == true) { MessageBox.Show("Login Successfull."); loggedIn = l.username; switch (l.user_type) { case "Admin": { AdminDashboard admin = new AdminDashboard(); admin.Show(); this.Hide(); } break; case "User": { UserDashboard user = new UserDashboard(); user.Show(); this.Hide(); } break; default: { MessageBox.Show("Invalid user type!"); } break; } } else { MessageBox.Show("Login failed. Try again!!"); } }
private void btnLogin_Click(object sender, EventArgs e) { #region Throw Error Message if (txtUsername.Text == "" && txtPassword.Text == "" && cmbUserType.Text == "") { MessageBox.Show(" Please Fill All The Details..... !! "); } else if (txtPassword.Text == "" && cmbUserType.Text == "") { MessageBox.Show(" Please Enter Passsword & Select UserType ... !! "); } else if (txtUsername.Text == "") { MessageBox.Show(" Please Enter Username.... !! "); } else if (txtPassword.Text == "") { MessageBox.Show(" Please Enter Password ... !! "); } else if (cmbUserType.Text == "") { MessageBox.Show(" Please Select Usertype ... !! "); } #endregion else { l.username = txtUsername.Text.Trim(); l.password = txtPassword.Text.Trim(); l.user_type = cmbUserType.Text.Trim(); //Checking the login credentials bool success = dal.loginCheck(l); if (success == true) { MessageBox.Show("Login Successfull"); loggedIn = l.username; //Need to open forms based on usertype switch (l.user_type) { case "Admin": { AdminDashboard admin = new AdminDashboard(); admin.Show(); this.Hide(); } break; case "User": { UserDashboard user = new UserDashboard(); user.Show(); this.Hide(); } break; default: { MessageBox.Show("Invalid User Type"); } break; } } else { MessageBox.Show("Login Failed.Try again"); } } }