Rock.Model.FinancialTransactionService.Delete C# (CSharp) Méthode

Delete() public méthode

Deletes the specified item.
public Delete ( FinancialTransaction item ) : bool
item FinancialTransaction The item.
Résultat bool
        public override bool Delete( FinancialTransaction item )
        {
            if ( item.FinancialPaymentDetailId.HasValue )
            {
                var paymentDetailsService = new FinancialPaymentDetailService( (Rock.Data.RockContext)this.Context );
                var paymentDetail = paymentDetailsService.Get( item.FinancialPaymentDetailId.Value );
                if ( paymentDetail != null )
                {
                    paymentDetailsService.Delete( paymentDetail );
                }
            }

            return base.Delete( item );
        }

Usage Example

        /// <summary>
        /// Handles the Delete event of the rGridTransactions control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param>
        protected void rGridTransactions_Delete(object sender, Rock.Web.UI.Controls.RowEventArgs e)
        {
            var financialTransactionService = new Rock.Model.FinancialTransactionService();

            FinancialTransaction financialTransaction = financialTransactionService.Get((int)e.RowKeyValue);

            if (financialTransaction != null)
            {
                financialTransactionService.Delete(financialTransaction, CurrentPersonId);
                financialTransactionService.Save(financialTransaction, CurrentPersonId);
            }

            BindGrid();
        }
All Usage Examples Of Rock.Model.FinancialTransactionService::Delete
FinancialTransactionService