Dynamicweb 8 Documentation
CanBeMerged Method
Example 

The other order line.
Determines whether this instance can be merged with another order line.
Syntax
'Declaration
 
Public Function CanBeMerged( _ 
   ByVal other As OrderLine _ 
) As Boolean
public bool CanBeMerged( 
   OrderLine other 
)

Parameters

other
The other order line.

Return Value

true if this instance can be merged with another order line; otherwise, false.
Example
class MyPage : System.Web.UI.Page
{
   private Order order;
 
    public void AddLine(OrderLine orderLine)
    {
    	bool merged = false;

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

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

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

   				break;
   		   }

       }

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

   }
 
}
Requirements

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

See Also

Reference

OrderLine Class
OrderLine Members

Send Feedback