Table of Contents

Class OrderStateService

Namespace
Dynamicweb.Ecommerce.Orders
Assembly
Dynamicweb.Ecommerce.dll

Manages the order states an order can be in: reading them, keeping exactly one state per order flow marked as the default, and deleting the ones that are not in use.

public class OrderStateService : ICacheStorage<string, OrderState>, ICacheStorage<string>, ICacheStorage
Inheritance
OrderStateService
Implements
Inherited Members

Properties

Info

Information about the object cache

public CacheInformation Info { get; }

Property Value

CacheInformation

Methods

CanDelete(OrderState, bool)

Gets a value indicating whether an order state can be deleted.

public virtual bool CanDelete(OrderState state, bool checkDefault)

Parameters

state OrderState

The order state to check.

checkDefault bool

When true, the default state of a flow cannot be deleted.

Returns

bool

true when the state can be deleted; otherwise false.

ClearCache()

Resets all keys to the default value for objects stored in the object cache

public void ClearCache()

ClearCache(IEnumerable<string>)

Resets the specified keys to the default value for objects stored in the object cache

public void ClearCache(IEnumerable<string> keys)

Parameters

keys IEnumerable<string>

Keys to reset

ClearCache(string)

Resets the specified key to the default value for objects stored in the object cache

public void ClearCache(string key)

Parameters

key string

Key to reset

Delete(OrderState)

Deletes an order state, unless it is the default state of its flow or it is in use by an order.

public virtual void Delete(OrderState state)

Parameters

state OrderState

The order state to delete.

GetDefaultStateByFlow(OrderFlow)

Gets the state an order enters by default when it is placed in the given flow.

public virtual OrderState? GetDefaultStateByFlow(OrderFlow flow)

Parameters

flow OrderFlow

The order flow.

Returns

OrderState

The default state of the flow, or null when the flow has none.

GetStateById(string)

Gets an order state by its identifier.

public virtual OrderState? GetStateById(string id)

Parameters

id string

Order state identifier.

Returns

OrderState

The order state, or null when id is empty or no state has that identifier.

GetStatesByFlow(OrderFlow)

Gets the states belonging to the given order flow, in sort order.

public virtual IEnumerable<OrderState> GetStatesByFlow(OrderFlow flow)

Parameters

flow OrderFlow

The order flow.

Returns

IEnumerable<OrderState>

GetStatesByOrderType(OrderType)

Gets the states that apply to the given order type, in sort order.

public virtual IEnumerable<OrderState> GetStatesByOrderType(OrderType orderType)

Parameters

orderType OrderType

The order type.

Returns

IEnumerable<OrderState>

IsStateInUse(OrderState)

Gets a value indicating whether any order is currently in the given state.

public virtual bool IsStateInUse(OrderState state)

Parameters

state OrderState

The order state to check.

Returns

bool

Save(OrderState)

Creates or updates an order state. The flow it belongs to is left with exactly one default state.

public virtual void Save(OrderState state)

Parameters

state OrderState

The order state to save. Ignored when null.

SetCacheType<TObjectCache>()

Changes the storage container

public void SetCacheType<TObjectCache>() where TObjectCache : ServiceCache<string, OrderState>

Type Parameters

TObjectCache
To top