本文整理匯總了C#中System.Xml.XmlTextReader.ReadElementContentAsDecimal方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlTextReader.ReadElementContentAsDecimal方法的具體用法?C# XmlTextReader.ReadElementContentAsDecimal怎麽用?C# XmlTextReader.ReadElementContentAsDecimal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Xml.XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.ReadElementContentAsDecimal方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReadXml
internal override void ReadXml(XmlTextReader reader)
{
while (reader.Read())
{
// End of invoice element, get out of here
if (reader.Name == "invoice" && reader.NodeType == XmlNodeType.EndElement)
break;
if (reader.NodeType != XmlNodeType.Element) continue;
switch (reader.Name)
{
case "account":
var accountHref = reader.GetAttribute("href");
AccountCode = Uri.UnescapeDataString(accountHref.Substring(accountHref.LastIndexOf("/") + 1));
break;
case "subscription":
var subHref = reader.GetAttribute("href");
SubscriptionUuid = Uri.UnescapeDataString(subHref.Substring(subHref.LastIndexOf("/") + 1));
break;
case "uuid":
Uuid = reader.ReadElementContentAsString();
break;
case "state":
State = reader.ReadElementContentAsString().ParseAsEnum<InvoiceState>();
break;
case "invoice_number":
int invNumber;
if (Int32.TryParse(reader.ReadElementContentAsString(), out invNumber))
InvoiceNumber = invNumber;
break;
case "po_number":
PoNumber = reader.ReadElementContentAsString();
break;
case "vat_number":
VatNumber = reader.ReadElementContentAsString();
break;
case "subtotal_in_cents":
SubtotalInCents = reader.ReadElementContentAsInt();
break;
case "tax_in_cents":
TaxInCents = reader.ReadElementContentAsInt();
break;
case "total_in_cents":
TotalInCents = reader.ReadElementContentAsInt();
break;
case "currency":
Currency = reader.ReadElementContentAsString();
break;
case "created_at":
DateTime createdAt;
if (DateTime.TryParse(reader.ReadElementContentAsString(), out createdAt))
CreatedAt = createdAt;
break;
case "closed_at":
DateTime closedAt;
if (DateTime.TryParse(reader.ReadElementContentAsString(), out closedAt))
ClosedAt = closedAt;
break;
case "tax_type":
TaxType = reader.ReadElementContentAsString();
break;
case "tax_rate":
TaxRate = reader.ReadElementContentAsDecimal();
break;
case "net_terms":
NetTerms = reader.ReadElementContentAsInt();
break;
case "collection_method":
CollectionMethod = reader.ReadElementContentAsString();
break;
case "line_items":
// overrite existing value with the Recurly API response
Adjustments = new AdjustmentList();
Adjustments.ReadXml(reader);
break;
case "transactions":
// overrite existing value with the Recurly API response
Transactions = new TransactionList();
Transactions.ReadXml(reader);
break;
}
//.........這裏部分代碼省略.........
示例2: ReadXml
//.........這裏部分代碼省略.........
case "expires_at":
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
ExpiresAt = dateVal;
break;
case "current_period_started_at":
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
CurrentPeriodStartedAt = dateVal;
break;
case "current_period_ends_at":
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
CurrentPeriodEndsAt = dateVal;
break;
case "trial_started_at":
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
TrialPeriodStartedAt = dateVal;
break;
case "trial_ends_at":
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
_trialPeriodEndsAt = dateVal;
break;
case "bank_account_authorized_at":
if (DateTime.TryParse(reader.ReadElementContentAsString(), out dateVal))
BankAccountAuthorizedAt = dateVal;
break;
case "subscription_add_ons":
// overwrite existing list with what came back from Recurly
AddOns = new SubscriptionAddOnList(this);
AddOns.ReadXml(reader);
break;
case "invoice":
href = reader.GetAttribute("href");
if (null != href)
_invoiceNumber = Uri.UnescapeDataString(href.Substring(href.LastIndexOf("/") + 1));
break;
case "pending_subscription":
PendingSubscription = new Subscription { IsPendingSubscription = true };
PendingSubscription.ReadPendingSubscription(reader);
// TODO test all returned properties are read
break;
case "collection_method":
CollectionMethod = reader.ReadElementContentAsString();
break;
case "net_terms":
NetTerms = reader.ReadElementContentAsInt();
break;
case "po_number":
PoNumber = reader.ReadElementContentAsString();
break;
case "total_billing_cycles":
if (Int32.TryParse(reader.ReadElementContentAsString(), out billingCycles))
TotalBillingCycles = billingCycles;
break;
case "remaining_billing_cycles":
if (Int32.TryParse(reader.ReadElementContentAsString(), out billingCycles))
RemainingBillingCycles = billingCycles;
break;
case "tax_in_cents":
TaxInCents = reader.ReadElementContentAsInt();
break;
case "tax_type":
TaxType = reader.ReadElementContentAsString();
break;
case "tax_rate":
TaxRate = reader.ReadElementContentAsDecimal();
break;
case "customer_notes":
CustomerNotes = reader.ReadElementContentAsString();
break;
case "terms_and_conditions":
TermsAndConditions = reader.ReadElementContentAsString();
break;
case "vat_reverse_charge_notes":
VatReverseChargeNotes = reader.ReadElementContentAsString();
break;
case "address":
Address = new Address(reader);
break;
}
}
}
示例3: ReadXml
internal override void ReadXml(XmlTextReader reader)
{
while (reader.Read())
{
// End of invoice element, get out of here
if (reader.Name == "invoice" && reader.NodeType == XmlNodeType.EndElement)
break;
if (reader.NodeType != XmlNodeType.Element) continue;
switch (reader.Name)
{
case "account":
var accountHref = reader.GetAttribute("href");
AccountCode = Uri.UnescapeDataString(accountHref.Substring(accountHref.LastIndexOf("/") + 1));
break;
case "subscription":
var subHref = reader.GetAttribute("href");
SubscriptionUuid = Uri.UnescapeDataString(subHref.Substring(subHref.LastIndexOf("/") + 1));
break;
case "original_invoice":
var originalInvoiceHref = reader.GetAttribute("href");
var invoiceNumber = Uri.UnescapeDataString(originalInvoiceHref.Substring(originalInvoiceHref.LastIndexOf("/") + 1));
MatchCollection matches = Regex.Matches(invoiceNumber, "([^\\d]{2})(\\d+)");
if (matches.Count == 1)
{
OriginalInvoiceNumberPrefix = matches[0].Groups[1].Value;
OriginalInvoiceNumber = int.Parse(matches[0].Groups[2].Value);
}
else
{
OriginalInvoiceNumber = int.Parse(invoiceNumber);
}
break;
case "uuid":
Uuid = reader.ReadElementContentAsString();
break;
case "state":
State = reader.ReadElementContentAsString().ParseAsEnum<InvoiceState>();
break;
case "invoice_number":
int invNumber;
if (Int32.TryParse(reader.ReadElementContentAsString(), out invNumber))
InvoiceNumber = invNumber;
break;
case "invoice_number_prefix":
InvoiceNumberPrefix = reader.ReadElementContentAsString();
break;
case "po_number":
PoNumber = reader.ReadElementContentAsString();
break;
case "vat_number":
VatNumber = reader.ReadElementContentAsString();
break;
case "subtotal_in_cents":
SubtotalInCents = reader.ReadElementContentAsInt();
break;
case "tax_in_cents":
TaxInCents = reader.ReadElementContentAsInt();
break;
case "total_in_cents":
TotalInCents = reader.ReadElementContentAsInt();
break;
case "currency":
Currency = reader.ReadElementContentAsString();
break;
case "created_at":
DateTime createdAt;
if (DateTime.TryParse(reader.ReadElementContentAsString(), out createdAt))
CreatedAt = createdAt;
break;
case "closed_at":
DateTime closedAt;
if (DateTime.TryParse(reader.ReadElementContentAsString(), out closedAt))
ClosedAt = closedAt;
break;
case "tax_type":
TaxType = reader.ReadElementContentAsString();
break;
case "tax_rate":
TaxRate = reader.ReadElementContentAsDecimal();
break;
//.........這裏部分代碼省略.........
示例4: ReadXml
internal override void ReadXml(XmlTextReader reader)
{
while (reader.Read())
{
// End of account element, get out of here
if (reader.Name == "adjustment" && reader.NodeType == XmlNodeType.EndElement)
break;
if (reader.NodeType != XmlNodeType.Element) continue;
switch (reader.Name)
{
case "account":
var href = reader.GetAttribute("href");
AccountCode = Uri.UnescapeDataString(href.Substring(href.LastIndexOf("/") + 1));
break;
case "uuid":
Uuid = reader.ReadElementContentAsString();
break;
case "description":
Description = reader.ReadElementContentAsString();
break;
case "accounting_code":
AccountingCode = reader.ReadElementContentAsString();
break;
case "product_code":
ProductCode = reader.ReadElementContentAsString();
break;
case "origin":
Origin = reader.ReadElementContentAsString();
break;
case "unit_amount_in_cents":
UnitAmountInCents = reader.ReadElementContentAsInt();
break;
case "quantity":
Quantity = reader.ReadElementContentAsInt();
break;
case "discount_in_cents":
DiscountInCents = reader.ReadElementContentAsInt();
break;
case "tax_in_cents":
TaxInCents = reader.ReadElementContentAsInt();
break;
case "total_in_cents":
TotalInCents = reader.ReadElementContentAsInt();
break;
case "currency":
Currency = reader.ReadElementContentAsString();
break;
case "tax_exempt":
TaxExempt = reader.ReadElementContentAsBoolean();
break;
case "tax_code":
TaxCode = reader.ReadElementContentAsString();
break;
case "tax_type":
TaxType = reader.ReadElementContentAsString();
break;
case "tax_rate":
TaxRate = reader.ReadElementContentAsDecimal();
break;
case "tax_region":
TaxRegion = reader.ReadElementContentAsString();
break;
case "start_date":
DateTime startDate;
if (DateTime.TryParse(reader.ReadElementContentAsString(), out startDate))
StartDate = startDate;
break;
case "end_date":
DateTime endDate;
if (DateTime.TryParse(reader.ReadElementContentAsString(), out endDate))
EndDate = endDate;
break;
case "created_at":
DateTime createdAt;
if (DateTime.TryParse(reader.ReadElementContentAsString(), out createdAt))
CreatedAt = createdAt;
break;
case "updated_at":
DateTime updatedAt;
//.........這裏部分代碼省略.........
示例5: getCopay
private decimal getCopay()
{
decimal coPay = new decimal();
StringBuilder data = new StringBuilder();
data.Append(server);
data.Append("viewPatientREST.php");
data.Append("?u=" + WebUtility.HtmlEncode(sessionManager.UserName));
data.Append("&key=" + WebUtility.HtmlEncode(sessionManager.Key));
data.Append("&pat=all");
//Create the request
string url = data.ToString();
WebRequest request = WebRequest.Create(url);
request.Method = "GET";
try
{
WebResponse response = request.GetResponse();
XmlTextReader xmlReader = new XmlTextReader(response.GetResponseStream());
while (xmlReader.Read())
{
if (xmlReader.Name == "CoPay")
{
coPay = xmlReader.ReadElementContentAsDecimal();
break;
}
}
}
catch (Exception)
{
MessageBox.Show("Error retrieving copay information.\n Reciept may not show correct information.", "Error", MessageBoxButtons.OK);
}
return coPay;
}