Exemplo n.º 1
0
 public void ChangeMaritalStatus(MaritalStatus maritalStatus)
 {
     if (_maritalStatus != maritalStatus)
     {
         ApplyChange(new CustomerMaritalStatusChanged
         {
             CustomerId    = Id,
             MaritalStatus = maritalStatus.Status,
         });
     }
 }
Exemplo n.º 2
0
 public void ChangeMaritalStatus(MaritalStatus maritalStatus)
 {
     if (_maritalStatus != maritalStatus)
     {
         ApplyChange(new CustomerMaritalStatusChanged
             {
                 CustomerId = Id,
                 MaritalStatus = maritalStatus.Status,
             });
     }
 }
Exemplo n.º 3
0
        public void RegisterNewCustomer(Guid customerId, PersonName personName, DateTime dateOfBirth, StreetAddress primaryAddress, MaritalStatus maritalStatus, GenderEnum gender)
        {
            //do any business logic in here, check invariants and throw a DomainException if there is a problem
            //check DoB is not in the future
            if(dateOfBirth > SystemTime.Now)
                throw new DomainException(string.Format("Date of birth ({0}) can not be in the future.", dateOfBirth));

            ApplyChange(new CustomerRegistered
                {
                    City = primaryAddress.City,
                    DateOfBirth = dateOfBirth,
                    FirstName = personName.FirstName,
                    Gender = gender.Gender,
                    HouseNumber = primaryAddress.HouseNumber,
                    Id = customerId,
                    LastName = personName.LastName,
                    MaritalStatus = maritalStatus.Status,
                    MiddleName = personName.MiddleName,
                    State = primaryAddress.State,
                    Street = primaryAddress.Street,
                    Zip = primaryAddress.Zip.Zip,
                });
        }
Exemplo n.º 4
0
 internal void When(CustomerMaritalStatusChanged evnt)
 {
     _maritalStatus = MaritalStatus.Parse(evnt.MaritalStatus);
 }
Exemplo n.º 5
0
 internal void When(CustomerRegistered customerRegisteredEvent)
 {
     _id            = customerRegisteredEvent.Id;
     _maritalStatus = MaritalStatus.Parse(customerRegisteredEvent.MaritalStatus);
 }
Exemplo n.º 6
0
        public void RegisterNewCustomer(Guid customerId, PersonName personName, DateTime dateOfBirth, StreetAddress primaryAddress, MaritalStatus maritalStatus, GenderEnum gender)
        {
            //do any business logic in here, check invariants and throw a DomainException if there is a problem
            //check DoB is not in the future
            if (dateOfBirth > SystemTime.Now)
            {
                throw new DomainException(string.Format("Date of birth ({0}) can not be in the future.", dateOfBirth));
            }

            ApplyChange(new CustomerRegistered
            {
                City          = primaryAddress.City,
                DateOfBirth   = dateOfBirth,
                FirstName     = personName.FirstName,
                Gender        = gender.Gender,
                HouseNumber   = primaryAddress.HouseNumber,
                Id            = customerId,
                LastName      = personName.LastName,
                MaritalStatus = maritalStatus.Status,
                MiddleName    = personName.MiddleName,
                State         = primaryAddress.State,
                Street        = primaryAddress.Street,
                Zip           = primaryAddress.Zip.Zip,
            });
        }
Exemplo n.º 7
0
 internal void When(CustomerMaritalStatusChanged evnt)
 {
     _maritalStatus = MaritalStatus.Parse(evnt.MaritalStatus);
 }
Exemplo n.º 8
0
 internal void When(CustomerRegistered customerRegisteredEvent)
 {
     _id = customerRegisteredEvent.Id;
     _maritalStatus = MaritalStatus.Parse(customerRegisteredEvent.MaritalStatus);
 }