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
Methods
CanDelete(OrderState, bool)
Gets a value indicating whether an order state can be deleted.
public virtual bool CanDelete(OrderState state, bool checkDefault)
Parameters
stateOrderStateThe order state to check.
checkDefaultboolWhen
true, the default state of a flow cannot be deleted.
Returns
- bool
truewhen the state can be deleted; otherwisefalse.
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
keysIEnumerable<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
keystringKey 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
stateOrderStateThe 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
flowOrderFlowThe order flow.
Returns
- OrderState
The default state of the flow, or
nullwhen the flow has none.
GetStateById(string)
Gets an order state by its identifier.
public virtual OrderState? GetStateById(string id)
Parameters
idstringOrder state identifier.
Returns
- OrderState
The order state, or
nullwhenidis 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
flowOrderFlowThe order flow.
Returns
GetStatesByOrderType(OrderType)
Gets the states that apply to the given order type, in sort order.
public virtual IEnumerable<OrderState> GetStatesByOrderType(OrderType orderType)
Parameters
orderTypeOrderTypeThe order type.
Returns
IsStateInUse(OrderState)
Gets a value indicating whether any order is currently in the given state.
public virtual bool IsStateInUse(OrderState state)
Parameters
stateOrderStateThe order state to check.
Returns
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
stateOrderStateThe 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