/// <summary>
/// Handles the Delete event of the gList 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 gList_Delete( object sender, RowEventArgs e )
{
var rockContext = new RockContext();
var financialPersonBankAccountService = new FinancialPersonBankAccountService( rockContext );
var financialPersonBankAccount = financialPersonBankAccountService.Get( e.RowKeyId );
if ( financialPersonBankAccount != null )
{
string errorMessage;
if ( !financialPersonBankAccountService.CanDelete( financialPersonBankAccount, out errorMessage ) )
{
mdGridWarning.Show( errorMessage, ModalAlertType.Information );
return;
}
financialPersonBankAccountService.Delete( financialPersonBankAccount );
rockContext.SaveChanges();
}
BindGrid();
}