OrderGroup.AddItemsFromTemplate Method (PIA)

Use this method to add the line items associated with an on-disk order group template to the current OrderGroup object.

This method iterates across all the OrderForms in the specified template and adds them to the current OrderGroup. If the OrderForms being added already exist, the line items on the template OrderGroup are simply added. When a non-existing OrderForm is encountered, the method will add the OrderForm in its entirety to the OrderGroup, including OrderForm-level dictionary values.

The OrderGroup object keeps a counter of total line items at the OrderForm and OrderGroup levels. For the OrderGroup level, it keeps track of the number of line items in all the OrderForms. This value is held under the key "total_lineitems".

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Orders
…
Public Sub AddItemsFromTemplate(OrderGroupID As String)

[C#]

using Microsoft.CommerceServer.Interop.Orders;
…
public void AddItemsFromTemplate(stringOrderGroupID);

Parameters

[Visual Basic .NET]

  • OrderGroupID
    A String that specifies the OrderGroup object ID for the template.

[C#]

  • OrderGroupID
    A string that specifies the OrderGroup object ID for the template.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

Remarks

Ee823840.note(en-US,CS.20).gif Note

  • It is the responsibility of the application to implement security. This method does not check whether the user ID of the template is the same as the user ID specified in the initialization call.

This method also works on previously submitted orders and baskets, as well as OrderGroup objects with Template (Saved Order) status.

[Visual Basic .NET]

Example

' oOrderGroup is a Commerce.OrderGroup object
' myOGID is a GUID String
myOGID ="754C40C6-EAA9-454C-A8AB-02789FBE0FB9"
oOrderGroup.AddItemsFromTemplate(myOGID)

Requirements

Namespace: Microsoft.CommerceServer.Interop.Orders

Platforms: Windows 2000, Windows Server 2003

Assembly: Microsoft.CommerceServer.Interop.Orders.Requisition.dll

See Also

OrderGroup Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.