Beispiel #1
0
        public Tuple <List <TEntity>, int> PageByQueryable <TEntity>(object queryObj, IDTO_Page param = null) where TEntity : DBEntity_Basic, new()
        {
            string orderBy = param.Sort.GenerOrderBySql <TEntity>();

            var query = ((ISugarQueryable <TEntity>)queryObj).OrderBy(orderBy);

            int rowQty = query.Count();

            param.PageSize  = param.PageSize == 0 ? 10 : param.PageSize;
            param.PageIndex = param.PageIndex == 0 ? 1 : param.PageIndex;

            var dataList = query.ToPageList(param.PageIndex, param.PageSize, ref rowQty);

            return(new Tuple <List <TEntity>, int>(dataList, rowQty));
        }
Beispiel #2
0
        public Tuple <List <TEntity>, int> PageByQueryable <TEntity>(object queryObj, IDTO_Page param = null) where TEntity : DBEntity_Basic, new()
        {
            var query = ((IQueryable <TEntity>)queryObj).OrderBy(param.Sort);

            int rowQty = query.Count();

            param.PageSize  = param.PageSize == 0 ? 10 : param.PageSize;
            param.PageIndex = param.PageIndex == 0 ? 1 : param.PageIndex;

            var dataList = query.Skip(param.PageSize * (param.PageIndex - 1)).Take(param.PageSize)
                           .ToList();

            return(new Tuple <List <TEntity>, int>(dataList, rowQty));
        }
Beispiel #3
0
        public Tuple <List <TEntity>, int> Page <TEntity>(Expression <Func <TEntity, bool> > expression, IDTO_Page param = null) where TEntity : DBEntity_Basic, new()
        {
            var query = GetSimpleClient <TEntity>().AsQueryable().Where(expression);

            return(PageByQueryable <TEntity>(query, param));
        }
Beispiel #4
0
 public virtual Tuple <List <T>, int> PageByQueryable <T>(object queryObj, IDTO_Page param = null) where T : DBEntity_Basic, new()
 {
     return(DBContext.PageByQueryable <T>(queryObj, param));
 }