Esempio n. 1
0
        //Method to rollback a trasaction for the bank
        public static void DoRollback(Bank bank)
        {
            try
            {
                Console.Write("\nDo you wish to rollback a specific transaction? (y/n): ");
                string ans = Console.ReadLine();

                if (ans.ToLower() == "y" || ans.ToLower() == "yes")
                {
                    Console.Write("Please enter the transaction number: ");
                    int position = Convert.ToInt32(Console.ReadLine());

                    //Transaction to rollback
                    Transaction transaction = bank.Transactions[position - 1];

                    bank.RollbackTransaction(transaction);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error! : " + e.Message);
            }
        }