Beispiel #1
0
        public IEnumerable <FilterModel> BuildFilters(FilterList list)
        {
            filters.Add(new FilterModel((int)FilterCategory.Category, FilterType.List, ParametricValueType.Integer));
            filters.Add(new FilterModel((int)FilterCategory.Manufacturer, FilterType.List, ParametricValueType.Integer));
            filters.Add(new FilterModel((int)FilterCategory.Flag, FilterType.List, ParametricValueType.Integer));
            filters.Add(new FilterModel((int)FilterCategory.OnHand, FilterType.Bool, ParametricValueType.Boolean));
            filters.Add(new FilterModel((int)FilterCategory.Price, FilterType.Range, ParametricValueType.Decimal));

            AddCategoryValue(list.Find(i => i.Name == "catf"));
            AddManufacturerValue(list.Find(i => i.Name == "mfrf"));
            AddFlagValue(list.Find(i => i.Name == "flgf"));
            AddOnHand(list.Find(i => i.Name == "ohf"));
            AddPriceValue(list.Find(i => i.Name == "prcf"));
            AddParametrics(list.Find(i => i.Name == "parf"));

            filters.ForEach(f => f.Values.RemoveAll(v => !v.HasValidCount(ItemCount)));
            filters.RemoveAll(f => !f.HasValidCount(ItemCount));
            return(filters);
        }