// Make transactions from accounts
        public void makeTransactionFromCurrentAccount(string accountNo = "")
        {
            if (accountNo == "")
            {
                InputOutputHandler IO_Handler = new InputOutputHandler();
                accountNo = IO_Handler.getAccountNoFromUser();
            }
            int indexOfCurrentAccountInADT = this.getCurrentAccountIndex(accountNo);

            if (indexOfCurrentAccountInADT != -1)
            {
                CurrentAccount currentAccountToMakeTransactionOn = accountsData.AllCurrentAccountsArrayList[indexOfCurrentAccountInADT] as CurrentAccount;
                double withdrawAmount = IO_Handler.getAmountToWithdrawFromUser(currentAccountToMakeTransactionOn.WithdrawalLimit, currentAccountToMakeTransactionOn.Balance);
                
                if (!isTransactionsThresholdMetForAnAccount(currentAccountToMakeTransactionOn.AccountNo, withdrawAmount)) 
                {
                    (accountsData.AllCurrentAccountsArrayList[indexOfCurrentAccountInADT] as CurrentAccount).withdrawal(withdrawAmount);
                    Transaction transaction = new Transaction(currentAccountToMakeTransactionOn.AccountNo, withdrawAmount, 'C', DateTime.Now);
                    accountsData.AllTransations.Add(transaction);
                    accountsData.generateTransactionReport(transaction, (accountsData.AllCurrentAccountsArrayList[indexOfCurrentAccountInADT] as CurrentAccount).Balance);
                }
                else
                {
                    IO_Handler.cantWithdrawToday(withdrawAmount);
                }
            }
            else
            {
                IO_Handler.printNotFoundCurrentAccount(accountNo);
            }
        }
 // Creation of Accounts
 public void addACurrentAccount()
 {
     CurrentAccount newCurrentAccountCreated = IO_Handler.getCurrentAccountDetailsFromUser();
     accountsData.AllCurrentAccountsArrayList.Add(newCurrentAccountCreated);
     if (IO_Handler.wantAnAtm())
     {
         string pin = IO_Handler.getAtmPinFromUser();
         accountsData.AllAtmCards.Add(new Atm(newCurrentAccountCreated.AccountNo, pin));
     }
 }
        public CurrentAccount printUpdateCurrentAccountMenu(CurrentAccount accountToUpdate)
        {
            Console.WriteLine("##### Account Info #####\n");
            this.printOneCurrentAccount(accountToUpdate);

            Console.WriteLine("Press 1 to update Account No");
            Console.WriteLine("Press 2 to update Account Title");
            Console.WriteLine("Press 3 to update Cnic");
            Console.WriteLine("Press 4 to update Balance");
            Console.WriteLine("Press 5 to update Profit Percentage");
            Console.WriteLine("Press 0 to Exit");

            Console.Write("Your Choice : ");
            char choice = Console.ReadLine()[0];

            while (!(choice >= '0' && choice <= '5'))
            {
                Console.Write("Re-enter your choice between 0 and 5 : ");
                choice = Console.ReadLine()[0];
            }

            switch (choice)
            {
                case '1':
                    Console.Write("Enter new account no : ");
                    accountToUpdate.AccountNo = Console.ReadLine();
                    break;
                case '2':
                    Console.Write("Enter new title : ");
                    accountToUpdate.AccountTitle = Console.ReadLine();
                    break;
                case '3':
                    Console.Write("Enter new Cnic : ");
                    accountToUpdate.Cnic = Console.ReadLine();
                    break;
                case '4':
                    Console.Write("Enter new balance : ");
                    accountToUpdate.Balance = double.Parse(Console.ReadLine());
                    break;
                case '5':
                    Console.Write("Enter new Profit Percentage : ");
                    accountToUpdate.WithdrawalLimit = double.Parse(Console.ReadLine());
                    break;
                default:
                    Console.WriteLine("No changes have been made!");
                    break;
            };
            return accountToUpdate;
        }
        // Updation of Accounts
        public void updateCurrentAccount()
        {
            string accountNoToUpdateItsDetails = IO_Handler.getAccountNoFromUser();
            int indexOfCurrentAccountToUpdate = getCurrentAccountIndex(accountNoToUpdateItsDetails);

            if (indexOfCurrentAccountToUpdate != -1)
            {
                CurrentAccount accountToUpdate = accountsData.AllCurrentAccountsArrayList[indexOfCurrentAccountToUpdate] as CurrentAccount;
                accountsData.AllCurrentAccountsArrayList[indexOfCurrentAccountToUpdate] = IO_Handler.printUpdateCurrentAccountMenu(accountToUpdate);
            }
            else
            {
                IO_Handler.printNotFoundCurrentAccount(accountNoToUpdateItsDetails);
            }
        }
        // Interface for user
        public void printAccountHolderInterface()
        {
            AccountManager userInteracting = new AccountManager();
            string accountNo = this.getAccountNoFromUser();
            string pin = "";

            if (this.selectAccountType() =='c')
            {
                if (userInteracting.getCurrentAccountIndex(accountNo) == -1)
                {
                    Console.WriteLine("Current Account with AccountNo '" + accountNo + "' does not exist");
                    Environment.Exit(0);
                }

                if (!userInteracting.hasAtm(accountNo))
                {
                    Console.WriteLine("You dont an atm card registered");
                    Console.Write("Register for ATM now (y/n) : ");

                    char choice = Console.ReadLine()[0];

                    if (choice == 'y' || choice == 'Y')
                    {
                        pin = this.getAtmPinFromUser();
                        userInteracting.AccountsData.AllAtmCards.Add(new Atm(accountNo, pin));
                    }
                    else
                    {
                        Console.WriteLine("Bye! Come back when you want or have an atm card");
                        Environment.Exit(0);
                    }
                }

                CurrentAccount accountInfoOfTheUserWhoLoggedIn = userInteracting.AccountsData.AllCurrentAccountsArrayList[userInteracting.getCurrentAccountIndex(accountNo)] as CurrentAccount;

                do
                {
                    Console.Clear();

                    Console.WriteLine("##### My Virtual Bank #####");
                    Console.WriteLine("Press 0 to exit");
                    Console.WriteLine("Press 1 to display account info");
                    Console.WriteLine("Press 2 to deposit an amount");
                    Console.WriteLine("Press 3 to withdraw an amount");

                    Console.Write("\nEnter your choice : ");
                    char choice = Console.ReadLine()[0];

                    switch (choice)
                    {
                        case '0':
                            userInteracting.writeBackAllFiles();
                            Environment.Exit(0);
                            break;
                        case '1':
                            this.printOneCurrentAccount(accountInfoOfTheUserWhoLoggedIn);
                            break;
                        case '2':
                            pin = this.getAtmPinFromUser();
                            if (userInteracting.verifyCredentials(accountInfoOfTheUserWhoLoggedIn.AccountNo, pin))
                            {
                                userInteracting.makeDepositToCurrentAccount(accountNo);
                            }
                            else
                            {
                                Console.WriteLine("You entered incorrect pin");
                            }
                            break;
                        case '3':
                            pin = this.getAtmPinFromUser();
                            if (userInteracting.verifyCredentials(accountInfoOfTheUserWhoLoggedIn.AccountNo, pin))
                            {
                                userInteracting.makeTransactionFromCurrentAccount(accountNo);
                            }
                            else
                            {
                                Console.WriteLine("You entered incorrect pin");
                            }
                            break;
                        default:
                            break;
                    }
                } while (askIfUserWantsToContinue());
            }
            else
            {
                if(userInteracting.getSavingAccountIndex(accountNo) == -1)
                {
                    Console.WriteLine("Saving Account with AccountNo '" + accountNo + "' does not exist");
                    Environment.Exit(0);
                }

                if (!userInteracting.hasAtm(accountNo))
                {
                    Console.WriteLine("You dont an atm card registered");
                    Console.Write("Register for ATM now (y/n) : ");

                    char choice = Console.ReadLine()[0];

                    if (choice == 'y' || choice == 'Y')
                    {
                        pin = this.getAtmPinFromUser();
                        userInteracting.AccountsData.AllAtmCards.Add(new Atm(accountNo, pin));
                    }
                    else
                    {
                        Console.WriteLine("Bye! Come back when you want or have an atm card");
                        Environment.Exit(0);
                    }
                }

                SavingAccount accountInfoOfTheUserWhoLoggedIn = userInteracting.AccountsData.AllSavingAccountsList[userInteracting.getCurrentAccountIndex(accountNo)];

                do
                {
                    Console.Clear();

                    Console.WriteLine("Press 0 to exit");
                    Console.WriteLine("Press 1 to get account details");
                    Console.WriteLine("Press 2 to deposit an amount");
                    Console.WriteLine("Press 3 to withdraw an amount");

                    char choice = Console.ReadLine()[0];

                    switch (choice)
                    {
                        case '0':
                            userInteracting.writeBackAllFiles();
                            Environment.Exit(0);
                            break;
                        case '1':
                            this.printOneSavingAccount(accountInfoOfTheUserWhoLoggedIn);
                            break;

                        case '2':
                            pin = this.getAtmPinFromUser();
                            if (userInteracting.verifyCredentials(accountInfoOfTheUserWhoLoggedIn.AccountNo, pin))
                            {
                                userInteracting.makeDepositToSavingAccount(accountNo);
                            }
                            else
                            {
                                Console.WriteLine("You entered incorrect pin");
                            }
                            break;
                        case '3':
                            pin = this.getAtmPinFromUser();
                            if (userInteracting.verifyCredentials(accountInfoOfTheUserWhoLoggedIn.AccountNo, pin))
                            {
                                userInteracting.makeTransactionFromSavingAccount(accountNo);
                            }
                            else
                            {
                                Console.WriteLine("You entered incorrect pin");
                            }
                            break;
                        default:
                            break;
                    }

                } while (askIfUserWantsToContinue());
            }
        }
 // Display an account of a certain type that is passed as argument
 public void printOneCurrentAccount(CurrentAccount currentAccountToPrint)
 {
     Console.WriteLine(currentAccountToPrint.getAccountData() + "\n");
 }