Пример #1
0
    private static void DoTransfer(Bank toBank)
    {
        Account toAccount;
        Account fromAccount;
        String  input;
        decimal transfer = 0;

        Console.WriteLine("Which account do you wish to transfer from?: ");
        fromAccount = FindAccount(toBank);

        Console.WriteLine("Which account do you wish to transfer To?: ");
        toAccount = FindAccount(toBank);

        Console.WriteLine("How much would you like to transfer?: ");

        try
        {
            input    = Console.ReadLine();
            transfer = Convert.ToDecimal(input);
        }
        catch (System.FormatException)
        {
            Console.WriteLine("Not a number");
        }

        TransferTransaction transferT = new TransferTransaction(toAccount, fromAccount, transfer);

        toBank.ExecuteTransaction(transferT);
        transferT.Print();
    }
Пример #2
0
    private static void DoTransfer(Bank toBank)
    {
        Account toAccount = FindAccount(toBank);

        if (toAccount == null)
        {
            return;
        }

        Account fromAccount = FindAccount(toBank);

        if (fromAccount == null)
        {
            return;
        }

        Console.WriteLine("Enter amount to transfer: ");
        string  input  = Console.ReadLine();
        decimal amount = Convert.ToDecimal(input);

        TransferTransaction transfertransac = new TransferTransaction(fromAccount, toAccount, amount);

        toBank.ExecuteTransaction(transfertransac);

        transfertransac.Print();
    }
Пример #3
0
 public static void ExecuteTransaction(TransferTransaction transaction)
 {
     transaction.Execute();
     transaction.Print();
 }