コード例 #1
0
        private void SearchDR()
        {
            DRService service = new DRService(_context);

            SearchParam p = new SearchParam();

            p.CurrentPage = _drCurrentPage - 1;
            p.PageSize    = _pageSize;

            p.ReceiptType = (ReceiptType)cboCategory.SelectedItem;
            p.DRNumber    = txtDrNumber.Text;
            p.OrderBy     = rbDRAscending.Checked ? OrdeBy.Ascending : OrdeBy.Descending;

            DRSearchResult r = service.DRSearch(p);

            _Drs = r.Results;
            LoadDRToListView();
            _drPageCount = r.PageCount;

            SetNavigationText();
        }
コード例 #2
0
        public DRSearchResult DRSearch(SearchParam param)
        {
            IQueryable <DR> query = _context.DRs.Include("ReturnedHistory").AsNoTracking();

            DRSearchResult r = new DRSearchResult();

            query = ApplyCondition(param, query);

            r.TotalItems = query.Count();
            r.PageCount  = (int)Math.Ceiling((double)r.TotalItems / param.PageSize);


            int skipRows = param.CurrentPage * param.PageSize;

            query = ApplyOrderBy(param, query);

            query = query.Skip(skipRows)
                    .Take(param.PageSize);

            r.Results = query.ToList();

            return(r);
        }