Esempio n. 1
0
 public void Print()
 {
     if (_success == true) //if all successful print the tranfer details and the methods from withdraw and deposit
     {
         Utl.lineBreak();
         System.Console.WriteLine("The transcation was successful");
         Utl.lineBreak();
         System.Console.WriteLine("Transferred ${0} from {1} to {2}", _amount, _fromAccount.Name, _toAccount.Name);
         Utl.lineBreak();
         _theWithdraw.Print();
         Utl.lineBreak();
         _theDeposit.Print();
     }
     else //else print that it was not succesful
     {
         Console.WriteLine("Transcation wasn't succesful");
     }
 }
Esempio n. 2
0
        private static void DoWithdraw(Bank toBank) // withdraw method
        {
            decimal input;                          //used to store the user inputted amount
            Account fromAccount = FindAccount(toBank);

            if (fromAccount == null)
            {
                return;
            }


            Utl.lineBreak();
            Console.WriteLine("Enter how much you would like to withdraw?");
            input = Convert.ToDecimal(Console.ReadLine()); //store the amount after converting to decimal

            var withdraw = new WithdrawTransaction(fromAccount, input);

            withdraw.Execute();
            withdraw.Print();
            toBank.ExecuteTransaction(withdraw);
            // account.Withdraw(input); //call the Withdraw method passing the amount to be withdraw
        }