private void EditLoad(object sender, RoutedEventArgs e) { BeforeEditId = EditIdBox.Text; Department[] deps = FileControls.getArrayDep(); if (deps != null) { for (int i = 0; i < deps.Length; i++) { EditDepartmentBox.Items.Add(deps[i].departmentName.Trim('\0')); } } }
private void addEmpLoad(object sender, RoutedEventArgs e) { ComboBoxItem defaultChoice = new ComboBoxItem(); defaultChoice.IsSelected = true; defaultChoice.IsEnabled = false; defaultChoice.Content = "Departments"; DepartmentBox.Items.Add(defaultChoice); Department[] deps = FileControls.getArrayDep(); if (deps != null) { for (int i = 0; i < deps.Length; i++) { DepartmentBox.Items.Add(deps[i].departmentName.Trim('\0')); } } }
public static void reload(Employee[] employees) { mainPanel.Children.Clear(); Department tmpDep = new Department(); if (employees != null) { for (int i = 0; i < employees.Length; i++) { tmpDep = FileControls.getDepartmentName(employees[i].departmentNumber); CreatePanel(employees[i].employeeName.Trim('\0'), employees[i].id.Trim('\0'), employees[i].hireDate.Trim('\0'), tmpDep.departmentName.Trim('\0')); } } int currentChoice = departmentFilter.SelectedIndex; departmentFilter.Items.Clear(); ComboBoxItem defaultChoice = new ComboBoxItem(); defaultChoice.IsSelected = true; defaultChoice.IsEnabled = false; defaultChoice.Content = "Department Filter"; departmentFilter.Items.Add(defaultChoice); Department[] deps = FileControls.getArrayDep(); if (deps != null) { for (int i = 0; i < deps.Length; i++) { departmentFilter.Items.Add(deps[i].departmentName.Trim('\0')); } } if (currentChoice == -1) { currentChoice = 0; } departmentFilter.SelectedIndex = currentChoice; }
// Implementation Needs to be changed for a better looking code private void DepcomboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Search.Clear(); Department[] deps = FileControls.getArrayDep(); if (deps != null) { if (DepcomboBox.SelectedItem != null) { for (int i = 0; i < deps.Length; i++) { if (DepcomboBox.SelectedItem.ToString() == deps[i].departmentName.Trim('\0')) { Department tmpDep = new Department(); List <Employee> tmpEmployeesList = FileControls.getEmpInDep(deps[i].departmentName); int j = tmpEmployeesList.Count() - 1; Console.WriteLine(tmpEmployeesList.Count()); if (j >= 0) { mainPanel.Children.Clear(); while (j != -1) { tmpDep = FileControls.getDepartmentName(tmpEmployeesList[j].departmentNumber); string srchEmpName = tmpEmployeesList[j].employeeName.Trim('\0'); string srchDepName = tmpDep.departmentName.Trim('\0'); string srchEmpid = tmpEmployeesList[j].id.Trim('\0'); string srchHireDate = tmpEmployeesList[j].hireDate.Trim('\0'); CreatePanel(srchEmpName, srchEmpid, srchHireDate, srchDepName); j--; } } else { mainPanel.Children.Clear(); } } } } } }