Example #1
0
        //数据绑定
        public void SearData(int pageIndex)
        {
            string ssdq = "";
            string zzlb = "";

            foreach (ListItem item in this.cbl_ssdq.Items)
            {
                if (item.Selected)
                {
                    ssdq += item.Text + ",";
                }
            }
            ssdq = ssdq.Trim(',');

            foreach (ListItem item in this.cbl_zzlb.Items)
            {
                if (item.Selected)
                {
                    zzlb += item.Text + ",";
                }
            }
            zzlb = zzlb.Trim(',');

            int allRecordCount;
            List <IDataItem> list = this.GetControlValue();

            //WebCommon.AddDataItem(list, "zzjgdm", this.WorkUser.LoginName);

            if (!string.IsNullOrEmpty(ssdq))
            {
                WebCommon.AddDataItem(list, "qysd", ssdq);
            }

            if (!string.IsNullOrEmpty(zzlb))
            {
                WebCommon.AddDataItem(list, "zzlb", zzlb);
            }


            DataTable dt = new DataTable();

            dt = xytxBll.RetrieveQyxykp(list, this.gridView.PageSize, pageIndex, "kpnd desc", out allRecordCount).Result;

            this.gridView.RecordCount = allRecordCount;
            this.gridView.PageIndex   = pageIndex;
            this.gridView.DataSource  = dt;
            this.gridView.DataBind();
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int     allRecordCount = 0;
            string  json           = "";
            string  sortname       = context.Request.Params["sortname"];
            string  sortorder      = context.Request.Params["sortorder"];
            int     page           = Convert.ToInt32(context.Request.Params["page"]) - 1; // 系统的索引从0开始,所以此处需要减1
            int     pagesize       = Convert.ToInt32(context.Request.Params["pagesize"]);
            string  fromWhere      = context.Request.QueryString["fromwhere"];
            string  type           = context.Request.QueryString["type"];
            object  sessionAppUser = context.Session[ConfigManager.GetSignInAppUserSessionName()];
            AppUser workUser       = (AppUser)sessionAppUser;

            xytxBLL = new XytxBLL(workUser);
            //排序
            string orderby = @" " + sortname.ToString2() + " " + sortorder.ToString2() + " ";

            orderby = orderby.Trim();
            //通过检索翻译 生成查询条件
            FilterTranslator ft = ContextExtension.GetGridData(context);
            //分页
            DataTable dt = new DataTable();

            switch (fromWhere)
            {
            case "qyxykp":
                string qylx = context.Request.QueryString["qylx"];

                dt = xytxBLL.RetrieveQyxykp(qylx, ft, pagesize, page, orderby, out allRecordCount);

                break;

            case "xzcf":
                //throw new Exception("aaa");
                dt = xytxBLL.RetrieveXzcf(type, ft, pagesize, page, orderby, out allRecordCount);
                break;
            }
            ft.Parms.Clear();

            string result = JSONHelper.DataTableToJson(dt);

            //result = Regex.Replace(result, @"[/n/r]", ""); //去掉字符串里所有换行符
            //result = result.TrimEnd((char[])"\n\r".ToCharArray());  //去掉换行符
            json = @"{""Rows"":[" + result + @"],""Total"":""" + allRecordCount + @"""}";
            context.Response.Write(json);
            context.Response.End();
        }