Ejemplo n.º 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);
            });
        }
Ejemplo n.º 2
0
 public static Client CreateNew(ClientName clientName, Address address, PhoneNumber phoneNumber)
 {
     return new Client(clientName, address, phoneNumber);
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 5
0
 private void onClientPhoneNumberWasChanged(ClientPhoneNumberChangedEvent clientPhoneNumberChangedEvent)
 {
     _phoneNumber = new PhoneNumber(clientPhoneNumberChangedEvent.PhoneNumber);
 }
Ejemplo n.º 6
0
        public void UpdatePhoneNumber(PhoneNumber phoneNumber)
        {
            IsClientCreated();

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