public static bool IsFilterAbsorbed(this TreeContext context, IFilter filter, IFilterGroup group)
        {
            var node = context.GetGroupNode(group);

            if (node == null)
            {
                return(false);
            }

            return(node.Children.Any(x => context.FilterIsAbsorbedBy(filter, x)));
        }
Exemplo n.º 2
0
        public static void AssignFilter(this TreeContext context, IFilter filter)
        {
            var finalFilter = context.GetFinalFilter(filter);
            var node        = context.GetGroupNode(filter as IFilterGroup);

            if (node != null)
            {
                context.AssignFilterToNode(finalFilter, node);
                return;
            }

            var group = context.GetParentGroup(filter);

            if (group == null || context.IsFilterAbsorbed(filter, group))
            {
                context.AssignFilterToNode(finalFilter, context.GetAssignmentNode(filter));
            }
            else
            {
                group.Filters.Add(finalFilter);
            }
        }