Example #1
0
        private void LoadMoreTplCfgInfo(System.Web.HttpContext context)
        {
            int type      = 0;
            int pageSize  = 8;
            int pageIndex = 0;
            int total     = 0;

            if (!string.IsNullOrEmpty(context.Request["type"]))
            {
                int.TryParse(context.Request["type"], out type);
            }
            if (!string.IsNullOrEmpty(context.Request["pageSize"]))
            {
                pageSize = int.Parse(context.Request["pageSize"]);
            }
            if (!string.IsNullOrEmpty(context.Request["pageIndex"]))
            {
                pageIndex = int.Parse(context.Request["pageIndex"]);
                pageIndex--;
            }
            IList <TplCfgInfo> listTplCfgInfo = VshopBrowser.GetTplCfgInfoList(ClientType.VShop, type, pageSize, pageIndex, ref total);
            string             json           = Newtonsoft.Json.JsonConvert.SerializeObject(listTplCfgInfo);
            StringBuilder      stringBuilder  = new StringBuilder();

            stringBuilder.Append("{");
            stringBuilder.AppendFormat("\"tplCfgInfo\"  :{0},", json);
            total = total % pageSize == 0 ? total / pageSize : (total / pageSize + 1);
            stringBuilder.AppendFormat("\"totalPage\":{0}", total);
            stringBuilder.Append("}");
            context.Response.Write(stringBuilder.ToString());
            context.Response.End();
        }