I was doing some SQL profiling which showed that the following piece of SQL was being run regularly on our database:
Code:
update orders set IsNew=0 where ParentOrderNumber IS NOT NULL and CartType<>2
This resulted in the same 72 (currently) records being regularly updated in the same way, ie making IsNew=0. I tracked this down to the admin\orders.aspx.cs page around about line 97 where it was doing this:
Code:
DB.ExecuteSQL("update orders set IsNew=0 where ParentOrderNumber IS NOT NULL and CartType<>" + ((int)CartTypeEnum.RecurringCart).ToString()); // any "ad hoc" orders should not be new. so this is a safety check to force that.
To ensure that it doesn't needlessly update the same orders over and over again everytime you enter that page you can change the line to this:
Code:
DB.ExecuteSQL("update orders set IsNew=0 where IsNew=1 AND ParentOrderNumber IS NOT NULL and CartType<>" + ((int)CartTypeEnum.RecurringCart).ToString()); // any "ad hoc" orders should not be new. so this is a safety check to force that.
You can check how many rows this may, or may not, affect on your system with this test:
Code:
SELECT COUNT(*) FROM Orders WHERE ParentOrderNumber IS NOT NULL and CartType<>2