/// <summary> /// Method for deciding which View will open according to logged in Employee credentials /// </summary> private void LoginExecute(object o) { try { string password = (o as PasswordBox).Password; if (Username == "Mag2019" && password == "Mag2019") { EmployeeView employee = new EmployeeView(); logInView.Close(); employee.ShowDialog(); } else if (Username == "Man2019" && password == "Man2019") { ManagerView manager = new ManagerView(); logInView.Close(); manager.ShowDialog(); return; } else { MessageBox.Show("Username or password not correct."); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Method for deciding which View will open according to logged in Employee credentials /// </summary> private void LoginExecute() { try { switch (loggedEmployee.Role) { case "Admin": AdminView adminMenu = new AdminView(); adminMenu.ShowDialog(); loginView.Close(); break; case "Employee": EmployeeView employeeView = new EmployeeView(loggedEmployee.ID); employeeView.ShowDialog(); loginView.Close(); break; case "Manager": tblManager manager = Services.LogInService.GetManagerById(loggedEmployee.ID); if (manager.AccessLevel == "Modify") { ModifyView modify = new ModifyView(); modify.ShowDialog(); loginView.Close(); } else { ReadOnlyView readOnly = new ReadOnlyView(); readOnly.ShowDialog(); loginView.Close(); } break; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }