@using System; @using System.Net; @using System.Net.Http; @using System.Web; @using System.Web.Script.Serialization; @using Dynamicweb.Ecommerce; @{ string orderId = ""; string jsonString = "{}"; Dynamicweb.Ecommerce.Orders.Order myOrder = new Dynamicweb.Ecommerce.Orders.Order(); orderId = System.Web.HttpContext.Current.Request["orderId"]; try { Dynamicweb.Ecommerce.Orders.OrderService orderService = new Dynamicweb.Ecommerce.Orders.OrderService(); myOrder = orderService.GetOrder(orderId); orderService.RemoveOrderCache(orderId); orderService.ClearCachedPrices(myOrder); orderService.CalculateDiscounts(myOrder); orderService.ForcePriceRecalculation(myOrder); if(myOrder.Price.Price <= 0) { orderService.ClearCachedPrices(myOrder); orderService.RemoveOrderCache(myOrder.Id); } myOrder.ForcePriceRecalculation(); orderService.CalculateDiscounts(myOrder); jsonString = "{"; jsonString += "\"Id\" : \"" + myOrder.Id + "\", "; jsonString += "\"CurrencyCode\" : \"" + myOrder.CurrencyCode + "\", "; jsonString += "\"CurrencyName\" : \"" + myOrder.CurrencyName + "\", "; jsonString += "\"CurrencyRate\" : \"" + myOrder.CurrencyRate + "\", "; jsonString += "\"Vat\" : \"" + myOrder.Vat + "\", "; jsonString += "\"Currency\" : {"; jsonString += "\"Symbol\" : \"" + myOrder.Currency.Symbol + "\", "; jsonString += "\"Code\" : \"" + myOrder.Currency.Code + "\", "; jsonString += "\"CultureInfo\" : \"" + myOrder.Currency.CultureInfo + "\", "; jsonString += "\"IsDefault\" : \"" + myOrder.Currency.IsDefault + "\", "; jsonString += "\"LanguageId\" : \"" + myOrder.Currency.LanguageId + "\", "; jsonString += "\"Name\" : \"" + myOrder.Currency.Name + "\" "; jsonString += "},"; jsonString += "\"Price\" : {"; jsonString += "\"Price\" : \"" + myOrder.Price.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrder.Price.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrder.Price.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrder.Price.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrder.Price.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrder.Price.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrder.Price.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrder.Price.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrder.Price.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrder.Price.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrder.Price.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrder.Price.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrder.Price.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrder.Price.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrder.Price.VATPercentFormatted + "\" "; jsonString += "},"; jsonString += "\"ShippingFee\" : {"; jsonString += "\"Price\" : \"" + myOrder.ShippingFee.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrder.ShippingFee.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrder.ShippingFee.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrder.ShippingFee.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrder.ShippingFee.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrder.ShippingFee.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrder.ShippingFee.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrder.ShippingFee.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrder.ShippingFee.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrder.ShippingFee.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrder.ShippingFee.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrder.ShippingFee.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrder.ShippingFee.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrder.ShippingFee.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrder.ShippingFee.VATPercentFormatted + "\" "; jsonString += "},"; jsonString += "\"TotalDiscount\" : {"; jsonString += "\"Price\" : \"" + myOrder.TotalDiscount.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrder.TotalDiscount.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrder.TotalDiscount.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrder.TotalDiscount.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrder.TotalDiscount.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrder.TotalDiscount.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrder.TotalDiscount.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrder.TotalDiscount.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrder.TotalDiscount.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrder.TotalDiscount.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrder.TotalDiscount.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrder.TotalDiscount.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrder.TotalDiscount.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrder.TotalDiscount.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrder.TotalDiscount.VATPercentFormatted + "\" "; jsonString += "},"; //Total jsonString += "\"TotalPoints\" : \"" + myOrder.TotalPoints + "\", "; jsonString += "\"TotalPriceFormatted\" : \"" + myOrder.TotalPriceFormatted + "\", "; jsonString += "\"TotalPrice\" : " + myOrder.TotalPrice + ", "; jsonString += "\"TotalPriceWithoutVatFormatted\" : \"" + myOrder.TotalPriceWithoutVatFormatted + "\", "; //TotalPriceWithoutDiscounts jsonString += "\"TotalPriceWithoutDiscounts\" : {"; jsonString += "\"Price\" : \"" + myOrder.TotalPriceWithoutDiscounts.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrder.TotalPriceWithoutDiscounts.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscounts.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrder.TotalPriceWithoutDiscounts.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrder.TotalPriceWithoutDiscounts.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscounts.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrder.TotalPriceWithoutDiscounts.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrder.TotalPriceWithoutDiscounts.VATPercentFormatted + "\" "; jsonString += "},"; //TotalPriceWithoutDiscountsOrTaxes jsonString += "\"TotalPriceWithoutDiscountsOrTaxes\" : {"; jsonString += "\"Price\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrder.TotalPriceWithoutDiscountsOrTaxes.VATPercentFormatted + "\" "; jsonString += "},"; //TotalPriceWithoutTaxes jsonString += "\"TotalPriceWithoutTaxes\" : {"; jsonString += "\"Price\" : \"" + myOrder.TotalPriceWithoutTaxes.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrder.TotalPriceWithoutTaxes.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutTaxes.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrder.TotalPriceWithoutTaxes.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrder.TotalPriceWithoutTaxes.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrder.TotalPriceWithoutTaxes.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrder.TotalPriceWithoutTaxes.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrder.TotalPriceWithoutTaxes .VATPercentFormatted + "\" "; jsonString += "},"; jsonString += "\"LanguageId\" : \"" + myOrder.LanguageId + "\", "; jsonString += "\"ShopId\" : \"" + myOrder.ShopId + "\", "; jsonString += "\"ShopName\" : \"" + myOrder.ShopName + "\", "; jsonString += "\"CaptureAmount\" : \"" + myOrder.CaptureAmount + "\", "; jsonString += "\"Complete\" : \"" + myOrder.Complete + "\", "; jsonString += "\"CompletedDate\" : \"" + myOrder.CompletedDate + "\", "; jsonString += "\"Date\" : \"" + myOrder.Date + "\", "; jsonString += "\"Deleted\" : \"" + myOrder.Deleted + "\", "; jsonString += "\"IsCart\" : \"" + myOrder.IsCart + "\", "; jsonString += "\"IsCartEditable\" : \"" + myOrder.IsCartEditable + "\", "; jsonString += "\"IsQuote\" : \"" + myOrder.IsQuote + "\", "; jsonString += "\"Modified\" : \"" + myOrder.Modified + "\", "; jsonString += "\"PaymentMethodId\" : \"" + myOrder.PaymentMethodId + "\", "; jsonString += "\"Comment\" : \"" + myOrder.Comment + "\", "; //Voucher jsonString += "\"VoucherCode\" : \"" + myOrder.VoucherCode + "\", "; //Custom Fields foreach(var orderFieldValue in myOrder.OrderFieldValues) { jsonString += "\"" + orderFieldValue.OrderField.SystemName + "\" : \"" + orderFieldValue.Value + "\", "; } //Customer Info jsonString += "\"CustomerAccessUserId\" : \"" + myOrder.CustomerAccessUserId + "\", "; jsonString += "\"CustomerAccessUserUserName\" : \"" + myOrder.CustomerAccessUserUserName + "\", "; jsonString += "\"CustomerNumber\" : \"" + myOrder.CustomerNumber + "\", "; //Customer Address jsonString += "\"CustomerHouseNumber\" : \"" + myOrder.CustomerHouseNumber + "\", "; jsonString += "\"CustomerCompany\" : \"" + myOrder.CustomerCompany + "\", "; jsonString += "\"CustomerInitials\" : \"" + myOrder.CustomerInitials + "\", "; jsonString += "\"CustomerName\" : \"" + myOrder.CustomerName + "\", "; jsonString += "\"CustomerFirstName\" : \"" + myOrder.CustomerFirstName + "\", "; jsonString += "\"CustomerSurname\" : \"" + myOrder.CustomerSurname + "\", "; jsonString += "\"CustomerAddress\" : \"" + myOrder.CustomerAddress + "\", "; jsonString += "\"CustomerAddress2\" : \"" + myOrder.CustomerAddress2 + "\", "; jsonString += "\"CustomerZip\" : \"" + myOrder.CustomerZip + "\", "; jsonString += "\"CustomerCity\" : \"" + myOrder.CustomerCity + "\", "; jsonString += "\"CustomerCountry\" : \"" + myOrder.CustomerCountry + "\", "; jsonString += "\"CustomerCountryCode\" : \"" + myOrder.CustomerCountryCode + "\", "; jsonString += "\"CustomerRegion\" : \"" + myOrder.CustomerRegion + "\", "; jsonString += "\"CustomerPhone\" : \"" + myOrder.CustomerPhone + "\", "; jsonString += "\"CustomerFax\" : \"" + myOrder.CustomerFax + "\", "; jsonString += "\"CustomerCell\" : \"" + myOrder.CustomerCell + "\", "; jsonString += "\"CustomerEmail\" : \"" + myOrder.CustomerEmail + "\", "; //Delivery Address jsonString += "\"DeliveryHouseNumber\" : \"" + myOrder.DeliveryHouseNumber + "\", "; jsonString += "\"DeliveryCompany\" : \"" + myOrder.DeliveryCompany + "\", "; jsonString += "\"DeliveryInitials\" : \"" + myOrder.DeliveryInitials + "\", "; jsonString += "\"DeliveryName\" : \"" + myOrder.DeliveryName + "\", "; jsonString += "\"DeliveryFirstName\" : \"" + myOrder.DeliveryFirstName + "\", "; jsonString += "\"DeliverySurname\" : \"" + myOrder.DeliverySurname + "\", "; jsonString += "\"DeliveryAddress\" : \"" + myOrder.DeliveryAddress + "\", "; jsonString += "\"DeliveryAddress2\" : \"" + myOrder.DeliveryAddress2 + "\", "; jsonString += "\"DeliveryZip\" : \"" + myOrder.DeliveryZip + "\", "; jsonString += "\"DeliveryCity\" : \"" + myOrder.DeliveryCity + "\", "; jsonString += "\"DeliveryCountry\" : \"" + myOrder.DeliveryCountry + "\", "; jsonString += "\"DeliveryCountryCode\" : \"" + myOrder.DeliveryCountryCode + "\", "; jsonString += "\"DeliveryRegion\" : \"" + myOrder.DeliveryRegion + "\", "; jsonString += "\"DeliveryPhone\" : \"" + myOrder.DeliveryPhone + "\", "; jsonString += "\"DeliveryFax\" : \"" + myOrder.DeliveryFax + "\", "; jsonString += "\"DeliveryCell\" : \"" + myOrder.DeliveryCell + "\", "; jsonString += "\"DeliveryEmail\" : \"" + myOrder.DeliveryEmail + "\", "; //Shipping Method jsonString += "\"ShippingMethod\" : \"" + myOrder.ShippingMethod + "\", "; jsonString += "\"ShippingMethodCountryCode\" : \"" + myOrder.ShippingMethodCountryCode + "\", "; jsonString += "\"ShippingMethodDescription\" : \"" + myOrder.ShippingMethodDescription + "\", "; jsonString += "\"ShippingMethodId\" : \"" + myOrder.ShippingMethodId + "\", "; //OrderLines jsonString += "\"OrderLines\" : ["; foreach(var myOrderLine in myOrder.OrderLines) { jsonString += "{"; jsonString += "\"Attachment\" : \"" + myOrderLine.Attachment + "\", "; jsonString += "\"Bom\" : " + myOrderLine.Bom.ToString().ToLower() + ", "; jsonString += "\"BomItemId\" : \"" + myOrderLine.BomItemId + "\", "; jsonString += "\"Date\" : \"" + myOrderLine.Date + "\", "; jsonString += "\"DiscountId\" : \"" + myOrderLine.DiscountId + "\", "; jsonString += "\"GiftCardCode\" : \"" + myOrderLine.GiftCardCode + "\", "; jsonString += "\"Id\" : \"" + myOrderLine.Id + "\", "; jsonString += "\"ListId\" : \"" + myOrderLine.ListId + "\", "; jsonString += "\"Modified\" : \"" + myOrderLine.Modified + "\", "; jsonString += "\"OrderId\" : \"" + myOrderLine.OrderId + "\", "; jsonString += "\"ParentLineId\" : \"" + myOrderLine.ParentLineId + "\", "; jsonString += "\"Points\" : " + (string.IsNullOrEmpty(myOrderLine.Points.ToString()) ? 0 : myOrderLine.Points) + ", "; bool allowGift = false; try { var myProduct = Dynamicweb.Ecommerce.Products.Product.GetProductById(myOrderLine.ProductId); foreach(var ProductFieldValue in myProduct.ProductFieldValues) { if(ProductFieldValue.ProductField.SystemName == "ItemClassification") { string aa = ProductFieldValue.ProductField.SystemName + " : " + ProductFieldValue.Value + ", \n"; allowGift = !(ProductFieldValue.Value.ToString() == "gourmet"); } } jsonString += "\"AllowGift\" : " + allowGift.ToString().ToLower() + ", "; } catch { jsonString += "\"AllowGift\" : " + allowGift.ToString().ToLower() + ", "; } //Order Line Custom Fields foreach(var myOrderLineFieldValue in myOrderLine.OrderLineFieldValues) { if(myOrderLineFieldValue.OrderLineFieldSystemName == "Gift") { jsonString += "\"" + myOrderLineFieldValue.OrderLineFieldSystemName + "\" : " + (!string.IsNullOrEmpty(myOrderLineFieldValue.Value.ToString())).ToString().ToLower() + ", "; } else { jsonString += "\"" + myOrderLineFieldValue.OrderLineFieldSystemName + "\" : \"" + myOrderLineFieldValue.Value + "\", "; } } jsonString += "\"Price\" : {"; jsonString += "\"Price\" : \"" + myOrderLine.Price.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrderLine.Price.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrderLine.Price.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrderLine.Price.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrderLine.Price.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrderLine.Price.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrderLine.Price.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrderLine.Price.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrderLine.Price.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrderLine.Price.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrderLine.Price.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrderLine.Price.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrderLine.Price.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrderLine.Price.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrderLine.Price.VATPercentFormatted + "\" "; jsonString += "},"; jsonString += "\"ProductId\" : \"" + myOrderLine.ProductId + "\", "; jsonString += "\"ProductName\" : \"" + myOrderLine.ProductName + "\", "; jsonString += "\"ProductNumber\" : \"" + myOrderLine.ProductNumber + "\", "; jsonString += "\"ProductImage\" : \"" + (string.IsNullOrEmpty(myOrderLine.ProductNumber) ? "" : "/files/Images/TWG-Tea/Products/list290x230/" + myOrderLine.ProductNumber.Replace(" ", "") + ".jpg") + "\", "; jsonString += "\"ProductVariantId\" : \"" + myOrderLine.ProductVariantId + "\", "; jsonString += "\"ProductVariantText\" : \"" + myOrderLine.ProductVariantText + "\", "; jsonString += "\"Quantity\" : " + myOrderLine.Quantity + ", "; jsonString += "\"Reference\" : \"" + myOrderLine.Reference + "\", "; jsonString += "\"TotalDiscount\" : {"; jsonString += "\"Price\" : \"" + myOrderLine.TotalDiscount.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrderLine.TotalDiscount.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrderLine.TotalDiscount.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrderLine.TotalDiscount.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrderLine.TotalDiscount.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrderLine.TotalDiscount.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrderLine.TotalDiscount.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrderLine.TotalDiscount.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrderLine.TotalDiscount.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrderLine.TotalDiscount.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrderLine.TotalDiscount.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrderLine.TotalDiscount.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrderLine.TotalDiscount.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrderLine.TotalDiscount.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrderLine.TotalDiscount.VATPercentFormatted + "\" "; jsonString += "},"; jsonString += "\"Type\" : \"" + myOrderLine.Type + "\", "; jsonString += "\"UnitId\" : \"" + myOrderLine.UnitId + "\", "; jsonString += "\"UnitPoints\" : " + (string.IsNullOrEmpty(myOrderLine.UnitPoints.ToString()) ? 0 : myOrderLine.UnitPoints) + ", "; jsonString += "\"UnitPrice\" : {"; jsonString += "\"Price\" : \"" + myOrderLine.UnitPrice.Price + "\", "; jsonString += "\"PriceFormatted\" : \"" + myOrderLine.UnitPrice.PriceFormatted + "\", "; jsonString += "\"PriceFormattedNoSymbol\" : \"" + myOrderLine.UnitPrice.PriceFormattedNoSymbol + "\", "; jsonString += "\"PricePIP\" : \"" + myOrderLine.UnitPrice.PricePIP + "\", "; jsonString += "\"PriceWithoutVAT\" : \"" + myOrderLine.UnitPrice.PriceWithoutVAT + "\", "; jsonString += "\"PriceWithoutVATFormatted\" : \"" + myOrderLine.UnitPrice.PriceWithoutVATFormatted + "\", "; jsonString += "\"PriceWithoutVATFormattedNoSymbol\" : \"" + myOrderLine.UnitPrice.PriceWithoutVATFormattedNoSymbol + "\", "; jsonString += "\"PriceWithVAT\" : \"" + myOrderLine.UnitPrice.PriceWithVAT + "\", "; jsonString += "\"PriceWithVATFormatted\" : \"" + myOrderLine.UnitPrice.PriceWithVATFormatted + "\", "; jsonString += "\"PriceWithVATFormattedNoSymbol\" : \"" + myOrderLine.UnitPrice.PriceWithVATFormattedNoSymbol + "\", "; jsonString += "\"VAT\" : \"" + myOrderLine.UnitPrice.VAT + "\", "; jsonString += "\"VATFormatted\" : \"" + myOrderLine.UnitPrice.VATFormatted + "\", "; jsonString += "\"VATFormattedNoSymbol\" : \"" + myOrderLine.UnitPrice.VATFormattedNoSymbol + "\", "; jsonString += "\"VATPercent\" : \"" + myOrderLine.UnitPrice.VATPercent + "\", "; jsonString += "\"VATPercentFormatted\" : \"" + myOrderLine.UnitPrice.VATPercentFormatted + "\" "; jsonString += "},"; jsonString += "\"Volume\" : " + (string.IsNullOrEmpty(myOrderLine.Volume.ToString()) ? 0 : myOrderLine.Volume) + ", "; jsonString += "\"Weight\" : " + (string.IsNullOrEmpty(myOrderLine.Weight.ToString()) ? 0 : myOrderLine.Weight) + ""; jsonString += "}"; } jsonString += "]"; jsonString += "}"; jsonString = jsonString.Replace("}{", "},{"); } catch(Exception ex) { jsonString = ex.Message.ToString(); } } @jsonString