Example #1
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);
 }
Example #2
0
 public void Handle(ClientCreatedEvent message)
 {
     AggregateRoot.FirstName = message.FirstName;
     AggregateRoot.LastName  = message.LastName;
     AggregateRoot.Email     = message.Email;
     AggregateRoot._products = new ProductCollection();
 }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var factory = new ConnectionFactory()
            {
                HostName = "localhost"
            };

            using (var connection = factory.CreateConnection())
            {
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare("StartR", true, false, false, null);
                    var client = new ClientCreatedEvent();
                    client.FirstName  = "Keith";
                    client.LastName   = "Elder";
                    client.State      = "MS";
                    client.Zip        = "39401";
                    client.City       = "Hattiesburg";
                    client.Address1   = "somwhere";
                    client.Address2   = "address 2";
                    client.CreateDate = DateTime.Now;
                    client.Id         = 1000;
                    var ser  = new XmlSerializer <ClientCreatedEvent>();
                    var body = Encoding.UTF8.GetBytes(ser.Serialize(client));
                    channel.BasicPublish("", "StartR", null, body);
                    toolStripStatusLabel1.Text = "Done...";
                }
            }
        }
Example #4
0
 private void Apply(ClientCreatedEvent @event)
 {
     ClientId    = @event.ClientId;
     AggregateId = @event.Id;
     Name        = @event.Data.Name;
     Email       = @event.Data.Email;
     Account     = null;
 }
Example #5
0
            public static Client Created(Client client, ClientCreatedEvent e)
            {
                client.Name        = e.Name;
                client.Description = e.Description;
                client.Secret      = e.Secret;
                client.Active      = false;

                return(client);
            }
Example #6
0
        public Client(string name, string secret, string description = null) : this(Guid.NewGuid())
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new EntityValidationException("Name must not be blank!");
            }

            if (string.IsNullOrWhiteSpace(secret))
            {
                throw new EntityValidationException("Secret must not be blank!");
            }

            var e = new ClientCreatedEvent()
            {
                ClientId    = Id,
                Name        = name,
                Secret      = ShaUtils.Sha256HashString(secret),
                Description = description,
                OccurredOn  = DateTime.UtcNow
            };

            _changes.Add(e);
            EventHandler.Created(this, e);
        }
Example #7
0
        private void OnClientCreated(string clientId, string type, string ipAddress)
        {
            var ev = new ClientCreatedEvent(this, clientId, type, ipAddress);

            AddDomainEvent(ev);
        }