Esempio n. 1
0
        public PagedResult <IndexedDocumentData> GetDocuments(
            int pageNumber,
            int itemsPerPage,
            string docType,
            string subDocType,
            string addresseeSubType,
            string accountNumber,
            string mailingName,
            IList <string> managementCompanies,
            string investorReference,
            DateTime?processingDateFrom,
            DateTime?processingDateTo,
            string primaryHolder,
            string agentReference,
            string addresseePostCode,
            string emailAddress,
            string faxNumber,
            DateTime?contractDate,
            DateTime?paymentDate,
            string documentNumber)
        {
            try
            {
                int startRow;
                int endRow;
                _documentEngine.GetStartEndRow(pageNumber, itemsPerPage, out startRow, out endRow);

                GetAuthData();

                var searchCriteria = _indexNameCriteraService.BuildSearchCriteria(
                    docType,
                    subDocType,
                    addresseeSubType,
                    accountNumber,
                    mailingName,
                    managementCompanies,
                    investorReference,
                    processingDateFrom,
                    processingDateTo,
                    primaryHolder,
                    agentReference,
                    addresseePostCode,
                    emailAddress,
                    faxNumber,
                    contractDate,
                    paymentDate,
                    documentNumber);

                var fromDate = processingDateFrom == null ? new DateTime(2000, 1, 1) : processingDateFrom;
                var toDate   = processingDateTo == null ? DateTime.Now : processingDateTo.Value.AddHours(23).AddMinutes(59).AddSeconds(59);

                var data = _archiveService.DocumentSearchMapVerbose(_authenticationData, startRow, endRow, 1, fromDate, toDate, searchCriteria);

                return(_documentEngine.GetPagedResults(startRow, endRow, pageNumber, itemsPerPage, data));
            }
            catch (Exception e)
            {
                throw new UnityException("Unable to search for documents", e);
            }
        }
        public void GivenASearchFields_WhenIAskToBuildTheType_IndexNameCriteriaDataIsReturned()
        {
            var listManCoTexts = new List <string>();

            listManCoTexts.Add("manco1");
            listManCoTexts.Add("manco2");

            var result = _indexNameCriteraService.BuildSearchCriteria(
                "docType",
                "subDocType",
                "addresseeSubType",
                "accountNumber",
                "mailingName",
                listManCoTexts,
                "investorReference",
                new DateTime(2014, 1, 13, 13, 10, 22),
                new DateTime(2014, 1, 14, 13, 10, 22),
                "primaryHolder",
                "agentReference",
                "addresseePostCode",
                "emailAddress",
                "faxNumber",
                new DateTime(2014, 1, 13, 13, 10, 22),
                new DateTime(2014, 1, 12, 13, 10, 22),
                "documentNumber");

            result.Should()
            .Contain(i => i.IndexName == "DOCUMENT_TYPE")
            .And.Contain(i => i.SearchValue == "docType")
            .And.Contain(i => i.IndexName == "DOCUMENT_SUB_TYPE")
            .And.Contain(i => i.SearchValue == "subDocType")
            .And.Contain(i => i.IndexName == "ACCOUNT_NUMBER")
            .And.Contain(i => i.SearchValue == "accountNumber")
            .And.Contain(i => i.IndexName == "MAILING_NAME")
            .And.Contain(i => i.SearchValue == "mailingName")
            .And.Contain(i => i.IndexName == "MANAGEMENT_COMPANY")
            .And.Contain(i => i.SearchValue == "manco1")
            .And.Contain(i => i.IndexName == "MANAGEMENT_COMPANY")
            .And.Contain(i => i.SearchValue == "manco2")
            .And.Contain(i => i.IndexName == "INVESTOR_REFERENCE")
            .And.Contain(i => i.SearchValue == "investorReference")
            .And.Contain(i => i.IndexName == "ADDRESSEE_SUB_TYPE")
            .And.Contain(i => i.SearchValue == "addresseeSubType")
            .And.Contain(i => i.IndexName == "PRIMARY_HOLDER_NAME")
            .And.Contain(i => i.SearchValue == "primaryHolder")
            .And.Contain(i => i.IndexName == "AGENT_REFERENCE")
            .And.Contain(i => i.SearchValue == "agentReference")
            .And.Contain(i => i.IndexName == "ADDRESSEE_POSTCODE")
            .And.Contain(i => i.SearchValue == "addresseePostCode")
            .And.Contain(i => i.IndexName == "EMAIL_ADDRESS")
            .And.Contain(i => i.SearchValue == "emailAddress")
            .And.Contain(i => i.IndexName == "FAX_NUMBER")
            .And.Contain(i => i.SearchValue == "faxNumber")
            .And.Contain(i => i.IndexName == "CONTRACT_DATE")
            .And.Contain(i => i.SearchValue == "13/01/2014*")
            .And.Contain(i => i.IndexName == "PAYMENT_DATE")
            .And.Contain(i => i.SearchValue == "12/01/2014*")
            .And.Contain(i => i.IndexName == "DOCUMENT_REFERENCE")
            .And.Contain(i => i.SearchValue == "documentNumber")
            .And.HaveCount(16);
        }