Ejemplo n.º 1
0
        /// <summary>Группирование значений</summary>
        protected IEnumerable <clValue> Compl(IEnumerable <clValue> Values, data.EGettingValue GettingVal)
        {
            List <clValue> result = new List <clValue>();

            foreach (var one in Values.GroupBy(x => x.Pollution))
            {
                result.Add(new clValue(Math.Round(GettingValue(GettingVal, one.Select(x => x.Value).ToArray()), one.First().Pollution.Round, MidpointRounding.AwayFromZero), one.First().Well, one.Key,
                                       one.First().ValueNorm,
                                       one.First().CalculationFormula,
                                       one.First().CoefficientValue,
                                       one.First().PriceNorm));
            }
            return(result.ToArray());
        }
Ejemplo n.º 2
0
        /// <summary>Получить значение</summary>
        /// <param name="GettingValue">Получаемое значение</param>
        protected virtual decimal GettingValue(data.EGettingValue GettingValue, decimal[] Values)
        {
            switch (GettingValue)
            {
            case data.EGettingValue.Max:
            { return(Values.Max()); }

            case data.EGettingValue.Medium:
            { return(Values.Sum() / Values.Length); }

            case data.EGettingValue.Summ:
            { return(Values.Sum()); }
            }
            throw new Exception("Не выбран метод определения значения");
        }