Beispiel #1
0
 public static void AddSQLPaging(IPageCriteria pageCriteria, string sortby, SqlCommand cmd)
 {
     pageCriteria.TotalItemCount = SQLHelper.GetTotalItemsCount(cmd);
     cmd.CommandText            += string.Format(@" ORDER BY {0}
                     OFFSET {1} * ({2} - 1) ROWS
                     FETCH NEXT {1} ROWS ONLY", sortby, pageCriteria.PageSize, pageCriteria.PageIndex);
 }
 public static ResultPage <T> PickPage <T>(this IQueryable <T> query, IPageCriteria criteria, int totalItemsCount)
 {
     return(new ResultPage <T>(query.Skip((criteria.PageNumber - 1) * criteria.PageSize)
                               .Take(criteria.PageSize).ToList(), criteria.PageNumber, criteria.PageSize, totalItemsCount));
 }
 public static ResultPage <T> PickPage <T>(this IQueryable <T> query, IPageCriteria criteria)
 {
     return(PickPage(query, criteria, query.Count()));
 }