Пример #1
0
        private async Task <bool> UploadCompensationClaims()
        {
            if (_foundPerson.CompensationClaims == null)
            {
                return(true);
            }
            try
            {
                _logger.LogDebug($"Attempting to create compnsation claims records for SearchRequest[{_searchRequest.SearchRequestId}]");

                foreach (CompensationClaim claim in _foundPerson.CompensationClaims)
                {
                    BankingInformationEntity bankEntity = null;
                    if (claim.BankInfo != null)
                    {
                        bankEntity = _mapper.Map <BankingInformationEntity>(claim.BankInfo);
                        bankEntity.InformationSource = _providerDynamicsID;
                    }

                    EmploymentEntity employmentEntity = null;
                    if (claim.Employer != null)
                    {
                        employmentEntity = _mapper.Map <EmploymentEntity>(claim.Employer);
                        employmentEntity.InformationSource = _providerDynamicsID;
                        employmentEntity.Date1             = claim.ReferenceDates?.SingleOrDefault(m => m.Index == 0)?.Value.DateTime;
                        employmentEntity.Date1Label        = claim.ReferenceDates?.SingleOrDefault(m => m.Index == 0)?.Key;
                        //FAMS3-3742: OpenShift to stop creating Employment Contact records
                        //List<EmploymentContactEntity> contacts = new List<EmploymentContactEntity>();
                        //if (claim.Employer.Phones != null)
                        //{
                        //    foreach (var phone in claim.Employer.Phones)
                        //    {
                        //        EmploymentContactEntity p = _mapper.Map<EmploymentContactEntity>(phone);
                        //        contacts.Add(p);
                        //    }
                        //}
                        //employmentEntity.EmploymentContactEntities = contacts.ToArray();
                    }

                    CompensationClaimEntity ssg_claim = _mapper.Map <CompensationClaimEntity>(claim);
                    ssg_claim.SearchRequest         = _searchRequest;
                    ssg_claim.InformationSource     = _providerDynamicsID;
                    ssg_claim.Person                = _returnedPerson;
                    ssg_claim.BankInformationEntity = bankEntity;
                    ssg_claim.EmploymentEntity      = employmentEntity;

                    SSG_Asset_WorkSafeBcClaim ssg_Claim = await _searchRequestService.CreateCompensationClaim(ssg_claim, _cancellationToken);
                    await CreateResultTransaction(ssg_Claim);
                }
                return(true);
            }
            catch (Exception ex)
            {
                LogException(ex);
                return(false);
            }
        }