Dynamicweb.eCommerce.Orders Namespace > OrderLine Class > Save Method : Save(String) Method |
public void Save( string IDstr )
class MyPage : System.Web.UI.Page { private string GetValue(XmlNode node, string value) { if (node == null) return string.Empty; XmlNode n = node.SelectSingleNode(value); if (n == null) return string.Empty; return Base.ChkString(n.InnerText).Trim(); } public void SaveOrderLinesToDB(XmlNode orderLinesNode, eCommerce.Orders.Order order) { if (orderLinesNode == null || order == null || order.ID == null || order.ID.Length == 0) return; foreach (XmlNode o in orderLinesNode.SelectNodes("OrderLine")) { string OrderLineID = GetValue(o, "OrderLineID"); eCommerce.Orders.OrderLine orderLine = eCommerce.Orders.OrderLine.Create(OrderLineID, order); orderLine.ID = OrderLineID; orderLine.OrderID = order.ID; orderLine.ParentLineID = GetValue(o, "OrderLineParentLineID"); orderLine.BOM = Base.ChkBoolean(GetValue(o, "OrderLineBOM")); orderLine.Date = Base.ChkDate(GetValue(o, "OrderLineDate")); orderLine.Modified = Base.ChkDate(GetValue(o, "OrderLineModified")); orderLine.ProductNumber = GetValue(o, "OrderLineProductNumber"); orderLine.ProductID = GetValue(o, "OrderLineProductID"); orderLine.ProductVariantID = GetValue(o, "OrderLineProductVariantID"); orderLine.ProductName = GetValue(o, "OrderLineProductName"); orderLine.ProductVariantText = GetValue(o, "OrderLineProductVariantText"); orderLine.Price.VATPercent = Base.ChkDouble(GetValue(o, "OrderLineVatPercent")); orderLine.Price.VAT = Base.ChkDouble(GetValue(o, "OrderLineVatPrice")); orderLine.Quantity = Base.ChkDouble(GetValue(o, "OrderLineQuantity")); orderLine.Type = GetValue(o, "OrderLineType"); orderLine.Reference = GetValue(o, "OrderLineReference"); orderLine.BOMItemID = GetValue(o, "OrderLineBOMItemID"); orderLine.UnitID = GetValue(o, "OrderLineUnitID"); orderLine.Price.PriceWithVAT = Base.ChkDouble(GetValue(o, "OrderLinePriceWithVAT")); orderLine.Price.PriceWithoutVAT = Base.ChkDouble(GetValue(o, "OrderLinePriceWithoutVAT")); orderLine.Price.VAT = Base.ChkDouble(GetValue(o, "OrderLinePriceVAT")); orderLine.Price.VATPercent = Base.ChkDouble(GetValue(o, "OrderLinePriceVATPercent")); orderLine.UnitPrice.PriceWithVAT = Base.ChkDouble(GetValue(o, "OrderLineUnitPriceWithVAT")); orderLine.UnitPrice.PriceWithoutVAT = Base.ChkDouble(GetValue(o, "OrderLineUnitPriceWithoutVAT")); orderLine.UnitPrice.VAT = Base.ChkDouble(GetValue(o, "OrderLineUnitPriceVAT")); orderLine.UnitPrice.VATPercent = Base.ChkDouble(GetValue(o, "OrderLineUnitPriceVATPercent")); orderLine.PageID = Base.ChkInteger(GetValue(o, "OrderLinePageId")); orderLine.Save( OrderLineID ); } } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2