/// <summary> /// Creates a new instance of a workshop-planning for the specified date. /// </summary> /// <param name="date">The date to create the planning for.</param> /// <param name="planning">The initialized WorkshopPlanning instance.</param> /// <returns>The WorkshopPlanningCreated event.</returns> /// <remarks>This implementation makes sure creation of the planning becomes part of the event-stream.</remarks> public static IEnumerable <Event> Create(DateTime date, out WorkshopPlanning planning) { planning = new WorkshopPlanning(); WorkshopPlanningCreated e = new WorkshopPlanningCreated(Guid.NewGuid(), date); return(planning.HandleEvent(e)); }
private IEnumerable <Event> Handle(WorkshopPlanningCreated e) { Jobs = new List <MaintenanceJob>(); Date = e.Date.Date; return(new List <Event>(new Event[] { e })); }
/// <summary> /// Creates a new instance of a workshop-planning for the specified date. /// </summary> /// <param name="date">The date to create the planning for.</param> public static WorkshopPlanning Create(DateTime date) { WorkshopPlanning planning = new WorkshopPlanning(date); WorkshopPlanningCreated e = new WorkshopPlanningCreated(Guid.NewGuid(), date); planning.RaiseEvent(e); return(planning); }
public IEnumerable <Event> Create(DateTime date) { List <Event> events = new List <Event>(); WorkshopPlanningCreated e = new WorkshopPlanningCreated(Guid.NewGuid(), Date = date); events.AddRange(Handle(e)); return(events); }
public IEnumerable <Event> RegisterPlanning(RegisterPlanning cmd) { List <Event> events = new List <Event>(); WorkshopPlanningCreated e = new WorkshopPlanningCreated(Guid.NewGuid(), Date = cmd.PlanningDate); events.AddRange(Handle(e)); return(events); }
private void Handle(WorkshopPlanningCreated e) { Jobs = new List <MaintenanceJob>(); }
public WorkshopPlanningCreated Build() { WorkshopPlanningCreated e = new WorkshopPlanningCreated(Guid.NewGuid(), Date); return(e); }