示例#1
0
        public static Manager Create(IIdentity id, string name)
        {
            var manager = new Manager(id, name);

            DomainEvent.OnPublished(new OnManagerCreatedEventArgs(manager));

            return(manager);
        }
示例#2
0
        public static Bank Create(IIdentity id, string address, Manager.Manager manager, List <Atm> atmList)
        {
            var bank = new Bank(id, address, manager, atmList);

            DomainEvent.OnPublished(new OnBankCreatedEventArgs(bank));

            return(bank);
        }
示例#3
0
        public Atm NewAtmInstalled(IIdentity id, double cashBalance)
        {
            var atm = new Atm(id, cashBalance);

            _atms.Add(atm);

            DomainEvent.OnPublished(new OnAtmCreatedEventArgs(atm, Id));

            return(atm);
        }
示例#4
0
        public void AtmBalanceChanged(IIdentity atmId, double cashBalance)
        {
            var atm = Atms.FirstOrDefault(o => o.Id.Equals(atmId));

            if (atm == null)
            {
                throw new NullReferenceException();
            }

            atm.AddCash(cashBalance);

            DomainEvent.OnPublished(new OnCashBalanceChangedEventArgs(this, atm));
        }