|
Home > Archive > Commerce Server General > October 2006 > Custo Pipeline read/write values
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Custo Pipeline read/write values
|
|
| Steve H. 2006-10-28, 1:33 pm |
| I am trying to develop a custom pipeline component to read values from
previous pipeline components and to write values for following components to
use.
The component won't provide any visual form to specify values like in
"MinMaxShipping" pipeline component included in SDK folder of the commerce
server...
Basically I would like to read values loaded by the "QueryProdInfo"
components such as "item.product_id", "item.product_catalog", and
"item._product_cy_list_price"]; plus some other Weakly typed property added
to the line item.
So, is it within the "Execute" procedure of the 'IPipelineComponent' like
the following:
int IPipelineComponent.Execute(object pdispOrder, object pdispContext, int
lFlags)
{
IDictionary Context = (IDictionary)pdispContext;
OrderContext myOrderContext =
(OrderContext)Context["item._product_cy_list_price"];
}
and what's the correct way to reference to a line item from within the
component: i.e. is it pdispOrder["lineItem"] or pdispContext["lineItem"] or
some other way ??
| |
| Colin Bowern 2006-10-31, 7:21 pm |
| Steve,
The pipeline process converts the order form into a bunch of IDictionary and
ISimpleList's. You will need to take the pDispOrder which is an IDictionary
representing the OrderForm and read the items from there. Here's a few bits
to give you a hint as to how to access the various levels:
IDictionary OrderForm = (IDictionary)pDispOrder;
ISimpleList LineItems = OrderForm["items"];
IDictionary Item = LineItems[0];
Item["_product_cy_list_price"] = new CurrencyWrapper(decimal.Zero);
pDispContext contains the MessageManager among a number of other properties.
I ended up writing a wrapper to access the values to make the code more
maintainable. Here's a snippet of my PipelineContext class which wraps the
pDispContext with strongly-typed properties:
[CLSCompliant(false)]
public ICacheManager CacheManager
{
get { return this[Extensions.PipelineContextKeys.CacheManager]
as ICacheManager; }
set { this[Extensions.PipelineContextKeys.CacheManager] =
value; }
}
public string CatalogLanguage
{
get { return
this[Extensions.PipelineContextKeys.CatalogLanguage] as string; }
set { this[Extensions.PipelineContextKeys.CatalogLanguage] =
value; }
}
[CLSCompliant(false)]
public IMessageManager MessageManager
{
get { return this[Extensions.PipelineContextKeys.MessageManager]
as IMessageManager; }
set { this[Extensions.PipelineContextKeys.MessageManager] =
value; }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage",
" CA2227:CollectionPropertiesShouldBeReadO
nly")]
public CommerceResourceCollection CommerceResources
{
get { return
this[Extensions.PipelineContextKeys.CommerceResources] as
CommerceResourceCollection; }
set { this[Extensions.PipelineContextKeys.CommerceResources] =
value; }
}
Cheers,
Colin
"Steve H." <SteveH@discussions.microsoft.com> wrote in message
news:86EF58B1-3604-4BAB-BED0-08E58AEC542C@microsoft.com...
>I am trying to develop a custom pipeline component to read values from
> previous pipeline components and to write values for following components
> to
> use.
>
> The component won't provide any visual form to specify values like in
> "MinMaxShipping" pipeline component included in SDK folder of the commerce
> server...
>
> Basically I would like to read values loaded by the "QueryProdInfo"
> components such as "item.product_id", "item.product_catalog", and
> "item._product_cy_list_price"]; plus some other Weakly typed property
> added
> to the line item.
>
> So, is it within the "Execute" procedure of the 'IPipelineComponent' like
> the following:
>
> int IPipelineComponent.Execute(object pdispOrder, object pdispContext, int
> lFlags)
> {
> IDictionary Context = (IDictionary)pdispContext;
> OrderContext myOrderContext =
> (OrderContext)Context["item._product_cy_list_price"];
>
> }
>
> and what's the correct way to reference to a line item from within the
> component: i.e. is it pdispOrder["lineItem"] or pdispContext["lineItem"]
> or
> some other way ??
|
|
|
|
|