BOOL CXTPCalendarRemindersManager::GetUpcomingEventsAll(COleDateTime dtFrom, COleDateTimeSpan spPeriod, CXTPCalendarEventsPtr& rptrEvents) { rptrEvents = NULL; if (!m_pResourcesNf || !m_pResourcesNf->GetResourcesGroupedByDP()) { ASSERT(FALSE); return FALSE; } CXTPCalendarResources* pRCgroups = m_pResourcesNf->GetResourcesGroupedByDP(); int i; int nCount = pRCgroups->GetCount(); //-- check is all data providers opened ------------- for (i = 0; i < nCount; i++) { CXTPCalendarResource* pRC = pRCgroups->GetAt(i); ASSERT(pRC); CXTPCalendarData* pData = pRC ? pRC->GetDataProvider() : NULL; ASSERT(pData); if (!pData || !pData->IsOpen()) { return FALSE; } } //-- read data ---------------- for (i = 0; i < nCount; i++) { CXTPCalendarResource* pRC = pRCgroups->GetAt(i); ASSERT(pRC); CXTPCalendarData* pData = pRC ? pRC->GetDataProvider() : NULL; if (!pData || !pData->IsOpen()) { ASSERT(FALSE); continue; } CXTPCalendarEventsPtr ptrEv = pData->GetUpcomingEvents(dtFrom, spPeriod); if (rptrEvents) { rptrEvents->Append(ptrEv); } else { rptrEvents = ptrEv; } pRC->FilterEventsByScheduleID(rptrEvents); } return TRUE; }
void CXTPCalendarResourcesManager::RemoveDataProvider(int nIndex) { if (nIndex >= 0 && nIndex < m_arDataProviders.GetCount()) { CXTPCalendarData* pData = m_arDataProviders.GetAt(nIndex); if (pData && pData->IsOpen()) { pData->Close(); } m_arDataProviders.RemoveAt(nIndex); } }