Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String amountText = this.textBox1.Text;
            int    val        = 0;
            bool   result     = int.TryParse(amountText, out val);

            if (result)
            {
                int amount = Int32.Parse(amountText);
                Console.WriteLine("WithDrawing : " + amount);
                int currentBalance = myATM.getCurrentUserBalance();
                if (currentBalance >= amount)
                {
                    int lastBal = myATM.getCurrentUserBalance();
                    myATM.withdrawFunds(amount);
                    Console.WriteLine(myATM.getCurrentUserBalance());
                    VanishingScreen vs = new VanishingScreen(lastBal, myATM);
                    this.Hide();
                    vs.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Withdraw Amount", "Invalid Withdraw Amount", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Please only input integers", "Invalid Withdraw Input", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return;
        }
Beispiel #2
0
        private void deposit__Click(object sender, EventArgs e)
        {
            Console.WriteLine("Depositing : " + this.textBox1.Text);
            String amount = this.textBox1.Text;
            int    val    = 0;
            bool   result = int.TryParse(amount, out val);

            if (result)
            {
                int prevBal = myATM.getCurrentUserBalance();
                myATM.depositFunds(Int32.Parse(amount));
                Console.WriteLine(myATM.getCurrentUserBalance());
                VanishingScreen vs = new VanishingScreen(prevBal, myATM);
                this.Hide();
                vs.Show();
            }
            else
            {
                MessageBox.Show("Invalid Deposit Amount", "Invalid Deposit Amount", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return;
        }
Beispiel #3
0
        // Withdraw 60 quick button
        private void button5_Click(object sender, EventArgs e)
        {
            int amount = 60;

            Console.WriteLine("WithDrawing : " + amount);
            int currentBalance = myATM.getCurrentUserBalance();

            if (currentBalance >= amount)
            {
                int lastBal = myATM.getCurrentUserBalance();
                myATM.withdrawFunds(amount);
                Console.WriteLine(myATM.getCurrentUserBalance());
                VanishingScreen vs = new VanishingScreen(lastBal, myATM);
                this.Hide();
                vs.Show();
            }
            else
            {
                MessageBox.Show("Invalid Withdraw Amount", "Invalid Withdraw Amount", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return;
        }