protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues) { GenericKeyDataArgs args = new GenericKeyDataArgs(keys, oldValues); int rowsReturned = this.Owner.Delete(args); return(rowsReturned); }
public virtual void OnExecuteDelete(GenericKeyDataArgs a) { if (ExecuteDelete != null) { ExecuteDelete(this, a); } else { throw new NotImplementedException(string.Format("ExecuteDelete Handler for the GenericDataSource '{0}' is not implemented.", this.ID)); } }
/// <summary> /// Triggers the data source Update operation. /// It ofers support for Optimistic concurrency, by storing the original and updated parameter values. /// </summary> /// <param name="args">The GenericDeleteArgs arguments.</param> /// <returns>The number of affected rows.</returns> public virtual int Delete(GenericKeyDataArgs args) { if (this.ExecuteDelete != null) { ExecuteDelete(this, args); } else { OnExecuteDelete(args); } return(args.RowsAffected); }
protected void OnDelete(object sender, GenericKeyDataArgs arg) { if (EnableDelete && Data == null) { var set = Context.Set <TElement>(); var x = arg.GetDataItem <TElement>(); set.Remove(x); Context.SaveChanges(); changed = false; RaiseDataSourceChangedEvent(EventArgs.Empty); } }