示例#1
0
        public async Task <SSG_SearchRequest> ProcessSearchRequestOrdered(SearchRequestOrdered searchRequestOrdered)
        {
            _personSought = searchRequestOrdered.Person;
            var cts = new CancellationTokenSource();

            _cancellationToken = cts.Token;

            SearchRequestEntity searchRequestEntity = _mapper.Map <SearchRequestEntity>(searchRequestOrdered);

            searchRequestEntity.CreatedByApi = true;
            searchRequestEntity.SendNotificationOnCreation = true;
            _uploadedSearchRequest = await _searchRequestService.CreateSearchRequest(searchRequestEntity, cts.Token);

            if (_uploadedSearchRequest == null)
            {
                return(null);
            }
            _logger.LogInformation("Create Search Request successfully");

            PersonEntity personEntity = _mapper.Map <PersonEntity>(_personSought);

            personEntity.SearchRequest     = _uploadedSearchRequest;
            personEntity.InformationSource = InformationSourceType.Request.Value;
            personEntity.IsCreatedByAgency = true;
            personEntity.IsPrimary         = true;
            _uploadedPerson = await _searchRequestService.SavePerson(personEntity, _cancellationToken);

            _logger.LogInformation("Create Person successfully");

            await UploadIdentifiers();
            await UploadAddresses();
            await UploadPhones();
            await UploadEmployment();
            await UploadRelatedPersons();
            await UploadRelatedApplicant(_uploadedSearchRequest.ApplicantFirstName, _uploadedSearchRequest.ApplicantLastName);
            await UploadAliases();
            await UploadSafetyConcern();

            return(_uploadedSearchRequest);
        }