public static void PromoteEmailReminders(Item item, List <VAlarm> emailVAlarms, ExDateTime startTime, ExDateTime endTime, bool isOccurrence) { if (item != null && emailVAlarms != null && emailVAlarms.Count > 0) { Reminders <EventTimeBasedInboxReminder> reminders = new Reminders <EventTimeBasedInboxReminder>(); foreach (VAlarm valarm in emailVAlarms) { int reminderOffset = VAlarm.CalculateReminderMinutesBeforeStart(valarm, startTime, endTime); EventTimeBasedInboxReminder eventTimeBasedInboxReminder = new EventTimeBasedInboxReminder(); eventTimeBasedInboxReminder.CustomMessage = valarm.Message; eventTimeBasedInboxReminder.ReminderOffset = reminderOffset; eventTimeBasedInboxReminder.OccurrenceChange = (isOccurrence ? EmailReminderChangeType.Added : EmailReminderChangeType.None); reminders.ReminderList.Add(eventTimeBasedInboxReminder); } Reminders <EventTimeBasedInboxReminder> .Set(item, InternalSchema.EventTimeBasedInboxReminders, reminders); } }
private bool PromoteReminders() { if (base.Context.Method == CalendarMethod.Request || base.Context.Method == CalendarMethod.Publish) { ExDateTime valueOrDefault = base.GetValueOrDefault <ExDateTime>(InternalSchema.DueDate, ExDateTime.MinValue); bool flag = false; if (this.item != null && this.item.Session != null && this.item.Session.IsOlcMoveDestination) { InternalRecurrence recurrenceFromItem = CalendarItem.GetRecurrenceFromItem(this.item); ExDateTime exDateTime; if (recurrenceFromItem != null) { exDateTime = recurrenceFromItem.EndDate + recurrenceFromItem.EndOffset; } else { exDateTime = valueOrDefault; } flag = (exDateTime.CompareTo(ExDateTime.UtcNow) < 0); } if (this.displayVAlarm != null && this.displayVAlarm.Validate() && !flag && (this.dueTime != null || this.displayVAlarm.ValueType == CalendarValueType.DateTime)) { int num = VAlarm.CalculateReminderMinutesBeforeStart(this.displayVAlarm, valueOrDefault, valueOrDefault); base.SetProperty(InternalSchema.ReminderIsSetInternal, true); base.SetProperty(InternalSchema.ReminderDueBy, valueOrDefault.AddMinutes((double)(-(double)num))); } else { base.SetProperty(InternalSchema.ReminderMinutesBeforeStart, 0); base.SetProperty(InternalSchema.ReminderIsSetInternal, false); } if (!flag) { VAlarm.PromoteEmailReminders(this.item, this.emailVAlarms, valueOrDefault, valueOrDefault, false); } } return(true); }