コード例 #1
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);
            }
        }
コード例 #2
0
        public void GivenDocumentSearchResultsData_WhenIAskForTheFirstPaginatedResults_IGetCorrectPaginatedResults()
        {
            const int startRow     = 1;
            const int endRow       = 10;
            const int PageNumber   = 1;
            const int ItemsPerPage = 10;

            var pagedResult = _documentEngine.GetPagedResults(startRow, endRow, PageNumber, ItemsPerPage, _data, false);

            pagedResult.StartRow.Should().Be(1);
            pagedResult.EndRow.Should().Be(10);
            pagedResult.ItemsPerPage.Should().Be(10);
            pagedResult.Results.Should().HaveCount(10);
        }