Пример #1
0
        public static GroupBy Combine(GroupBy firstGroupBy, GroupBy secondGroupBy)
        {
            GroupBy groupBy = null;
            bool collaps = false;

            var fieldRefs = new List<FieldRef>();

            if (firstGroupBy != null && firstGroupBy.FieldRefs != null)
            {
                collaps = firstGroupBy.Collapse;
                fieldRefs.AddRange(firstGroupBy.FieldRefs);
            }

            if (secondGroupBy != null && secondGroupBy.FieldRefs != null)
            {
                collaps = collaps | secondGroupBy.Collapse;
                fieldRefs.AddRange(secondGroupBy.FieldRefs);
            }

            if (fieldRefs.Count > 0)
            {
                groupBy = new GroupBy(fieldRefs, collaps);
            }

            return groupBy;
        }