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}"); } }
protected virtual bool Filter(FileBrowingNode filenode, FilterByEnumStateArgs arg) { if (arg.State == Domains.EnumDataState.Normal) {//搜索正常的 return(!filenode.IsDelete); } else {//搜索删除的 return(filenode.IsDelete); } }