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); } }
/// <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; }
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)); }
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; }