internal static ContactAddress SetContact(this ContactAddress address, IContactKey contactKey)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }
            if (contactKey == null)
            {
                throw new ArgumentNullException("contactKey");
            }

            address.Contact   = null;
            address.CompanyId = contactKey.CompanyKey_Id;
            address.ContactId = contactKey.ContactKey_Id;

            return(address);
        }
Пример #2
0
 public static ContactKey ToContactKey(this IContactKey k)
 {
     return(new ContactKey(k));
 }
Пример #3
0
        private static IEnumerable <ContactAddress> GetContactAddresses(IEnumerable <ContactAddressDTO> addresses, IContactKey contactKey)
        {
            var nextAddressId = 1;

            return(addresses.Select(a => new ContactAddress
            {
                OldContextID = a.OldContextID,
                CompanyId = contactKey.CompanyKey_Id,
                ContactId = contactKey.ContactKey_Id,
                AddressId = nextAddressId++,
                AddressDescription = a.AddrType,

                Address = new Address
                {
                    AddressLine1 = a.Address1_IA,
                    AddressLine2 = a.Address2_IA,
                    AddressLine3 = a.Address3_IA,
                    City = a.City_IA,
                    State = a.State_IA,
                    PostalCode = a.Zip_IA,
                    Country = a.Country_IA
                }
            }));
        }