Beispiel #1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AssessmentReminderRevisedEvent" /> class.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="version">The version.</param>
 /// <param name="time">The time.</param>
 /// <param name="unit">The unit.</param>
 public AssessmentReminderRevisedEvent(Guid key, int version, double time, AssessmentReminderUnit unit, Email sendToEmail = null)
     : base(key, version)
 {
     Time        = time;
     Unit        = unit;
     SendToEmail = sendToEmail;
 }
Beispiel #2
0
 private static DateTime GetThresholdDateForAssessmentReminder(DateTime reminderDate,
                                                               AssessmentReminderUnit reminderUnit,
                                                               double reminderTime)
 {
     return(reminderUnit == AssessmentReminderUnit.Days ? reminderDate.AddDays(-Convert.ToInt32(reminderTime)) :
            reminderDate.AddDays(-Convert.ToInt32(reminderTime * 7)));
 }
Beispiel #3
0
        private static void AddAssessmentReminderForPatient(
            Guid assessmentDefinitionKey,
            Guid organizationKey,
            Guid patientKey,
            Guid staffKey,
            string reminderName,
            string description,
            string email,
            DateTime startDateTime,
            DateTime endDateTime,
            AssessmentReminderRecurrence reminderRecurrenceType,
            AssessmentReminderUnit assessmentReminderUnit)
        {
            var assessmentReminder = new AssessmentReminder(organizationKey,
                                                            patientKey,
                                                            staffKey,
                                                            assessmentDefinitionKey,
                                                            reminderName,
                                                            startDateTime,
                                                            description,
                                                            reminderRecurrenceType,
                                                            endDateTime);

            assessmentReminder.ReviseReminder(1, assessmentReminderUnit, new Email(email));
            Console.WriteLine("Added Assessment Reminder: {0} ......", reminderName);
        }
 public void ReviseReminder(double reminderTime, AssessmentReminderUnit reminderUnit, Email sendToEmail = null)
 {
     RaiseEvent(new AssessmentReminderRevisedEvent(Key, Version, reminderTime, reminderUnit, sendToEmail));
     if (AlertSentDate.HasValue) //mark for re-send
     {
         var thresholdDate = reminderUnit == AssessmentReminderUnit.Days ? Start.AddDays(-Convert.ToInt32(reminderTime)) : Start.AddDays(-Convert.ToInt32(reminderTime * 7));
         if (DateTime.Now < thresholdDate)
         {
             RaiseEvent(new AssessmentReminderUpdatedEvent(Key, Version, a => a.AlertSentDate, null));
         }
     }
 }