Пример #1
0
        static void Main(string[] args)
        {
            // Read Bank from file
            string filePath = Path.Combine(Environment.CurrentDirectory, "bank.txt");
            Bank   bank     = GetBankFromFile(filePath);

            // Prompt the user for who they are
            BankCustomer user = ChooseUser(bank, true);

            // Prompt the user for which account to enter
            BankAccount working = PickAnAccount(bank, user, true);

            Console.Clear();

            // Prompt user for what they would like to do
            string input = PromptUserForMenuChoice(user, working);

            // Evaluate their choice
            while (input != "Q")
            {
                switch (input)
                {
                case "1":                         // Make a Deposit
                    MakeDeposit(working);
                    break;

                case "2":                         // Make a Withdrawl
                    MakeWithdrawl(working);
                    break;

                case "3":                         // Make a Transfer
                    MakeTransfer(bank, working);
                    break;

                case "4":                         // Show Balance
                    ShowBalance(working);
                    break;

                case "5":                         //Change or add Account
                    working = PickAnAccount(bank, user, true);
                    break;

                case "6":                         //Change User info
                    ChangeUserInfo(user);
                    break;

                case "7":                         //Change User
                    user    = ChooseUser(bank, true);
                    working = PickAnAccount(bank, user, true);
                    break;

                case "8":                         //Save Changes
                    WriteBankToFile(bank, filePath);
                    break;
                }
                input = PromptUserForMenuChoice(user, working);
            }
            WriteBankToFile(bank, filePath);
            Console.Clear();
            Console.WriteLine("Thanks for banking with TE Bank.");
            Console.WriteLine("Have a great day.");
        }