WriteXml() private method

private WriteXml ( XmlTextWriter xmlWriter ) : void
xmlWriter System.Xml.XmlTextWriter
return void
        internal override void WriteXml(XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("account"); // Start: account

            xmlWriter.WriteElementString("account_code", AccountCode);
            xmlWriter.WriteStringIfValid("username", Username);
            xmlWriter.WriteStringIfValid("email", Email);
            xmlWriter.WriteStringIfValid("first_name", FirstName);
            xmlWriter.WriteStringIfValid("last_name", LastName);
            xmlWriter.WriteStringIfValid("company_name", CompanyName);
            xmlWriter.WriteStringIfValid("accept_language", AcceptLanguage);
            xmlWriter.WriteStringIfValid("vat_number", VatNumber);

            if (TaxExempt.HasValue)
            {
                xmlWriter.WriteElementString("tax_exempt", TaxExempt.Value.AsString());
            }

            if (_billingInfo != null)
            {
                _billingInfo.WriteXml(xmlWriter);
            }

            if (Address != null)
            {
                Address.WriteXml(xmlWriter);
            }

            xmlWriter.WriteEndElement(); // End: account
        }
Beispiel #2
0
        internal void WriteXml(XmlTextWriter xmlWriter, string xmlName)
        {
            xmlWriter.WriteStartElement(xmlName); // Start: account

            xmlWriter.WriteElementString("account_code", AccountCode);
            xmlWriter.WriteStringIfValid("username", Username);
            xmlWriter.WriteStringIfValid("email", Email);
            xmlWriter.WriteStringIfValid("first_name", FirstName);
            xmlWriter.WriteStringIfValid("last_name", LastName);
            xmlWriter.WriteStringIfValid("company_name", CompanyName);
            xmlWriter.WriteStringIfValid("accept_language", AcceptLanguage);
            xmlWriter.WriteStringIfValid("vat_number", VatNumber);
            xmlWriter.WriteStringIfValid("entity_use_code", EntityUseCode);
            xmlWriter.WriteStringIfValid("cc_emails", CcEmails);

            xmlWriter.WriteIfCollectionHasAny("shipping_addresses", ShippingAddresses);

            if (TaxExempt.HasValue)
            {
                xmlWriter.WriteElementString("tax_exempt", TaxExempt.Value.AsString());
            }

            if (_billingInfo != null)
            {
                _billingInfo.WriteXml(xmlWriter);
            }

            if (Address != null)
            {
                Address.WriteXml(xmlWriter);
            }

            xmlWriter.WriteEndElement(); // End: account
        }
        internal void WriteXml(XmlTextWriter xmlWriter, string xmlName)
        {
            xmlWriter.WriteStartElement(xmlName); // Start: account

            xmlWriter.WriteElementString("account_code", AccountCode);
            xmlWriter.WriteStringIfValid("username", Username);
            xmlWriter.WriteStringIfValid("email", Email);
            xmlWriter.WriteStringIfValid("first_name", FirstName);
            xmlWriter.WriteStringIfValid("last_name", LastName);
            xmlWriter.WriteStringIfValid("company_name", CompanyName);
            xmlWriter.WriteStringIfValid("accept_language", AcceptLanguage);
            xmlWriter.WriteStringIfValid("vat_number", VatNumber);
            xmlWriter.WriteStringIfValid("entity_use_code", EntityUseCode);
            xmlWriter.WriteStringIfValid("cc_emails", CcEmails);
            xmlWriter.WriteStringIfValid("preferred_locale", PreferredLocale);

            xmlWriter.WriteIfCollectionHasAny("shipping_addresses", ShippingAddresses);
            xmlWriter.WriteIfCollectionHasAny("custom_fields", CustomFields);

            // Clear the parent account by writing empty string. Null should not clear parent.
            if (ParentAccountCode != null)
            {
                xmlWriter.WriteElementString("parent_account_code", ParentAccountCode);
            }

            if (TaxExempt.HasValue)
            {
                xmlWriter.WriteElementString("tax_exempt", TaxExempt.Value.AsString());
            }

            xmlWriter.WriteStringIfValid("exemption_certificate", ExemptionCertificate);

            if (_accountAcquisition != null)
            {
                _accountAcquisition.WriteXml(xmlWriter);
            }

            if (_billingInfo != null)
            {
                _billingInfo.WriteXml(xmlWriter);
            }

            if (Address != null)
            {
                Address.WriteXml(xmlWriter);
            }

            xmlWriter.WriteEndElement(); // End: account
        }