Пример #1
0
        public void sendSMS(object sender, IrregularBalanceEventArgs args)
        {
            ConsoleColor oldColor = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("{0} Irregular balance detected. Calling the customer to tell him someone is using his account too much", Name);
            Console.WriteLine("Suspect is: {0}, Balance: {0}", args.Suspect, args.Balance);
            Console.ForegroundColor = oldColor;
        }
Пример #2
0
        public void sendSMS(object sender, IrregularBalanceEventArgs args)
        {
            ConsoleColor oldColor = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("{0} Irregular balance detected. SMSing CFO we have a budget problem", Name);
            Console.WriteLine("Suspect is: {0}, Balance: {0}", args.Suspect, args.Balance);
            Console.ForegroundColor = oldColor;
        }
Пример #3
0
        // whenever we update customer balance, for any reason, we
        // should use this method, to make sure we check and fire the event if needed.
        private void addToCustomerBalance(Customer cust, double cost)
        {
            cust.addToBalance(cost);
            if (cust.Balance >= MAX_BALANCE_ALLOWED) // PROBLEM! Customer ows too much money!
            {
                IrregularBalanceEventArgs args = new IrregularBalanceEventArgs(cust, cost);

                if (irregBalanceListner != null)
                {
                    irregBalanceListner(this, args);
                }
            }
        }