Microsoft Developer Network >
Forums Home
>
Commerce Server Forums
>
Commerce Server 2007
>
Modify a purchase order
Modify a purchase order
- This question is regarding SavePurchaseOrder, UpdatePurchaseOrder, and UpdatePurchaseOrderProperties methods in the PurchaseOrderManager class.
1) Is there a functional difference between SavePurchaseOrder and UpdatePurchaseOrder?
2) If I have a purchase order as XML (GetPurchaseOrderAsXml) and I want to change one of the attributes of one of the nodes can I use UpdatePurchaseOrderProperties or am I forced to SavePurchaseOrder even if all I changed was an attribute? If I can use UpdatePurchaseOrderProperties what is the format of the XmlElement for a "property" that is an attribute?
I see that if I want to search the database for a particular purchase order it seems that I am better off programming using the DataSet model. What are the scenarios which I am better off using XML?
Thank you.
Kevin
Answers
- Sorry, I posted the wrong link. This one should help you : http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.orders.purchaseordermanager.updatepurchaseorderproperties.aspx
And the method you should use is UpdatePurchaseOrderProperties , not updatepurchaseorder.
hth,
Cyrebre- Marked As Answer byKevinBurton Friday, November 06, 2009 7:06 PM
- Proposed As Answer byCyril Rebreyend Friday, October 30, 2009 9:33 AM
All Replies
- Hi Kevin,
looks like i am your best friend today ! :)
to change some attributes to a purchase order, you should use UpdatePurchaseOrder this way :
http://msdn.microsoft.com/en-us/library/bb219142.aspx
It is incredibely faster than the save method applied to dataset.
hth,
Cyrebre- Proposed As Answer byCyril Rebreyend Thursday, October 29, 2009 8:07 PM
- But the change is still applied to the DataSet. You are saying that UpdatePurchaseOrder is faster than . . . .
Thank you.
Kevin - I don't understand... What do you mean by 'the change is still applied to dataset' ?
- This articl only deals with DataSets. It doesn't use XML at all.
Kevin - Sorry, I posted the wrong link. This one should help you : http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.orders.purchaseordermanager.updatepurchaseorderproperties.aspx
And the method you should use is UpdatePurchaseOrderProperties , not updatepurchaseorder.
hth,
Cyrebre- Marked As Answer byKevinBurton Friday, November 06, 2009 7:06 PM
- Proposed As Answer byCyril Rebreyend Friday, October 30, 2009 9:33 AM
For example if I want to modify more than one attribute/property on the PurchaseOrder element would I just add another PurchaseOrder element or do I need to call UpdatePurchaseOrderProperties once for each property that I want to modify?
Thanks again.
Kevin- No, the aim of this function is to bulk modify your PO; so you can update a lot of PO With just 1 call.
Cyrebre - Another question if you don't mind. We have "extended" the LineItem and OrderForm. We call our extended version BsiLineItem and BsiOrderForm. If we substitute BsiLineItem for LineItem in the Xml that is passed to UpdatePurchaseOrderProperties and use our extended properties, this will work right?
Kevin - Normally you should extend your webservice too (copy the orderobjectsmapping.xml and orderpipelinemappings.xml to the webservice folder) and then the WS will return you BsiLineItem instead of LineItem.
hth
Cyrebre - We have done this. Is what I see in GetPurchaseOrderAsXml is a structure like:
<LineItems>
<BsiLineItem . . . . ./>
<BsiLineItem . . . . ./>
If I want to changed the property/attribute of a *BsiLineItem* can I feed Xml like:
<PurchaseOrderUpdates>
<BsiLineItem LineItemId=.... PropertyName=... PropertyValue=.... />
<BsiLineItem LineItemId=.... PropertyName=... PropertyValue=.... />
. . .
?
Thank you.
Kevin - I think it's the way it works, but i didn't test it (we don't update lineitems on our site).
But if you try i'm interested in the result.
++
Cyrebre

