Example #1
0
        /// <summary>
        /// 模拟数据库分页
        /// </summary>
        /// <returns></returns>
        private DataTable GetPagedDataTable2(int pageIndex, int pageSize)
        {
            Demo.BLL.tb_JC_Position bll = new Demo.BLL.tb_JC_Position();
            DataTable source            = bll.GetList("").Tables[0];

            DataTable paged = source.Clone();

            int rowbegin = pageIndex * pageSize;
            int rowend   = (pageIndex + 1) * pageSize;

            if (rowend > source.Rows.Count)
            {
                rowend = source.Rows.Count;
            }

            for (int i = rowbegin; i < rowend; i++)
            {
                paged.ImportRow(source.Rows[i]);
            }

            return(paged);
        }
Example #2
0
 /// <summary>
 /// 模拟返回总项数
 /// </summary>
 /// <returns></returns>
 private int GetTotalCount3()
 {
     Demo.BLL.tb_JC_Position bll = new Demo.BLL.tb_JC_Position();
     return(bll.GetList("").Tables[0].Rows.Count);
 }