private void calculate()
        {
            WorkplacesTimesNew.ToList().ForEach(i =>
            {
                i.Total = i.KapaNew + i.KapaOld + i.SetUpNew + i.SetUpOld;

                //schichten eintragen
                if (i.Total > 5900)
                {          //-100 wegen Puffer
                    i.Shifts = 3;
                }
                else if (i.Total > 3500)
                {   //-100 wegen Puffer
                    i.Shifts = 2;
                }
                else
                {
                    i.Shifts = 1;
                }

                // Überstunden eintragen
                if ((i.Total - (i.Shifts - 1) * 2400) > 2400)
                {
                    i.Overtime = (i.Total + 100 - (i.Shifts * 2400)) / 5;
                }
                if (i.Shifts == 3)
                {
                    i.Overtime = 0;
                }
            });
        }
 private void calcSetUpNew()
 {
     productionList.ForEach(list =>
     {
         produceItems.ForEach(item =>
         {
             if (item.id == list.article)
             {
                 item.timePerWorkplace.ToList().ForEach(work =>
                 {
                     WorkplacesTimesNew.ToList().ForEach(workNew =>
                     {
                         if (workNew.Id != work.id)
                         {
                             return;
                         }
                         if (list.quantity > 0)
                         {
                             workNew.SetUpNew += work.setUpTime;
                         }
                     });
                 });
             }
         });
     });
 }
        private void oldSetUpTime(results rLastPeriod, List <produceItemsItem> produceItems)
        {
            var itemsList = new List <int>();

            rLastPeriod.waitinglistworkstations?.ToList().ForEach(wait =>
            {
                wait.waitinglist?.ToList().ForEach(waitList =>
                {
                    itemsList.Add(waitList.item);
                });
            });

            itemsList.ForEach(item =>
            {
                produceItems.ForEach(produce =>
                {
                    if (item == produce.id)
                    {
                        produce.timePerWorkplace.ToList().ForEach(work =>
                        {
                            WorkplacesTimesNew.ToList().ForEach(workNew =>
                            {
                                if (workNew.Id == work.id)
                                {
                                    workNew.SetUpOld += work.setUpTime;
                                }
                            });
                        });
                    }
                });
            });
        }
        private void AddEverythingToExportModel()
        {
            var         workingtimeList = new List <Workingtime>();
            Workingtime newWorkingtime;

            WorkplacesTimesNew.ToList().ForEach(w =>
            {
                newWorkingtime = new Workingtime(w.Id, w.Shifts > 3 ? 3 : w.Shifts, w.Overtime);
                workingtimeList.Add(newWorkingtime);
            });

            exportModel.workingtimeList = workingtimeList;
        }
 private void createMapOldWaitinglistWorkstations(results rLastPeriod)
 {
     rLastPeriod.waitinglistworkstations?.ToList().ForEach(wait =>
     {
         WorkplacesTimesNew.ToList().ForEach(workNew =>
         {
             if (workNew.Id == wait.id)
             {
                 workNew.KapaOld += wait.timeneed;
             }
         });
     });
 }
 private void createMapOldTimeOrdersInWork(results rLastPeriod)
 {
     rLastPeriod.ordersinwork.ToList().ForEach(work =>
     {
         WorkplacesTimesNew.ToList().ForEach(workNew =>
         {
             if (workNew.Id == work.id)
             {
                 workNew.KapaOld += work.timeneed;
             }
         });
     });
 }
 private void calculateProductionTimeNew(int item, int quantity)
 {
     produceItemProductionList.ForEach(k =>
     {
         if (k.id == item)
         {
             k.timePerWorkplace.ToList().ForEach((j =>
             {
                 WorkplacesTimesNew.ToList().ForEach(x =>
                 {
                     if (x.Id == j.id)
                     {
                         x.KapaNew += j.time * quantity;
                     }
                 });
             }));
         }
     });
 }