private void CheckProjectsByEmployee(string employeeOib) { foreach (var project in RelationProjectEmployeeRepo.GetProjectsByEmployee(employeeOib)) { for (var i = 0; i < ProjectListBox.Items.Count; i++) { if (ProjectListBox.Items[i].ToString().GetProjectName() != project.ToString().GetProjectName()) { continue; } ProjectListBox.SetItemChecked(i, true); break; } } }
private void EditEmployeeForm_Load() { FirstNametextbox.Text = ToViewEmployee.FirstName; LastNametextbox.Text = ToViewEmployee.LastName; OibTextbox.Text = ToViewEmployee.Oib; birthTimePicker.Text = ToViewEmployee.DateOfBirth.ToString(); JobComboBox.Text = ToViewEmployee.Position.ToString(); HoursTextbox.Text = DataBaseRelations.GetHours(ToViewEmployee.Oib).ToString(); var index = 0; foreach (var project in DataBaseProjects.ListProjects) { ProjectListBox.Items.Add(project.Name); if (DataBaseRelations.GetRelation(project.Name, ToViewEmployee.Oib) != null) { ProjectListBox.SetItemChecked(index, true); } index++; } }