Esempio n. 1
0
        public void Finish(string comments = null)
        {
            Printer.Print(ConsoleColor.Cyan);

            var @event = new AppointmentCompleted(Id, comments);

            Apply(@event);
            DomainEvents.Publish(@event);
        }
Esempio n. 2
0
        public void Execute(AppointmentCompleted @event)
        {
            Printer.Print(ConsoleColor.Magenta);

            var appointmentRepository = new MyRepository <Appointment>();
            var appointment           = appointmentRepository.Fetch(@event.AppointmentId);
            var appointmentsOfJob     = new MyRepository <Appointment>().FetchAll().Where(a => a.JobId == appointment.JobId);

            if (appointmentsOfJob.All(a => a.IsCompleted()))
            {
                var jobRepository = new MyRepository <Job>();
                var job           = jobRepository.Fetch(appointment.JobId);

                job.Finish();
            }

            //Printer.Print("Job marked as in progress", ConsoleColor.Magenta);
        }
Esempio n. 3
0
 public void Apply(AppointmentCompleted @event)
 {
     Status   = Status.Completed;
     Comments = @event.Comments;
 }