public async Task HandleAsync(IDomainEvent <PatientAggregate, PatientId, CancerPatientWithBreastTopygraphyIsRegistered> @event, ISagaContext sagaContext, CancellationToken cancellationToken)
        {
            this.Emit(new ConsultationSchedulingIsStartedEvent(@event.AggregateIdentity,
                                                               @event.AggregateEvent.RegistrationDate));

            var doctors = await _queryProcessor.ProcessAsync(DoctorQueriesFactory.GetAllOncologists, cancellationToken).ConfigureAwait(false);

            var machines = await _queryProcessor.ProcessAsync(TreatmentMachineQueriesFactory.GetRoomsWithAdvanceOrSimpleCapability, cancellationToken).ConfigureAwait(false);

            var machineIds = machines.Select(x => x.Id);

            var rooms = await _queryProcessor.ProcessAsync(TreatmentRoomQueriesFactory.RoomsEquippedWithAnyOfTheseMachines(machineIds), cancellationToken).ConfigureAwait(false);

            await HandleReservation(rooms, doctors).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
        public TreatmentRoomModel GetTreatmentRoomById(string treatmentRoomId)
        {
            var entities = this.Query(TreatmentRoomQueriesFactory.GetByTreatmentRoomId(treatmentRoomId));

            return(new TreatmentRoomModel(entities.FirstOrDefault(), this));
        }