/// <summary>
        /// 把Expression列表转化为单一Expression(use and)
        /// </summary>
        /// <param name="exps"></param>
        /// <returns></returns>
        public static ISearchExpression ConvertListToOne(IList <ISearchExpression> exps)
        {
            if (exps.Count == 0)
            {
                return(null);
            }
            ISearchExpression exp = exps[0];

            for (int i = 1; i < exps.Count; ++i)
            {
                exp = SearchExpression.And(exp, exps[i]);
            }
            return(exp);
        }
        /// <summary>
        /// List To One
        /// </summary>
        /// <param name="searchExpressions"></param>
        /// <returns></returns>
        public static ISearchExpression ToSingle(IList <ISearchExpression> searchExpressions)
        {
            if (searchExpressions == null || searchExpressions.Count == 0)
            {
                return(null);
            }
            ISearchExpression se = searchExpressions[0];

            for (int i = 1; i < searchExpressions.Count; ++i)
            {
                se = SearchExpression.And(se, searchExpressions[i]);
            }
            return(se);
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sm"></param>
 /// <param name="searchExpression"></param>
 /// <param name="searchOrders"></param>
 public static void FillSearchAdditionals(this ISearchManager sm, ref ISearchExpression searchExpression, ref IList <ISearchOrder> searchOrders)
 {
     if (!string.IsNullOrEmpty(sm.AdditionalSearchExpression))
     {
         searchExpression = SearchExpression.And(searchExpression,
                                                 SearchExpression.Parse(sm.AdditionalSearchExpression));
     }
     if (!string.IsNullOrEmpty(sm.AdditionalSearchOrder))
     {
         if (searchOrders == null)
         {
             searchOrders = new List <ISearchOrder>();
         }
         foreach (var i in SearchOrder.Parse(sm.AdditionalSearchOrder))
         {
             searchOrders.Add(i);
         }
     }
 }