public JsonResult NormWork(string table, string typeOfWork, string volumeWood, string checkedConditionsWinter, string checkedConditionsHard,
                                   string tractorMoving, string block, string reduceDeforestationCoefficient, string forestPlantingConditions)//норма выполнения робот
        {
            NormFromDB      normFromDB      = new NormFromDB();
            CoefficientNorm coefficientNorm = new CoefficientNorm();
            ArrayList       normArray       = new ArrayList();

            bool winterConditions = coefficientNorm.WinterConditions(table); //приминение зимних условий ДА/НЕТ

            Task <double> coefficientWinter = Task.Run(() => 1.0);           //по умолчанию 1

            if (winterConditions)
            {
                coefficientWinter = coefficientNorm.CoefficientNorm_Winter_Hard(checkedConditionsWinter);                                                            //поправочный коефиц. Зима
            }
            Task <double> coefficientHard     = coefficientNorm.CoefficientNorm_Winter_Hard(checkedConditionsHard);                                                  //поправочный коефиц. Тяжелые условия
            Task <double> coefficientDistance = coefficientNorm.CoefficientTractorMoving(Replace(tractorMoving));                                                    //поправочный коефиц. переезд
            Task <double> coefficientBlock    = coefficientNorm.CoefficientBlock(Replace(block));                                                                    //поправочный коефиц. помехи

            double deforestationCoefficient = !string.IsNullOrEmpty(reduceDeforestationCoefficient) ? Convert.ToDouble(Replace(reduceDeforestationCoefficient)) : 1; //поправочный коефиц. заготовка (по приказу)
            string tableNormOfWork          = normFromDB.TableNorm(table);
            double norm = normFromDB.NormFromTable(table, tableNormOfWork, typeOfWork, Replace(volumeWood), forestPlantingConditions);                               //норма выроботка

            Task.WaitAll(coefficientWinter, coefficientHard, coefficientDistance, coefficientBlock);                                                                 //ожидаем завершение асинхронных методов

            norm = Math.Round(norm * (coefficientWinter.Result * coefficientHard.Result * coefficientDistance.Result * coefficientBlock.Result * deforestationCoefficient), 3);
            normArray.Add(norm);
            return(new JsonResult {
                Data = normArray, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public JsonResult CollectionOilCosts(string table, string typeOfWork, string volumeWood, string executed, string checkedConditionsWinter, string checkedConditionsHard, string hoursUsed)//нормарасхода ГСМ
        {
            NormOil         oilCalculation  = new NormOil();
            NormFromDB      normFromDB      = new NormFromDB();
            CoefficientNorm coefficientNorm = new CoefficientNorm();

            Task <double> coefficientWinter = coefficientNorm.CoefficientOil_Winter_Hard(checkedConditionsWinter); //поправочный коефиц. Зима
            Task <double> coefficientHard   = coefficientNorm.CoefficientOil_Winter_Hard(checkedConditionsHard);   //поправочный коефиц. Тяжелые условия

            double normOilHoursUsed = coefficientNorm.NormHoursUsed();                                             //норма расход топлива на переезд

            hoursUsed = !string.IsNullOrEmpty(hoursUsed) ? hoursUsed : "0";
            string tableNormOil = oilCalculation.TableNormOfOil(table);
            double normOil      = normFromDB.NormFromTable(table, tableNormOil, typeOfWork, Replace(volumeWood), "");                                                                               //норма расхода ГСМ

            Task.WaitAll(coefficientWinter, coefficientHard);                                                                                                                                       //ожидаем завершение асинхронных методов

            double     fuelCosts          = Convert.ToDouble(Replace(executed)) * normOil * (coefficientWinter.Result * coefficientHard.Result) + (normOilHoursUsed * Convert.ToDouble(hoursUsed)); //расход топлива
            List <Oil> collectionOilCosts = oilCalculation.CollectionOilCosts(table, fuelCosts);

            return(new JsonResult {
                Data = collectionOilCosts, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }