Print Page | Close Window

Regarding Week Mode. DoRetriveDayEvents Problem?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=10384
Printed Date: 17 December 2024 at 8:57pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Regarding Week Mode. DoRetriveDayEvents Problem?
Posted By: KumarCJ
Subject: Regarding Week Mode. DoRetriveDayEvents Problem?
Date Posted: 28 April 2008 at 8:32am

Hello,

We are using custom data provider for calendar control.

Flow is below:

From View class

void fun1()
{
 CXTPCalendarView* pView = GetCalendarCtrl().GetActiveView();
 if (pView && pView->GetViewType() != xtpCalendarWeekView)
 {
       GetCalendarCtrl().SwitchActiveView(xtpCalendarWeekView);
 }
}

SwitchActiveView calls DoRetrieveDayEvents

CXTPCalendarEventsPtr CCalendarDataProviderSQL::DoRetrieveDayEvents(COleDateTime dtDay)
{
 ----------------------------------

 /*CXTPCalendarEventsPtr ptrEvents; Define in .h file as member variable of class*/

 ptrEvents = new CXTPCalendarEvents();
 pView->GetEventsFromWeekData(ptrEvents);
 return ptrEvents;
}

we are calling views function from "DoRetrieveDayEvents()" who retrive the data from our database and add data as events
Please note that we are taking CXTPCalendarEventsPtr input parameter as a reference.

void MyView::GetEventsFromWeekData(CXTPCalendarEventsPtr& ptrEvents)
{
 //Retrive data for week

 for(i=0;i<7;i++)
 {
  Code to fetch data...
 
 //Add data  as event.
 m_pCalendar = &GetCalendarCtrl();
    pCalendarData = m_pCalendar->GetDataProvider();

        ptrEvent = pCalendarData->CreateNewEvent();
  
        ptrEvent->SetStartTime(evntStTime);
 ptrEvent->SetEndTime(evntEndTime);
 ptrEvent->SetSubject(strSubject);
  
    if (ptrEvent)
 {
  ptrEvents->Add(ptrEvent);
 }
 }//For loop ends here
}

ISSUE:
Application getting crash in
file name:  XTPCalendarViewDay.h
function name: virtual void Populate(COleDateTime dtDayDate)
Crash at: if (dtDayDate < CXTPCalendarUtils::ResetTime(pEvent->GetStartTime()) ||
  dtDayDate > CXTPCalendarUtils::ResetTime(pEvent->GetEndTime()) )
  {
   ASSERT(FALSE);
   TRACE(_T("ERROR data: Day: %s  EVENT {%s - %s} \n"),
     (LPCTSTR)dtDayDate.Format(_T("#%Y-%m-%d#")),
        (LPCTSTR)CXTPCalendarUtils::ResetTime(pEvent->GetStartTime()).Format(_T("#%Y-%m-%d#")),
        (LPCTSTR)CXTPCalendarUtils::ResetTime(pEvent->GetEndTime()).Format(_T("#%Y-%m-%d#"))
   ); 
  }

I had added 3 days data, but after ignoring the crash, it show me first day of week data only.

Please help me out in this.

Thanks,
Kumar




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net