November Happy Hour will be moved to Thursday December 5th.

Class OrderContext

The Order Context class is used to access all the functions of the Order System.

Inheritance
System.Object
OrderContext
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Commerce.Orders
Assembly: Mediachase.Commerce.dll
Version: 13.30.0
Syntax
public class OrderContext

Fields

CartMetaClassNameColumn

Declaration
public const string CartMetaClassNameColumn = "MetaClass.Name"
Field Value
Type Description
System.String

CartStatusColumn

Declaration
public const string CartStatusColumn = "Status"
Field Value
Type Description
System.String

CartTotalColumn

Declaration
public const string CartTotalColumn = "Total"
Field Value
Type Description
System.String

CustomerNameColumn

Declaration
public const string CustomerNameColumn = "CustomerName"
Field Value
Type Description
System.String

OrderGroupIdColumn

Declaration
public const string OrderGroupIdColumn = "OrderGroupId"
Field Value
Type Description
System.String

OrderMarketIdColumn

Declaration
public const string OrderMarketIdColumn = "MarketId"
Field Value
Type Description
System.String

OrderProviderIdColumn

Declaration
public const string OrderProviderIdColumn = "ProviderId"
Field Value
Type Description
System.String

PaymentPlanClassType

Declaration
public const string PaymentPlanClassType = "PaymentPlan"
Field Value
Type Description
System.String

PurchaseOrderClassType

Declaration
public const string PurchaseOrderClassType = "PurchaseOrder"
Field Value
Type Description
System.String

ShoppingCartClassType

Declaration
public const string ShoppingCartClassType = "ShoppingCart"
Field Value
Type Description
System.String

Properties

CashCardPaymentMetaClass

Gets the cash card payment meta class.

Declaration
public MetaClass CashCardPaymentMetaClass { get; }
Property Value
Type Description
MetaClass

The cash card payment meta class.

CreditCardPaymentMetaClass

Gets the credit card payment meta class.

Declaration
public MetaClass CreditCardPaymentMetaClass { get; }
Property Value
Type Description
MetaClass

The credit card payment meta class.

Current

Gets the current context.

Declaration
public static OrderContext Current { get; }
Property Value
Type Description
OrderContext

The current.

ExchangePaymentMetaClass

Gets the exchange payment meta class.

Declaration
public MetaClass ExchangePaymentMetaClass { get; }
Property Value
Type Description
MetaClass

The exchange payment meta class.

ExecutionManager

Gets the ActivityFlow execution manager.

Declaration
public ExecutionManager ExecutionManager { get; }
Property Value
Type Description
ExecutionManager

GiftCardPaymentMetaClass

Gets the gift card payment meta class.

Declaration
public MetaClass GiftCardPaymentMetaClass { get; }
Property Value
Type Description
MetaClass

The gift card payment meta class.

InvoicePaymentMetaClass

Gets the invoice payment meta class.

Declaration
public MetaClass InvoicePaymentMetaClass { get; }
Property Value
Type Description
MetaClass

The invoice payment meta class.

LineItemMetaClass

Gets the line item meta class.

Declaration
public MetaClass LineItemMetaClass { get; }
Property Value
Type Description
MetaClass

The line item meta class.

MetaDataContext

Gets or sets the meta data context.

Declaration
public static MetaDataContext MetaDataContext { get; set; }
Property Value
Type Description
MetaDataContext

The meta data context.

OrderAddressMetaClass

Gets the order address meta class.

Declaration
public MetaClass OrderAddressMetaClass { get; }
Property Value
Type Description
MetaClass

The order address meta class.

OrderFormMetaClass

Gets the order form meta class.

Declaration
public MetaClass OrderFormMetaClass { get; }
Property Value
Type Description
MetaClass

The order form meta class.

OrderGroupMetaClass

Gets the order group meta class.

Declaration
public MetaClass OrderGroupMetaClass { get; }
Property Value
Type Description
MetaClass

The order group meta class.

OrderItemMetaClass

Gets the order item meta class.

Declaration
public MetaClass OrderItemMetaClass { get; }
Property Value
Type Description
MetaClass

The order item meta class.

OtherPaymentMetaClass

Gets the other payment meta class.

Declaration
public MetaClass OtherPaymentMetaClass { get; }
Property Value
Type Description
MetaClass

The other payment meta class.

PaymentPlanMetaClass

Gets the payment plan meta class.

Declaration
public MetaClass PaymentPlanMetaClass { get; }
Property Value
Type Description
MetaClass

The payment plan meta class.

PurchaseOrderMetaClass

Gets the purchase order meta class.

Declaration
public MetaClass PurchaseOrderMetaClass { get; }
Property Value
Type Description
MetaClass

The purchase order meta class.

ShipmentMetaClass

Gets the shipment meta class.

Declaration
public MetaClass ShipmentMetaClass { get; }
Property Value
Type Description
MetaClass

The shipment meta class.

ShoppingCartMetaClass

Gets the shopping cart meta class.

Declaration
public MetaClass ShoppingCartMetaClass { get; }
Property Value
Type Description
MetaClass

The shopping cart meta class.

TrackingNumberPattern

Gets or sets the pattern for tracking number. By default, only numbers and characters are allowed.

Declaration
public string TrackingNumberPattern { get; set; }
Property Value
Type Description
System.String

Methods

Deserialize(XmlNode, Type)

Deserializes the specified node.

Declaration
public static object Deserialize(XmlNode node, Type type)
Parameters
Type Name Description
System.Xml.XmlNode node

The node.

System.Type type

The type.

Returns
Type Description
System.Object

FindActiveOrders()

Finds purchase orders with InProgress or PartiallyShipped status.

Declaration
public PurchaseOrder[] FindActiveOrders()
Returns
Type Description
PurchaseOrder[]

FindCarts(OrderSearchParameters, OrderSearchOptions)

Finds the carts.

Declaration
[Obsolete("This method is no longer used. Use Search<T> instead. Will remain at least until December 2019.")]
public Cart[] FindCarts(OrderSearchParameters parameters, OrderSearchOptions options)
Parameters
Type Name Description
OrderSearchParameters parameters

The parameters.

OrderSearchOptions options

The options.

Returns
Type Description
Cart[]

FindCarts(OrderSearchParameters, OrderSearchOptions, out Int32)

Finds the carts.

Declaration
[Obsolete("This method is no longer used. Use Search<T> instead. Will remain at least until December 2019.")]
public Cart[] FindCarts(OrderSearchParameters parameters, OrderSearchOptions options, out int totalRecords)
Parameters
Type Name Description
OrderSearchParameters parameters

The parameters.

OrderSearchOptions options

The options.

System.Int32 totalRecords

The total records.

Returns
Type Description
Cart[]

FindPaymentPlans(OrderSearchParameters, OrderSearchOptions)

Finds the payment plans.

Declaration
[Obsolete("This method is no longer used. Use Search<T> instead. Will remain at least until December 2019.")]
public PaymentPlan[] FindPaymentPlans(OrderSearchParameters parameters, OrderSearchOptions options)
Parameters
Type Name Description
OrderSearchParameters parameters

The parameters.

OrderSearchOptions options

The options.

Returns
Type Description
PaymentPlan[]

FindPaymentPlans(OrderSearchParameters, OrderSearchOptions, out Int32)

Finds the payment plans.

Declaration
[Obsolete("This method is no longer used. Use LoadByCustomerId<T> instead. Will remain at least until December 2019.")]
public PaymentPlan[] FindPaymentPlans(OrderSearchParameters parameters, OrderSearchOptions options, out int totalRecords)
Parameters
Type Name Description
OrderSearchParameters parameters

The parameters.

OrderSearchOptions options

The options.

System.Int32 totalRecords

The total records.

Returns
Type Description
PaymentPlan[]

FindPurchaseOrders(OrderSearchParameters, OrderSearchOptions)

Finds the purchase orders.

Declaration
[Obsolete("This method is no longer used. Use Search<T> instead. Will remain at least until December 2019.")]
public PurchaseOrder[] FindPurchaseOrders(OrderSearchParameters parameters, OrderSearchOptions options)
Parameters
Type Name Description
OrderSearchParameters parameters

The parameters.

OrderSearchOptions options

The options.

Returns
Type Description
PurchaseOrder[]

FindPurchaseOrders(OrderSearchParameters, OrderSearchOptions, out Int32)

Finds the purchase orders.

Declaration
[Obsolete("This method is no longer used. Use Search<T> instead. Will remain at least until December 2019.")]
public PurchaseOrder[] FindPurchaseOrders(OrderSearchParameters parameters, OrderSearchOptions options, out int totalRecords)
Parameters
Type Name Description
OrderSearchParameters parameters

The parameters.

OrderSearchOptions options

The options.

System.Int32 totalRecords

The total records.

Returns
Type Description
PurchaseOrder[]

FindPurchaseOrdersByStatus(OrderStatus[])

Finds purchase orders with given statuses.

Declaration
public PurchaseOrder[] FindPurchaseOrdersByStatus(params OrderStatus[] statuses)
Parameters
Type Name Description
OrderStatus[] statuses

One or more order statuses to search for.

Returns
Type Description
PurchaseOrder[]

Get<T>(Int32)

Loads a specific OrderGroup of specified type.

Declaration
public T Get<T>(int orderGroupId)
    where T : OrderGroup
Parameters
Type Name Description
System.Int32 orderGroupId

The order group id.

Returns
Type Description
T
Type Parameters
Name Description
T

The real type.

GetCart(Int32)

Returns the cart by customer id and order group id.

Declaration
[Obsolete("This method is no longer used. Use Get<T> instead. Will remain at least until December 2019.")]
public Cart GetCart(int orderGroupId)
Parameters
Type Name Description
System.Int32 orderGroupId

The order group id.

Returns
Type Description
Cart

GetCart(String, Guid)

Returns the cart by name and customer id in current market. If non found creates a new cart.

Declaration
public Cart GetCart(string name, Guid customerId)
Parameters
Type Name Description
System.String name

The name.

System.Guid customerId

The customer id.

Returns
Type Description
Cart

GetCart(String, Guid, MarketId)

Returns the cart by name and customer id in a specific market. If non found creates a new cart.

Declaration
public Cart GetCart(string name, Guid customerId, MarketId marketId)
Parameters
Type Name Description
System.String name

The name.

System.Guid customerId

The customer id.

MarketId marketId

The market id.

Returns
Type Description
Cart

GetMostRecentPurchaseOrder(Guid)

Gets the most recent purchase order.

Declaration
[Obsolete("This method is no longer used. Will remain at least until December 2019.")]
public PurchaseOrder GetMostRecentPurchaseOrder(Guid customerId)
Parameters
Type Name Description
System.Guid customerId

The customer id.

Returns
Type Description
PurchaseOrder

The most recent purchase order

GetPaymentPlan(Int32)

Gets the payment plan.

Declaration
[Obsolete("This method is no longer used. Use Get<T> instead. Will remain at least until December 2019.")]
public PaymentPlan GetPaymentPlan(int orderGroupId)
Parameters
Type Name Description
System.Int32 orderGroupId

The order group id.

Returns
Type Description
PaymentPlan

GetPaymentPlans(Guid)

Gets the payment plans.

Declaration
[Obsolete("This method is no longer used. Use LoadByCustomerId<T> instead. Will remain at least until December 2019.")]
public PaymentPlan[] GetPaymentPlans(Guid customerId)
Parameters
Type Name Description
System.Guid customerId

The customer id.

Returns
Type Description
PaymentPlan[]

GetPurchaseOrder(Int32)

Gets the purchase order.

Declaration
[Obsolete("This method is no longer used. Use Get<T> instead. Will remain at least until December 2019.")]
public PurchaseOrder GetPurchaseOrder(int orderGroupId)
Parameters
Type Name Description
System.Int32 orderGroupId

The order group id.

Returns
Type Description
PurchaseOrder

GetPurchaseOrder(String)

Gets the purchase order by tracking number.

Declaration
public PurchaseOrder GetPurchaseOrder(string trackingNumber)
Parameters
Type Name Description
System.String trackingNumber

The tracking number.

Returns
Type Description
PurchaseOrder

The first matching purchase order. Null if no order found.

Remarks

trackingNumber will be validated against TrackingNumberPattern. If it is not valid, null will be returned. You can change TrackingNumberPattern to be more strict, or more relax. However, a relaxed pattern should only be used with care.

GetPurchaseOrderById(Int32)

Gets the purchase order by id.

Declaration
[Obsolete("This method is no longer used. Use Get<T> instead. Will remain at least until December 2019.")]
public PurchaseOrder GetPurchaseOrderById(int orderGroupId)
Parameters
Type Name Description
System.Int32 orderGroupId

The order group id.

Returns
Type Description
PurchaseOrder

GetPurchaseOrders(Guid)

Gets the purchase orders.

Declaration
[Obsolete("This method is no longer used. Use LoadByCustomerId<T> instead. Will remain at least until December 2019.")]
public PurchaseOrder[] GetPurchaseOrders(Guid customerId)
Parameters
Type Name Description
System.Guid customerId

The customer id.

Returns
Type Description
PurchaseOrder[]

GetTaxes(Guid, String, String, IOrderAddress)

Gets the taxes.

Declaration
[Obsolete("This method is no longer used. Use ITaxCalculator instead. Will remain at least until December 2019.")]
public IEnumerable<TaxValue> GetTaxes(Guid siteId, string taxCategory, string languageCode, IOrderAddress orderAddress)
Parameters
Type Name Description
System.Guid siteId

The site identifier.

System.String taxCategory

The tax category.

System.String languageCode

The language code.

IOrderAddress orderAddress

The order address.

Returns
Type Description
System.Collections.Generic.IEnumerable<TaxValue>

GetTaxes(Guid, String, String, String, String, String, String, String, String)

Gets the taxes.

Declaration
[Obsolete("This method is no longer used. Use ITaxCalculator instead. Will remain at least until December 2019.")]
public TaxValue[] GetTaxes(Guid siteId, string taxCategory, string languageCode, string countryCode, string stateProvinceCode, string zipPostalCode, string district, string county, string city)
Parameters
Type Name Description
System.Guid siteId

The site id.

System.String taxCategory

The tax category.

System.String languageCode

The language code.

System.String countryCode

The country code.

System.String stateProvinceCode

The state province code.

System.String zipPostalCode

The zip postal code.

System.String district

The district.

System.String county

The county.

System.String city

The city.

Returns
Type Description
TaxValue[]

LoadByCustomerId<T>(Guid)

Searches for order groups made for a specific customer.

Declaration
public T[] LoadByCustomerId<T>(Guid customerId)
    where T : OrderGroup
Parameters
Type Name Description
System.Guid customerId

The customer id.

Returns
Type Description
T[]
Type Parameters
Name Description
T

RaiseOrderGroupDeletedEvent(IOrderGroup, OrderGroupEventArgs)

Raises the order group deleted event.

Declaration
public virtual void RaiseOrderGroupDeletedEvent(IOrderGroup orderGroup, OrderGroupEventArgs eventArgs)
Parameters
Type Name Description
IOrderGroup orderGroup

The order group.

OrderGroupEventArgs eventArgs

The OrderGroupEventArgs instance containing the event data.

RaiseOrderGroupUpdatedEvent(IOrderGroup, OrderGroupEventArgs)

Raises the order group updated event.

Declaration
public virtual void RaiseOrderGroupUpdatedEvent(IOrderGroup orderGroup, OrderGroupEventArgs eventArgs)
Parameters
Type Name Description
IOrderGroup orderGroup

The order group.

OrderGroupEventArgs eventArgs

The OrderGroupEventArgs instance containing the event data.

Search<T>(OrderSearch, out Int32)

Searches for order groups.

Declaration
public T[] Search<T>(OrderSearch search, out int totalRecords)
    where T : OrderGroup
Parameters
Type Name Description
OrderSearch search

The search.

System.Int32 totalRecords

The total records.

Returns
Type Description
T[]
Type Parameters
Name Description
T

Search<T>(OrderSearchParameters, OrderSearchOptions)

Searches for order groups of specified type.

Declaration
public T[] Search<T>(OrderSearchParameters parameters, OrderSearchOptions options)
    where T : OrderGroup
Parameters
Type Name Description
OrderSearchParameters parameters

The search parameter.

OrderSearchOptions options

The search options.

Returns
Type Description
T[]
Type Parameters
Name Description
T

Search<T>(OrderSearchParameters, OrderSearchOptions, out Int32)

Searches for order groups of specified type.

Declaration
public T[] Search<T>(OrderSearchParameters parameters, OrderSearchOptions options, out int totalRecords)
    where T : OrderGroup
Parameters
Type Name Description
OrderSearchParameters parameters

The search parameter.

OrderSearchOptions options

The search options.

System.Int32 totalRecords

The total records.

Returns
Type Description
T[]
Type Parameters
Name Description
T

Serialize(XmlTextWriter, OrderGroup)

Serializes the specified writer.

Declaration
public static void Serialize(XmlTextWriter writer, OrderGroup orderGroup)
Parameters
Type Name Description
System.Xml.XmlTextWriter writer

The writer.

OrderGroup orderGroup

The order group.

Events

OrderGroupDeleted

Occurs when [order group deleted].

Declaration
public event EventHandler<OrderGroupEventArgs> OrderGroupDeleted
Event Type
Type Description
System.EventHandler<OrderGroupEventArgs>

OrderGroupUpdated

Occurs when [order group updated].

Declaration
public event EventHandler<OrderGroupEventArgs> OrderGroupUpdated
Event Type
Type Description
System.EventHandler<OrderGroupEventArgs>