示例#1
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            fileIO fIO1 = new fileIO();
            double newBalance;
            //gathers the info in the textboxes when the user clicks the submit button
            Submit s      = new Submit();
            string toLine = toLineTextBox.Text.ToString();
            string amount = amountTextBox.Text.ToString();
            string memo   = memoTextBox.Text.ToString();

            //sends the info to the submit class
            s.submit(toLine, amount, memo, this.viewCheck.Checked);

            //today's date in MM/dd/yyyy format
            string date = DateTime.Today.ToString("MM/dd/yyyy");
            //writes new transaction to the .cbk file given.
            double          amountDoub = Convert.ToDouble(amount);
            transaction_gui t          = new transaction_gui(name);

            if (typeTrans == "deposit")
            {
                newBalance = fIO1.getCurrentBalance(name) + amountDoub;
                fIO1.writeTransaction(name, date, typeTrans.ToUpper(), amountDoub, toLine, memo, newBalance);
                MessageBox.Show("Current Account Balance: $" + newBalance);
                t.ShowDialog();
            }
            else
            {
                newBalance = fIO1.getCurrentBalance(name) - amountDoub;
                if (newBalance >= 0.00)
                {
                    fIO1.writeTransaction(name, date, typeTrans.ToUpper(), amountDoub, toLine, memo, fIO1.getCurrentBalance(name) - amountDoub);
                    MessageBox.Show("Current Account Balance: $" + newBalance);
                    t.ShowDialog();
                }
                else
                {
                    MessageBox.Show("This transaction will result in a negative account balance.\nContinue?");
                    MessageBox.Show("Current Account Balance: $" + newBalance);
                    t.ShowDialog();
                }
            }
        }
示例#2
0
        public static void Out()
        {
            Submit s = new Submit();

            s.getTally(checkNum, totalAmountSpent, numOfChecksWritten);
        }