Share via


OrderGroup.SaveAsOrder Method (PIA)

Use this method to save the OrderGroup object to the database with an order status.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Orders
…
Public Function SaveAsOrder(Optional vtOutTrackingNumber As Object) As Object

[C#]

using Microsoft.CommerceServer.Interop.Orders;
…
object SaveAsOrder(outobjectvtOutTrackingNumber);

Parameters

[Visual Basic .NET]

  • vtOutTrackingNumber
    An Object that specifies the tracking number. If specified, this Object must be a non-literal value; when the method returns, it will contain the tracking number.

[C#]

  • vtOutTrackingNumber
    On input, an object used to specify the tracking number.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns an Object that specifies the OrderGroupID.

[C#] This method returns an object indicating the OrderGroupID.

Exceptions

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

Remarks

This method sets the OrderGroup object status to "order" if the current status is template, basket, or undefined. (All other states are left alone; this allows orders to be in many states, such as pending approval, rejected, and so on.) You can set the state to any value except basket or template before calling the SaveAsOrder method; this method will not overwrite the state.

If this is the first time the order is saved, a special field will be written that records the order creation date. If an OrderTrackingNumber already exists on the OrderForm object (under the key order_number) before the save, a new one will not be generated. This feature allows for ERP-based tracking numbers.

If the OrderGroup object was loaded from a template or from a basket, this method will generate a new OrderGroupID and tracking number, and perform a database insert. If the OrderGroup does not yet exist on disk, this method will generate an OrderGroupID and tracking number and perform a database insert. If the OrderGroup was loaded from any other state, this method will perform a database update. If there are multiple OrderForms associated with an OrderGroup, all the OrderForms will share the same tracking number.

When the OrderGroup.SaveAsOrder, SaveAsBasket, or SaveAsTemplate methods are called, four values are copied from the first OrderForm in the OrderGroup into the OrderGroup object itself. If any of these values already existed at the OrderGroup level, they are overwritten with the values copied from the OrderForm. If the value was Null or never set on the OrderForm, and the value was set on the OrderGroup, the OrderGroup value is overwritten with Null. The values replaced in the OrderGroup are user_first_name, user_last_name, billing_currency, and user_org_name.

If you load a basket or template and call the SaveAsOrder method, the basket or template remains unchanged on disk. For this reason, a call to the SaveAsOrder method is typically followed by a call to OrderGroupManager.DeleteOrderGroupFromDisk.

[Visual Basic .NET]

Example

' oOrderGroup is a Commerce.OrderGroup Object
' vResult is an Object
' vTrackingNumber is an Object
vResult = oOrderGroup.SaveAsOrder(vTrackingNumber)

Requirements

Namespace: Microsoft.CommerceServer.Interop.Orders

Platforms: Windows 2000, Windows Server 2003

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

See Also

OrderGroup Class

OrderGroup.SaveAsBasket

OrderGroup.SaveAsTemplate

Copyright © 2005 Microsoft Corporation.
All rights reserved.