public List <ProviderRecordStructure> SynchroniseProviders(DateTime dtLastUpdate, ILogger log)
        {
            string[] statusesToFetch =
            {
                "A",     // Active
                //"V", // Verified                      // Omitted, we suspect this may be a subset of Active providers
                "PD1",   // Deactivation in process
                "PD2"    // Deactivation complete
            };

            List <ProviderRecordStructure> results = new List <ProviderRecordStructure>();
            var request = Request(dtLastUpdate);

            foreach (String status in statusesToFetch)
            {
                log.LogInformation($"Downloading providers from UKRLP service with status {status}");

                request.SelectionCriteria.ProviderStatus = status;
                request.QueryId = GetNextQueryId();

                var pqp = new ProviderQueryParam {
                    ProviderQueryRequest = request
                };
                var             retrieveall = new ProviderQueryPortTypeClient();
                Task <response> x           = retrieveall.retrieveAllProvidersAsync(request);
                x.Wait();

                log.LogInformation($"UKRLP service returned {x.Result?.ProviderQueryResponse?.MatchingProviderRecords?.LongLength ?? 0} providers with status {status}");
                results.AddRange(x.Result?.ProviderQueryResponse?.MatchingProviderRecords ?? new ProviderRecordStructure[] { });
            }
            return(results);
        }
示例#2
0
        private async Task <response> RetrieveAllAsync(ProviderQueryParam query)
        {
            try
            {
                var response = await _providerQueryPortTypeClient.retrieveAllProvidersAsync(query);

                return(response);
            }
            catch (Exception e)
            {
                if (_providerQueryPortTypeClient.State == CommunicationState.Faulted)
                {
                    _providerQueryPortTypeClient.Abort();
                }

                _logger.LogError($"Error Executing ProviderQueryPortTypeClient Internal Exception ==> {e}");
            }

            return(null);
        }
示例#3
0
        private static ProviderQueryParam GetQuery(DateTime dtLastUpdate)
        {
            var query = new ProviderQueryParam(new ProviderQueryStructure
            {
                QueryId           = "1",
                SelectionCriteria = new SelectionCriteriaStructure
                {
                    StakeholderId                  = "1",
                    ProviderUpdatedSince           = dtLastUpdate,
                    ProviderUpdatedSinceSpecified  = true,
                    ApprovedProvidersOnly          = YesNoType.No,
                    ApprovedProvidersOnlySpecified = true,
                    CriteriaCondition              = QueryCriteriaConditionType.OR,
                    CriteriaConditionSpecified     = true,
                    ProviderStatus                 = UkRlpRecordStatus.Active.Humanize()
                }
            });

            return(query);
        }