コード例 #1
0
ファイル: Program.cs プロジェクト: ddema12/OOP
        private static void DoRollback(Bank bank)
        {
            bank.PrintTranscationHistory();
            Console.WriteLine("Do you want to rollback a transaction? Y/N ");
            string x = Console.ReadLine();

            try
            {
                if (x == "n")
                {
                    return;
                }
                else if (x == "y")
                {
                    Console.WriteLine("Select which transaction using the index");
                    int r = Convert.ToInt32(Console.ReadLine());
                    bank.RollbackTransaction(bank.getTheList()[r - 1]);
                }
                else
                {
                    throw new InvalidOperationException("Unable to rollback transaction, please try again");
                }
            }
            catch (InvalidOperationException E)
            {
                Console.WriteLine(E.Message);
            }
        }