예제 #1
0
        private async Task <bool> UploadEmployment(Person person, SSG_SearchRequest request, SSG_Person ssg_person, int?providerDynamicsID, CancellationToken concellationToken)
        {
            if (person.Employments == null)
            {
                return(true);
            }
            try
            {
                foreach (var employment in person.Employments)
                {
                    EmploymentEntity e = _mapper.Map <EmploymentEntity>(employment);
                    e.SearchRequest     = request;
                    e.InformationSource = providerDynamicsID;
                    e.Person            = ssg_person;
                    SSG_Employment ssg_employment = await _searchRequestService.CreateEmployment(e, concellationToken);

                    if (employment.Employer != null)
                    {
                        foreach (var phone in employment.Employer.Phones)
                        {
                            SSG_EmploymentContact p = _mapper.Map <SSG_EmploymentContact>(phone);
                            p.Employment = ssg_employment;
                            await _searchRequestService.CreateEmploymentContact(p, concellationToken);
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(false);
            }
        }
예제 #2
0
        private async Task <bool> UploadEmployment(bool inUpdateProcess = false)
        {
            if (_personSought.Employments == null)
            {
                return(true);
            }

            _logger.LogDebug($"Attempting to create employment records for PersonSought.");

            foreach (var employment in _personSought.Employments)
            {
                EmploymentEntity e = _mapper.Map <EmploymentEntity>(employment);
                e.SearchRequest     = _uploadedSearchRequest;
                e.InformationSource = InformationSourceType.Request.Value;
                e.Person            = _uploadedPerson;
                e.IsCreatedByAgency = true;
                if (inUpdateProcess)
                {
                    e.UpdateDetails = "New Employment";
                }
                SSG_Employment ssg_employment = await _searchRequestService.CreateEmployment(e, _cancellationToken);

                if (employment.Employer != null)
                {
                    foreach (var phone in employment.Employer.Phones)
                    {
                        EmploymentContactEntity p = _mapper.Map <EmploymentContactEntity>(phone);
                        p.Employment = ssg_employment;
                        if (inUpdateProcess)
                        {
                            e.UpdateDetails = "New EmploymentContact";
                        }
                        await _searchRequestService.CreateEmploymentContact(p, _cancellationToken);
                    }
                }
            }

            _logger.LogInformation("Create employment records for SearchRequest successfully");
            return(true);
        }
예제 #3
0
        private async Task <bool> UploadEmployment( )
        {
            if (_foundPerson.Employments == null)
            {
                return(true);
            }
            try
            {
                _logger.LogDebug($"Attempting to create found employment records for SearchRequest[{_searchRequest.SearchRequestId}]");

                foreach (var employment in _foundPerson.Employments)
                {
                    EmploymentEntity e = _mapper.Map <EmploymentEntity>(employment);
                    e.SearchRequest     = _searchRequest;
                    e.InformationSource = _providerDynamicsID;
                    e.Person            = _returnedPerson;
                    SSG_Employment ssg_employment = await _searchRequestService.CreateEmployment(e, _cancellationToken);

                    //FAMS3-3742-OpenShift to stop creating Employment Contact records
                    //if (employment.Employer != null)
                    //{
                    //    foreach (var phone in employment.Employer.Phones)
                    //    {
                    //        EmploymentContactEntity p = _mapper.Map<EmploymentContactEntity>(phone);
                    //        p.Employment = ssg_employment;
                    //        await _searchRequestService.CreateEmploymentContact(p, _cancellationToken);
                    //    }
                    //}

                    await CreateResultTransaction(ssg_employment);
                }
                return(true);
            }
            catch (Exception ex)
            {
                LogException(ex);
                return(false);
            }
        }