Esempio n. 1
0
        public void GivenAPageNumberAndPageSize_WhenIAskToGetTheStartAndEndPageNumberForPageOneAndPageSizeTen_IGetTheCorrectStartAndEndPageNumbers()
        {
            const int PageNumber = 1;
            const int PageSize   = 10;
            int       startRow;
            int       endRow;

            _documentEngine.GetStartEndRow(PageNumber, PageSize, out startRow, out endRow);

            startRow.Should().Be(1);
            endRow.Should().Be(10);
        }
Esempio n. 2
0
        public PagedResult <IndexedDocumentData> GetDocuments(int pageNumber, int itemsPerPage, string grid, bool filterHouseHeld = false, bool filterUnapproved = false, bool filterApproved = false)
        {
            try
            {
                int startRow;
                int endRow;
                _documentEngine.GetStartEndRow(pageNumber, itemsPerPage, out startRow, out endRow);

                GetAuthData();

                DocumentSearchResultsData data;

                if (filterHouseHeld || filterUnapproved || filterApproved)
                {
                    data = _archiveService.DocumentSearch(_authenticationData, 1, 1000, "", grid, 1, "*", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                }
                else
                {
                    data = _archiveService.DocumentSearch(_authenticationData, startRow, endRow, "", grid, 1, "*", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                }

                if (filterHouseHeld)
                {
                    FilterHouseHolding(data);
                }

                if (filterUnapproved)
                {
                    FilterUnapproved(data, grid);
                }

                if (filterApproved)
                {
                    FilterApprovedAndRejected(data, grid);
                }

                return(_documentEngine.GetPagedResults(startRow, endRow, pageNumber, itemsPerPage, data, (filterHouseHeld || filterUnapproved || filterApproved)));
            }
            catch (Exception e)
            {
                throw new UnityException("Unable to search for documents", e);
            }
        }