protected void rGrid_Delete(object sender, RowEventArgs e) { Rock.Model.Auth auth = authService.Get((int)rGrid.DataKeys[e.RowIndex]["id"]); if (auth != null) { authService.Delete(auth, CurrentPersonId); authService.Save(auth, CurrentPersonId); Authorization.ReloadAction(iSecured.TypeId, iSecured.Id, CurrentAction); } BindGrid(); }
protected void rGrid_Delete(object sender, RowEventArgs e) { var rockContext = new RockContext(); var authService = new Rock.Model.AuthService(rockContext); Rock.Model.Auth auth = authService.Get((int)rGrid.DataKeys[e.RowIndex]["id"]); if (auth != null) { authService.Delete(auth); rockContext.SaveChanges(); Authorization.ReloadAction(iSecured.TypeId, iSecured.Id, CurrentAction); } BindGrid(); }
protected void rblAllowDeny_SelectedIndexChanged(object sender, EventArgs e) { RadioButtonList rblAllowDeny = (RadioButtonList)sender; GridViewRow selectedRow = rblAllowDeny.NamingContainer as GridViewRow; if (selectedRow != null) { int id = (int)rGrid.DataKeys[selectedRow.RowIndex]["id"]; var rockContext = new RockContext(); var authService = new Rock.Model.AuthService(rockContext); Rock.Model.Auth auth = authService.Get(id); if (auth != null) { auth.AllowOrDeny = rblAllowDeny.SelectedValue; rockContext.SaveChanges(); Authorization.ReloadAction(iSecured.TypeId, iSecured.Id, CurrentAction); } } BindGrid(); }
/// <summary> /// Handles the Delete event of the rGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param> protected void rGrid_Delete( object sender, RowEventArgs e ) { var rockContext = new RockContext(); var authService = new Rock.Model.AuthService( rockContext ); Rock.Model.Auth auth = authService.Get( e.RowKeyId ); if ( auth != null ) { authService.Delete( auth ); rockContext.SaveChanges(); Authorization.ReloadAction( iSecured.TypeId, iSecured.Id, CurrentAction ); } BindGrid(); }
/// <summary> /// Handles the SelectedIndexChanged event of the rblAllowDeny control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void rblAllowDeny_SelectedIndexChanged( object sender, EventArgs e ) { RadioButtonList rblAllowDeny = (RadioButtonList)sender; GridViewRow selectedRow = rblAllowDeny.NamingContainer as GridViewRow; if ( selectedRow != null ) { int id = (int)rGrid.DataKeys[selectedRow.RowIndex]["Id"]; var rockContext = new RockContext(); var authService = new Rock.Model.AuthService( rockContext ); Rock.Model.Auth auth = authService.Get( id ); if ( auth != null ) { auth.AllowOrDeny = rblAllowDeny.SelectedValue; rockContext.SaveChanges(); Authorization.ReloadAction( iSecured.TypeId, iSecured.Id, CurrentAction ); } } BindGrid(); }