Beispiel #1
0
        /// <summary>
        /// Formats the address 1, address 2 and address 3 lines into one address line.
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        private string FormatStreet(F1toPCO.Model.F1.address address)
        {
            StringBuilder retAddress = new StringBuilder();

            retAddress.Append(address.address1);
            if (!string.IsNullOrEmpty(address.address2))
            {
                retAddress.Append("\n").Append(address.address2);
            }
            if (!string.IsNullOrEmpty(address.address3))
            {
                retAddress.Append("\n").Append(address.address3);
            }

            return(retAddress.ToString().Trim());
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="f1Person"></param>
        /// <param name="pcoPerson"></param>
        private void UpdatePerson(F1toPCO.Model.F1.person f1Person, ref F1toPCO.Model.PCO.person pcoPerson)
        {
            pcoPerson.firstname = string.IsNullOrEmpty(f1Person.goesByName) ? f1Person.firstName : f1Person.goesByName;
            pcoPerson.lastname  = f1Person.lastName;

            //Emails
            F1toPCO.Model.F1.communications emailComms = new F1toPCO.Model.F1.communications();
            emailComms.items = f1Person.communications.FindByGeneralCommunicationType(F1toPCO.Model.F1.communicationGeneralType.Email);
            UpdateEmailCommunications(emailComms, pcoPerson.contactData.emailAddresses);

            //Phone numbers
            F1toPCO.Model.F1.communications phoneComs = new F1toPCO.Model.F1.communications();
            phoneComs.items = f1Person.communications.FindByGeneralCommunicationType(F1toPCO.Model.F1.communicationGeneralType.Telephone);
            UpdatePhoneCommunications(phoneComs, pcoPerson.contactData.phoneNumbers);

            //Address
            F1toPCO.Model.F1.address  primaryAddress = f1Person.addresses.FindByType("Primary");
            F1toPCO.Model.PCO.address pcoAddress     = pcoPerson.contactData.addresses.FindByLocation("Home");
            if (primaryAddress != null)
            {
                if (pcoAddress == null)
                {
                    pcoAddress = new F1toPCO.Model.PCO.address();
                    pcoPerson.contactData.addresses.address.Add(pcoAddress);
                }
                pcoAddress.street = FormatStreet(primaryAddress);
                pcoAddress.city   = primaryAddress.city;
                pcoAddress.state  = primaryAddress.stProvince;
                pcoAddress.zip    = primaryAddress.postalCode;
            }
            else
            {
                if (pcoAddress != null)
                {
                    pcoPerson.contactData.addresses.address.Remove(pcoAddress);
                }
            }
        }