/// <summary>
        /// Perform a consumer batch ihi search on the Medicare IHI service.
        /// </summary>
        /// <param name="searches">List of SearchIHIRequestType containing the request identifier and the search parameters.</param>
        /// <returns>Results matching the search parameters. Different fields are returned for diffent search types. For full details please refer to:
        /// <list type="bullet">
        /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.BasicSearch"/></description></item>
        /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.BasicMedicareSearch"/></description></item>
        /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.BasicDvaSearch"/></description></item>
        /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.DetailedSearch"/></description></item>
        /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.AustralianPostalAddressSearch"/></description></item>
        /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.AustralianStreetAddressSearch"/></description></item>
        /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.InternationalAddressSearch"/></description></item>
        /// </list>
        /// </returns>
        public searchIHIBatchResponse SearchIHIBatchSync(List <CommonSearchIHIRequestType> searches)
        {
            Validation.ValidateArgumentRequired("searches", searches);

            searchIHIBatchSyncRequest envelope = new searchIHIBatchSyncRequest();

            var mappedSearches = Mapper.Map <List <SearchIHIRequestType> >(searches);

            //var mappedSearches = Mapper.Map<List<CommonSearchIHIRequestType>, List<SearchIHIRequestType>>(searches);

            envelope.searchIHIBatchSync = mappedSearches.ToArray();
            envelope.product            = product;
            envelope.user      = user;
            envelope.hpio      = hpio;
            envelope.signature = new SignatureContainerType();

            envelope.timestamp = new TimestampType()
            {
                created          = DateTime.Now,
                expires          = DateTime.Now.AddDays(30),
                expiresSpecified = true
            };

            // Set LastSoapRequestTimestamp
            LastSoapRequestTimestamp = envelope.timestamp;

            searchIHIBatchSyncResponse response = null;

            try
            {
                response = ihiBatchClient.searchIHIBatchSync(envelope);
            }
            catch (Exception ex)
            {
                // Catch generic FaultException and call helper to throw a more specific fault
                // (FaultException<ServiceMessagesType>
                FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex);
            }

            if (response != null && response.searchIHIBatchResponse != null)
            {
                return(response.searchIHIBatchResponse);
            }
            else
            {
                throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse);
            }
        }
        /// <summary>
        /// Perform the service call.
        /// </summary>
        /// <param name="request">The search criteria in a searchHIProviderDirectoryForIndividual object.</param>
        /// <returns>The search results in a searchHIProviderDirectoryForIndividualResponse object.</returns>
        public searchForProviderIndividualResponse ProviderIndividualSearch(searchForProviderIndividual request)
        {
            var envelope = new searchForProviderIndividualRequest()
            {
                searchForProviderIndividual = request,
                product   = product,
                user      = user,
                hpio      = hpio,
                signature = new SignatureContainerType()
            };

            envelope.timestamp = new TimestampType()
            {
                created          = DateTime.Now,
                expires          = DateTime.Now.AddDays(30),
                expiresSpecified = true
            };

            // Set LastSoapRequestTimestamp
            LastSoapRequestTimestamp = envelope.timestamp;

            searchForProviderIndividualResponse1 response1 = null;

            try
            {
                response1 = providerSearchForProviderIndividualClient.searchForProviderIndividual(envelope);

                providerSearchForProviderIndividualClient.searchForProviderIndividual(envelope);
            }
            catch (Exception ex)
            {
                // Catch generic FaultException and call helper to throw a more specific fault
                // (FaultException<ServiceMessagesType>
                FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex);
            }

            if (response1 != null && response1.searchForProviderIndividualResponse != null)
            {
                return(response1.searchForProviderIndividualResponse);
            }
            else
            {
                throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse);
            }
        }
        /// <summary>
        /// Obtain the current acceptable values for a list of web service request elements.
        /// Elements include (but may not be limited to):
        /// <list type="bullet">
        /// <item>providerTypeCode</item>
        /// <item>providerSpecialty</item>
        /// <item>providerSpecialisation</item>
        /// <item>organisationTypeCode</item>
        /// <item>organisationService</item>
        /// <item>organisationServiceUnit</item>
        /// <item>operatingSystem</item>
        /// <item>token</item>
        /// </list>
        /// </summary>
        /// <param name="referenceList">A string array of request elements to look up.</param>
        /// <returns>The current reference data values for the specified elements.</returns>
        public readReferenceDataResponse ReadReferenceData(string[] referenceList)
        {
            Validation.ValidateArgumentRequired("referenceList", referenceList);

            readReferenceDataRequest envelope = new readReferenceDataRequest();

            envelope.readReferenceData = referenceList;
            envelope.product           = product;
            envelope.user      = user;
            envelope.hpio      = hpio;
            envelope.signature = new SignatureContainerType();

            envelope.timestamp = new TimestampType()
            {
                created          = DateTime.Now.ToUniversalTime(),
                expires          = DateTime.Now.AddDays(30).ToUniversalTime(),
                expiresSpecified = true
            };

            // Set LastSoapRequestTimestamp
            LastSoapRequestTimestamp = envelope.timestamp;

            readReferenceDataResponse1 response1 = null;

            try
            {
                response1 = providerReadReferenceDataClient.readReferenceData(envelope);
            }
            catch (Exception ex)
            {
                // Catch generic FaultException and call helper to throw a more specific fault
                // (FaultException<ServiceMessagesType>
                FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex);
            }

            if (response1 != null && response1.readReferenceDataResponse != null)
            {
                return(response1.readReferenceDataResponse);
            }
            else
            {
                throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse);
            }
        }
        /// <summary>
        /// Perform the IHI service call.
        /// </summary>
        /// <param name="request">The search criteria in a searchIHI object.</param>
        /// <returns>The IHI search results.</returns>
        private searchIHIResponse IHISearch(searchIHI request)
        {
            searchIHIRequest envelope = new searchIHIRequest();

            envelope.searchIHI = request;
            envelope.product   = product;
            envelope.user      = user;
            envelope.hpio      = hpio;
            envelope.signature = new SignatureContainerType();

            envelope.timestamp = new TimestampType()
            {
                created          = DateTime.Now.ToUniversalTime(),
                expires          = DateTime.Now.AddDays(30).ToUniversalTime(),
                expiresSpecified = true
            };

            // Set LastSoapRequestTimestamp
            LastSoapRequestTimestamp = envelope.timestamp;

            searchIHIResponse1 response1 = null;

            try
            {
                response1 = searchIhiClient.searchIHI(envelope);
            }
            catch (Exception ex)
            {
                // Catch generic FaultException and call helper to throw a more specific fault
                // (FaultException<ServiceMessagesType>
                FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex);
            }

            if (response1 != null && response1.searchIHIResponse != null)
            {
                return(response1.searchIHIResponse);
            }
            else
            {
                throw new ApplicationException(Pyro.ADHA.Properties.Resources.UnexpectedServiceResponse);
            }
        }
Exemple #5
0
        /// <summary>
        /// Remove the results of a batch IHI search after the results have been retrieved.
        /// </summary>
        /// <param name="batchIdentifier">The batch search identifier for the batch results to be deleted.</param>
        /// <returns>The status of the delete operation.</returns>
        public deleteSearchIHIBatchResponse1 DeleteSearchIHIBatch(string batchIdentifier)
        {
            Validation.ValidateArgumentRequired("batchIdentifier", batchIdentifier);

            var envelope = new deleteSearchIHIBatchRequest();

            envelope.deleteSearchIHIBatch = new deleteSearchIHIBatch()
            {
                batchIdentifier = batchIdentifier
            };
            envelope.product   = product;
            envelope.user      = user;
            envelope.signature = new SignatureContainerType();

            envelope.timestamp = new TimestampType()
            {
                created          = DateTime.Now,
                expires          = DateTime.Now.AddDays(30),
                expiresSpecified = true
            };

            // Set LastSoapRequestTimestamp
            LastSoapRequestTimestamp = envelope.timestamp;

            deleteSearchIHIBatchResponse1 response = null;

            try
            {
                response = ihiBatchClient.deleteSearchIHIBatch(envelope);
            }
            catch (Exception ex)
            {
                // Catch generic FaultException and call helper to throw a more specific fault
                // (FaultException<ServiceMessagesType>
                FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex);
            }

            return(response);
        }