Example #1
0
        //---------------------------------------------------------------------
        // Returns entry from expense form after closed
        //---------------------------------------------------------------------
        private void formVisibleChanged(object sender, EventArgs e)
        {
            TransactionForm newExpense = (TransactionForm)sender;

            if (!newExpense.Visible)
            {
                int         categoryindex;
                Transaction addedTransaction = newExpense.ReturnData;

                recentHistory.AddTransaction(addedTransaction);

                if (addedTransaction.getCategory() == null)
                {
                    categoryindex = -1;
                }
                else
                {
                    categoryindex = categories.getIndex(addedTransaction.
                                                        getCategory().getCategoryTitle());
                }

                InsertTransaction(categoryindex);

                if (addedTransaction.getPrice() < EXPENSE) // revenue transaction
                {
                    updateFormOnRevenue(addedTransaction.getPrice());
                }
                else // expense transaction
                {
                    updateFormOnExpense(addedTransaction.getPrice());
                }
                newExpense.Dispose();//destroying the transaction form
            }
        }
Example #2
0
        //---------------------------------------------------------------------
        //Opens form for new transaction
        //---------------------------------------------------------------------
        private void bNewTransaction_Click(object sender, EventArgs e)
        {
            TransactionForm newExpense = new TransactionForm(categories,
                                                             recentHistory, currentUser.getPrimaryKey(),
                                                             autoList, currentDate,
                                                             currentUser, commandHandler);

            newExpense.Show();
            newExpense.VisibleChanged += formVisibleChanged;
        }