public static FWTIndividual Map(this Customer customer) { var contactName = new FWTIndividualName { Title = customer.Title?.Trim(), Forename = new[] { customer.Forename?.Trim() }, Initials = customer.Initials?.Trim(), Surname = customer.Surname?.Trim(), Preferred = true }; var personDetails = new FWTIndividual { Name = new[] { contactName } }; if (customer.DateOfBirth != DateTime.MinValue) { personDetails.DateOfBirth = customer.DateOfBirth; personDetails.DateOfBirthSpecified = true; } // Setup the address details if (customer.Address != null) { personDetails.ContactPostals = new[] { (customer.Address.Map()) }; } // Setup the telephone contact information. var contactPhones = new FWTContactPhone { Number = customer.Telephone?.Trim(), Preferred = true }; personDetails.ContactPhones = new[] { contactPhones }; // Setup email address information. var contactEmails = new FWTContactEmail { EmailAddress = customer.Email?.Trim(), Preferred = true }; personDetails.ContactEmails = new[] { contactEmails }; return(personDetails); }
private static bool AddNameUpdates(this FWTIndividualUpdate update, FWTIndividual individual, Customer customer) { if (!string.IsNullOrWhiteSpace(customer.Surname) && individual.Name == null) { var newName = new FWTIndividualName { Forename = new[] { customer.Forename + string.Empty }, Surname = customer.Surname + string.Empty, Initials = customer.Initials + string.Empty, Title = customer.Title + string.Empty, }; update.Name = new[] { new FWTIndividualNameUpdate { IndividualNameDetails = newName, ListItemUpdateType = "Insert" } }; return(true); } return(false); }