當前位置: 首頁>>代碼示例>>C#>>正文


C# Expression.And方法代碼示例

本文整理匯總了C#中System.Linq.Expressions.Expression.And方法的典型用法代碼示例。如果您正苦於以下問題:C# Expression.And方法的具體用法?C# Expression.And怎麽用?C# Expression.And使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Linq.Expressions.Expression的用法示例。


在下文中一共展示了Expression.And方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     if (operation != 1 && operation != 2 && operation != 3)
     {
         return predicate;
     }
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.operation + " on " + this.date.Date);
         switch (operation)
         {
             case 1: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
             case 2: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
             case 3: return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
             default: return predicate;
         }
     }
     else
     {
         Debug.WriteLine("And " + this.operation + " on " + this.date.Date);
         switch (operation)
         {
             case 1: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) >= this.date);
             case 2: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) <= this.date);
             case 3: return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) == this.date);
             default: return predicate;
         }
     }
 }
開發者ID:CactidSpoder,項目名稱:Unbrickable,代碼行數:29,代碼來源:DateSearchFilter.cs

示例2: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.min_date.Date + " to " + this.max_date.Date);
         return predicate.Or(x => DbFunctions.TruncateTime(x.date_posted) >= min_date && DbFunctions.TruncateTime(x.date_posted) <= max_date);
     }
     else
     {
         Debug.WriteLine("And " + this.min_date.Date + " to " + this.max_date.Date);
         return predicate.And(x => DbFunctions.TruncateTime(x.date_posted) >= min_date && DbFunctions.TruncateTime(x.date_posted) <= max_date);
     }
 }
開發者ID:CactidSpoder,項目名稱:Unbrickable,代碼行數:13,代碼來源:DateRangeSearchFilter.cs

示例3: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     this.username = this.username ?? "";
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.username);
         return predicate.Or(x => x.Account.username.Equals(this.username));
     }
     else
     {
         Debug.WriteLine("And " + this.username);
         return predicate.And(x => x.Account.username.Equals(this.username));
     }
 }
開發者ID:CactidSpoder,項目名稱:Unbrickable,代碼行數:14,代碼來源:UsernameSearchFilter.cs

示例4: filterPosts

 public override Expression<Func<Unbrickable.Models.Post, bool>> filterPosts(Expression<Func<Unbrickable.Models.Post, bool>> predicate)
 {
     this.search_contents = this.search_contents ?? "";
     if (this.isOr)
     {
         Debug.WriteLine("Or " + this.search_contents);
         return predicate.Or(x => x.entry.Contains(this.search_contents));
     }
     else
     {
         Debug.WriteLine("And " + this.search_contents);
         return predicate.And(x => x.entry.Contains(this.search_contents));
     }
 }
開發者ID:CactidSpoder,項目名稱:Unbrickable,代碼行數:14,代碼來源:PostSearchFilter.cs

示例5: GetPastRange

        private Expression<Func<AccountTransactionValue, bool>> GetPastRange(int filterType, Expression<Func<AccountTransactionValue, bool>> activeSpecification, WorkPeriod workPeriod)
        {
            //Resources.All, Resources.Month, Resources.Week, Resources.WorkPeriod
            DateTime? date = null;

            if (filterType == 1) date = DateTime.Now.MonthStart();
            if (filterType == 2) date = DateTime.Now.StartOfWeek();
            if (filterType == 3) date = workPeriod.StartDate;

            return date.HasValue ? activeSpecification.And(x => x.Date < date) : activeSpecification;
        }
開發者ID:khriza,項目名稱:SambaPOS-3,代碼行數:11,代碼來源:AccountTransactionSummary.cs

示例6: GetPastRange

 private Expression<Func<AccountTransactionValue, bool>> GetPastRange(Expression<Func<AccountTransactionValue, bool>> activeSpecification)
 {
     if (FilterType == Resources.Month) return activeSpecification.And(x => x.Date < DateTime.Now.MonthStart());
     if (FilterType == Resources.WorkPeriod) return activeSpecification.And(x => x.Date < _applicationState.CurrentWorkPeriod.StartDate);
     return activeSpecification;
 }
開發者ID:neapolis,項目名稱:SambaPOS-3,代碼行數:6,代碼來源:AccountDetailsViewModel.cs


注:本文中的System.Linq.Expressions.Expression.And方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。