public Schedule( ISchedulePeriodOfTimeChecker schedulePeriodOfTimeChecker, FacilityId facilityId, string name, DateTime startDate, DateTime endDate, List <AvailabilityData> availabilities, EmployeeId creatorId) { CheckRule(new ScheduleMustHaveAtLeastOneAvailabilityRule(availabilities)); CheckRule(new NewSchedulePeriodOfTimeMustBeAvailableRule(schedulePeriodOfTimeChecker, facilityId, startDate, endDate)); CheckRule(new WorkerAvailabilityCanNotDuplicateInPeriodOfTimeRule(availabilities)); Id = new ScheduleId(Guid.NewGuid()); SetData(facilityId, name, startDate, endDate, availabilities, creatorId); creationDate = DateTime.Now; AddDomainEvent(new ScheduleCreatedEvent(Id)); }
public ScheduleCreatedEvent(ScheduleId id) { Id = id; }