本文整理汇总了C#中OrderInfo.SetVATNumber方法的典型用法代码示例。如果您正苦于以下问题:C# OrderInfo.SetVATNumber方法的具体用法?C# OrderInfo.SetVATNumber怎么用?C# OrderInfo.SetVATNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderInfo
的用法示例。
在下文中一共展示了OrderInfo.SetVATNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCustomerFields
public bool AddCustomerFields(OrderInfo order, Dictionary<string, string> fields, CustomerDatatypes customerDataType, bool ingnoreNotAllowed = false)
{
if (ChangeOrderToIncompleteAndReturnTrueIfNotAllowed(order) && ingnoreNotAllowed == false)
{
return false;
}
//var xDoc = OrderUpdatingService.CreateXDocumentBasedOnCMSDocumentType(fields, documentAlias);
var xDoc = new XDocument(new XElement(customerDataType.ToString()));
if (customerDataType == CustomerDatatypes.Customer)
{
if (order.CustomerInfo.customerInformation != null) xDoc = order.CustomerInfo.customerInformation;
}
if (customerDataType == CustomerDatatypes.Shipping)
{
if (order.CustomerInfo.shippingInformation != null) xDoc = order.CustomerInfo.shippingInformation;
}
if (customerDataType == CustomerDatatypes.Extra)
{
if (order.CustomerInfo.extraInformation != null) xDoc = order.CustomerInfo.extraInformation;
}
foreach (var field in fields.Where(field => xDoc.Root != null && xDoc.Root.Descendants(field.Key).Any()))
{
if (xDoc.Root != null) xDoc.Root.Descendants(field.Key).Remove();
}
AddFieldsToXDocumentBasedOnCMSDocumentType(xDoc, fields, Order.NodeAlias);
var documentType = IO.Container.Resolve<ICMSDocumentTypeService>().GetByAlias(Order.NodeAlias);
// special fields that also work when field is not created on order document type
foreach (var field in fields)
{
if (field.Key.ToLower() == "customercountry")
{
if (field.Value != "0")
{
order.CustomerInfo.CountryCode = field.Value;
if (field.Value.Length > 4)
{
Log.Instance.LogDebug(
string.Format("customerCountry Length == {0} Value: {1}, Possible added Country.Name instead of Country.Code?",
field.Key.Length, field.Value));
}
}
}
if (field.Key.ToLower() == "shippingcountry")
{
if (field.Value != "0")
{
order.CustomerInfo.ShippingCountryCode = field.Value;
if (field.Value.Length > 4)
{
Log.Instance.LogDebug(
string.Format("shippingcountry Length == {0} Value: {1}, Possible added Country.Name instead of Country.Code?",
field.Key.Length, field.Value));
}
}
}
if (field.Key.ToLower() == "customervatnumber")
{
order.SetVATNumber(field.Value);
}
if (field.Key.ToLower() == "customerregion")
{
order.CustomerInfo.RegionCode = field.Value;
order._regionalVatInCents = null;
if (field.Value.Length > 4)
{
Log.Instance.LogDebug(string.Format("customerregion Length == {0} Value: {1}, Possible added Country.Name instead of Country.Code?", field.Key.Length, field.Value));
}
}
if (field.Key.ToLower() == "acceptsmarketing" || field.Key.ToLower() == "customeracceptsmarketing")
{
if (field.Value == "1" || field.Value == "true" || field.Value == "on" || field.Value == "acceptsmarketing" || field.Value == "customeracceptsmarketing")
{
order.CustomerInfo.AcceptsMarketing = true;
}
else
{
order.CustomerInfo.AcceptsMarketing = false;
}
}
// 'hack' because if you an empty checkbox is not send to the browser, by supporting this option the developer can add a hidden input 'false' field and make it checked using javascript.
if (field.Key.ToLower() == "acceptsmarketingfalse" || field.Key.ToLower() == "customeracceptsmarketingfalse")
{
if (field.Value == "1" || field.Value == "true" || field.Value == "on" || field.Value == "acceptsmarketingfalse" || field.Value == "customeracceptsmarketingfalse")
//.........这里部分代码省略.........