internal static bool GetReminderItemsInternal(UserContext userContext, ExDateTime actualizationTime, TextWriter output)
        {
            bool            result = false;
            string          name   = userContext.UserCulture.Name;
            List <object[]> list   = RemindersRenderingUtilities.QueryReminders(actualizationTime, userContext);

            if (list.Count == 0)
            {
                return(false);
            }
            foreach (object[] reminder in list)
            {
                ExDateTime exDateTime  = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, ItemSchema.ReminderDueBy, ExDateTime.MinValue);
                ExDateTime exDateTime2 = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, ItemSchema.ReminderNextTime, ExDateTime.MinValue);
                if (!(exDateTime == ExDateTime.MinValue) && !(exDateTime2 == ExDateTime.MinValue) && !(exDateTime2 == RemindersRenderingUtilities.MaxOutlookDate))
                {
                    string itemProperty  = RemindersRenderingUtilities.GetItemProperty <string>(reminder, StoreObjectSchema.ItemClass, string.Empty);
                    bool   itemProperty2 = RemindersRenderingUtilities.GetItemProperty <bool>(reminder, MessageItemSchema.IsDraft, false);
                    int    itemProperty3 = RemindersRenderingUtilities.GetItemProperty <int>(reminder, MessageItemSchema.SwappedToDoStore, -1);
                    if (itemProperty.IndexOf("IPM.Schedule.Meeting", StringComparison.OrdinalIgnoreCase) == -1 && (itemProperty.IndexOf("IPM.Note", StringComparison.OrdinalIgnoreCase) == -1 || !itemProperty2) && itemProperty3 == -1)
                    {
                        ExDateTime itemProperty4 = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, CalendarItemInstanceSchema.StartTime, ExDateTime.MinValue);
                        ExDateTime itemProperty5 = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, CalendarItemInstanceSchema.EndTime, ExDateTime.MinValue);
                        int        num           = (int)(itemProperty5 - itemProperty4).TotalMinutes;
                        if (num < 0)
                        {
                            num = 0;
                        }
                        bool        flag          = ObjectClass.IsCalendarItem(itemProperty);
                        VersionedId itemProperty6 = RemindersRenderingUtilities.GetItemProperty <VersionedId>(reminder, ItemSchema.Id);
                        bool        flag2         = false;
                        if (flag)
                        {
                            CalendarItemType itemProperty7 = RemindersRenderingUtilities.GetItemProperty <CalendarItemType>(reminder, CalendarItemBaseSchema.CalendarItemType, CalendarItemType.Single);
                            flag2 = (itemProperty7 == CalendarItemType.RecurringMaster);
                        }
                        VersionedId versionedId = null;
                        string      text;
                        string      text2;
                        if (flag2)
                        {
                            CalendarItemOccurrence calendarItemOccurrence = null;
                            Item item = null;
                            try
                            {
                                try
                                {
                                    item = Utilities.GetItem <Item>(userContext, itemProperty6.ObjectId, new PropertyDefinition[0]);
                                    if (item.Reminder != null)
                                    {
                                        calendarItemOccurrence = (item.Reminder.GetPertinentItem(actualizationTime) as CalendarItemOccurrence);
                                    }
                                    if (calendarItemOccurrence == null)
                                    {
                                        continue;
                                    }
                                    object obj  = calendarItemOccurrence.Reminder.DueBy;
                                    object obj2 = calendarItemOccurrence.Reminder.ReminderNextTime;
                                    if (obj == null || obj2 == null)
                                    {
                                        continue;
                                    }
                                    exDateTime2 = (ExDateTime)obj2;
                                    exDateTime  = (ExDateTime)obj;
                                    versionedId = calendarItemOccurrence.Id;
                                    text        = calendarItemOccurrence.Subject;
                                    text2       = calendarItemOccurrence.Location;
                                }
                                catch (StoragePermanentException ex)
                                {
                                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Unable to retrieve calendar item occurence for this reminder.  Exception: {0}", ex.Message);
                                    result = true;
                                    continue;
                                }
                                catch (StorageTransientException ex2)
                                {
                                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Unable to retrieve calendar item occurence for this reminder.  Exception: {0}", ex2.Message);
                                    result = true;
                                    continue;
                                }
                                goto IL_289;
                            }
                            finally
                            {
                                if (item != null)
                                {
                                    item.Dispose();
                                    item = null;
                                }
                                if (calendarItemOccurrence != null)
                                {
                                    calendarItemOccurrence.Dispose();
                                    calendarItemOccurrence = null;
                                }
                            }
                            goto IL_26D;
                        }
                        goto IL_26D;
IL_289:
                        using (StringWriter stringWriter = new StringWriter())
                        {
                            stringWriter.Write("<div _lnk=1 class=\"divNotificationsItem\" id=\"b");
                            Utilities.HtmlEncode(itemProperty6.ObjectId.ToBase64String(), stringWriter);
                            stringWriter.Write("\" ck=\"");
                            Utilities.HtmlEncode(itemProperty6.ChangeKeyAsBase64String(), stringWriter);
                            if (flag2)
                            {
                                stringWriter.Write("\" oid=\"");
                                Utilities.HtmlEncode(versionedId.ObjectId.ToBase64String(), stringWriter);
                            }
                            stringWriter.Write("\" t=\"");
                            Utilities.HtmlEncode(DateTimeUtilities.GetJavascriptDate(exDateTime), stringWriter);
                            stringWriter.Write("\" c=\"");
                            Utilities.HtmlEncode(itemProperty, stringWriter);
                            stringWriter.Write("\" r=\"");
                            Utilities.HtmlEncode(DateTimeUtilities.GetJavascriptDate(exDateTime2), stringWriter);
                            stringWriter.Write("\" d=\"");
                            stringWriter.Write(num);
                            SanitizedHtmlString sanitizedHtmlString = null;
                            if (!string.IsNullOrEmpty(text))
                            {
                                sanitizedHtmlString = Utilities.SanitizeHtmlEncode(text);
                            }
                            SanitizedHtmlString sanitizedHtmlString2 = null;
                            if (!string.IsNullOrEmpty(text2))
                            {
                                sanitizedHtmlString2 = Utilities.SanitizeHtmlEncode(text2);
                            }
                            stringWriter.Write("\" subj=\"");
                            stringWriter.Write(sanitizedHtmlString);
                            stringWriter.Write("\" loc=\"");
                            stringWriter.Write(sanitizedHtmlString2);
                            string text3 = string.Format(userContext.UserCulture, LocalizedStrings.GetHtmlEncodedFromKey(name, 580192567), new object[]
                            {
                                Utilities.HtmlEncode(exDateTime.ToString(DateTimeFormatInfo.CurrentInfo.LongDatePattern)),
                                Utilities.HtmlEncode(exDateTime.ToString(userContext.UserOptions.TimeFormat))
                            });
                            stringWriter.Write("\" due=\"");
                            stringWriter.Write(text3);
                            stringWriter.Write("\" tabindex=0>");
                            SmallIconManager.RenderItemIcon(stringWriter, userContext, itemProperty, false, -1, string.Empty, new string[]
                            {
                                "id=\"imgNtfyEnt\""
                            });
                            stringWriter.Write("<DIV id=\"c3\" class=\"divNotificationsColumn3\"><div id=\"c3Time\" class=\"divRemindersDueInTime\"></div><div id=\"c3Text\" class=\"divRemindersDueInText\"></div></div>");
                            stringWriter.Write("<DIV id=\"c2\" class=\"divNotificationsColumn2\"><div id=\"c2Time\" class=\"divRemindersDueInTime\"></div><div id=\"c2Text\" class=\"divRemindersDueInText\"></div></div>");
                            stringWriter.Write("<DIV id=\"c1\" class=\"divNotificationsColumn1\"><div id=\"c1Row1\" class=\"divNotificationsColumn1Row1\">{0}</div><div id=\"c1Row2\" class=\"divNotificationsColumn1Row2\">{1}</div>", (sanitizedHtmlString != null) ? sanitizedHtmlString.ToString() : string.Empty, text3);
                            if (sanitizedHtmlString2 != null)
                            {
                                stringWriter.Write("<div id=\"c1Row3\" class=\"divNotificationsColumn1Row3\">");
                                stringWriter.Write(sanitizedHtmlString2);
                                stringWriter.Write("</div>");
                            }
                            stringWriter.Write("</div></div>");
                            Utilities.JavascriptEncode(stringWriter.ToString(), output);
                        }
                        continue;
IL_26D:
                        text  = RemindersRenderingUtilities.GetItemProperty <string>(reminder, ItemSchema.Subject, null);
                        text2 = RemindersRenderingUtilities.GetItemProperty <string>(reminder, CalendarItemBaseSchema.Location, null);
                        goto IL_289;
                    }
                }
            }
            return(result);
        }