/// <summary>
 /// Creates a new instance of the <see cref="Contact"/> class with the
 /// specified contact information.
 /// </summary>
 ///
 /// <param name="contactInfo">
 /// The information about the contact.
 /// </param>
 ///
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="contactInfo"/> parameter is <b>null</b>.
 /// </exception>
 ///
 public Contact(ContactInfo contactInfo)
     : base(TypeId)
 {
     ContactInformation = contactInfo;
 }
Exemple #2
0
        /// <summary>
        /// Populates this <see cref="Payer"/> instance from the data in the XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the payer data from.
        /// </param>
        ///
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> parameter is not
        /// a payer node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator payerNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("payer");

            Validator.ThrowInvalidIfNull(payerNav, Resources.PayerUnexpectedNode);

            _planName = payerNav.SelectSingleNode("plan-name").Value;

            _coverageType =
                XPathHelper.GetOptNavValue <CodableValue>(payerNav, "coverage-type");

            XPathNavigator carrierIdNav =
                payerNav.SelectSingleNode("carrier-id");

            if (carrierIdNav != null)
            {
                _carrierId = carrierIdNav.Value;
            }

            XPathNavigator groupNumNav =
                payerNav.SelectSingleNode("group-num");

            if (groupNumNav != null)
            {
                _groupNumber = groupNumNav.Value;
            }

            XPathNavigator planCodeNav =
                payerNav.SelectSingleNode("plan-code");

            if (planCodeNav != null)
            {
                _planCode = planCodeNav.Value;
            }

            XPathNavigator subscriberIdNav =
                payerNav.SelectSingleNode("subscriber-id");

            if (subscriberIdNav != null)
            {
                _subscriberId = subscriberIdNav.Value;
            }

            XPathNavigator personCodeNav =
                payerNav.SelectSingleNode("person-code");

            if (personCodeNav != null)
            {
                _personCode = personCodeNav.Value;
            }

            XPathNavigator subscriberNameNav =
                payerNav.SelectSingleNode("subscriber-name");

            if (subscriberNameNav != null)
            {
                _subscriberName = subscriberNameNav.Value;
            }

            XPathNavigator subscriberDobNav =
                payerNav.SelectSingleNode("subscriber-dob");

            if (subscriberDobNav != null)
            {
                _subscriberDateOfBirth = new HealthServiceDateTime();
                _subscriberDateOfBirth.ParseXml(subscriberDobNav);
            }

            XPathNavigator isPrimaryNav =
                payerNav.SelectSingleNode("is-primary");

            if (isPrimaryNav != null)
            {
                _isPrimary = isPrimaryNav.ValueAsBoolean;
            }

            XPathNavigator expirationDateNav =
                payerNav.SelectSingleNode("expiration-date");

            if (expirationDateNav != null)
            {
                _expirationDate = new HealthServiceDateTime();
                _expirationDate.ParseXml(expirationDateNav);
            }

            XPathNavigator contactNav =
                payerNav.SelectSingleNode("contact");

            if (contactNav != null)
            {
                _contact = new ContactInfo();
                _contact.ParseXml(contactNav);
            }
        }