Hi!
I have a question about Aurelius and XData. I posted here, because the problem/solution is in Aurelus, bu if I'm wrong, I'll post on the XData part of the forum.
I 'm creating an app that rread/write through XData. The classes that I use are (very simplified, just properties)
TDocument: class
Id: integer
Items: Proxy<TDocItem>
end;
TDocItem: class
Id: integer;
StockItem: TStockItem;
Qty: integer;
end;
TStockItem: class
Id: integer;
OnStock: integer;
end;
When saving, I update the TStockItem.OnStock with TDocItem.Qty when saving the TDocument. I can do this using the event OnUpdated and going through all TDocument.Items to update the stocks.
My problem is that when I edit an existing document, I would like to update the stock before updating the TDocument. So I would need the old document (the one that is still in the DB) and change the stocks based on the old document items.
Basically I would like to do this:
12:00:00 Product1: stock=10
12:01:00 Editing the doucment, changing Product1 Qty from 5 to 6
12:02:00 Staring to save the document
12:02:01 (OnUpdating) Change to Product1 = 10 + 5 --> 15
12:02:02 (OnUpdated) Change to Product1 = 15 - 6 --> 9
Hope I explained the problem good enough :)