I'm trying to clone or copy an excisting order, but with both options I get the same error:
Type in assembly Dynamicweb.eCommerce.Orders.OrderCaptureInfo Dynamicweb, Version = 18.9.1.1, Culture = neutral, PublicKeyToken = null is not marked as serializable.
Somebody knows how to handle this?
Developer forum
E-mail notifications
Copy or Clone Order
Posted on 19/10/2010 10:58:25
Replies
Posted on 10/11/2010 12:56:21
Hi there,
What cloning code are you using?
Why you don't you simply create a new order and copy over the properties through code? You can automate this using something like AutoMapper....
Hope this helps,
Imar
What cloning code are you using?
Why you don't you simply create a new order and copy over the properties through code? You can automate this using something like AutoMapper....
Hope this helps,
Imar
Posted on 12/11/2010 12:58:17
Hi Imar
I made it work with a custom function.
The function makes a copy from a field in the source order and copies it to the field in the target order:
I made it work with a custom function.
The function makes a copy from a field in the source order and copies it to the field in the target order:
Protected Sub CopyMyOrder(ByVal Target As Orders.Order, ByVal Source As Orders.Order, ByVal Credit As Boolean)
Target.CustomerAddress = Source.CustomerAddress
Target.CustomerAddress2 = Source.CustomerAddress2
Target.CustomerName = Source.CustomerName
Target.CustomerNumber = Source.CustomerNumberEnd Sub
Above a few lines of the complete function. It takes about 60 lines to copy al the important fields to the new order. There are 2 functions in code available, copy() and clone(). It seems to me that I can make an new order and use one of the two functions to copy al the properties of one order to another order. Like:Dim myOriginalOrder As eCommerce.Orders.Order = eCommerce.Orders.Order.Create("WO1234")
Dim myNewOrder As New Dynamicweb.eCommerce.Orders.Order
myNewOrder = myOriginalOrder.Clone() or:Dim myOriginalOrder As eCommerce.Orders.Order = eCommerce.Orders.Order.Create("WO1234")
Dim myNewOrder As New Dynamicweb.eCommerce.Orders.Order
myNewOrder = myOriginalOrder.Copy() Visual Studio says the code is OK, the functions ar valid. But when you try to run the code, there comes the execption.
Posted on 12/11/2010 13:53:20
Hi Martijn,
I don't know if that is it, but it seems to me that you are missing out on the Save() method of your clone:
Let me know how it goes.
PS: Rather post too much than too little, when posting your code...we've got lots of storage! ;-)
Regards /Morten
I don't know if that is it, but it seems to me that you are missing out on the Save() method of your clone:
Order o = new Order();
o = order.Clone();
o.Save(order.ID);
Let me know how it goes.
PS: Rather post too much than too little, when posting your code...we've got lots of storage! ;-)
Regards /Morten
Posted on 12/11/2010 16:10:26
Hi Morten,
If I read Martijn's message right, he gets an error when he clones the order. He gets a "not serializable" exception on the OrderCaptureInfo type which makes sense as the type is indeed not marked as [Serializable].
So, maybe Clone and Copy (which uses Clone) broke when the CaptureInfo class was added recently? The same might be true for some other properties.
Imar
If I read Martijn's message right, he gets an error when he clones the order. He gets a "not serializable" exception on the OrderCaptureInfo type which makes sense as the type is indeed not marked as [Serializable].
So, maybe Clone and Copy (which uses Clone) broke when the CaptureInfo class was added recently? The same might be true for some other properties.
Imar
Posted on 15/11/2010 08:38:56
Hi Imar / Morten
That's correct. The exception takes place when I try to copy or clone an excisting order to my new order.
Martijn
That's correct. The exception takes place when I try to copy or clone an excisting order to my new order.
Martijn
Posted on 15/11/2010 10:43:31
It is a bug. Registret as bug #5690. Sorry dudes! :-)
Regards /Snedker
Regards /Snedker
Posted on 14/02/2011 13:01:41
Can you inform me when this bug will be resolved?
Jeppe Eriksson Agger
Posted on 18/02/2011 14:36:28
It will be out with the upcoming Service Release (19.2.1.0).
You must be logged in to post in the forum