当前位置: 首页>>代码示例>>C#>>正文


C# OrderInfo.SetVATNumber方法代码示例

本文整理汇总了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")
//.........这里部分代码省略.........
开发者ID:Chuhukon,项目名称:uWebshop-Releases,代码行数:101,代码来源:OrderUpdatingService.cs


注:本文中的OrderInfo.SetVATNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。