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 GetListColumn(string nameTable)//получить список колонок (все длины) в таблице
 {
     using (БД_НарядEntities1 dc = new БД_НарядEntities1())
     {
         NormFromDB    normFromDB = new NormFromDB();
         List <string> listColumn = normFromDB.ColumnList(nameTable);
         listColumn.RemoveRange(0, 2);
         return(new JsonResult {
             Data = listColumn, 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
            });
        }