Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ChequingAccount a = new ChequingAccount(textBox3.Text, Convert.ToDouble(textBox2.Text));

            ChequingAccountsList.Add(a);

            SaveChequingAccounts();

            dgvReadChequingAccounts.DataSource = null;
            dgvReadChequingAccounts.DataSource = ChequingAccountsList;
            MessageBox.Show("Added");
        }
Exemplo n.º 2
0
        public static void CheckingMenu()
        {
            ChequingAccount chequing = new ChequingAccount(10.00, 0.03);

            ShowChequingsAccountMenu();

            bool exit = false;


            try
            {
                do
                {
                    string input = Console.ReadLine();

                    switch (input.ToUpper())
                    {
                    case "A":

                        Console.WriteLine("--------------------------------------------");
                        Console.WriteLine("How much do you want to deposit?");

                        string a;
                        double depositAmount;

                        a = Console.ReadLine();

                        while (!double.TryParse(a, out depositAmount))
                        {
                            Console.WriteLine("Please enter a number");
                            a = Console.ReadLine();
                        }

                        chequing.MakeDeposit(depositAmount);

                        ShowChequingsAccountMenu();
                        break;

                    case "B":

                        Console.WriteLine("--------------------------------------------");
                        Console.WriteLine("How much do you want to withdraw?");

                        string b = Console.ReadLine();
                        double withdrawAmount;


                        while (!double.TryParse(b, out withdrawAmount))
                        {
                            Console.WriteLine("Please enter a number");
                            b = Console.ReadLine();
                        }

                        chequing.MakeWithdraw(withdrawAmount);

                        ShowChequingsAccountMenu();
                        break;

                    case "C":
                        Console.WriteLine("--------------------------------------------");
                        Console.Write(chequing.CloseAndReport());
                        Console.WriteLine("\nPress enter to continue");
                        Console.ReadLine();
                        ShowChequingsAccountMenu();
                        break;

                    case "Q":
                        MainMenu();
                        exit = true;
                        break;

                    default:
                        Console.WriteLine("--------------------------------------------");
                        Console.WriteLine("Please select a valid option: ");
                        ShowChequingsAccountMenu();
                        break;
                    }
                } while (exit == false);
            }
            catch (Exception)
            {
                Console.WriteLine("Error, try again");
            }
        }