internal static string ConstructLinqFilterExpression(JQAutoComplete autoComplete, Util.SearchArguments args) { Guard.IsNotNull(autoComplete.DataField, "DataField", "must be set in order to perform search operations. If you get this error from search/export method, make sure you setup(initialize) the grid again prior to filtering/exporting."); string filterExpressionCompare = "{0} {1} \"{2}\""; return(Util.GetLinqExpression(filterExpressionCompare, args, false, typeof(string))); }
private static string ConstructLinqFilterExpression(JQGrid grid, Util.SearchArguments args) { JQGridColumn jQGridColumn = grid.Columns.Find((JQGridColumn c) => c.DataField == args.SearchColumn); if (jQGridColumn == null) { throw new Exception("JqGridColumn ûÓÐÉèÖÃ"); } if (jQGridColumn.DataType == null) { throw new DataTypeNotSetException("JQGridColumn.DataType must be set in order to perform search operations."); } string filterExpressionCompare = (jQGridColumn.DataType == typeof(string)) ? "{0} {1} \"{2}\"" : "{0} {1} {2}"; if (jQGridColumn.DataType == typeof(DateTime)) { if (!string.IsNullOrEmpty(args.SearchString)) { DateTime dateTime = DateTime.Parse(args.SearchString); string str = string.Format("({0},{1},{2},{3},{4},{5})", dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second); filterExpressionCompare = "{0} {1} DateTime" + str; } } //string str2 = string.Format("{0} != null AND ", args.SearchColumn); string str2 = ""; if (jQGridColumn.DataType == typeof(Guid)) { filterExpressionCompare = "{0} {1} Guid(\"{2}\")"; //str2 = "";//string.Format("{0} != Guid.Empty AND ", args.SearchColumn); } return(str2 + Util.GetLinqExpression(filterExpressionCompare, args, jQGridColumn.SearchCaseSensitive, jQGridColumn.DataType)); }