示例#1
0
        private static string GetLinqExpression(string filterExpressionCompare, Util.SearchArguments args)
        {
            switch (args.SearchOperation)
            {
            case SearchOperation.IsEqualTo:
                return(string.Format(filterExpressionCompare, args.SearchColumn, "=", args.SearchString));

            case SearchOperation.IsLessThan:
                return(string.Format(filterExpressionCompare, args.SearchColumn, "<", args.SearchString));

            case SearchOperation.IsLessOrEqualTo:
                return(string.Format(filterExpressionCompare, args.SearchColumn, "<=", args.SearchString));

            case SearchOperation.IsGreaterThan:
                return(string.Format(filterExpressionCompare, args.SearchColumn, ">", args.SearchString));

            case SearchOperation.IsGreaterOrEqualTo:
                return(string.Format(filterExpressionCompare, args.SearchColumn, ">=", args.SearchString));

            case SearchOperation.BeginsWith:
                return(string.Format("{0}.StartsWith(\"{1}\")", args.SearchColumn, args.SearchString));

            case SearchOperation.DoesNotBeginWith:
                return(string.Format("!{0}.StartsWith(\"{1}\")", args.SearchColumn, args.SearchString));

            case SearchOperation.EndsWith:
                return(string.Format("{0}.EndsWith(\"{1}\")", args.SearchColumn, args.SearchString));

            case SearchOperation.DoesNotEndWith:
                return(string.Format("!{0}.EndsWith(\"{1}\")", args.SearchColumn, args.SearchString));

            case SearchOperation.Contains:
                return(string.Format("{0}.Contains(\"{1}\")", args.SearchColumn, args.SearchString));

            case SearchOperation.DoesNotContain:
                return(string.Format("!{0}.Contains(\"{1}\")", args.SearchColumn, args.SearchString));
            }
            throw new Exception("Invalid search operation.");
        }
示例#2
0
 public static string GetWhereClause(JQGrid grid)
 {
     string text = " && ";
     string text2 = "";
     new Hashtable();
     foreach (JQGridColumn jQGridColumn in grid.Columns)
     {
         string text3 = HttpContext.Current.Request[jQGridColumn.DataField];
         if (!string.IsNullOrEmpty(text3))
         {
             Util.SearchArguments args = new Util.SearchArguments
             {
                 SearchColumn = jQGridColumn.DataField,
                 SearchString = text3,
                 SearchOperation = jQGridColumn.SearchToolBarOperation
             };
             string str = (text2.Length > 0) ? text : "";
             string str2 = Util.ConstructLinqFilterExpression(args);
             text2 = text2 + str + str2;
         }
     }
     return text2;
 }
示例#3
0
        public static string GetWhereClause(JQGrid grid)
        {
            string text  = " && ";
            string text2 = "";

            new Hashtable();
            foreach (JQGridColumn jQGridColumn in grid.Columns)
            {
                string text3 = HttpContext.Current.Request[jQGridColumn.DataField];
                if (!string.IsNullOrEmpty(text3))
                {
                    Util.SearchArguments args = new Util.SearchArguments
                    {
                        SearchColumn    = jQGridColumn.DataField,
                        SearchString    = text3,
                        SearchOperation = jQGridColumn.SearchToolBarOperation
                    };
                    string str  = (text2.Length > 0) ? text : "";
                    string str2 = Util.ConstructLinqFilterExpression(args);
                    text2 = text2 + str + str2;
                }
            }
            return(text2);
        }
示例#4
0
        internal static string ConstructLinqFilterExpression(JQAutoComplete autoComplete, Util.SearchArguments args)
        {
            Guard.IsNull(autoComplete.DataTextField, "DataField", "must be set in order to perform search operations.");
            string filterExpressionCompare = "{0} {1} \"{2}\"";

            return(Util.GetLinqExpression(filterExpressionCompare, args));
        }
示例#5
0
        private static string ConstructLinqFilterExpression(Util.SearchArguments args)
        {
            string filterExpressionCompare = "{0} {1} \"{2}\"";

            return(Util.GetLinqExpression(filterExpressionCompare, args));
        }