private async Task <bool> UploadIdentifiers(bool inUpdateProcess = false) { if (_personSought.Identifiers == null) { return(true); } _logger.LogDebug($"Attempting to create identifier records for SearchRequest."); foreach (var personId in _personSought.Identifiers.Where(m => m.Owner == OwnerType.PersonSought)) { IdentifierEntity identifier = _mapper.Map <IdentifierEntity>(personId); identifier.SearchRequest = _uploadedSearchRequest; identifier.InformationSource = InformationSourceType.Request.Value; identifier.Person = _uploadedPerson; identifier.IsCreatedByAgency = true; identifier.UpdatedByApi = inUpdateProcess; if (inUpdateProcess) { identifier.UpdateDetails = "New Identifier"; } SSG_Identifier newIdentifier = await _searchRequestService.CreateIdentifier(identifier, _cancellationToken); } //following is for alias person has identifiers, 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.Identifiers != null) { foreach (var personId in personName.Identifiers) { IdentifierEntity identifier = _mapper.Map <IdentifierEntity>(personId); identifier.SearchRequest = _uploadedSearchRequest; identifier.InformationSource = InformationSourceType.Request.Value; identifier.Person = _uploadedPerson; identifier.IsCreatedByAgency = true; identifier.UpdatedByApi = inUpdateProcess; if (inUpdateProcess) { identifier.UpdateDetails = "New Identifier"; } SSG_Identifier newIdentifier = await _searchRequestService.CreateIdentifier(identifier, _cancellationToken); } } } _logger.LogInformation("Create identifier records for SearchRequest successfully"); return(true); }
private async Task <bool> UploadIdentifiers() { if (_foundPerson.Identifiers == null) { return(true); } try { _logger.LogDebug($"Attempting to create found identifier records for SearchRequest[{_searchRequest.SearchRequestId}]"); foreach (var matchFoundPersonId in _foundPerson.Identifiers) { IdentifierEntity identifier = _mapper.Map <IdentifierEntity>(matchFoundPersonId); identifier.SearchRequest = _searchRequest; identifier.InformationSource = _providerDynamicsID; identifier.Person = _returnedPerson; SSG_Identifier newIdentifier = await _searchRequestService.CreateIdentifier(identifier, _cancellationToken); await CreateResultTransaction(newIdentifier); } return(true); } catch (Exception ex) { LogException(ex); return(false); } }
private async Task <bool> UploadIdentifiers(SSG_SearchRequest request, PersonSearchCompleted personCompletedEvent, CancellationToken concellationToken) { if (personCompletedEvent.MatchedPerson.Identifiers == null) { return(true); } foreach (var matchFoundPersonId in personCompletedEvent.MatchedPerson.Identifiers) { SSG_Identifier identifier = _mapper.Map <SSG_Identifier>(matchFoundPersonId); identifier.SSG_SearchRequest = request; var identifer = await _searchRequestService.CreateIdentifier(identifier, concellationToken); } return(true); }
private async Task <bool> UploadIdentifiers(Person person, SSG_SearchRequest request, SSG_Person ssg_person, int?providerDynamicsID, CancellationToken concellationToken) { if (person.Identifiers == null) { return(true); } try { foreach (var matchFoundPersonId in person.Identifiers) { SSG_Identifier identifier = _mapper.Map <SSG_Identifier>(matchFoundPersonId); identifier.SearchRequest = request; identifier.InformationSource = providerDynamicsID; identifier.Person = ssg_person; var identifer = await _searchRequestService.CreateIdentifier(identifier, concellationToken); } return(true); }catch (Exception ex) { _logger.LogError(ex.Message); return(false); } }