Order System Task and Object Mapping from COM to .NET
The OrderForm and OrderGroup objects are the core of the Order System functionality in both the COM and .NET-based models. Pipelines are no longer run from the OrderGroup
Object mapping
The .NET types in the following table are in the Microsoft.CommerceServer.Runtime.Orders namespace unless otherwise noted.
ASP | ASP.NET |
---|---|
OrderGroup | Basket, OrderTemplate, and PurchaseOrder classes are all derived from the OrderGroup abstract base class.
OrderContext is a factory object for these types. |
OrderForm
OrderGroup.Value(“OrderForms”).Value(“OrderFormName”) |
OrderForm |
OrderForms DictionaryOrderGroup.Value(“OrderForms”) | OrderFormCollection |
Item Dictionary OrderForm.Items(n) |
LineItem |
Items SimpleList
OrderForm.Items |
LineItemCollection |
Address Dictionary | OrderAddress |
Addresses Dictionary | OrderAddressCollection |
OrderGroupManager | OrderGroupSearch
OrderGroupSearchOptions |
MtsPipeline
PooledPipeline |
OrderPipeline
(Microsoft.CommerceServer.Runtime.Pipelines) |
Pipeline Context Dictionary | PipelineInfo |
Task mapping
Accessing the root object for interacting with the Order System
Loading a basket or creating a new basket for a user
Saving a basket
Converting a basket to a purchase order at checkout
Searching for a saved order
Loading an existing purchase order
Saving a purchase order
Loading an existing order template for a user
Creating an order template as a copy of an existing basket or purchase order
Saving an order template
Running an order processing pipeline on an OrderGroup
Retrieving a list of configured shipping methods
Accessing the collection of OrderForms in an OrderGroup
Adding a new line item to an OrderForm
Accessing the root object for interacting with the Order System
ASP | ASP.NET |
---|---|
Access to most order system functionality is through the Commerce.OrderGroup object.
|
CommerceContext.Current.OrderSystem (OrderContext class) |
Loading a basket or creating a new basket for a user
In both the COM and .NET-based object models, a new basket is created if one does not already exist for the user, otherwise the existing basket is loaded.
In the COM object model, the userId parameter is a string usually representing a GUID. In the .NET-based model, the userId parameter is a System.Guid structure.
ASP | ASP.NET |
---|---|
OrderGroup.Initialize(connStr, userId)
OrderGroup.LoadBasket |
OrderContext.GetBasket(userId) |
Saving a basket
ASP | ASP.NET |
---|---|
OrderGroup.SaveAsBasket | Basket.Save |
Converting a basket to a purchase order at checkout
This task is typically done after the checkout pipeline has successfully run, within the same transaction in which the pipeline was run.
ASP | ASP.NET |
---|---|
OrderGroup.SaveAsOrder |
|
Searching for a saved order
ASP | ASP.NET |
---|---|
Use the OrderGroupManager.SimpleFind method together with a SimpleFindSearchInfo object. Alternatively, use the Find method method directly.
Results are returned in an ADO Recordset object. |
Create an instance of the OrderGroupSearch object and set the properties to specify the search criteria. Call the Find method, passing an instance of the OrderGroupSearchOptions object to specify the search options.
Results are returned in an ADO.NET DataSet. |
Loading an existing purchase order
ASP | ASP.NET |
---|---|
OrderGroup.Initialize(connStr, userId)
OrderGroup.LoadOrder(orderId) |
OrderContext.GetPurchaseOrder(userId, orderId) |
Saving a purchase order
ASP | ASP.NET |
---|---|
OrderGroup.SaveAsOrder | PurchaseOrder.Save |
Loading an existing order template for a user
ASP | ASP.NET |
---|---|
OrderGroup.Initialize(userId)
OrderGroup.LoadTemplate(templateId) |
OrderContext.GetOrderTemplate(userId, templateId) |
Creating an order template as a copy of an existing basket or purchase order
Order templates can be used for wish lists and saved shopping lists.
ASP | ASP.NET |
---|---|
One approach is to load the existing basket or purchase order and then call the OrderGroup.SaveAsTemplate method.
Another approach is to create a new OrderGroup object and use the AddOrderForm method to copy the order forms from the existing OrderGroup to the template. Then call the SaveAsTemplate method to save the new template. The AddOrderForm method clones the order form, it does not add a new reference to the existing order form. |
Create an OrderTemplate object and copy the order forms to the new template by using the Add method on the OrderForms collection of the template. Save the new template by calling OrderTemplate.Save method. |
Saving an order template
ASP | ASP.NET |
---|---|
OrderGroup.SaveAsTemplate | OrderTemplate.Save |
Running an order processing pipeline on an OrderGroup
When a pipeline is run against an OrderGroup object, it is run against each of the order forms in the pipeline, one at a time. If the pipeline is transactional, all pipeline executions occur in the context of a single transaction.
ASP | ASP.NET |
---|---|
Create a pipeline context dictionary and set the key value pairs needed by the pipeline components within the pipeline. Run the pipeline by calling the OrderGroup.RunPipe method. To view an example, see the RunMtsPipeline method in the std_pipeline_lib.asp include file in the Solution Sites. The std_pipeline_lib.asp file is located in the <drive>:\Inetpub\wwwroot\<Solution Site>\include directory. This file is only available if the Retail or Supplier Solution Site has been unpacked. | Create an instance of the PipelineInfo object, passing in the name of the pipeline. The PipelineInfo object is roughly equivalent to a COM pipeline context dictionary. The constructor takes special action for the well-known pipeline names "Basket" and "Total". It automatically sets up many of the required keys in the context dictionary that are required for the standard Commerce Server pipeline components. Custom keys can be set by accessing the Item property. |
Retrieving a list of configured shipping methods
Both the COM and .NET-based versions allow you to specify a filter criteria, a sort order, and the columns to return.
ASP | ASP.NET |
---|---|
ShippingMethodManager.GetInstalledMethodList | OrderContext.GetShippingMethods |
Accessing the collection of OrderForms in an OrderGroup
ASP | ASP.NET |
---|---|
OrderGroup.Value(“OrderForms”)
This is a Commerce.Dictionary object containing the OrderForm objects keyed by name ("default" is the name of the default OrderForm object). |
OrderGroup.OrderForms property |
Adding a new line item to an OrderForm
ASP | ASP.NET |
---|---|
Create a Commerce.Dictionary object representing the item. Typically, the dictionary contains at least the following keys:
Then call the OrderGroup.AddItem(dictItem) method. |
Create an instance of the LineItem object, passing properties of the product to the constructor as arguments. Set any additional custom properties by using the Item property of the LineItem object. Add the LineItem object to the OrderForm by using the Add method of the OrderForm.LineItemCollection property. |
Copyright © 2005 Microsoft Corporation.
All rights reserved.