private void Addbtn_Click(object sender, RoutedEventArgs e) { if (DepartmentBox.SelectedIndex != 0) { Department deps = FileControls.getDepartment(DepartmentBox.Text); string id = IdBox.Text; string name = nameBox.Text; name = name.ToLower(); string date = DateBox.Text; string dep = deps.departmentId; bool done = FileControls.addEmployee(id, name, date, dep); if (!done) { System.Windows.MessageBox.Show("ID already used"); } else { HomeWindow.reload(FileControls.getArrayEmp()); this.Close(); } } else { System.Windows.MessageBox.Show("You should choose a department"); } }
private void AddDepBtn_Click(object sender, RoutedEventArgs e) { bool done; string depid = DepNoBox.Text; string depName = DepNameBox.Text; if (depid == "") { System.Windows.MessageBox.Show("you must enter ID"); } else if (depName == "") { System.Windows.MessageBox.Show("you must enter a name"); } if (depName != "" && depid != "") { done = FileControls.addDepartment(depid, depName); if (!done) { System.Windows.MessageBox.Show("Id already used"); } else { HomeWindow.reload(FileControls.getArrayEmp()); this.Close(); } } }
private void SubmitEdit_Click(object sender, RoutedEventArgs e) { string editId = EditIdBox.Text; string editName = EditNameBox.Text; string editDate = EditDateBox.Text; Department dep = FileControls.getDepartment(EditDepartmentBox.Text); string editDep = dep.departmentId; bool done = FileControls.editEmployee(editId, BeforeEditId, editName, editDate, editDep); if (!done) { System.Windows.MessageBox.Show("Id already used"); } else { HomeWindow.reload(FileControls.getArrayEmp()); this.Close(); } }