protected virtual void OnPostUpdate(esDataSourceUpdateEventArgs e) { esDataSource.esDataSourceUpdateEventHandler handler = base.Events[evPostUpdate] as esDataSource.esDataSourceUpdateEventHandler; if (handler != null) { handler(this, e); } }
public override void Update ( System.Collections.IDictionary keys, System.Collections.IDictionary values, System.Collections.IDictionary oldValues, DataSourceViewOperationCallback callback ) { esDataSourceUpdateEventArgs e = null; try { if (keys != null && keys.Count > 0) { e = new esDataSourceUpdateEventArgs(); e.Keys = keys; e.Values = values; e.OldValues = oldValues; this.OnPreUpdate(e); if (e.Cancel) { return; } // Find the proper esEntity and set it's values object[] pks = new object[keys.Count]; int index = 0; foreach (object value in keys.Values) { pks[index++] = value; } esDataSourceCreateEntityEventArgs ce = new esDataSourceCreateEntityEventArgs(); ce.PrimaryKeys = pks; this.OnCreateEntity(ce); esEntity entity = ce.Entity; e.Entity = entity; //this.OnPreUpdate(e); if (entity != null) { entity.SetProperties(values); } e.EventWasHandled = false; this.OnUpdate(e); if (!e.EventWasHandled) { entity.Save(); this.OnDataSourceViewChanged(EventArgs.Empty); } this.OnPostUpdate(e); } } catch (Exception ex) { esDataSourceExceptionEventArgs exArgs = new esDataSourceExceptionEventArgs(ex); exArgs.EventType = esDataSourceEventType.Delete; exArgs.UpdateArgs = e; try { this.OnException(exArgs); } catch { } if (!exArgs.ExceptionWasHandled) { throw; } } finally { callback(1, null); } }
public override void Update ( System.Collections.IDictionary keys, System.Collections.IDictionary values, System.Collections.IDictionary oldValues, DataSourceViewOperationCallback callback ) { esDataSourceUpdateEventArgs e = null; try { if (keys != null && keys.Count > 0) { e = new esDataSourceUpdateEventArgs(); e.Keys = keys; e.Values = values; e.OldValues = oldValues; this.OnPreUpdate(e); if (e.Cancel) return; // Find the proper esEntity and set it's values object[] pks = new object[keys.Count]; int index = 0; foreach (object value in keys.Values) { pks[index++] = value; } esDataSourceCreateEntityEventArgs ce = new esDataSourceCreateEntityEventArgs(); ce.PrimaryKeys = pks; this.OnCreateEntity(ce); esEntity entity = ce.Entity; e.Entity = entity; //this.OnPreUpdate(e); if (entity != null) { entity.SetProperties(values); } e.EventWasHandled = false; this.OnUpdate(e); if (!e.EventWasHandled) { entity.Save(); this.OnDataSourceViewChanged(EventArgs.Empty); } this.OnPostUpdate(e); } } catch (Exception ex) { esDataSourceExceptionEventArgs exArgs = new esDataSourceExceptionEventArgs(ex); exArgs.EventType = esDataSourceEventType.Delete; exArgs.UpdateArgs = e; try { this.OnException(exArgs); } catch { } if (!exArgs.ExceptionWasHandled) { throw; } } finally { callback(1, null); } }