public static void RefactorListWorkers(RefactorStringParameters parameteres, int hours, string date)
 {
     if (parameteres._isNewDate == true)
     {
         WorkerRepository.ListWorkers.Add($"{date},{Worker.WorkerName},{hours},{Worker.NewTask ?? " "}");
     }
     else
     {
         WorkerRepository.ListWorkers[parameteres._numberOfNote] = parameteres._refactorString;
     }
 }
        public override void SetWorkingHours(int hours, string date)
        {
            if (DateTime.Parse(date) > DateTime.Today)
            {
                throw new ArgumentException("Дата не может быть позже сегодняшнего дня!");
            }
            WorkerRepository.SetFileName(this);
            WorkerRepository.LoadWorkersToString();
            RefactorStringParameters.Worker = this;
            var parameters = RefactorStringParameters.FindOrCreateNewNote(date, hours);

            RefactorStringParameters.RefactorListWorkers(parameters, hours, date);
            WorkerRepository.ListWorkers.Sort();
            WorkerRepository.WriteWorkersToString();
        }
        public static RefactorStringParameters FindOrCreateNewNote(string date, int hours)
        {
            var parameteres = new RefactorStringParameters(false, "", 0);

            for (int i = 0; i < WorkerRepository.ListWorkers.Count; i++)
            {
                string[] employeeInfo = WorkerRepository.ListWorkers[i].Split(new char[] { ',' });
                if (employeeInfo[1] == Worker.WorkerName && date == employeeInfo[0])
                {
                    SetNewHoursInString(ref employeeInfo, hours);
                    parameteres = GetNewParametres(employeeInfo, i);
                    break;
                }
                else
                {
                    parameteres._isNewDate = true;
                }
            }
            return(parameteres);
        }