Beispiel #1
0
        private ResidentInformation MapDetailsToResidentInformation(Person person, Address address,
                                                                    TenancyAgreement tenancyAgreement, ContactLink contactLink, int?contactKey)
        {
            var resident = person.ToDomain();

            resident.UPRN             = address?.UPRN;
            resident.ResidentAddress  = address?.ToDomain();
            resident.TenancyReference = tenancyAgreement?.TagRef.Trim();
            resident.ContactKey       = contactKey.ToString();
            resident.TenureType       = (tenancyAgreement == null) ? null
              : $"{tenancyAgreement.UhTenureTypeId.Trim()}: {tenancyAgreement.UhTenureType.Description.Trim()}";

            if (contactLink == null)
            {
                return(resident);
            }

            var telephoneNumberForPerson = _UHContext
                                           .TelephoneNumbers.Where(t => t.ContactID == contactLink.ContactID).ToList();

            var emailAddressForPerson =
                _UHContext.EmailAddresses.Where(c => c.ContactID == contactLink.ContactID).ToList();

            AttachContactDetailsToPerson(resident, telephoneNumberForPerson, emailAddressForPerson);

            return(resident);
        }
 public static Address ToDomain(this DbAddress databaseEntity)
 {
     return(new Address
     {
         PropertyRef = databaseEntity.PropertyRef.Trim(),
         AddressLine1 = databaseEntity.AddressLine1.Trim(),
         PostCode = databaseEntity.PostCode.Trim()
     });
 }
Beispiel #3
0
        private static ResidentInformation MapToExpectedDomain(Person databaseEntity, Address address,
                                                               List <Phone> phoneNumber, List <Email> emailAddresses,
                                                               TenancyAgreement tenancy, string contactKey = "")
        {
            var domainEntity = databaseEntity.ToDomain();

            domainEntity.ResidentAddress  = address.ToDomain();
            domainEntity.UPRN             = address.UPRN;
            domainEntity.PhoneNumber      = phoneNumber;
            domainEntity.Email            = emailAddresses;
            domainEntity.TenancyReference = tenancy.TagRef;
            domainEntity.ContactKey       = contactKey;
            domainEntity.TenureType       = (tenancy == null) ? null
              : $"{tenancy.UhTenureTypeId.Trim()}: {tenancy.UhTenureType.Description.Trim()}";
            return(domainEntity);
        }