Beispiel #1
0
        /// <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));
        }
Beispiel #2
0
        private IEnumerable <Event> Handle(WorkshopPlanningCreated e)
        {
            Jobs = new List <MaintenanceJob>();
            Date = e.Date.Date;

            return(new List <Event>(new Event[] { e }));
        }
Beispiel #3
0
    /// <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);
    }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
 private void Handle(WorkshopPlanningCreated e)
 {
     Jobs = new List <MaintenanceJob>();
 }
        public WorkshopPlanningCreated Build()
        {
            WorkshopPlanningCreated e = new WorkshopPlanningCreated(Guid.NewGuid(), Date);

            return(e);
        }