Share via


SaveAsOrder Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Saves the basket to the order capture system database as a placed purchase order.

Namespace:  Microsoft.CommerceServer.Runtime.Orders
Assembly:  Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)

Syntax

'Declaration
Public Function SaveAsOrder As PurchaseOrder
'Usage
Dim instance As Basket
Dim returnValue As PurchaseOrder

returnValue = instance.SaveAsOrder()
public PurchaseOrder SaveAsOrder()
public:
PurchaseOrder^ SaveAsOrder()
public function SaveAsOrder() : PurchaseOrder

Return Value

Type: Microsoft.CommerceServer.Runtime.Orders..::.PurchaseOrder
The newly-created purchase order.

Exceptions

Exception Condition
UnexpectedContainedTypeException

A collection in a mapped class contains an instance of an unmapped class.

OrderGroupConversionException

A strongly-typed or weakly-typed property in the Basket has the same name but a different type as a strongly-named property in the PurchaseOrder class.

SqlException

An error occurred while writing data to the SQL Server.

InvalidCatalogOperationException

The basket has already been disposed, either directly or by conversion to a purchase order.

Remarks

Use this method to persist the basket as a purchase order to the underlying stores.

SaveAsOrder conducts a two-phase commit using a distributed transaction coordinator.

If SaveAsOrder returns successfully, the underlying Basket is cleared. If Save is called immediately after this, a new Basket is created with the same name as the previous Basket.

When an exception is thrown from SaveAsOrder, the in-memory version of the basket is restored to the condition before SaveAsOrder was called. It is possible that any unsaved in-memory changes may be saved to storage as part of error handling.

Permissions

See Also

Reference

Basket Class

Basket Members

Microsoft.CommerceServer.Runtime.Orders Namespace