Beispiel #1
0
        private void SetRegistrationNumber(RegistrationNumber registrationNumber)
        {
            if (registrationNumber is null)
            {
                throw new EmptyRegistrationNumberException();
            }

            RegistrationNumber = registrationNumber;
        }
Beispiel #2
0
 public Employee(Guid id, RegistrationNumber registrationNumber, string pesel, DateTime dateOfBirth, string lastName, string firstName, string secondName,
                 string gender, DateTime now, int version = 0)
 {
     Id = id;
     SetRegistrationNumber(registrationNumber);
     SetPesel(pesel);
     SetDateOfBirth(dateOfBirth, now);
     SetLastName(lastName);
     SetNames(firstName, secondName);
     SetGender(gender);
 }
Beispiel #3
0
        public static Employee Create(string pesel, DateTime dateOfBirth, string lastName, string firstName, string secondName,
                                      string gender, DateTime now, IEnumerable <RegistrationNumber> unavailableRegistrationNumbers)
        {
            var employee = new Employee();

            employee.SetId();
            employee.RegistrationNumber = RegistrationNumber.Create(unavailableRegistrationNumbers);
            employee.SetPesel(pesel);
            employee.SetDateOfBirth(dateOfBirth, now);
            employee.SetLastName(lastName);
            employee.SetNames(firstName, secondName);
            employee.SetGender(gender);

            //for the future -> add EmployeeCreated DomainEvent

            return(employee);
        }