Example #1
0
        public void open(string cbkName)
        {
            fileIO fIO = new fileIO();

            currBalance = fIO.getCurrentBalance(cbkName);
            transaction_gui t = new transaction_gui(cbkName);

            t.ShowDialog();
        }
Example #2
0
        public void create(string cbkName)
        {
            //creates new checkbook in the folder.
            fileIO fIO = new fileIO();

            fIO.makeNewCheckbook(cbkName);
            currBalance = 0.00;
            //Makes a new transaction_gui and opens it so the user can choose
            //what type of transaction to make.
            transaction_gui t = new transaction_gui(cbkName);

            t.ShowDialog();
        }
Example #3
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();
                }
            }
        }