示例#1
0
        void IOrginator.SetMemento(IMemento memento)
        {
            var clientMemento = (ClientMemento) memento;
            Id = clientMemento.Id;
            Version = clientMemento.Version;
            _clientName = new ClientName(clientMemento.ClientName);
            _address = new Address(clientMemento.Street, clientMemento.StreetNumber, clientMemento.PostalCode, clientMemento.City);
            _phoneNumber = new PhoneNumber(clientMemento.PhoneNumber);
            _accounts.AddRange(clientMemento.Accounts);

            clientMemento.BankCardMementos.ForEach(x =>
            {
                var bankCard = new BankCard();
                ((IOrginator)bankCard).SetMemento(x);
                _bankCards.Add(bankCard);
            });
        }
示例#2
0
 public static Client CreateNew(ClientName clientName, Address address, PhoneNumber phoneNumber)
 {
     return new Client(clientName, address, phoneNumber);
 }
示例#3
0
 private Client(ClientName clientName, Address address, PhoneNumber phoneNumber)
     : this()
 {
     Apply(new ClientCreatedEvent(Guid.NewGuid(), clientName.Name, address.Street, address.StreetNumber, address.PostalCode, address.City, phoneNumber.Number));
 }
示例#4
0
 private void onNewClientCreated(ClientCreatedEvent clientCreatedEvent)
 {
     Id = clientCreatedEvent.ClientId;
     _clientName = new ClientName(clientCreatedEvent.ClientName);
     _address = new Address(clientCreatedEvent.Street, clientCreatedEvent.StreetNumber, clientCreatedEvent.PostalCode, clientCreatedEvent.City);
     _phoneNumber = new PhoneNumber(clientCreatedEvent.PhoneNumber);
 }
示例#5
0
 private void onClientPhoneNumberWasChanged(ClientPhoneNumberChangedEvent clientPhoneNumberChangedEvent)
 {
     _phoneNumber = new PhoneNumber(clientPhoneNumberChangedEvent.PhoneNumber);
 }
示例#6
0
        public void UpdatePhoneNumber(PhoneNumber phoneNumber)
        {
            IsClientCreated();

            Apply(new ClientPhoneNumberChangedEvent(phoneNumber.Number));
        }