Created
December 8, 2015 20:45
-
-
Save Mozu-CS/2f6e164dfa7f1a20e652 to your computer and use it in GitHub Desktop.
Method for mapping a customer contact to a customer object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Mozu.Api.Contracts.Customer.CustomerContact MapCustomerContact(System.Data.DataRow drContact) | |
{ | |
var mappedContact = new Mozu.Api.Contracts.Customer.CustomerContact() | |
{ | |
CompanyOrOrganization = drContact["CompanyOrOrganization"].ToString(), | |
Email = drContact["Email"].ToString(), | |
FaxNumber = drContact["FaxNumber"].ToString(), | |
FirstName = drContact["FirstName"].ToString(), | |
LastNameOrSurname = drContact["LastNameOrSurname"].ToString(), | |
MiddleNameOrInitial = drContact["MiddleNameOrInitial"].ToString(), | |
Types = new List<Mozu.Api.Contracts.Customer.ContactType>() | |
{ | |
new Mozu.Api.Contracts.Customer.ContactType() | |
{ | |
Name = drContact["Type"].ToString(), | |
IsPrimary = Convert.ToBoolean(drContact["IsPrimary"]), | |
} | |
}, | |
Address = new Mozu.Api.Contracts.Core.Address() | |
{ | |
Address1 = drContact["Address1"].ToString(), | |
Address2 = drContact["Address2"].ToString(), | |
AddressType = drContact["AddressType"].ToString(), | |
CityOrTown = drContact["CityOrTown"].ToString(), | |
StateOrProvince = drContact["StateOrProvince"].ToString(), | |
PostalOrZipCode = drContact["PostalOrZipCode"].ToString(), | |
CountryCode = drContact["CountryCode"].ToString() | |
}, | |
PhoneNumbers = new Mozu.Api.Contracts.Core.Phone() | |
{ | |
Home = drContact["HomePhone"].ToString(), | |
Mobile = drContact["MobilePhone"].ToString(), | |
Work = drContact["WorkPhone"].ToString(), | |
} | |
}; | |
return mappedContact; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment