本文整理匯總了C#中System.Xml.XmlTextWriter.WriteStringIfValid方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlTextWriter.WriteStringIfValid方法的具體用法?C# XmlTextWriter.WriteStringIfValid怎麽用?C# XmlTextWriter.WriteStringIfValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlTextWriter
的用法示例。
在下文中一共展示了XmlTextWriter.WriteStringIfValid方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: WriteSubscriptionXml
protected void WriteSubscriptionXml(XmlTextWriter xmlWriter)
{
xmlWriter.WriteStartElement("subscription"); // Start: subscription
xmlWriter.WriteElementString("plan_code", _planCode);
xmlWriter.WriteElementString("currency", Currency);
xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);
xmlWriter.WriteStringIfValid("coupon_code", _couponCode);
if (_couponCodes != null && _couponCodes.Length != 0) {
xmlWriter.WriteStartElement("coupon_codes");
foreach (var _coupon_code in _couponCodes)
{
xmlWriter.WriteElementString("coupon_code", _coupon_code);
}
xmlWriter.WriteEndElement();
}
xmlWriter.WriteElementString("customer_notes", CustomerNotes);
xmlWriter.WriteElementString("terms_and_conditions", TermsAndConditions);
xmlWriter.WriteElementString("vat_reverse_charge_notes", VatReverseChargeNotes);
if (UnitAmountInCents.HasValue)
xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
xmlWriter.WriteElementString("quantity", Quantity.AsString());
if (TrialPeriodEndsAt.HasValue)
xmlWriter.WriteElementString("trial_ends_at", TrialPeriodEndsAt.Value.ToString("s"));
if (BankAccountAuthorizedAt.HasValue)
xmlWriter.WriteElementString("bank_account_authorized_at", BankAccountAuthorizedAt.Value.ToString("s"));
if (StartsAt.HasValue)
xmlWriter.WriteElementString("starts_at", StartsAt.Value.ToString("s"));
if (TotalBillingCycles.HasValue)
xmlWriter.WriteElementString("total_billing_cycles", TotalBillingCycles.Value.AsString());
if (FirstRenewalDate.HasValue)
xmlWriter.WriteElementString("first_renewal_date", FirstRenewalDate.Value.ToString("s"));
if (Bulk.HasValue)
xmlWriter.WriteElementString("bulk", Bulk.ToString().ToLower());
if (CollectionMethod.Like("manual"))
{
xmlWriter.WriteElementString("collection_method", "manual");
xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
xmlWriter.WriteElementString("po_number", PoNumber);
}
else if (CollectionMethod.Like("automatic"))
xmlWriter.WriteElementString("collection_method", "automatic");
// <account> and billing info
Account.WriteXml(xmlWriter);
xmlWriter.WriteEndElement(); // End: subscription
}
示例2: WriteXml
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);
xmlWriter.WriteStringIfValid("entity_use_code", EntityUseCode);
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
}
示例3: WriteXml
internal override void WriteXml(XmlTextWriter xmlWriter)
{
xmlWriter.WriteStartElement("billing_info"); // Start: billing_info
//if a recurly js token is supplied we don't want to send billing info here
if (string.IsNullOrEmpty(TokenId))
{
xmlWriter.WriteStringIfValid("first_name", FirstName);
xmlWriter.WriteStringIfValid("last_name", LastName);
xmlWriter.WriteStringIfValid("name_on_account", NameOnAccount);
xmlWriter.WriteStringIfValid("address1", Address1);
xmlWriter.WriteStringIfValid("address2", Address2);
xmlWriter.WriteStringIfValid("city", City);
xmlWriter.WriteStringIfValid("state", State);
xmlWriter.WriteStringIfValid("zip", PostalCode);
xmlWriter.WriteStringIfValid("country", Country);
xmlWriter.WriteStringIfValid("phone", PhoneNumber);
xmlWriter.WriteStringIfValid("vat_number", VatNumber);
xmlWriter.WriteStringIfValid("currency", Currency);
if (!IpAddress.IsNullOrEmpty())
xmlWriter.WriteElementString("ip_address", IpAddress);
else
Debug.WriteLine("Recurly Client Library: Recording IP Address is strongly recommended.");
if (!CreditCardNumber.IsNullOrEmpty())
{
xmlWriter.WriteElementString("number", CreditCardNumber);
xmlWriter.WriteElementString("month", ExpirationMonth.AsString());
xmlWriter.WriteElementString("year", ExpirationYear.AsString());
xmlWriter.WriteStringIfValid("verification_value", VerificationValue);
}
if (!AccountNumber.IsNullOrEmpty())
{
xmlWriter.WriteElementString("routing_number", RoutingNumber);
xmlWriter.WriteElementString("account_number", AccountNumber);
xmlWriter.WriteElementString("account_type", AccountType.ToString().EnumNameToTransportCase());
}
if (!PaypalBillingAgreementId.IsNullOrEmpty())
{
xmlWriter.WriteElementString("paypal_billing_agreement_id", PaypalBillingAgreementId);
}
}
xmlWriter.WriteStringIfValid("token_id", TokenId);
xmlWriter.WriteEndElement(); // End: billing_info
}
示例4: WriteChangeSubscriptionXml
protected void WriteChangeSubscriptionXml(XmlTextWriter xmlWriter, ChangeTimeframe timeframe)
{
xmlWriter.WriteStartElement("subscription"); // Start: subscription
xmlWriter.WriteElementString("timeframe", timeframe.ToString().EnumNameToTransportCase());
xmlWriter.WriteElementString("quantity", Quantity.AsString());
xmlWriter.WriteStringIfValid("plan_code", _planCode);
xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);
xmlWriter.WriteStringIfValid("coupon_code", _couponCode);
if (_couponCodes != null && _couponCodes.Length != 0) {
xmlWriter.WriteStartElement("coupon_codes");
foreach (var _coupon_code in _couponCodes)
{
xmlWriter.WriteElementString("coupon_code", _coupon_code);
}
xmlWriter.WriteEndElement();
}
if (UnitAmountInCents.HasValue)
xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
if (CollectionMethod.Like("manual"))
{
xmlWriter.WriteElementString("collection_method", "manual");
xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
xmlWriter.WriteElementString("po_number", PoNumber);
}
else if (CollectionMethod.Like("automatic"))
xmlWriter.WriteElementString("collection_method", "automatic");
xmlWriter.WriteEndElement(); // End: subscription
}
示例5: WriteXml
internal override void WriteXml(XmlTextWriter xmlWriter)
{
xmlWriter.WriteStartElement("transaction");
xmlWriter.WriteElementString("amount_in_cents", AmountInCents.AsString());
xmlWriter.WriteElementString("currency", Currency);
xmlWriter.WriteStringIfValid("description", Description);
xmlWriter.WriteElementString("tax_exempt", TaxExempt.AsString().ToLower());
xmlWriter.WriteStringIfValid("tax_code", TaxCode);
xmlWriter.WriteStringIfValid("accounting_code", AccountingCode);
if (Account != null)
{
Account.WriteXml(xmlWriter);
}
xmlWriter.WriteEndElement();
}
示例6: WriteXml
internal override void WriteXml(XmlTextWriter xmlWriter)
{
xmlWriter.WriteStartElement("measured_unit");
xmlWriter.WriteElementString("name", Name);
xmlWriter.WriteElementString("display_name", DisplayName);
xmlWriter.WriteStringIfValid("description", Description);
xmlWriter.WriteEndElement();
}
示例7: WriteXml
internal override void WriteXml(XmlTextWriter xmlWriter)
{
xmlWriter.WriteStartElement("plan");
xmlWriter.WriteElementString("plan_code", PlanCode);
xmlWriter.WriteElementString("name", Name);
xmlWriter.WriteStringIfValid("description", Description);
xmlWriter.WriteStringIfValid("accounting_code", AccountingCode);
if (PlanIntervalLength > 0)
{
xmlWriter.WriteElementString("plan_interval_unit", PlanIntervalUnit.ToString().EnumNameToTransportCase());
xmlWriter.WriteElementString("plan_interval_length", PlanIntervalLength.AsString());
}
if (TrialIntervalLength > 0)
{
xmlWriter.WriteElementString("trial_interval_unit", TrialIntervalUnit.ToString().EnumNameToTransportCase());
xmlWriter.WriteElementString("trial_interval_length", TrialIntervalLength.AsString());
}
xmlWriter.WriteIfCollectionHasAny("setup_fee_in_cents", SetupFeeInCents, pair => pair.Key, pair => pair.Value.AsString());
xmlWriter.WriteIfCollectionHasAny("unit_amount_in_cents", UnitAmountInCents, pair => pair.Key, pair => pair.Value.AsString());
if (TotalBillingCycles.HasValue && TotalBillingCycles > 0)
xmlWriter.WriteElementString("total_billing_cycles", TotalBillingCycles.Value.AsString());
xmlWriter.WriteStringIfValid("unit_name", UnitName);
if (DisplayDonationAmounts.HasValue)
xmlWriter.WriteElementString("display_donation_amounts", DisplayDonationAmounts.Value.AsString());
if (DisplayQuantity.HasValue)
xmlWriter.WriteElementString("display_quantity", DisplayQuantity.Value.AsString());
if (DisplayPhoneNumber.HasValue)
xmlWriter.WriteElementString("display_phone_number", DisplayPhoneNumber.Value.AsString());
if (BypassHostedConfirmation.HasValue)
xmlWriter.WriteElementString("bypass_hosted_confirmation", BypassHostedConfirmation.Value.AsString());
if(TaxExempt.HasValue)
xmlWriter.WriteElementString("tax_exempt", TaxExempt.Value.AsString());
xmlWriter.WriteStringIfValid("success_url", SuccessUrl);
xmlWriter.WriteStringIfValid("cancel_url", CancelUrl);
xmlWriter.WriteEndElement();
}
示例8: WriteSubscriptionXml
protected void WriteSubscriptionXml(XmlTextWriter xmlWriter)
{
xmlWriter.WriteStartElement("subscription"); // Start: subscription
xmlWriter.WriteElementString("plan_code", _planCode);
xmlWriter.WriteElementString("currency", Currency);
xmlWriter.WriteIfCollectionHasAny("subscription_add_ons", AddOns);
xmlWriter.WriteStringIfValid("coupon_code", _couponCode);
if (UnitAmountInCents.HasValue)
xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.Value.AsString());
xmlWriter.WriteElementString("quantity", Quantity.AsString());
if (TrialPeriodEndsAt.HasValue)
xmlWriter.WriteElementString("trial_ends_at", TrialPeriodEndsAt.Value.ToString("s"));
if (StartsAt.HasValue)
xmlWriter.WriteElementString("starts_at", StartsAt.Value.ToString("s"));
if (TotalBillingCycles.HasValue)
xmlWriter.WriteElementString("total_billing_cycles", TotalBillingCycles.Value.AsString());
if (FirstRenewalDate.HasValue)
xmlWriter.WriteElementString("first_renewal_date", FirstRenewalDate.Value.ToString("s"));
if (CollectionMethod.Like("manual"))
{
xmlWriter.WriteElementString("collection_method", "manual");
xmlWriter.WriteElementString("net_terms", NetTerms.Value.AsString());
xmlWriter.WriteElementString("po_number", PoNumber);
}
// <account> and billing info
Account.WriteXml(xmlWriter);
xmlWriter.WriteEndElement(); // End: subscription
}
示例9: WriteXml
internal override void WriteXml(XmlTextWriter xmlWriter)
{
xmlWriter.WriteStartElement("billing_info"); // Start: billing_info
xmlWriter.WriteStringIfValid("first_name", FirstName);
xmlWriter.WriteStringIfValid("last_name", LastName);
xmlWriter.WriteStringIfValid("address1", Address1);
xmlWriter.WriteStringIfValid("address2", Address2);
xmlWriter.WriteStringIfValid("city", City);
xmlWriter.WriteStringIfValid("state", State);
xmlWriter.WriteStringIfValid("zip", PostalCode);
xmlWriter.WriteStringIfValid("country", Country);
xmlWriter.WriteStringIfValid("phone", PhoneNumber);
xmlWriter.WriteStringIfValid("vat_number", VatNumber);
if (!IpAddress.IsNullOrEmpty())
xmlWriter.WriteElementString("ip_address", IpAddress);
else
Debug.WriteLine("Recurly Client Library: Recording IP Address is strongly recommended.");
if (!CreditCardNumber.IsNullOrEmpty())
{
xmlWriter.WriteElementString("number", CreditCardNumber);
xmlWriter.WriteElementString("month", ExpirationMonth.AsString());
xmlWriter.WriteElementString("year", ExpirationYear.AsString());
xmlWriter.WriteStringIfValid("verification_value", VerificationValue);
}
xmlWriter.WriteStringIfValid("token_id", TokenId);
xmlWriter.WriteEndElement(); // End: billing_info
}