Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BooksBll bbl = new BooksBll();

            typelist = new CategoriesBll().GetModelList("");
            string index = Request["index"];

            if (string.IsNullOrEmpty(index))
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = Convert.ToInt32(index);
            }



            //获得类型id
            string  typeId = Request["typeId"];
            DataSet ds;

            if (string.IsNullOrEmpty(typeId))
            {
                ds = bbl.GetListByPage("", "Id", (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);
                //总条数
                total = bbl.GetRecordCount("");
            }
            else
            {
                ds = bbl.GetListByPage("CategoryId=" + typeId, "Id", (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);
                //总条数
                total = bbl.GetRecordCount("CategoryId=" + typeId);
            }
            //总页码数
            pageCount = Convert.ToInt32(Math.Ceiling((double)total / pageSize));

            //每页显示的数据集
            bookslist = bbl.DataTableToList(ds.Tables[0]);
            //随机显示3条数据
            DataSet ds1 = bbl.GetBooksByRandom(3);

            ramdomBooks = bbl.DataTableToList(ds1.Tables[0]);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BooksBll bbll = new BooksBll();

            string index = Request["index"];

            if (string.IsNullOrEmpty(index))
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = Convert.ToInt32(index);
            }
            //总页数
            int total = bbll.GetRecordCount("");

            pageCount = Convert.ToInt32(Math.Ceiling((double)total / pageSize));

            //集合
            DataSet ds = bbll.GetListByPage("", "", (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);

            bookList = bbll.DataTableToList(ds.Tables[0]);
        }