private async Task SendSms(Appointment appointment, User notifiedUser)
        {
            var template = await _smsTemplateRepository.GetByNameAsync(TemplateNames.ConfirmAppointment);

            var values = await _appointmentService.GetTemplateValues(appointment);

            var message = new SmsMessage(template, values, notifiedUser.Address.Phone);

            _jobManager.Enqueue(message);
        }
예제 #2
0
        private async Task SendEmail(Appointment appointment, User notifiedUser)
        {
            var template = await _emailTemplateRepository.GetByNameAsync(TemplateNames.AppointmentCanceled);

            var values = await _appointmentService.GetTemplateValues(appointment);

            var to      = new EmailAddress(notifiedUser.Email, notifiedUser.FullName);
            var message = new EmailMessage("Extivita HBOT Appointment", template, values, to)
            {
                CalendarEntry = _appointmentService.CreateCalendarEntry(appointment, CalendarEntryStatus.Canceled)
            };

            _jobManager.Enqueue(message);
        }
예제 #3
0
        private async Task SendReminderEmail(Appointment appointment, User notifiedUser)
        {
            var template = await _emailTemplateRepository.GetByNameAsync(TemplateNames.AppointmentReminder);

            var values = await _appointmentService.GetTemplateValues(appointment);

            var to      = new EmailAddress(notifiedUser.Email, notifiedUser.FullName);
            var message = new EmailMessage("Appointment Reminder", template, values, to);

            //{
            //    CalendarEntry = _appointmentService.CreateCalendarEntry(appointment, CalendarEntryStatus.Confirmed)
            //};
            _jobManager.Enqueue(message);
        }
예제 #4
0
        private async Task SendEmail(
            Appointment appointment,
            User notifiedUser,
            Dictionary <string, string> values)
        {
            var template = await _emailTemplateRepository.GetByNameAsync(TemplateNames.AppointmentRescheduled);

            var to      = new EmailAddress(notifiedUser.Email, notifiedUser.FullName);
            var message = new EmailMessage("Extivita HBOT Appointment", template, values, to)
            {
                CalendarEntry = _appointmentService.CreateCalendarEntry(appointment, CalendarEntryStatus.Updated)
            };

            _jobManager.Enqueue(message);
        }
예제 #5
0
 public async Task <Result> TestJob([FromServices] IJobManager jobManager)
 {
     jobManager.Enqueue <Demo1, Demo1Args>(new Demo1Args {
         Name = "1"
     });
     return(Result.Ok());
 }
예제 #6
0
        public ActionResult <JsonStatus> ProblemsPost([FromBody] JsonJob instance)
        {
            // Sanity check job
            var inputErr = JsonIO.Validate(instance.Instance);

            if (inputErr != null)
            {
                _logger.LogWarning($"POST calculation had error: {inputErr}");
                return(BadRequest(inputErr));
            }
            // Create calculation job
            int calcId = _jobManager.GetNextId();
            var calc   = new Calculation(calcId, instance, null);

            if (calc.Problem.Configuration == null) // Set a default config, if none is given
            {
                calc.Problem.Configuration = new ObjectModel.Configuration.Configuration(ObjectModel.MethodType.ExtremePointInsertion, false);
            }
            calc.Status.ProblemUrl  = $"{SUB_CALCULATION_PROBLEMS}/{calcId}";
            calc.Status.StatusUrl   = $"{SUB_CALCULATION_PROBLEMS}/{calcId}/status";
            calc.Status.SolutionUrl = $"{SUB_CALCULATION_PROBLEMS}/{calcId}/solution";
            // Log
            _logger.LogInformation($"POST calculation (got ID {calcId})");
            // Enqueue the problem
            _jobManager.Enqueue(calc);
            return(Ok(calc.Status));
        }