/// <summary>
 /// Add a contact to this customer
 /// </summary>
 /// <param name="vo"></param>
 public void addContact(ContactVO vo)
 {
     if (vo == null || this.contacts == null || this.contacts.Contains(vo))
     {
         return;
     }
     this.contacts.Add(new ContactVO(vo));
 }
        /// <summary>
        /// Returns the contact object of the customer
        /// that is set as primary
        /// </summary>
        /// <returns></returns>
        public ContactVO getPrimaryContact()
        {
            ContactVO custContact = this.contacts.Find(delegate(ContactVO contactObj)
            {
                return(contactObj.TeleusrDefText == "true");
            });

            return(custContact);
        }
        /// <summary>
        /// Returns the contact type which is set as the
        /// primary phone in the system
        /// </summary>
        /// <returns></returns>
        public string CustPhoneType()
        {
            ContactVO primaryContact = this.getPrimaryContact();

            if (primaryContact != null)
            {
                return(primaryContact.ContactType);
            }
            return(string.Empty);
        }
        /// <summary>
        /// Get a contact object that matches the contact type
        /// </summary>
        /// <param name="contactType"></param>
        /// <returns></returns>
        public ContactVO getContact(string contactType)
        {
            if (contactType.Trim().Length == 0 || this.contacts == null)
            {
                return(null);
            }
            ContactVO contObj = this.contacts.Find(delegate(ContactVO contactObj)
            {
                return(contactObj.TypeOfContact() == contactType);
            });

            return(contObj);
        }
Esempio n. 5
0
 public ContactVO(ContactVO cvo)
 {
     if (cvo != null)
     {
         this.ContactType        = cvo.ContactType;
         this.ContactAreaCode    = cvo.ContactAreaCode;
         this.ContactExtension   = cvo.ContactExtension;
         this.ContactPhoneNumber = cvo.ContactPhoneNumber;
         this.TelecomNumType     = cvo.TelecomNumType;
         this.CountryDialNumCode = cvo.CountryDialNumCode;
         this.TeleusrDefText     = cvo.TeleusrDefText;
     }
     else
     {
         this.initialize();
     }
 }
        /// <summary>
        /// Get a contact object that matches the contact type,areacode, phone number, extension and country code provided
        /// overloaded method
        /// </summary>
        /// <param name="contactType"></param>
        /// <param name="areaCode"></param>
        /// <param name="phoneNum"></param>
        /// <param name="extension"></param>
        /// <param name="countryCode"></param>
        /// <param name="isPrimary"></param>
        /// <returns></returns>
        public ContactVO getContact(string contactType, string areaCode, string phoneNum,
                                    string extension, string countryCode, string isPrimary)
        {
            if (this.contacts == null)
            {
                return(null);
            }
            ContactVO contObj = this.contacts.Find(delegate(ContactVO contactobj)
            {
                return(contactobj.ContactType == contactType &&
                       contactobj.ContactAreaCode == areaCode &&
                       contactobj.ContactPhoneNumber == phoneNum &&
                       contactobj.ContactExtension == extension &&
                       contactobj.CountryDialNumCode == countryCode &&
                       contactobj.TeleusrDefText == isPrimary
                       );
            });

            return(contObj);
        }
        /// <summary>
        /// Updates an existing phone number with the values passed in and if it is not there
        /// creates a new contact object to add to the customer
        /// </summary>
        /// <param name="contactType"></param>
        /// <param name="contactAreaCode"></param>
        /// <param name="contactNumber"></param>
        /// <param name="extension"></param>
        /// <param name="countryCode"></param>
        /// <param name="telecomType"></param>
        /// <param name="isPrimary"></param>
        public void updatePhoneNumber(
            string contactType,
            string contactAreaCode,
            string contactNumber,
            string extension,
            string countryCode,
            string telecomType,
            string isPrimary)
        {
            bool      phoneUpdated    = false;
            ContactVO customerContact = (from contact in this.contacts
                                         where contact.ContactType == contactType &&
                                         contact.TelecomNumType == telecomType
                                         select contact).FirstOrDefault();

            if (customerContact != null)
            {
                customerContact.ContactAreaCode    = contactAreaCode;
                customerContact.ContactPhoneNumber = contactNumber;
                customerContact.ContactExtension   = extension;
                customerContact.CountryDialNumCode = countryCode;
                customerContact.TelecomNumType     = telecomType;
                customerContact.TeleusrDefText     = isPrimary;
                phoneUpdated = true;
            }
            if (!(phoneUpdated))
            {
                ContactVO custContact = new ContactVO();
                custContact.ContactType        = contactType;
                custContact.ContactAreaCode    = contactAreaCode;
                custContact.ContactPhoneNumber = contactNumber;
                custContact.ContactExtension   = extension;
                custContact.CountryDialNumCode = countryCode;
                custContact.TelecomNumType     = telecomType;
                custContact.TeleusrDefText     = isPrimary;
                this.addContact(custContact);
            }
        }