protected void Page_Load(object sender, EventArgs e) { string actionKey = string.Empty; if (Request.QueryString.AllKeys.Contains("actionKey")) { actionKey = Request.QueryString["actionKey"]; } QueryStringInfo queryStringInfo = new QueryStringInfo().Fill(Request.QueryString); Response.Clear(); JQGrid grid = new Custom_PerFormsService().GetJQGrid(actionKey, null, queryStringInfo); Response.Write(new JSON().Serialize(grid)); Response.End(); }
public Filter Parse(QueryStringInfo queryStringInfo) { Filter filter = new Filter { Page = queryStringInfo.page, RowsPerPage = queryStringInfo.rows, SortColumnName = queryStringInfo.sidx, SortAscending = queryStringInfo.sord.ToUpper().Equals("ASC") }; filter.FilterOperator = new FilterOperatorFactory().Build(queryStringInfo.filters.groupOp); foreach (QueryStringFilterRule queryStringFilterRule in queryStringInfo.filters.rules) { filter.FilterRows.Add(new FilterRow { FieldName = queryStringFilterRule.field, FieldValue = queryStringFilterRule.data, FieldOperator = new FieldOperatorFactory().Build(queryStringFilterRule.op) }); } return filter; }
protected virtual JQGrid.JQGrid GetJQGrid(string originalQuery, string columnName, QueryStringInfo queryStringInfo) { if (queryStringInfo == null) { queryStringInfo = new QueryStringInfo { filters = new QueryStringFilter { groupOp = "AND", rules = new QueryStringFilterRule[0] }, page = 1, rows = 10, sidx = columnName, sord = "ASC" }; } string totalRecordsQuery; string query = new FilterFormatter().Format(new FilterParser().Parse(queryStringInfo), originalQuery, out totalRecordsQuery); return queryStringInfo.GetJQGrid(Select(query), GetScalarInt(Select(totalRecordsQuery))); }
public virtual JQGrid.JQGrid GetJQGrid(string actionKey, Dictionary<string, List<string>> values, QueryStringInfo queryStringInfo) { string columnName; string query = GetQuery(actionKey, values, out columnName); return GetJQGrid(query, columnName, queryStringInfo); }