void Submit(object obj) { string password = (obj as PasswordBox).Password; if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password)) { MessageBox.Show("Wrong user name or password"); return; } if (UserName.Equals(UserConstants.MANAGER_USER_NAME) && password.Equals(UserConstants.MANAGER_PASSWORD)) { ManagerMainView managerView = new ManagerMainView(); view.Close(); managerView.Show(); } else if (UserName.Equals(UserConstants.STOREKEEPER_USER_NAME) && password.Equals(UserConstants.STOREKEEPER_PASSWORD)) { StorekeeperMainView storekeeperView = new StorekeeperMainView(); view.Close(); storekeeperView.Show(); } else { MessageBox.Show("Wrong username or password"); } }
private void BackExecute() { try { ManagerMainView managerMainView = new ManagerMainView(Manager); managerMainView.Show(); view.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void Submit(object obj) { string password = (obj as PasswordBox).Password; if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password)) { MessageBox.Show("Wrong user name or password"); return; } if (UserName.Equals("WPFMaster") && password.Equals("WPFAccess")) { PredifinedAccount predifinedAccount = new PredifinedAccount(); view.Close(); predifinedAccount.Show(); return; } string encryptedString = EncryptionHelper.Encrypt(password); tblUser user = userService.GetUserByUserNameAndPassword(UserName, encryptedString); if (user != null) { tblAdmin admin = adminService.GetAdminByUserId(user.UserID); if (admin != null) { if (admin.AdministratorType.Equals("System")) { AdminMainView adminMainView = new AdminMainView(admin); adminMainView.Show(); view.Close(); return; } else if (admin.AdministratorType.Equals("Local")) { LocaldAminMainView localAdminView = new LocaldAminMainView(); localAdminView.Show(); view.Close(); return; } else if (admin.AdministratorType.Equals("Team")) { TeamAdminView teamAdminView = new TeamAdminView(); teamAdminView.Show(); view.Close(); return; } } tblManager manager = managerService.GetManagerByUserId(user.UserID); if (manager != null) { if (string.IsNullOrEmpty(manager.ResponsibilityLevel)) { string str1 = string.Format("You can not login\nLocal Admin has not gave you" + " responsibility level yet"); MessageBox.Show(str1); return; } ManagerMainView managerMainView = new ManagerMainView(manager); managerMainView.Show(); view.Close(); return; } tblEmployee employee = employeeService.GetEmployeeByUserId(user.UserID); if (employee != null) { EmployeeMainView employeeMainView = new EmployeeMainView(employee); employeeMainView.Show(); view.Close(); return; } MessageBox.Show("Wrong username or password"); } //else if (UserName.Equals(UserConstants.STOREKEEPER_USER_NAME) && // password.Equals(UserConstants.STOREKEEPER_PASSWORD)) //{ // StorekeeperMainView storekeeperView = new StorekeeperMainView(); // view.Close(); // storekeeperView.Show(); //} else { MessageBox.Show("Wrong username or password"); } }