From the application, when certain field has made changes and binding will trigger the changes and will inform user to save changes. But my problem is when certain field in the database is non-visible object field to the form and I have to trigger its changes everytime I call OrdersCollection.Save() method.
Instead the application execute the following SQL command when I have made changes of "ShipName" to another new name in data binding.
UPDATE Orders SET ShipName=@ShipName WHERE CustomerID='VINET' and OrderID='10248'
I need the application execute the actual SQL command was
UPDATE Orders SET ShipName=@ShipName, RequiredDate='dd/mm/yyyy' WHERE CustomerID='VINET' and OrderID='10248'
Everytime I update any fields in Orders table, it will trigger the RequiredDate fields as changes fields as well but RequiredDate does not bind to any controls. How do I do it through coding using ES collection?
It sounds like what you are wanting to do is override .Save and add your own values. If so see these threads
http://community.entityspaces.net/forums/thread/15331.aspx
http://community.entityspaces.net/forums/thread/15254.aspx
Regards, Scott Schecter EntitySpaces | Blog | Twitter
If I override the Save() method at Entity, how do I interactively set certain fields to a specified value from the ES collection since if I called ES collection Save() method will not trigger the method at Entity class. Any idea on how to trigger Entity's Save() method from ES collection?
public partial class Orders : esOrders { public override void Save() { if (!es.IsDeleted) { this.LastModified = DateTime.Now; } base.Save(); } }
I realize this is maybe more cumbersome that you want but you might try this?
public partial class EmployeesCollection : esEmployeesCollection { public override void Save() { foreach(Employees emp in this) { if (emp.es.RowState == DataRowState.Modified) { this.LastModified = DateTime.Now; } } base.Save(); } }
EntitySpaces | Twitter | BLOG | Please honor our Software License