示例#1
0
        protected virtual void onTransaction(TransactionMadeEventArgs e)
        {
            EventHandler <TransactionMadeEventArgs> handler = TransactionMade;

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#2
0
        public bool deposit(float amountToAdd)
        {
            accountBalance += amountToAdd;

            TransactionMadeEventArgs env = new TransactionMadeEventArgs();

            env.TypeOfTransation    = "deposit ";
            env.amountOfTransaction = amountToAdd;

            // raise the event
            onTransaction(env);

            return(true);
        }
示例#3
0
        public bool withdrawal(float amountToWithdrawal)
        {
            if (amountToWithdrawal > accountBalance)
            {
                Console.WriteLine("Transaction Failed: Not enough funds");
                return(false);
            }
            else
            {
                accountBalance -= amountToWithdrawal;

                // Console.WriteLine("Withdrawing {0}, your account balance is {1}", amountToWithdrawal, accountBalance);

                TransactionMadeEventArgs env = new TransactionMadeEventArgs();
                env.TypeOfTransation    = "withdrawl";
                env.amountOfTransaction = amountToWithdrawal;

                // raise the event
                onTransaction(env);

                return(true);
            }
        }
示例#4
0
 static void HandleCustomEvent(object sender, TransactionMadeEventArgs e)
 {
     Console.WriteLine("Transaction type: {0}   Transaction amount: {1}", e.TypeOfTransation, e.amountOfTransaction);
     //Environment.Exit(0);
 }