Example #1
0
        private void mnuItemDeleteTransaction_Click(object sender, EventArgs e)
        {
            //Retrieve selected transaction from grid
            Data.Transaction selectedTransaction = (Data.Transaction)gvwTransactions.SelectedRows[0].DataBoundItem;

            string deleteConfirmationString  = Translator.Instance.Translate("confirm_delete_transaction");
            string deleteConfirmationCaption = Translator.Instance.Translate("confirm_delete_transaction_caption");

            //If user acknowledges, delete the transaction
            if (MessageBox.Show(String.Format(deleteConfirmationString, selectedTransaction.Timestamp, selectedTransaction.LocalizedAmount), deleteConfirmationCaption, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                CustomerData.Transactions.Remove(selectedTransaction);
                CustomerData.UpdateToDatabase();
                RefreshLedger();
                UpdateInterface();
            }
        }
Example #2
0
        private void mnuItemEditTransaction_Click(object sender, EventArgs e)
        {
            //Retrieve selected transaction from grid
            Data.Transaction selectedTransaction = (Data.Transaction)gvwTransactions.SelectedRows[0].DataBoundItem;

            //Pass the retrieved transaction to a new transaction form and show the form
            using (frmTransaction transactionForm = new frmTransaction())
            {
                transactionForm.TransactionData = selectedTransaction;
                transactionForm.CustomerName    = CustomerData.Name;
                transactionForm.ShowDialog();
                if (transactionForm.DialogResult == DialogResult.OK)
                {
                    //Update any changes
                    CustomerData.UpdateToDatabase();
                    RefreshLedger();
                    UpdateInterface();
                }
            }
        }