Пример #1
0
        protected override int ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues)
        {
            GenericUpdateArgs args = new GenericUpdateArgs(keys, values, oldValues);
            int rowsReturned       = this.Owner.Update(args);

            return(rowsReturned);
        }
Пример #2
0
 public virtual void OnExecuteUpdate(GenericUpdateArgs a)
 {
     if (ExecuteUpdate != null)
     {
         ExecuteUpdate(this, a);
     }
     else
     {
         throw new NotImplementedException(string.Format("ExecuteUpdate Handler for the GenericDataSource '{0}' is not implemented.", this.ID));
     }
 }
Пример #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 GenericUpdateArgs arguments.</param>
 /// <returns>The number of affected rows.</returns>
 public virtual int Update(GenericUpdateArgs args)
 {
     if (this.ExecuteUpdate != null)
     {
         ExecuteUpdate(this, args);
     }
     else
     {
         OnExecuteUpdate(args);
     }
     return(args.RowsAffected);
 }
Пример #4
0
 protected void OnUpdate(object sender, GenericUpdateArgs arg)
 {
     if (EnableUpdate && Data == null)
     {
         var      set      = Context.Set <TElement>();
         var      keynames = arg.Keys.Keys.OfType <string>().ToList();
         TElement x;
         if (arg.Keys.Count == 1)
         {
             x = set.Find(arg.Keys[0]);
         }
         else
         {
             var keyindexes = keynames.Select(key => typeof(TElement).GetProperties().Select(p => p.Name).ToList().IndexOf(key)).ToList();
             x = set.Find(keynames.OrderBy(name => keyindexes));
         }
         arg.FillDataItem <TElement>(x);
         Context.SaveChanges();
         changed = false;
         RaiseDataSourceChangedEvent(EventArgs.Empty);
     }
 }