Exemple #1
0
        private void AddEmployeesToProject()
        {
            var employeesToUncheck = new List <string>();

            foreach (var employeeOib in _checkedEmployeesOibList)
            {
                if (RelationProjectEmployeeRepo.IsEmployeeOnProject(employeeOib, OldName))
                {
                    continue;
                }
                var addHours = new AddHoursForm(NameTextBox.Text, EmployeeRepo.GetEmployeeByOib(employeeOib).Name, false);
                addHours.ShowDialog();
                if (addHours.HoursToAdd == 0)
                {
                    var hoursError =
                        new ErrorForm(
                            $"Employee {EmployeeRepo.GetEmployeeByOib(employeeOib).Name} could not be added!\nAn employee cannot work 0 hours on a project!");
                    hoursError.ShowDialog();
                    employeesToUncheck.Add(employeeOib);
                    continue;
                }
                RelationProjectEmployeeRepo.TryAdd(OldName, employeeOib, addHours.HoursToAdd);
            }
            UncheckEmployees(employeesToUncheck);
        }
Exemple #2
0
 private void AddProjectsToEmployee(IEnumerable <string> projectNameListSource)
 {
     foreach (var projectName in projectNameListSource)
     {
         if (RelationProjectEmployeeRepo.IsEmployeeOnProject(OldOib, projectName))
         {
             continue;
         }
         var addHours = new AddHoursForm(projectName, NameTextBox.Text, true);
         addHours.ShowDialog();
         if (addHours.HoursToAdd == 0)
         {
             var hoursError =
                 new ErrorForm(
                     $"Project {projectName} could not be added!\nAn employee cannot work 0 hours on a project!");
             hoursError.ShowDialog();
             continue;
         }
         RelationProjectEmployeeRepo.TryAdd(projectName, OldOib, addHours.HoursToAdd);
     }
 }