Пример #1
0
        private async Task <bool> UploadAddresses(bool inUpdateProcess = false)
        {
            if (_personSought.Addresses == null)
            {
                return(true);
            }

            _logger.LogDebug($"Attempting to create adddress for SoughtPerson");

            foreach (var address in _personSought.Addresses.Where(m => m.Owner == OwnerType.PersonSought))
            {
                AddressEntity addr = _mapper.Map <AddressEntity>(address);
                addr.SearchRequest     = _uploadedSearchRequest;
                addr.InformationSource = InformationSourceType.Request.Value;
                addr.Person            = _uploadedPerson;
                addr.IsCreatedByAgency = true;
                addr.UpdatedByApi      = inUpdateProcess;
                if (inUpdateProcess)
                {
                    addr.UpdateDetails = "New Address";
                }
                SSG_Address uploadedAddr = await _searchRequestService.CreateAddress(addr, _cancellationToken);
            }

            //following is for alias person has addresses, this situation never happened before. But the data structure is there.
            if (_personSought.Names == null)
            {
                return(true);
            }
            foreach (Name personName in _personSought.Names?.Where(m => m.Owner == OwnerType.PersonSought))
            {
                if (personName.Addresses != null)
                {
                    foreach (var address in personName.Addresses)
                    {
                        AddressEntity addr = _mapper.Map <AddressEntity>(address);
                        addr.SearchRequest     = _uploadedSearchRequest;
                        addr.InformationSource = InformationSourceType.Request.Value;
                        addr.Person            = _uploadedPerson;
                        addr.IsCreatedByAgency = true;

                        SSG_Address uploadedAddr = await _searchRequestService.CreateAddress(addr, _cancellationToken);
                    }
                }
            }
            _logger.LogInformation("Create addresses records for SearchRequest successfully");
            return(true);
        }
Пример #2
0
        private async Task <bool> UploadAddresses( )
        {
            if (_foundPerson.Addresses == null)
            {
                return(true);
            }
            try
            {
                _logger.LogDebug($"Attempting to create found adddress records for SearchRequest[{_searchRequest.SearchRequestId}]");

                foreach (var address in _foundPerson.Addresses)
                {
                    AddressEntity addr = _mapper.Map <AddressEntity>(address);
                    addr.SearchRequest     = _searchRequest;
                    addr.InformationSource = _providerDynamicsID;
                    addr.Person            = _returnedPerson;
                    SSG_Address uploadedAddr = await _searchRequestService.CreateAddress(addr, _cancellationToken);
                    await CreateResultTransaction(uploadedAddr);
                }
                return(true);
            }
            catch (Exception ex)
            {
                LogException(ex);
                return(false);
            }
        }
Пример #3
0
 private async Task <bool> UploadAddresses(SSG_SearchRequest request, PersonSearchCompleted personCompletedEvent, CancellationToken concellationToken)
 {
     if (personCompletedEvent.MatchedPerson.Addresses == null)
     {
         return(true);
     }
     foreach (var address in personCompletedEvent.MatchedPerson.Addresses)
     {
         SSG_Address addr = _mapper.Map <SSG_Address>(address);
         addr.SearchRequest = request;
         var uploadedAddr = await _searchRequestService.CreateAddress(addr, concellationToken);
     }
     return(true);
 }
Пример #4
0
 private async Task <bool> UploadAddresses(Person person, SSG_SearchRequest request, SSG_Person ssg_person, int?providerDynamicsID, CancellationToken concellationToken)
 {
     if (person.Addresses == null)
     {
         return(true);
     }
     try
     {
         foreach (var address in person.Addresses)
         {
             SSG_Address addr = _mapper.Map <SSG_Address>(address);
             addr.SearchRequest     = request;
             addr.InformationSource = providerDynamicsID;
             addr.Person            = ssg_person;
             var uploadedAddr = await _searchRequestService.CreateAddress(addr, concellationToken);
         }
         return(true);
     }catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(false);
     }
 }