Esempio n. 1
0
        public async Task <Pagin <Tourist> > PaginationPartMethod(Expression <Func <Tourist, bool> > filter, int pageSize, int pageNumber)
        {
            int ExcludeRecords = (pageSize * pageNumber) - pageSize;

            IQueryable <Tourist> dataSearch = db.Tourists;

            if (filter != null)
            {
                dataSearch = dataSearch.Where(filter);
            }

            var data = await dataSearch.OrderBy(c => c.Fullname)
                       .Skip(ExcludeRecords)
                       .Take(pageSize)
                       .ToListAsync();

            var dataCount = await dataSearch.CountAsync();

            count       = dataCount;
            touristData = data;

            var result = new Pagin <Tourist>
            {
                Data       = touristData,
                TotalItems = count,
                PageNumber = pageNumber,
                PageSize   = pageSize
            };

            return(result);
        }
Esempio n. 2
0
        public void btn_Export_Click()
        {
            string    sqla = "select Department_Code as '部门编码',Department_Name as '部门名称',Department_ParentCode as '上级部门编码',Department_ParentCode as '上级部门名称' from Sys_Department ORDER BY Department_Level,Department_Sequence  asc";
            DataSet   da   = Pagin.Query(sqla);
            DataTable dt   = da.Tables[0];

            string ph = ExportExcel(dt);

            Response.Write(ph);
        }
        public IActionResult Index(int Id)
        {
            OrderListViewModel viewModel = new OrderListViewModel();
            Pagin pagin = new Pagin {
                PageIndex = Id, OrderByDescending = "CreateDate"
            };

            viewModel.Orders = _orderService.Get(m => m.UserId == _applicationContextAccessor.Current.CurrentCustomer.UserID, pagin);
            viewModel.Pagin  = pagin;
            viewModel.Pagin.BaseUrlFormat = "~/MyOrder/Index/{0}";
            return(View(viewModel));
        }
Esempio n. 4
0
        public async Task <Pagin <Tour> > AllToursListForGuide(int pageNumber, int pageSize)
        {
            int ExcludeRecords = (pageNumber * pageSize) - pageSize;
            var result         = new Pagin <Tour>
            {
                Data       = await db.Tours.OrderBy(c => c.Name).Skip(ExcludeRecords).Take(pageSize).AsNoTracking().ToListAsync(),
                TotalItems = db.Tours.Count(),
                PageNumber = pageNumber,
                PageSize   = pageSize
            };

            return(result);
        }
Esempio n. 5
0
        public Pagin <Tourist> ToVueMethod(int pageSize = 4, int pageNumber = 1)
        {
            int ExcludeRecords = (pageSize * pageNumber) - pageSize;

            IQueryable <Tourist> dataSearch = db.Tourists;
            var data = dataSearch.OrderBy(c => c.Fullname)
                       .Skip(ExcludeRecords)
                       .Take(pageSize)
                       .ToList();

            var dataCount = dataSearch.Count();

            var result = new Pagin <Tourist>
            {
                Data       = data,
                TotalItems = dataCount,
                PageNumber = pageNumber,
                PageSize   = pageSize
            };

            return(result);
        }