Table of Contents

Class OrderLine

Namespace
Dynamicweb.Ecommerce.Orders
Assembly
Dynamicweb.Ecommerce.dll
Represents information about an order line.
[Serializable]
public class OrderLine : IWithPrice
Inheritance
OrderLine
Implements
Inherited Members

Constructors

OrderLine()

Initializes a new instance of the OrderLine class.
[Obsolete("Use constructor that takes an order instead.")]
public OrderLine()

OrderLine(Currency)

Initializes a new instance of the OrderLine class.
[Obsolete("Use constructor that takes an order instead.")]
public OrderLine(Currency currency)

Parameters

currency Currency

OrderLine(Order)

public OrderLine(Order order)

Parameters

order Order

OrderLine(DataRow)

Initializes a new instance of the OrderLine class.
[Obsolete("This method is no longer used.")]
public OrderLine(DataRow dataRow)

Parameters

dataRow DataRow
The data record.

OrderLine(IDataRecord)

Initializes a new instance of the OrderLine class.
[Obsolete("This method is no longer used.")]
public OrderLine(IDataRecord dataRecord)

Parameters

dataRecord IDataRecord
The data record.

OrderLine(IDataRecord, Order)

Initializes a new instance of the OrderLine class.
[Obsolete("This method is no longer used.")]
public OrderLine(IDataRecord dataRecord, Order order)

Parameters

dataRecord IDataRecord
The data record.
order Order
The order.

Fields

DisableRemoveFromCartRules

public bool DisableRemoveFromCartRules

Field Value

bool

Properties

AllowOverridePrices

Indicated whether Price is overridden and not calculated. Used to set explicit PriceInfo values.
public bool AllowOverridePrices { get; set; }

Property Value

bool

Attachment

Gets or sets the attachment.
public string Attachment { get; set; }

Property Value

string

Bom

Gets or sets a value indicating whether this OrderLine is BOM.
public bool Bom { get; set; }

Property Value

bool

BomItemId

Gets or sets the BOM item ID.
public string BomItemId { get; set; }

Property Value

string

BomOrderLines

Gets or sets the BOM order lines.
public OrderLineCollection BomOrderLines { get; set; }

Property Value

OrderLineCollection

Currency

[Obsolete("Use order currency instead")]
public Currency Currency { get; set; }

Property Value

Currency

Date

Gets or sets the date.
public DateTime Date { get; set; }

Property Value

DateTime

DiscountId

Gets or sets the discount ID.
public string DiscountId { get; set; }

Property Value

string

DiscountPercentage

Gets or sets the line discount (%).
public double DiscountPercentage { get; set; }

Property Value

double
lineDiscount

GiftCardCode

Gets or sets encoded gift card code, orderline based on.
public string GiftCardCode { get; set; }

Property Value

string

Id

Gets or sets the ID.
public string Id { get; set; }

Property Value

string

ListId

Gets or sets the list ID.
public int ListId { get; set; }

Property Value

int

Modified

Gets or sets when the order line was modified.
public DateTime Modified { get; set; }

Property Value

DateTime

Order

Gets or sets the order.
public Order Order { get; set; }

Property Value

Order

OrderId

Gets or sets the order ID.
public string OrderId { get; set; }

Property Value

string

OrderLineFieldValues

Gets or sets the collection of OrderLineFieldValue objects.
public OrderLineFieldValueCollection OrderLineFieldValues { get; set; }

Property Value

OrderLineFieldValueCollection

OrderLineType

Gets or sets the order line type.
public OrderLineType OrderLineType { get; set; }

Property Value

OrderLineType

PageId

Gets or sets the page ID.
public int PageId { get; set; }

Property Value

int

ParentLineId

Gets or sets the parent line ID.
public string ParentLineId { get; set; }

Property Value

string

Points

Returns number of points of OrderLine necessary for payment.
public double? Points { get; }

Property Value

double?

Price

Gets the total price of the orderline, quantity * unitprice.
public PriceInfo Price { get; }

Property Value

PriceInfo

Product

Gets or sets the product.
public Product Product { get; set; }

Property Value

Product

ProductId

Gets or sets the product ID.
public string ProductId { get; set; }

Property Value

string

ProductName

Gets or sets the product name.
public string ProductName { get; set; }

Property Value

string

ProductNumber

Gets or sets the product number.
public string ProductNumber { get; set; }

Property Value

string

ProductVariantId

Gets or sets the product variant ID.
public string ProductVariantId { get; set; }

Property Value

string

ProductVariantText

Gets or sets the product variant text.
public string ProductVariantText { get; set; }

Property Value

string

Quantity

Gets or sets the quantity.
public double Quantity { get; set; }

Property Value

double

Reference

Gets or sets the reference.
public string Reference { get; set; }

Property Value

string

ReverseChargeForVat

Gets or sets a value indicating whether the price for this OrderLine has reverse charge for VAT.
public bool ReverseChargeForVat { get; set; }

Property Value

bool
true if the price has reverse charge for VAT; otherwise, false.

RewardId

Gets or sets the loyalty reward id.
public int? RewardId { get; }

Property Value

int?

RewardPoints

Returns information about the points which will be rewarded to the user.
public PointInfo RewardPoints { get; }

Property Value

PointInfo

RewardValue

Gets or sets the order line reward points.
public double? RewardValue { get; }

Property Value

double?

StockLocationId

Gets or sets the stock location.
public long StockLocationId { get; set; }

Property Value

long

TotalDiscount

Gets the discount value.
public PriceInfo TotalDiscount { get; }

Property Value

PriceInfo

TotalPriceWithProductDiscounts

Returns the price with the product discounts applied to it.
public PriceInfo TotalPriceWithProductDiscounts { get; }

Property Value

PriceInfo

Type

Gets or sets the type.
[Obsolete("Use OrderLineType instead.")]
public string Type { get; set; }

Property Value

string

UnitDiscount

Returns the unit discount.
public PriceInfo UnitDiscount { get; }

Property Value

PriceInfo

UnitId

Gets or sets the unit ID.
public string UnitId { get; set; }

Property Value

string

UnitPoints

Returns points cost of product unit.
public double? UnitPoints { get; }

Property Value

double?

UnitPrice

Gets or sets the unit price.
public PriceInfo UnitPrice { get; set; }

Property Value

PriceInfo

UnitPriceBeforeDiscount

Gets or sets the price per unit without discounts.
public double UnitPriceBeforeDiscount { get; }

Property Value

double

UnitPriceInfoBeforeDiscount

public PriceInfo UnitPriceInfoBeforeDiscount { get; }

Property Value

PriceInfo

UnitPriceWithProductDiscount

Returns the unit price with the product discount applied to it.
public PriceInfo UnitPriceWithProductDiscount { get; }

Property Value

PriceInfo

UnitRewardPoints

Returns information about the points which will be rewarded to the user for one unit of product.
public PointInfo UnitRewardPoints { get; }

Property Value

PointInfo

UnitRewardValue

Gets or sets unit reward points.
public double? UnitRewardValue { get; }

Property Value

double?

Volume

Gets the volume.
public double Volume { get; }

Property Value

double

Weight

Gets the weight.
public double Weight { get; }

Property Value

double

Methods

CanBeMerged(OrderLine)

Determines whether this instance can be merged with another order line.
[Obsolete("Use Ecommerce.Services.OrderLines.CanBeMerged instead.")]
public bool CanBeMerged(OrderLine other)

Parameters

other OrderLine
The other order line.

Returns

bool
true if this instance can be merged with another order line; otherwise, false.

Examples

class MyPage : System.Web.UI.Page
{
private Order order;

public void AddLine(OrderLine orderLine)
{
bool merged = false;

foreach (OrderLine theOrderLine in order.OrderLines)
{
if (!(string.IsNullOrEmpty(theOrderLine.DiscountId)))
{
continue;
}

if (theOrderLine.CanBeMerged(orderLine))
{
merged = true;

if ((theOrderLine.Quantity + orderLine.Quantity) < 1)
{
List.Remove(theOrderLine);
theOrderLine.Delete();
}
else
{
theOrderLine.Quantity += orderLine.Quantity;
}
UpdateBOMOrderLine(theOrderLine);

break;
}

}

if (merged == false)
{
order.OrderLines.Add(orderLine);
}

}

}

ClearCachedPrices()

Clears the cached prices for this OrderLine.
[Obsolete("Use Ecommerce.Services.OrderLines.ClearCachedPrices instead.")]
public void ClearCachedPrices()

Clone()

Clones this instance.
public OrderLine Clone()

Returns

OrderLine
The copy of the OrderLine.

Examples

class MyPage : System.Web.UI.Page
{
private OrderLine orderLine;
public void DoSave()
{
OrderLine theOrderLine = new OrderLine();
theOrderLine = orderLine.Clone();
theOrderLine.ID = string.Empty;
theOrderLine.Save(theOrderLine.ID);
}
}

Copy()

Copies this instance.
[Obsolete]
public OrderLine Copy()

Returns

OrderLine
The copy of the OrderLine.

Examples

class MyPage : System.Web.UI.Page
{
private OrderLine orderLine;
public OrderLine DoSave()
{
OrderLine theOrderLine = new OrderLine();
theOrderLine = orderLine.Copy();
return theOrderLine;
}
}

Delete()

Deletes order line from DB.
[Obsolete("Use Ecommerce.Services.OrderLines.Delete instead.")]
public void Delete()

Examples

Removes all orderlines that is of type Product and that no longer exist in the database. Also removes products according to the control panel settings: Active, on stock, price is zero.
class MyPage : System.Web.UI.Page
{
private Order order;

public void RemoveNoneActiveProducts()
{

HACK: This prevents dbProduct.Price.Price below to call this method and create an endless loop
if (order.IsCart)
{
Context.SetCart(order);
}

bool doCheckStock = Converter.ToBoolean(Dynamicweb.Configuration.SystemConfiguration.Instance.GetValue("/Globalsettings/Ecom/Product/DontShowProductIfNotOnStock"));
bool doCheckPrice = Converter.ToBoolean(Dynamicweb.Configuration.SystemConfiguration.Instance.GetValue("/Globalsettings/Ecom/Product/DontShowProductIfHasNoPrice"));

First build a list of ID's of the products to get from the database
List<string> ids = new List<string>();
List<OrderLine> productLines = new List<OrderLine>();
foreach (OrderLine orderLine in order.OrderLines)
{
if (orderLine.Type == Converter.ToString(Converter.ToInt32(OrderLineType.Product)))
{
ids.Add(orderLine.Product.ID);
productLines.Add(orderLine);
}
}

Get the products that match the ids
ProductCollection productsFromDatabase = Product.getProducts(ids.ToArray(), false);

Remove the products that don't exist or is not active
foreach (OrderLine productLine in productLines)
{
bool doRemove = true;
Product product = productLine.Product;
foreach (Product dbProduct in productsFromDatabase)
{
if (product.ID == dbProduct.ID && product.VariantID == dbProduct.VariantID && product.LanguageID == dbProduct.LanguageID)
{
if (dbProduct.Active)
{
doRemove = false;
}
if (! doRemove && doCheckPrice && dbProduct.Price.Price <= 0)
{
doRemove = true;
}
if (! doRemove && doCheckStock && dbProduct.UnitStock <= 0)
{
doRemove = true;
}
break;
}
}
if (doRemove)
{
order.OrderLines.Remove(productLine);
productLine.Delete();
}
}
}
}

Delete(string)

Deletes order line from DB.
[Obsolete("Use Ecommerce.Services.OrderLines.Delete instead.")]
public void Delete(string lineId)

Parameters

lineId string
The OrderLine ID.

Examples

Removes all orderlines that is of type Product and that no longer exist in the database. Also removes products according to the control panel settings: Active, on stock, price is zero.
class MyPage : System.Web.UI.Page
{
private Order order;

public void RemoveNoneActiveProducts()
{

HACK: This prevents dbProduct.Price.Price below to call this method and create an endless loop
if (order.IsCart)
{
Context.SetCart(order);
}

bool doCheckStock = Converter.ToBoolean(Dynamicweb.Configuration.SystemConfiguration.Instance.GetValue("/Globalsettings/Ecom/Product/DontShowProductIfNotOnStock"));
bool doCheckPrice = Converter.ToBoolean(Dynamicweb.Configuration.SystemConfiguration.Instance.GetValue("/Globalsettings/Ecom/Product/DontShowProductIfHasNoPrice"));

First build a list of ID's of the products to get from the database
List<string> ids = new List<string>();
List<OrderLine> productLines = new List<OrderLine>();
foreach (OrderLine orderLine in order.OrderLines)
{
if (orderLine.Type == Converter.ToString(Converter.ToInt32(OrderLineType.Product)))
{
ids.Add(orderLine.Product.ID);
productLines.Add(orderLine);
}
}

Get the products that match the ids
ProductCollection productsFromDatabase = Product.getProducts(ids.ToArray(), false);

Remove the products that don't exist or is not active
foreach (OrderLine productLine in productLines)
{
bool doRemove = true;
Product product = productLine.Product;
foreach (Product dbProduct in productsFromDatabase)
{
if (product.ID == dbProduct.ID && product.VariantID == dbProduct.VariantID && product.LanguageID == dbProduct.LanguageID)
{
if (dbProduct.Active)
{
doRemove = false;
}
if (! doRemove && doCheckPrice && dbProduct.Price.Price <= 0)
{
doRemove = true;
}
if (! doRemove && doCheckStock && dbProduct.UnitStock <= 0)
{
doRemove = true;
}
break;
}
}
if (doRemove)
{
order.OrderLines.Remove(productLine);
productLine.Delete(productLine.ID);
}
}
}
}

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

get_OrderLineFieldValue(string)

Gets the OrderLineFieldValue object.
[Obsolete("Use GetOrderLineFieldValue instead")]
public OrderLineFieldValue get_OrderLineFieldValue(string orderLineFieldSystemName)

Parameters

orderLineFieldSystemName string

Returns

OrderLineFieldValue

GetOrderLineById(string)

Gets the OrderLine by ID.
[Obsolete("Use Ecommerce.Services.OrderLines.GetOrderLine instead.")]
public static OrderLine GetOrderLineById(string id)

Parameters

id string
The id.

Returns

OrderLine

GetOrderLineById(string, Order)

Gets the OrderLine by ID and sets the Order property to the given Order.
[Obsolete("Use Ecommerce.Services.OrderLines.GetOrderLine instead.")]
public static OrderLine GetOrderLineById(string id, Order order)

Parameters

id string
The id.
order Order
The order.

Returns

OrderLine

GetOrderLineFieldValue(string)

Gets the OrderLineFieldValue object.
public OrderLineFieldValue GetOrderLineFieldValue(string orderLineFieldSystemName)

Parameters

orderLineFieldSystemName string
System name of order line field

Returns

OrderLineFieldValue

GetOrderLinesByOrder(Order)

Gets the order lines.
[Obsolete("Use Ecommerce.Services.OrderLines.GetOrderLines instead.")]
public static OrderLineCollection GetOrderLinesByOrder(Order order)

Parameters

order Order
The order.

Returns

OrderLineCollection

Examples

class MyPage : System.Web.UI.Page
{

public double CalcOrderTotalValue(Order order)
{
OrderLineCollection orderLines = OrderLines.GetOrderLinesByOrder(order);
double theVolume = 0.0;
if (orderLines.Count > 0)
{
foreach (OrderLine theOrderLine in orderLines)
{
if (! (theOrderLine.Product.Type == ProductType.Service))
{
theVolume += theOrderLine.Volume;
}
}
}
return theVolume;
}

}

GetOrderLineType()

Gets the OrderLineType of this OrderLine.
[Obsolete("Use OrderLineType instead.")]
public OrderLineType GetOrderLineType()

Returns

OrderLineType

GetOrderLineType(int)

Gets the OrderLineType of this OrderLine.
[Obsolete("Use Ecommerce.Services.OrderLines.GetOrderLineType instead.")]
public static OrderLineType GetOrderLineType(int orderLineType)

Parameters

orderLineType int
The string literal of integer equivalent of OrderLineType.

Returns

OrderLineType

GetOrderLineType(string)

Gets the OrderLineType of this OrderLine.
[Obsolete("Use Ecommerce.Services.OrderLines.GetOrderLineType instead.")]
public static OrderLineType GetOrderLineType(string orderLineType)

Parameters

orderLineType string
The integer equivalent of OrderLineType.

Returns

OrderLineType

GetPriceContext()

Gets price context information for the current order line.
public PriceContext GetPriceContext()

Returns

PriceContext

GetProductImage(int?)

Returns the path to the product image.
[Obsolete("Use Ecommerce.Services.OrderLines.GetProductImage instead.")]
public string GetProductImage(int? areaId)

Parameters

areaId int?
The ID of the area.

Returns

string
The path to the product image.

HasType(OrderLineType)

Determines whether this OrderLine has the given OrderLineType.
public bool HasType(OrderLineType orderLineType)

Parameters

orderLineType OrderLineType
The OrderLineType to compare this OrderLine to.

Returns

bool

HasType(IEnumerable<OrderLineType>)

Determines whether this OrderLine has the given OrderLineTypes.
public bool HasType(IEnumerable<OrderLineType> orderLineTypes)

Parameters

orderLineTypes IEnumerable<OrderLineType>
The list of OrderLineTypes to compare this OrderLine to.

Returns

bool

Save()

Saves this instance.
[Obsolete("Use Ecommerce.Services.OrderLines.Save instead.")]
public void Save()

Examples

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 Converter.ToString(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 = Converter.ToBoolean(GetValue(o, "OrderLineBOM"));
orderLine.Date = Converter.ToDateTimeLegacy(GetValue(o, "OrderLineDate"));
orderLine.Modified = Converter.ToDateTimeLegacy(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 = Converter.ToDouble(GetValue(o, "OrderLineVatPercent"));
orderLine.Price.VAT = Converter.ToDouble(GetValue(o, "OrderLineVatPrice"));
orderLine.Quantity = Converter.ToDouble(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 = Converter.ToDouble(GetValue(o, "OrderLinePriceWithVAT"));
orderLine.Price.PriceWithoutVAT = Converter.ToDouble(GetValue(o, "OrderLinePriceWithoutVAT"));
orderLine.Price.VAT = Converter.ToDouble(GetValue(o, "OrderLinePriceVAT"));
orderLine.Price.VATPercent = Converter.ToDouble(GetValue(o, "OrderLinePriceVATPercent"));
orderLine.UnitPrice.PriceWithVAT = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceWithVAT"));
orderLine.UnitPrice.PriceWithoutVAT = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceWithoutVAT"));
orderLine.UnitPrice.VAT = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceVAT"));
orderLine.UnitPrice.VATPercent = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceVATPercent"));
orderLine.PageID = Converter.ToInt32(GetValue(o, "OrderLinePageId"));
orderLine.Save();
}
}
}

Save(DataRow)

Saves the specified row.
[Obsolete]
public void Save(DataRow dataRow)

Parameters

dataRow DataRow
The dataRow.

Examples

class MyPage : System.Web.UI.Page
{

public void SaveOrderLine(OrderLine orderLine)
{
IDbConnection connection = Database.CreateConnection();
System.Data.IDbCommand command = connection.CreateCommand();
DataSet dataSet = new DataSet();
IDbDataAdapter dataAdapter = Database.GetAdapter();
dataRow dataRow = null;

string query = "SELECT * FROM EcomOrderLines WHERE OrderLineID = '" + orderLine.Id + "' OR OrderLineParentLineID = '" + orderLine.Id + "'";
command.CommandText = query;
dataAdapter.SelectCommand = command;
object objCommandBuilder = Database.GetCommandBuilder(dataAdapter);
dataAdapter.Fill(dataSet);

if (dataSet.Tables[0].Rows.Count > 0)
{
dataRow = dataSet.Tables[0].Rows[0];
}
else
{
dataRow = dataSet.Tables[0].NewRow();
dataSet.Tables[0].Rows.Add(dataRow);
orderLine.Id = NumberGenerator.GetNumber("OL");
}

orderLine.Save(dataRow);

dataAdapter.Update(dataSet);
dataSet.Dispose();
command.Dispose();
connection.Close();
connection.Dispose();
}
}

Save(string)

Saves the instance into DB.
[Obsolete("Use Ecommerce.Services.OrderLines.Save instead.")]
public void Save(string lineId)

Parameters

lineId string
DB field name is OrderLineID or OrderLineParentLineID.

Examples

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 Converter.ToString(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 = Converter.ToBoolean(GetValue(o, "OrderLineBOM"));
orderLine.Date = Converter.ToDateTimeLegacy(GetValue(o, "OrderLineDate"));
orderLine.Modified = Converter.ToDateTimeLegacy(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 = Converter.ToDouble(GetValue(o, "OrderLineVatPercent"));
orderLine.Price.VAT = Converter.ToDouble(GetValue(o, "OrderLineVatPrice"));
orderLine.Quantity = Converter.ToDouble(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 = Converter.ToDouble(GetValue(o, "OrderLinePriceWithVAT"));
orderLine.Price.PriceWithoutVAT = Converter.ToDouble(GetValue(o, "OrderLinePriceWithoutVAT"));
orderLine.Price.VAT = Converter.ToDouble(GetValue(o, "OrderLinePriceVAT"));
orderLine.Price.VATPercent = Converter.ToDouble(GetValue(o, "OrderLinePriceVATPercent"));
orderLine.UnitPrice.PriceWithVAT = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceWithVAT"));
orderLine.UnitPrice.PriceWithoutVAT = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceWithoutVAT"));
orderLine.UnitPrice.VAT = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceVAT"));
orderLine.UnitPrice.VATPercent = Converter.ToDouble(GetValue(o, "OrderLineUnitPriceVATPercent"));
orderLine.PageID = Converter.ToInt32(GetValue(o, "OrderLinePageId"));
orderLine.Save( OrderLineID );
}
}
}

SetOrderLineType(OrderLineType)

Sets the OrderLineType of this OrderLine.
[Obsolete("Use OrderLineType instead.")]
public void SetOrderLineType(OrderLineType orderLineType)

Parameters

orderLineType OrderLineType
The OrderLineType to set this OrderLine to.

SetProductInformation(Product)

Sets the product information based on the given Product. Usually used for BOM products.
[Obsolete("Use Ecommerce.Services.OrderLines.SetProductInformation instead.")]
public void SetProductInformation(Product theProduct)

Parameters

theProduct Product
The product.

SetUnitPrice(PriceInfo)

Sets the unit price.
[Obsolete("Use Ecommerce.Services.OrderLines.SetUnitPrice instead.")]
public void SetUnitPrice(PriceInfo priceInfo)

Parameters

priceInfo PriceInfo
The PriceInfo object. The property - UnitPrice.

Examples

public class MyDiscountProvider: SalesDiscountProvider
{

private OrderLine CreateOrderLine(Order order, PriceInfo priceInfo)
{

Add a new order line
OrderLine line = new OrderLine();
line.Order = order;
line.Quantity = 1;
line.ProductName = this.DiscountName;
line.SetUnitPrice(priceInfo.Multiply(-1));
line.ParentLineID = null;
line.DiscountId = DiscountId;

if (IsProductDiscount)
line.Type = Converter.ToString(Converter.ToInt32(OrderLineType.ProductDiscount));
else
line.Type = Converter.ToString(Converter.ToInt32(OrderLineType.Discount));

return line;
}

}

SetUnitPrice(PriceInfo, bool)

Sets the unit price.
[Obsolete("Use Ecommerce.Services.OrderLines.SetUnitPrice instead.")]
public void SetUnitPrice(PriceInfo priceInfo, bool forcePriceRecalculation)

Parameters

priceInfo PriceInfo
The price info.
forcePriceRecalculation bool
if set to true the Price of the OrderLine is recalculated.

SetUnitPrice(double)

Sets the unit price.
[Obsolete("Use Ecommerce.Services.OrderLines.SetUnitPrice instead.")]
public void SetUnitPrice(double theUnitPrice)

Parameters

theUnitPrice double
The price.

Examples

public class MyDiscountProvider: SalesDiscountProvider
{

private OrderLine CreateOrderLine(Order order, double price)
{
Negate
price *= -1;

Add a new order line
OrderLine line = new OrderLine();
line.Order = order;
line.Quantity = 1;
line.ProductName = this.DiscountName;
line.SetUnitPrice(price);
line.ParentLineID = null;
line.DiscountId = DiscountId;

if (IsProductDiscount)
line.Type = Converter.ToString(Converter.ToInt32(OrderLineType.ProductDiscount));
else
line.Type = Converter.ToString(Converter.ToInt32(OrderLineType.Discount));

return line;
}

}
To top