Пример #1
0
        public void TestAggregationFilter()
        {
            var dataSource = CreateDataSource();
            FilterByStringContainsArgs arg1 = new FilterByStringContainsArgs {
                PatternText = "9"
            };
            FilterByRegexArgs arg2 = new FilterByRegexArgs {
                Regex = new Regex(@"^(\d{3,4}-)?\d{6,8}$")
            };
            FilterByDateRangeArgs arg3 = new FilterByDateRangeArgs {
                StartTime = DateTime.Now, EndTime = DateTime.Now.AddDays(1)
            };
            FilterByEnumStateArgs arg4 = new FilterByEnumStateArgs {
                State = EnumDataState.Deleted
            };
            FilterByBookmarkArgs arg5 = new FilterByBookmarkArgs {
                BookmarkId = 10
            };
            var result = dataSource[1].Filter <AbstractDataItem>(arg1, arg2);

            foreach (Call item in result.OfType <Call>())
            {
                Console.WriteLine($"{item.Name}--{item.Number}--{item.StartDate}--{item.DurationSecond}");
            }
        }
Пример #2
0
 protected virtual bool Filter(FileBrowingNode filenode, FilterByRegexArgs arg)
 {
     return(arg.Regex.IsMatch(filenode.Name));
 }