Ejemplo n.º 1
0
        protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues)
        {
            GenericKeyDataArgs args = new GenericKeyDataArgs(keys, oldValues);
            int rowsReturned        = this.Owner.Delete(args);

            return(rowsReturned);
        }
Ejemplo n.º 2
0
 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));
     }
 }
Ejemplo n.º 3
0
 /// <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);
 }
Ejemplo n.º 4
0
 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);
     }
 }