public Contact(FullName fullname, EmailAddress emailAddress, PhoneNumber phoneNumber, Address address, DateOfBirth dateOfBirth) : this()
        {
            if (fullname == null)
            {
                throw new ContactException("Fullname cannot be null");
            }

            if (emailAddress == null)
            {
                throw new ContactException("Emil address cannot be null");
            }

            if (phoneNumber == null)
            {
                throw new ContactException("Phone number cannot be null");
            }

            if (dateOfBirth == null)
            {
                throw new ContactException("Date of birth cannot be null");
            }

            FullName     = fullname;
            EmailAddress = emailAddress;
            PhoneNumber  = phoneNumber;
            Address      = address;

            RecordedEvents.Add(new ContactCreated(Id));
        }
 public void Delete()
 {
     if (Id != default(int))
     {
         RecordedEvents.Add(new ContactDeleted(Id));
     }
 }
 public void UpdatePhoneNumber(PhoneNumber phoneNumber)
 {
     if (!PhoneNumber.Equals(phoneNumber))
     {
         PhoneNumber = phoneNumber;
         RecordedEvents.Add(new ContactPhoneNumberUpdated(phoneNumber.Value));
     }
 }
 public void UpdateEmailAddress(EmailAddress emailAddress)
 {
     if (!EmailAddress.Equals(emailAddress))
     {
         EmailAddress = emailAddress;
         RecordedEvents.Add(new ContactEmailAddressUpdated(emailAddress.Value));
     }
 }
 public void UpdateFullName(FullName fullname)
 {
     if (!FullName.Equals(fullname))
     {
         FullName = fullname;
         RecordedEvents.Add(new ContactFullNameUpdated(fullname.ToString()));
     }
 }
 public void UpdateAddress(Address address)
 {
     if (!Address.Equals(address))
     {
         Address = address;
         RecordedEvents.Add(new ContactAddressUpdated(address.ToString()));
     }
 }
Exemple #7
0
        private void EventHandler(string eventName, object sender, EventArgs e, ValueUpdate vu = null)
        {
            var record = new EventRecord(eventName, sender, e, vu);

            lock (recordLock)
            {
                RecordedEvents.Add(record);
            }
            if (LogEvents)
            {
                Debug.WriteLine($"EventMonitor<{typeof(T).FullName}>: caught event from {eventName}");
            }
            CaughtEvent?.Invoke(this, new EventRecordEventArgs(record));
        }
 public Task RaisePlanEventAsync <T>(Guid scopeIdentifier, string hubName, Guid planId, T eventData, CancellationToken cancellationToken) where T : JobEvent
 {
     RecordedEvents.Add(eventData);
     return(Task.CompletedTask);
 }