public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; int start = 0; int limit = 10; string sort = string.Empty; string dir = string.Empty; string query = string.Empty; if (!string.IsNullOrEmpty(context.Request["start"])) { start = int.Parse(context.Request["start"]); } if (!string.IsNullOrEmpty(context.Request["limit"])) { limit = int.Parse(context.Request["limit"]); } if (!string.IsNullOrEmpty(context.Request["sort"])) { sort = context.Request["sort"]; } if (!string.IsNullOrEmpty(context.Request["dir"])) { dir = context.Request["dir"]; } if (!string.IsNullOrEmpty(context.Request["query"])) { query = context.Request["query"]; } List <QueryFilter> filters = new List <QueryFilter>(); if (!string.IsNullOrEmpty(query)) { filters.Add(new QueryFilter(SPSClientWrapper.PROPERTY_NAME_NAME, query, FilterFunction.Contains)); } List <SPChannelWrapper> channels = SPChannelWrapper.FindAllByOrderByAndFilter(filters, "", true); //} try { JSonResult <SPChannelWrapper> results = new JSonResult <SPChannelWrapper>(channels); context.Response.Write(JSON.Serialize(results)); } catch (Exception e) { logger.Error("读取通道错误", e); } }
protected void storeSPChannel_Refresh(object sender, StoreRefreshDataEventArgs e) { List <QueryFilter> filters = new List <QueryFilter>(); filters.Add(new QueryFilter(SPChannelWrapper.PROPERTY_NAME_ISDISABLE, "false", FilterFunction.EqualTo)); List <SPChannelWrapper> channels = SPChannelWrapper.FindAllByOrderByAndFilter(filters, SPChannelWrapper.PROPERTY_NAME_ID, true); storeSPChannel.DataSource = channels; storeSPChannel.DataBind(); }
protected void storeSPChannel_Refresh(object sender, StoreRefreshDataEventArgs e) { int recordCount = 0; string sortFieldName = ""; if (e.Sort != null) { sortFieldName = e.Sort; } int startIndex = 0; if (e.Start > -1) { startIndex = e.Start; } int limit = this.PagingToolBar1.PageSize; int pageIndex = 1; if ((startIndex % limit) == 0) { pageIndex = startIndex / limit + 1; } else { pageIndex = startIndex / limit; } List <QueryFilter> queryFilters = new List <QueryFilter>(); queryFilters.Add(new QueryFilter(SPChannelWrapper.PROPERTY_NAME_ISDISABLE, "false", FilterFunction.EqualTo)); string sname = txtSreachName.Text.Trim(); if (!string.IsNullOrEmpty(sname)) { queryFilters.Add(new QueryFilter(SPChannelWrapper.PROPERTY_NAME_NAME, sname, FilterFunction.Contains)); } storeSPChannel.DataSource = SPChannelWrapper.FindAllByOrderByAndFilter(queryFilters, sortFieldName, (e.Dir == SortDirection.DESC), pageIndex, limit, out recordCount); e.TotalCount = recordCount; storeSPChannel.DataBind(); }