public override void Print()
 {
     if (Success)
     {
         Console.WriteLine("Transferred $" + _amount + " from " + _fromAccount.Name + " to " + _toAccount.Name);
         _withdraw.Print();
         _deposit.Print();
     }
     else if (Reversed)
     {
         Console.WriteLine("transaction rolled back..");
     }
     else
     {
         Console.WriteLine("Transaction unsuccessfull!");
     }
 }
Exemple #2
0
        private static void DoWithdraw(Bank bank)
        {
            //Search for an account
            Account account = FindAccount(bank);

            //Take actions if the account is detected
            if (account != null)
            {
                Console.WriteLine("Input amount");
                decimal             amount             = InputToDec(Console.ReadLine());
                WithdrawTransaction currentTransaction = new WithdrawTransaction(account, amount);


                //Ask user to proceed, take action
                if (YNQuestion("Proceed? Y/N"))
                {
                    bank.ExecuteTransaction(currentTransaction);
                }
                else
                {
                    Console.WriteLine("Transaction cancelled");
                }

                //Ask user, then verify user input

                if (YNQuestion("Print transaction details? Y/N"))
                {
                    currentTransaction.Print();
                }
            }
            else
            {
                Console.WriteLine("Withdraw canceled!");
            }

            Console.ReadLine();
        }
 public override void Print()
 {
     Console.WriteLine($"Transfer {_amount.ToString("C")} from {_fromAccount.Name} to {_toAccount.Name}\n");
     _withdraw.Print();
     _deposit.Print();
 }