Rock.Apps.CheckScannerUtility.BatchPage.btnDeleteTransaction_Click C# (CSharp) Method

btnDeleteTransaction_Click() private method

Handles the Click event of the btnDeleteTransaction control.
private btnDeleteTransaction_Click ( object sender, RoutedEventArgs e ) : void
sender object The source of the event.
e System.Windows.RoutedEventArgs The instance containing the event data.
return void
        private void btnDeleteTransaction_Click( object sender, RoutedEventArgs e )
        {
            int transactionId = (int)( sender as Button ).CommandParameter;
            if ( MessageBox.Show( "Are you sure you want to delete this transaction?", "Confirm", MessageBoxButton.OKCancel ) == MessageBoxResult.OK )
            {
                try
                {
                    FinancialTransaction financialTransaction = grdBatchItems.SelectedValue as FinancialTransaction;

                    if ( financialTransaction != null )
                    {
                        RockConfig config = RockConfig.Load();
                        RockRestClient client = new RockRestClient( config.RockBaseUrl );
                        client.Login( config.Username, config.Password );
                        client.Delete( string.Format( "api/FinancialTransactions/{0}", transactionId ) );
                        UpdateBatchUI( this.SelectedFinancialBatch );
                    }
                }
                catch ( Exception ex )
                {
                    ShowException( ex );
                }
            }
        }