public TransferTransaction(Account fromAccount, Account toAccount, decimal amount) : base(amount) { this._fromAccount = fromAccount; this._toAccount = toAccount; this._amount = amount; this._withdraw = new WithdrawTransaction(_fromAccount, this._amount); this._deposit = new DepositTransaction(_toAccount, this._amount); }
static void DoDeposit(Bank bank) { Account account = FindAccount(bank); if (account != null) { Console.WriteLine("enter the amount you want to deposit:"); int amount = Convert.ToInt32(Console.ReadLine()); DepositTransaction deposit = new DepositTransaction(account, amount); bank.ExecuteTransaction(deposit); } }
public TransferTransaction(Account fromAccount, Account toAccount, decimal amount) : base(amount) { _fromAccount = fromAccount; _toAccount = toAccount; DepositTransaction deposit = new DepositTransaction(toAccount, amount); _deposit = deposit; WithdrawTransaction withdraw = new WithdrawTransaction(fromAccount, amount); _withdraw = withdraw; }
private static void DoDeposit(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()); DepositTransaction currentTransaction = new DepositTransaction(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("Deposit canceled!"); } Console.ReadLine(); }