public static void AccountCloser()
 {
     AccViewer.getAccounts();
     while (true)
     {
         Console.WriteLine("Please enter the account Id you wish to close...");
         AccId = Console.ReadLine();
         if (AccountStore.StoredAccounts.ContainsKey(AccId))
         {
             break;
         }
         else
         {
             Parsers.InvalidInput();
         }
     }
     if (AccountBalance.Balance[AccId] != 0 || !(AccountStore.StoredAccounts[AccId]._AssociatedAccountId is null))
     {
         Console.WriteLine("You cannot close an account with an outstanding balance!\nAccount " + AccId + " has a balance of $" +
                           AccountBalance.Balance[AccId]);
         if (!(AccountStore.StoredAccounts[AccId]._AssociatedAccountId is null))
         {
             Console.WriteLine("and the associated account " + AccountStore.StoredAccounts[AccId]._AssociatedAccountId + " has a balance of $" +
                               AccountBalance.Balance[AccountStore.StoredAccounts[AccId]._AssociatedAccountId]);
         }
     }
     else
     {
         TransactionStore.AddCloseTransaction(AccId);
         AccountStore.StoredAccounts.Remove(AccId);
         AccountBalance.Balance.Remove(AccId);
         Console.WriteLine("Account " + AccId + " has been closed!");
     }
 }
Exemplo n.º 2
0
        public static void MenuRedirect(int input)
        {
            switch (input)
            {
            case 0:
                AccCreator.Greeting();
                AccCreator.ParseInput();
                AccCreator.Creator(AccCreator.parsedInput);
                break;

            case 1:
                AccCreator.AccountCloser();
                break;

            case 2:
                BalanceTransact.SelectAcc('w');
                break;

            case 3:
                BalanceTransact.SelectAcc('d');
                break;

            case 4:
                BalanceTransact.SelectAcc('t');
                break;

            case 5:
                BalanceTransact.Pay();
                break;

            case 6:
                AccViewer.getAccounts();
                break;

            case 7:
                TransactionViewer.Display();
                break;

            case 8:
                TimeSim.PassTime();
                break;
            }
        }