The OrderForm

When the pipeline invokes a component's implementation of IPipelineComponent::Execute, the pipeline passes the component an IDispatch interface pointer on the object that stores order information. Usually, the object on which this IDispatch is implemented is an OrderForm or a Dictionary.

The OrderForm object is a structured set of Dictionary and SimpleList objects that contains a detailed summary of all or part of one or more shopping sessions. The following figure illustrates the structure of an OrderForm object.

To access any part of an OrderForm within your IPipelineComponent::Execute implementation, call QueryInterface through the IDispatch interface pointer to get an instance pointer on the interface that you need.

For example, the Items collection in an OrderForm is a SimpleList object that contains one or more Dictionary objects. The following sample implementation of IPipelineComponent::Execute demonstrates how to use the Execute method's pdispOrder parameter to get an ISimpleList pointer on this collection:

HRESULT SampleComponentImpl::Execute(IDispatch *pDispOrder, IDispatch *pDispContext, long lFlags, long *pErrorLevel)
{
    HRESULT hr = S_OK;
    IDictionary *pDict = NULL;
    ISimpleList *pListItems = NULL;
    VARIANT var;

    BSTR bstrItems = SysAllocString(L"Items");

    // Call QueryInterface to get the OrderForm Dictionary.

    hr = pDispOrder->QueryInterface(IID_IDictionary, (void**)&pDict);

    if(FAILED(hr)){
        SysFreeString(bstrItems);
        return hr;
    }

    // Get the value of the "Items" Dictionary entry.

    if(SUCCEEDED(hr = pDict->get_Value(bstrItems, &var))){

    if(FAILED(hr)){
        SysFreeString(bstrItems);
        pDict->Release();
        return hr;
    }

    // Make sure that the value of the retrieved item is a COM     //object.

    if(V_VT(var) != VT_DISPATCH && V_VT(var) != VT_UNKNOWN)
        hr = E_UNEXPECTED;
        else
            hr = V_DISPATCH(&var)->QueryInterface(IID_ISimpleList, (void**)&pListItems);

    }

    VariantClear(&var)
    return hr;

}

For information about the IPipelineComponent, ISimpleList, and IDictionary interfaces, see Commerce Server Interfaces


© 1997-1998 Microsoft Corporation. All rights reserved.