DeleteBaskets Method (SearchClause, Int32)
Deletes all baskets that match a supplied search clause. The number of deleted records is available.
Namespace: Microsoft.CommerceServer.Orders
Assembly: Microsoft.CommerceServer.Orders.CrossTierTypes (in Microsoft.CommerceServer.Orders.CrossTierTypes.dll)
Syntax
'Declaration
Public Sub DeleteBaskets ( _
searchClause As SearchClause, _
<OutAttribute> ByRef recordsDeleted As Integer _
)
'Usage
Dim instance As BasketManager
Dim searchClause As SearchClause
Dim recordsDeleted As Integer
instance.DeleteBaskets(searchClause, _
recordsDeleted)
public void DeleteBaskets(
SearchClause searchClause,
out int recordsDeleted
)
public:
void DeleteBaskets(
SearchClause^ searchClause,
[OutAttribute] int% recordsDeleted
)
public function DeleteBaskets(
searchClause : SearchClause,
recordsDeleted : int
)
Parameters
- searchClause
Type: Microsoft.CommerceServer..::.SearchClause
The search clause to use.
- recordsDeleted
Type: System..::.Int32%
The number of baskets that were deleted.
Exceptions
Exception | Condition |
---|---|
ArgumentException | The search clause is not a well formed search clause. |
NotAuthorizedException | The user does not have permission to perform this operation. |
Remarks
Deletes all baskets that match a supplied search clause and supplies a count of the number of baskets deleted.
Delete operations should be carried out in small chunks. Extensive delete operations can lock the baskets table and degrade site performance significantly for current customers. If the amount of baskets is large (e.g. during peak season), run the command multiple times during the day, or use a datetime range that breaks up the large count of baskets into smaller ones.
In order to perform a DeleteBaskets, the user must have the OrdersAdministrator permissions. See Orders System Roles [CS06] for more information about the specific roles in the Order System.
Some order system APIs support distributed transactions. If a cookie with a valid transaction is found the order system enlists as part of that transaction. If a valid transaction is not found the order system initiates a new transaction.
Examples
The following code sample deletes all baskets created on or before the current time (Effectively deleting all baskets).
OrderManagementContext orderSystem = new OrderManagementContext("app.config");
BasketManager basketmanager = orderSystem.BasketManager;
// Build the search clause.
DataSet searchableProperties = basketmanager.GetSearchableProperties("en-US");
SearchClauseFactory factory = basketmanager.GetSearchClauseFactory(searchableProperties, "Basket");
SearchClause clause = factory.CreateClause(ExplicitComparisonOperator.OnOrBefore, "Created", DateTime.Now.ToUniversalTime());
basketmanager.DeleteBaskets(clause, out recordsDeleted);
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.