how to programatically increment the ordernumber

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
harryhair5
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Fri Oct 15, 2010 2:05 pm

how to programatically increment the ordernumber

Post by harryhair5 » Mon Jan 16, 2012 1:21 pm

I'm inserting orders programatically from another system. When I set the order number:

Code: Select all

            Order curOrder = new Order();
            Store curStore = StoreDataSource.Load(1);
            curOrder.OrderNumber = curStore.NextOrderId;
            ...
            curOrder.Save();
It doesn't increment for the next order I insert. How can I increment it? I've tried:

Code: Select all

            curStore.NextOrderId += 1;
            curStore.Save();
            curStore.OrderIdIncrement;
and

Code: Select all

curOrder.OrderNumber = StoreDataSource.GetNextOrderNumber();
But still each time, the ordernumber is the same.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: how to programatically increment the ordernumber

Post by david-ebt » Mon Jan 16, 2012 3:50 pm

Do you have the

Code: Select all

Order curOrder = new Order();
code inside your order-creation loop? Or are you reusing the curOrder object?
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Post Reply