private void SaveExecute(object obj) { try { bool existsFloor = false; string password = (obj as PasswordBox).Password; Employee.Password = password; for (int i = 0; i < floorManager.Count; i++) { if (Employee.Floor == floorManager[i]) { existsFloor = true; } } if (existsFloor) { LoginScreen login = new LoginScreen(); serviceEmployee.AddEmployee(Employee); addEmployee.Close(); MessageBox.Show("Account created!"); login.ShowDialog(); } else { MessageBox.Show("There is no Manager for that floor. Can not hire an employee!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void SaveExecute() { try { if (serviceSector.IsSectorExists(Sector) == false) { serviceSector.AddSector(sector); } Employee.Sector = serviceSector.FindSector(sector); Employee.LocationID = Convert.ToInt32(Location.LocationID); Employee.Gender = Convert.ToInt32(Gender.GenderID); if (Manager != null) { Employee.Manager = Convert.ToInt32(Manager.EmployeeID); } serviceEmployee.AddEmployee(employee); addEmployeeView.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }