示例#1
0
        private Task <IReadOnlyCollection <Appointment> > GetTomorrowAppointments()
        {
            var tomorrow = Clock.Today.AddDays(1);

            return(_appointmentRepository.GetAllAsync(
                       AppointmentSpecification.ByDay(tomorrow).NotCanceled()));
        }
        private async Task <IReadOnlyCollection <Appointment> > GetTodayDivesWithoutPayment()
        {
            var dives = await _appointmentRepository.GetAllAsync(
                AppointmentSpecification.ForTodayDivesWithoutPayment().NotCanceled());

            return(dives);
        }
示例#3
0
        public async Task Handle(AppointmentCanceledEvent domainEvent, CancellationToken cancellationToken)
        {
            var appointment = await _appointmentRepository.GetSingleOrDefaultAsync(
                AppointmentSpecification.ById(domainEvent.AppointmentId));

            if (domainEvent.RefundPayment && appointment.Transaction?.Status == TransactionStatus.Completed)
            {
                await _checkoutService.RefundAsync(appointment.Transaction, RefundType.PatientCredit, appointment.Transaction.Amount);
            }
        }
示例#4
0
        public Task <IExecutionResult> BookAppointment(string value)
        {
            var spec = new AppointmentSpecification();

            //spec.ThrowDomainErrorIfNotSatisifiedBy(this);
            //await base.LoadAsync(eventStore, snapshotStore, CancellationToken.None);
            Emit(new AppointmentBookedEvent(AppointmentOrder, Location, Schedule, CarService));

            //this.eventFactory.Create(new AppointmentBookedEvent(AppointmentOrder, Location, Schedule),)

            return(Task.FromResult(ExecutionResult.Success()));
        }
示例#5
0
        public async Task Handle(AppointmentCanceledEvent domainEvent, CancellationToken cancellationToken)
        {
            var appointment = await _appointmentRepository.GetSingleOrDefaultAsync(
                AppointmentSpecification.ById(domainEvent.AppointmentId));

            var notifiedUser = await _userService.GetResponsibleUser(appointment.Patient.Id);

            var userPreference = await _preferenceRepository.LoadAsync <CommunicationPreference>(notifiedUser.Id);

            if (userPreference.ReceiveEmailAndCalendarReminders)
            {
                await SendEmail(appointment, notifiedUser);
            }
            if (userPreference.ReceiveSmsReminders)
            {
                await SendSms(appointment, notifiedUser);
            }
        }
        public async Task Handle(AppointmentCreatedEvent appointmentCreatedEvent, CancellationToken cancellationToken)
        {
            _logger.LogInformation("{appointmentCreatedEvent}", appointmentCreatedEvent);
            var appointment = await _appointmentRepository.GetFirstOrDefaultAsync(
                AppointmentSpecification.ById(appointmentCreatedEvent.AppointmentId));

            var notifiedUser = await _userService.GetResponsibleUser(appointment.Patient.Id);

            _logger.LogInformation($"Sending confirmation message to patient {notifiedUser.FullName}");
            var userPreference = await _preferenceRepository.LoadAsync <CommunicationPreference>(notifiedUser.Id);

            if (userPreference.ReceiveEmailAndCalendarReminders)
            {
                await SendEmail(appointment, notifiedUser);
            }
            if (userPreference.ReceiveSmsReminders)
            {
                await SendSms(appointment, notifiedUser);
            }
        }
示例#7
0
        public async Task Handle(AppointmentRescheduledEvent domainEvent, CancellationToken cancellationToken)
        {
            var appointment = await _appointmentRepository.GetSingleOrDefaultAsync(
                AppointmentSpecification.ById(domainEvent.AppointmentId));

            var notifiedUser = await _userService.GetResponsibleUser(appointment.Patient.Id);

            var values = await _appointmentService.GetTemplateValues(appointment);

            values["old_date_time"] = domainEvent.OldDateTime.ToString();
            var userPreference = await _preferenceRepository.LoadAsync <CommunicationPreference>(notifiedUser.Id);

            if (userPreference.ReceiveEmailAndCalendarReminders)
            {
                await SendEmail(appointment, notifiedUser, values);
            }
            if (userPreference.ReceiveSmsReminders)
            {
                await SendSms(notifiedUser, values);
            }
        }