コード例 #1
0
ファイル: FilterSearch.cs プロジェクト: Yoba91/EService
 public override void CreateFilter()
 {
     filter = null;
     if (members.Count > 0)
     {
         foreach (var item in members)
         {
             if (filter == null)
             {
                 filter = Expression.Call(item, "IndexOf", null, Expression.Constant(searchString, typeof(string)), Expression.Constant(strComp));
                 filter = Expression.GreaterThanOrEqual(filter, Expression.Constant(0));
             }
             else
             {
                 Expression tempfilter = Expression.Call(item, "IndexOf", null, Expression.Constant(searchString, typeof(string)), Expression.Constant(strComp));
                 tempfilter = Expression.GreaterThanOrEqual(tempfilter, Expression.Constant(0));
                 filter     = Expression.Or(filter, tempfilter);
             }
         }
     }
     else
     {
         filter = Expression.Call(member, "IndexOf", null, Expression.Constant(searchString, typeof(string)), Expression.Constant(strComp));
         filter = Expression.GreaterThanOrEqual(filter, Expression.Constant(0));
     }
     members.Clear();
     FilterCreated?.Invoke();
 }
コード例 #2
0
        public override void CreateFilter()
        {
            filter = null;
            var startExpr       = Expression.Constant(start);
            var endExpr         = Expression.Constant(stop);
            var firstCondition  = Expression.GreaterThanOrEqual(member, startExpr);
            var secondCondition = Expression.LessThanOrEqual(member, endExpr);

            filter = Expression.AndAlso(firstCondition, secondCondition);
            FilterCreated?.Invoke();
        }
コード例 #3
0
        public override void CreateFilter()
        {
            Expression constant = null, condition = null;

            filter = null;
            foreach (var item in numbers)
            {
                constant  = Expression.Constant(item);
                condition = Expression.Equal(member, constant);
                if (filter != null)
                {
                    filter = Expression.Or(filter, condition);
                }
                else
                {
                    filter = condition;
                }
            }
            FilterCreated?.Invoke();
        }