|
Home > Archive > Commerce Server General > April 2006 > Cloning an address
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 |
Cloning an address
|
|
| Alejandro 2006-04-10, 7:35 pm |
| I'm trying to clone an order, so I need to clone its addresses (shipping and
optionally billing)
I have the original order stored in po, so I'm trying to do it with:
foreach (OrderAddress oa in po.Addresses)
{
Guid id = Guid.NewGuid();
OrderAddress addrNew = new OrderAddress(oa.Name, id.ToString());
addrNew.Line1 = oa.Line1;
// copy all the other oa fields
basket.Addresses.Add(addrNew);
}
But that doesn't even write a row in table OrderGroupAddresses. Am I
missing something to commit to DB? is that the right way to go?
thanks,
Alejandro
| |
| Jeff Lynch 2006-04-10, 7:35 pm |
| I believe the Basket's OrderGroup.Addresses collection is saved in binary
format in the "BasketGroup" table until you save your Basket as a
PurchaseOrder. Then it is persisted to the OrderGroupAddresses table.
--
Jeff Lynch
"Ramblings From A [Microsoft] Connected Universe"
http://codebetter.com/blogs/jeff.lynch
"Alejandro" <Alejandro@discussions.microsoft.com> wrote in message
news:60CEC70B-983C-41AB-A7E1-F2423893B232@microsoft.com...
> I'm trying to clone an order, so I need to clone its addresses (shipping
> and
> optionally billing)
> I have the original order stored in po, so I'm trying to do it with:
>
> foreach (OrderAddress oa in po.Addresses)
> {
> Guid id = Guid.NewGuid();
> OrderAddress addrNew = new OrderAddress(oa.Name, id.ToString());
>
> addrNew.Line1 = oa.Line1;
> // copy all the other oa fields
> basket.Addresses.Add(addrNew);
> }
>
> But that doesn't even write a row in table OrderGroupAddresses. Am I
> missing something to commit to DB? is that the right way to go?
> thanks,
> Alejandro
|
|
|
|
|