Collapse AllExpand All        Code: All Code: Multiple Code: Visual Basic Code: C# Code: Visual C++ Code: J# Code: JScript 
SaveAsOrder Method

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

Visual Basic (Declaration)
Public Function SaveAsOrder As PurchaseOrder
Visual Basic (Usage)
Dim instance As Basket
Dim returnValue As PurchaseOrder

returnValue = instance.SaveAsOrder()
C#
public PurchaseOrder SaveAsOrder()
Visual C++
public:
PurchaseOrder^ SaveAsOrder()
JScript
public function SaveAsOrder() : PurchaseOrder

Return Value

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

ExceptionCondition
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

Page view tracker