private void RemoveUncheckedEmployees() { foreach (var EmployeeProperty in ProjectAddcheckedListBox.Items) { if (ProjectAddcheckedListBox.CheckedItems.Contains(EmployeeProperty)) { continue; } if (EmployeesOnProject.IsEmployeeOnProject(EmployeeProperty.ToString().GetOIBInCheck(), OldName)) { EmployeesOnProject.Remove(EmployeesOnProject.GetRelation(EmployeeProperty.ToString().GetOIBInCheck(), OldName)); } } }
private void EmployeeDeleteButton_Click(object sender, EventArgs e) { var Employee = new List <Employees>(); foreach (var EmployeeProperty in EmployeeMenucheckedListBox.CheckedItems) { Employee.Add(EmployeesList.FindEmployeeByOIB(EmployeeProperty.ToString().GetOIBInCheck())); } if (Employee.Count == 0) { return; } if (DialogResult.Yes == MessageBox.Show("Jeste li sigurni da zelite izbrisati odabrane stavke?", "Oprez!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)) { foreach (var employees in Employee) { DeleteEmployee(employees); /*var ErrorCounter = 0; * foreach (var Project in EmployeesOnProject.GetProjectsByEmployee(employee.OIB)) * { * if (EmployeesOnProject.TryRemove( * EmployeesOnProject.GetRelation(employee.OIB, Project.Name))) continue; * ErrorCounter++; * EmployeeDeleteError LastEmployeeError = new EmployeeDeleteError(); * LastEmployeeError.ShowDialog(); * * break; * } * if (ErrorCounter == 0) * EmployeesList.EmployeeDelete(employee);*/ } } RefreshEmployeesListBox(); }