BOOL CXTPCalendarRemindersManager::_GetMaxExceptionReminder( CXTPCalendarRecurrencePattern* pPattern, int& rnMinutes) { ASSERT(pPattern); if (!pPattern) { return FALSE; } CXTPCalendarEventsPtr ptrExcAr = pPattern->GetExceptions(); if (!ptrExcAr) { return FALSE; } BOOL bExists = FALSE; rnMinutes = 0; int nCount = ptrExcAr->GetCount(); for (int i = 0; i < nCount; i++) { CXTPCalendarEvent* pExc = ptrExcAr->GetAt(i, FALSE); if (pExc && pExc->IsReminder()) { rnMinutes = max(rnMinutes, pExc->GetReminderMinutesBeforeStart()); bExists = TRUE; } } return bExists; }
BOOL CXTPCalendarRemindersManager::UpdateDataFromDP(COleDateTime dtFrom, COleDateTimeSpan spPeriod) { ASSERT(m_pResourcesNf); if (!m_pResourcesNf || 0 == m_pResourcesNf->GetCount()) { m_dtLastUpdateTime = (DATE)0; return FALSE; } DWORD dwTime0 = ::GetTickCount(); DBG_REMINDERS_TRACE(_T("%s - CXTPCalendarRemindersManager::start retrieve UpcomingEvents(). \n"), CXTPCalendarUtils::GetCurrentTime().Format()); CWaitCursor _WC; int nWaitingCount = m_arWaitingReminders.GetCount(); int nActiveCount = m_arActiveReminders.GetCount(); // ??? m_arWaitingReminders.RemoveAll(); m_arActiveReminders.RemoveAll(); CXTPCalendarEventsPtr ptrEvents; BOOL bDataAvailable = GetUpcomingEventsAll(dtFrom, spPeriod, ptrEvents); if (bDataAvailable) { int nCount = ptrEvents ? ptrEvents->GetCount() : 0; for (int i = 0; i < nCount; i++) { CXTPCalendarEvent* pEvent = ptrEvents->GetAt(i, FALSE); ASSERT(pEvent); ProcessNewEvent(pEvent, dtFrom, spPeriod); } m_arActiveReminders.Sort(); m_dtLastUpdateTime = dtFrom; int nWaitingCount2 = m_arWaitingReminders.GetCount(); //------------------------------------ DWORD dwTime1 = ::GetTickCount(); DBG_REMINDERS_TRACE(_T("%s - CXTPCalendarRemindersManager::STOP retrieve UpcomingEvents(). time=%d ms, count = %d \n"), CXTPCalendarUtils::GetCurrentTime().Format(), (dwTime1 - dwTime0), nWaitingCount2); //------------------------------------------------------------ return (nWaitingCount != 0 || nWaitingCount2 != 0 || nActiveCount != 0); } //=================================================== DBG_REMINDERS_TRACE(_T("%s - CXTPCalendarRemindersManager::SKIP retrieve UpcomingEvents(). *** Some Data Closed. *** \n"), CXTPCalendarUtils::GetCurrentTime().Format()); m_dtLastUpdateTime = (DATE)0; return FALSE; }