/// <summary>
        /// 生成分页数据
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="PageSize">每页大小</param>
        /// <param name="pageNumber">页码</param>
        /// <returns></returns>
        public static PagingListData <DataRow> ToPagingData(this DataTable dt, int PageSize, int pageNumber)
        {
            PagingListData <DataRow> pd = new PagingListData <DataRow>
            {
                pagenumber = pageNumber,
                pagesize   = PageSize,
                total      = dt.Rows.Count
            };

            if (pageNumber < 1)
            {
                pageNumber = 1;
            }

            /*
             * int minIndex = PageSize * (pageNumber - 1) + 1;
             * int maxIndex = PageSize * pageNumber;
             */
            int minIndex    = PageSize * (pageNumber - 1);//从零开始
            int maxIndex    = PageSize * pageNumber - 1;
            int rowMaxIndex = (pd.total - 1) >= maxIndex ? maxIndex : (pd.total - 1);

            pd.rows = new List <DataRow>();
            for (int i = minIndex; i <= rowMaxIndex; i++)
            {
                pd.rows.Add(dt.Rows[i]);
            }

            return(pd);
        }
        /// <summary>
        /// 生成分页数据
        /// </summary>
        /// <param name="list"></param>
        /// <param name="PageSize">每页大小</param>
        /// <param name="pageNumber">页码</param>
        /// <returns></returns>
        public static PagingListData <T> ToPagingData <T>(this List <T> list, int PageSize, int pageNumber) where T : class, new()
        {
            if (pageNumber < 1)
            {
                pageNumber = 1;
            }
            if (PageSize < 1)
            {
                PageSize = 10;
            }

            PagingListData <T> pld = new PagingListData <T>();

            pld.pagenumber = pageNumber;
            pld.pagesize   = PageSize;
            pld.total      = list.Count;


            /*
             * int minIndex = PageSize * (pageNumber - 1) + 1;
             * int maxIndex = PageSize * pageNumber;
             */

            int      minIndex    = PageSize * (pageNumber - 1); //从零开始
            int      maxIndex    = PageSize * pageNumber - 1;   //1210
            int      rowMaxIndex = (pld.total - 1) >= maxIndex ? maxIndex : (pld.total - 1);
            List <T> pageList    = new List <T>();

            for (int i = minIndex; i <= rowMaxIndex; i++)
            {
                pageList.Add(list[i]);
            }
            pld.rows = pageList;

            return(pld);
        }