Esempio n. 1
0
        public static Account CreateAccount(long moneyAmount, string currency)
        {
            Account acc = new Account(moneyAmount, currency);

            BankSystem.AddAccount(acc);
            return(acc);
        }
Esempio n. 2
0
        public Account(long moneyAmount, string currency)
        {
            this.id = _nextId++;
            if (_moneyAmount < 0)
            {
                this._moneyAmount = 0;
            }
            else
            {
                this._moneyAmount = moneyAmount;
            }
            this.currency = currency;

            this.AccountActivatingEvent += new AccountHandler(BankSystem.AddAccountEvent);
            // or
            this.AccountActivatingEvent += (BankEventArg arg) =>
            {
                BankSystem.AddAccount(arg.account);
                Console.WriteLine("Reacted on activating account.\nAdding it into system...\nSuccesfully added");
            };
        }