コード例 #1
0
        protected void Serachwithcondition_Click(object sender, EventArgs e)
        {
            BLL.LiuYanBan mainService = new BLL.LiuYanBan();
            string        firsttype   = select2.Items[select2.SelectedIndex].Value;

            if (firsttype == "" || firsttype == "全部")
            {
                int pageIndex = int.Parse(Request["pageIndex"] ?? "1");
                pageindex = pageIndex;
                int pageSize = 8;
                var ds       = mainService.GetListByPage(string.Empty, " ", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex);
                list = mainService.DataTableToList(ds.Tables[0]);
                var allCount = mainService.GetRecordCount(string.Empty);
                DataCount = allCount;
                PageCount = Math.Max((allCount + pageSize - 1) / pageSize, 1);
                Navstring = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, allCount);
            }
            else
            {
                int pageIndex = 1;
                pageindex = pageIndex;
                int allCount = 0;
                int pageSize = 0;
                pageSize = 1000;
                var ds = mainService.GetListByPage(firsttype, " ", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex);
                list      = mainService.DataTableToList(ds.Tables[0]);
                allCount  = mainService.GetRecordCount(firsttype);
                DataCount = allCount;
                if (DataCount == 0)
                {
                    showinfo = "没有数据!";
                }
                PageCount = 1;
                PreSerach = firsttype;
                Navstring = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, allCount);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageIndex = int.Parse(Request["pageIndex"] ?? "1");

            pageindex = pageIndex;
            int pageSize = 8;

            BLL.LiuYanBan mainService = new BLL.LiuYanBan();
            var           ds          = mainService.GetListByPage(string.Empty, " ", (pageIndex - 1) * pageSize + 1, pageSize * pageIndex);

            //取当前页的数据
            list = mainService.DataTableToList(ds.Tables[0]);
            //设置一共多少页
            var allCount = mainService.GetRecordCount(string.Empty);

            DataCount = allCount;
            PageCount = Math.Max((allCount + pageSize - 1) / pageSize, 1);
            //生成 分页的标签
            Navstring = Common.LaomaPager.ShowPageNavigate(pageSize, pageIndex, allCount);
        }