コード例 #1
0
ファイル: RolesSource.cs プロジェクト: simonegli8/Silversite
 public override void OnExecuteUpdate(GenericUpdateArgs a)
 {
     var role = a.OldValues.OfType<string>().FirstOrDefault();
     var newrole = a.Values.OfType<string>().FirstOrDefault();
     var roles = Roles.GetAllRoles();
     if (role != null && role != newrole && !roles.Contains(newrole)) {
         Roles.CreateRole(newrole);
         var users = Roles.GetUsersInRole(role);
         Roles.AddUsersToRole(users, newrole);
         Roles.DeleteRole(role);
     }
 }
コード例 #2
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;
 }
コード例 #3
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));
 }
コード例 #4
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;
 }