Esempio n. 1
0
 /// <summary>
 /// Функция проверяет, что текущая квартира совпадает по параметрам (этаж, блок, подзона), с предыдущей.
 /// Это позволит избежать совпадений квартир из разных этажей, блоков и подзон.
 /// </summary>
 private bool CheckTwoApartments(IGrouping <object, Element> currApartment, Element pervApartment)
 {
     if (currApartment.Cast <Element>().FirstOrDefault().LevelId == pervApartment.LevelId &&
         currApartment.Cast <Element>().FirstOrDefault().GetParameters("BS_Блок").FirstOrDefault().AsString() == pervApartment.GetParameters("BS_Блок").FirstOrDefault().AsString() &&
         currApartment.Cast <Element>().FirstOrDefault().GetParameters("ROM_Подзона").FirstOrDefault().AsString() == pervApartment.GetParameters("ROM_Подзона").FirstOrDefault().AsString())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 2
0
        internal static Device CreateMultiDevice(IGrouping <string, Device> group)
        {
            var newDevice = new MultiSwitchDevice();

            newDevice.id       = group.Key;
            newDevice.Channels = group.Cast <SwitchDevice>().ToArray();

            return(newDevice);
        }
Esempio n. 3
0
        private ApplicationGroup GetApplicationGroup <T>(
            IGrouping <T, ApplicationListItem> grouping,
            IReadOnlyCollection <OrderType> orders,
            string field,
            Func <IGrouping <T, ApplicationListItem>, string> getValue)
        {
            int     count;
            float   weight;
            float   docWeight;
            decimal value;
            float   volume;

            if (field == OrderHelper.AwbFieldName)
            {
                var id = (long)(object)grouping.Key;
                if (_awbAggregates.ContainsKey(id))
                {
                    count     = _awbAggregates[id].TotalCount;
                    weight    = _awbAggregates[id].TotalWeight;
                    value     = _awbAggregates[id].TotalValue;
                    volume    = _awbAggregates[id].TotalVolume;
                    docWeight = _awbAggregates[id].TotalDocumentWeight;
                }
                else
                {
                    count     = _countWithouAwb;
                    weight    = _weightWithouAwb;
                    value     = _valueWithouAwb;
                    volume    = _volumeWithouAwb;
                    docWeight = _docWeightWithouAwb;
                }
            }
            else
            {
                count     = grouping.Sum(y => y.Count ?? 0);
                weight    = grouping.Sum(y => y.Weight ?? 0);
                value     = grouping.Sum(y => y.Value);
                volume    = grouping.Sum(y => y.Volume);
                docWeight = grouping.Sum(y => y.DocumentWeight ?? 0);
            }

            return(new ApplicationGroup
            {
                aggregates = new ApplicationGroup.Aggregates(count, weight, value, volume, docWeight),
                field = field,
                value = getValue(grouping),
                hasSubgroups = orders.Count > 0,
                items = orders.Count > 0
                                        ? GroupImpl(grouping.ToArray(), orders).Cast <object>().ToArray()
                                        : grouping.Cast <object>().ToArray()
            });
        }
Esempio n. 4
0
        public override Dictionary <string, List <ISpecElement> > GroupsFirst(IGrouping <GroupType, ISpecElement> indexTypeGroup)
        {
            var bars = indexTypeGroup.Cast <BarDetail>().GroupBy(g => g.prefix).OrderBy(o => o.Key, AcadLib.Comparers.AlphanumComparator.New);

            return(bars.ToDictionary(k => k.Key, i => i.Cast <ISpecElement>().ToList()));
        }