Beispiel #1
0
 /// <summary>
 /// Hàm paging Data
 /// </summary>
 /// <typeparam name="TSource">Object tương ứng </typeparam>
 /// <param name="pLstSource"></param>
 /// <param name="pCurPage"></param>
 /// <param name="pRecordOnPage"></param>
 /// <param name="pStrPaging"></param>
 /// <returns></returns>
 public static List <TSource> PagingData <TSource>(List <TSource> pLstSource, int pCurPage, int pRecordOnPage, ref string pStrPaging)
 {
     try
     {
         List <TSource> lstCurrentPage  = new List <TSource>();
         int            pIntTotalRecord = pLstSource.Count;
         double         _dobTotalRec    = Convert.ToDouble(pIntTotalRecord);
         int            _TotalPage      = NaviCommon.CommonFuc.RoundUp(_dobTotalRec / pRecordOnPage);
         pStrPaging = HtmlControllHelpers.WritePaging(_TotalPage, pCurPage, pIntTotalRecord, pRecordOnPage, "bản ghi");
         int start = pRecordOnPage * (pCurPage - 1);
         int end   = pRecordOnPage * pCurPage;
         if (end > pIntTotalRecord)
         {
             end = pIntTotalRecord;
         }
         //biến gắn vị trí cuối của bản ghi cần gửi ra
         for (int i = start; i < end; i++)
         {
             lstCurrentPage.Add(pLstSource[i]);
         }
         return(lstCurrentPage);
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return(new List <TSource>());
     }
 }
Beispiel #2
0
 /// <summary>
 /// Create: sangdd
 /// Mục đích: vẽ nexttrang
 /// </summary>
 /// <param name="pCurPage">Trang hiện tại</param>
 /// <param name="pRecordOnPage">Số bản ghi trên trang</param>
 /// <param name="pTotalRecord">Tổng số bản ghi</param>
 /// <returns></returns>
 public static string PagingData(int pCurPage, int pRecordOnPage, int pTotalRecord)
 {
     try
     {
         string pStrPaging   = "";
         double _dobTotalRec = Convert.ToDouble(pTotalRecord);
         int    _TotalPage   = NaviCommon.CommonFuc.RoundUp(_dobTotalRec / pRecordOnPage);
         pStrPaging = HtmlControllHelpers.WritePaging(_TotalPage, pCurPage, pTotalRecord, pRecordOnPage, "bản ghi");
         return(pStrPaging);
     }
     catch (Exception ex)
     {
         NaviCommon.Common.log.Error(ex.ToString());
         return("");
     }
 }