Exemplo n.º 1
0
 public static IQueryable <T> OrderInfo <T>(this IQueryable <T> list, Dictionary <string, OrderByStatus> orderInfo) where T : new()
 {
     if (orderInfo != null && orderInfo.Count > 0)
     {
         string[] strArray = new string[4]
         {
             "OrderBy",
             "OrderByDescending",
             "ThenBy",
             "ThenByDescending"
         };
         bool flag = list.ContainsOrderBy <T>();
         foreach (string key in orderInfo.Keys)
         {
             int index = orderInfo[key] == OrderByStatus.DESC ? 1 : 0;
             if (flag)
             {
                 index += 2;
             }
             list = OrderByExtensions.smethod_1 <T>(list, key, strArray[index]);
             flag = true;
         }
     }
     return(list);
 }
Exemplo n.º 2
0
        public static bool ContainsOrderBy <T>(this IQueryable <T> source)
        {
            bool       flag       = false;
            Expression expression = source.Expression;

            if (expression.NodeType == ExpressionType.Call)
            {
                flag = OrderByExtensions.smethod_0(expression as MethodCallExpression);
            }
            return(flag);
        }
Exemplo n.º 3
0
        private static bool smethod_0(MethodCallExpression methodCallExpression_0)
        {
            bool flag = false;

            if (!(methodCallExpression_0.Method.Name == "OrderBy") && !(methodCallExpression_0.Method.Name == "OrderByDescending"))
            {
                foreach (Expression expression in methodCallExpression_0.Arguments)
                {
                    if (expression.NodeType == ExpressionType.Call)
                    {
                        if (flag = OrderByExtensions.smethod_0(expression as MethodCallExpression))
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                flag = true;
            }
            return(flag);
        }
Exemplo n.º 4
0
 public static IEnumerable <T> OrderInfo <T>(this IEnumerable <T> list, Dictionary <string, OrderByStatus> orderInfo) where T : new()
 {
     return(OrderByExtensions.OrderInfo <T>(list.AsQueryable <T>(), orderInfo).AsEnumerable <T>());
 }