Exemple #1
0
        static void DoDeposit(Bank bank)
        {
            var account = FindAccount(bank);

            if (account == null)
            {
                return;                  //stop continuation of procedure
            }
            Console.WriteLine("Enter the amount you would like to deposit: ");
            decimal x           = Convert.ToDecimal(Console.ReadLine());
            var     transaction = new DepositTransaction(account, x);

            bank.ExecuteTransaction(transaction);
            transaction.Print();
        }
Exemple #2
0
        static void DoWithdraw(Bank bank)
        {
            var account = FindAccount(bank);

            Console.WriteLine("Enter the amount you would like to withdraw: ");
            if (account == null)
            {
                return;                  //stop continuation of procedure
            }
            decimal x           = Convert.ToDecimal(Console.ReadLine());
            var     transaction = new WithdrawTransaction(account, x);

            bank.ExecuteTransaction(transaction);
            transaction.Print();
            /*transaction.Rollback();*/
        }
Exemple #3
0
        static void DoTransfer(Bank bank)
        {
            Console.WriteLine("Sender Account :");
            Account from_account = FindAccount(bank);

            if (from_account == null)
            {
                return;                           //stop continuation of procedure
            }
            Console.WriteLine("Reciever Account :");
            Account to_account = FindAccount(bank);

            if (to_account == null)
            {
                return;                         //stop continuation of procedure
            }
            Console.WriteLine("Enter the amount you would like to transfer: ");
            decimal x           = Convert.ToDecimal(Console.ReadLine());
            var     transaction = new TransferTransaction(from_account, to_account, x);

            bank.ExecuteTransaction(transaction);
            transaction.Print();
        }