internal static JsonTreeResponse PrepareJsonTreeResponse(JsonTreeResponse response, CoreGrid grid, List <Hashtable> data) { for (int i = 0; i < data.Count; i++) { for (int j = 0; j < grid.Columns.Count; j++) { CoreColumn coreColumn = grid.Columns[j]; if (!string.IsNullOrEmpty(coreColumn.DataField) && !string.IsNullOrEmpty(coreColumn.DataFormatString)) { data[i][coreColumn.DataField] = coreColumn.FormatDataValue(data[i][coreColumn.DataField], coreColumn.HtmlEncode); } } response.rows[i] = data[i]; } return(response); }
private JsonResult FilterDataSource(object dataSource, Dictionary <string, string> queryString, out IQueryable iqueryable) { //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; string searchString = ""; string searchOper = ""; string text5 = ""; string sortDirection = ""; int num = 1; int num2 = 0; iqueryable = (dataSource as IQueryable); Guard.IsNotNull(iqueryable, "DataSource", "should implement the IQueryable interface."); if (queryString.ContainsKey("page")) { num = Convert.ToInt32(queryString["page"]); } if (queryString.ContainsKey("rows")) { num2 = Convert.ToInt32(queryString["rows"]); } if (queryString.ContainsKey("sidx")) { text5 = queryString["sidx"]; } if (queryString.ContainsKey("sord")) { sortDirection = queryString["sord"]; } if (queryString.ContainsKey("parentRowID")) { text = queryString["parentRowID"]; } if (queryString.ContainsKey("_search")) { text2 = queryString["_search"]; } if (queryString.ContainsKey("filters")) { text3 = queryString["filters"]; } if (queryString.ContainsKey("searchField")) { text4 = queryString["searchField"]; } if (queryString.ContainsKey("searchString")) { searchString = queryString["searchString"]; } if (queryString.ContainsKey("searchOper")) { searchOper = queryString["searchOper"]; } PagerSettings.CurrentPage = num; if (num2 > 0) { PagerSettings.PageSize = num2; } if ((!string.IsNullOrEmpty(text2) && text2 != "false") || !string.IsNullOrEmpty(text3)) { try { if (string.IsNullOrEmpty(text3) && !string.IsNullOrEmpty(text4)) { iqueryable = iqueryable.Where(Util.GetWhereClause(this, text4, searchString, searchOper)); } else if (!string.IsNullOrEmpty(text3)) { var predicate = Util.GetWhereClause(this, text3); if (!string.IsNullOrEmpty(predicate)) { iqueryable = iqueryable.Where(predicate); } } else if (ToolBarSettings.ShowSearchToolBar || text2 == "true") { iqueryable = iqueryable.Where(Util.GetWhereClause(this, queryString)); } } catch (DataTypeNotSetException ex) { throw ex; } catch (Exception e) { throw e; } } int num3 = iqueryable.Count(); if (PivotSettings.IsPivotEnabled()) { num2 = num3; } int totalPagesCount = (int)Math.Ceiling((double)((float)num3 / (float)num2)); if (string.IsNullOrEmpty(text5) && SortSettings.AutoSortByPrimaryKey) { if (Columns.Count == 0) { throw new Exception("CoreGrid must have at least one column defined."); } text5 = Util.GetPrimaryKeyField(this); sortDirection = "asc"; } if (!string.IsNullOrEmpty(text5)) { iqueryable = iqueryable.OrderBy(GetSortExpression(text5, sortDirection)); } if (!LoadOnce && !PivotSettings.IsPivotEnabled()) { iqueryable = iqueryable.Skip((num - 1) * num2).Take(num2); } List <Hashtable> list = Util.ToListOfHashtables(iqueryable, this); DataResolved?.Invoke(new CoreGridDataResolvedEventArgs(this, iqueryable, DataSource as IQueryable)); JsonTreeResponse response = new JsonTreeResponse(num, totalPagesCount, num3, num2, list.Count, Util.GetFooterInfo(this)); return(Util.ConvertToJson(response, this, list)); }
internal static JsonResult ConvertToJson(JsonTreeResponse response, CoreGrid grid, List <Hashtable> data) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown return(new JsonResult((object)PrepareJsonTreeResponse(response, grid, data))); }