private void AddDepartment_Click(object sender, RoutedEventArgs e) { Department newDepartment = bridge.Factory.CreateNewDepartment(DepartmentName.Text.Trim(), TotalPersonnelRequired.Text.Trim()); if (newDepartment.DepartmentName != "invalid") { List <string> empInfo = bridge.GetObjectInfo(newDepartment); string message = "Employee Creation Success:\n" + string.Join(Environment.NewLine, empInfo); MessageBox.Show(message); RefreshDepartmentComboBox(); RefreshThisForm(); } else { MessageBox.Show("This department name is already taken, please enter another."); } }
//private void Password_TextChanged(object sender, TextChangedEventArgs e) //{ //} private void Save_Click(object sender, RoutedEventArgs e) { Personnel admin = bridge.Factory.CreateNewAdmin(UserName.Text.Trim(), passwordBox.Password.Trim()); if (admin.Email != "invalid") { List <string> empInfo = bridge.GetObjectInfo(admin); empInfo.RemoveAt(empInfo.Count - 1); string message = "You have created the master admin account:\n" + string.Join(Environment.NewLine, empInfo); MessageBox.Show(message); bridge.Login(admin.Email, passwordBox.Password); AdminMenu adminMenu = new AdminMenu(); Close(); } else { MessageBox.Show("Email is invalid format, please enter a new email."); } }
private void AddEmployee_Click(object sender, RoutedEventArgs e) { int vacationDays = -1; try { vacationDays = int.Parse(VacationDaysBox.Text.Trim()); } catch { MessageBox.Show("Please enter a number for vacation days."); } if (vacationDays > -1) { Personnel newEmployee = bridge.Factory.CreateNewEmployee(UserName.Text.Trim(), Password.Text.Trim(), Email.Text.Trim(), DepartmentBox.Text.Trim(), vacationDays, (bool)Manager.IsChecked); if (newEmployee.Email != "invalid") { List <string> empInfo = bridge.GetObjectInfo(newEmployee); string message = "Employee Creation Success:\n" + string.Join(Environment.NewLine, empInfo); MessageBox.Show(message); RefreshThisForm(); RefreshAllPersonnelComboBox(); } else { MessageBox.Show("Email is invalid format or taken, please enter a new email."); } } }