Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Loading recurrents events with cutom dataprovider
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Loading recurrents events with cutom dataprovider

 Post Reply Post Reply
Author
Message
flam70 View Drop Down
Newbie
Newbie
Avatar

Joined: 08 January 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote flam70 Quote  Post ReplyReply Direct Link To This Post Topic: Loading recurrents events with cutom dataprovider
    Posted: 03 March 2009 at 5:21am
Hello,

I use calendar ActiveX with the Windev environment. I store events and patterns in two separated tables and i use a custom provider.
I can create events with recurrence in the database (HyperFile Database). But when i load events from the database into the calendar, recurrents events are loading as multidays events, occurrences seem to be not generated. I try to follow the example code provided with the activex. I have implemented DoRetrieveDayEvents and DoReadRPattern as explained but it does not work as well. I run out of ideas.

Here is a snippet of my code below :

// Initialization of the ActiveX 
// Calendar activeX's name is AX_Active1

AX_ActiveX1>>SetDataProvider("Provider=Custom")

AX_ActiveX1>>DataProvider>>Open()
IF NOT AX_ActiveX1>>DataProvider>>Open() THEN
    AX_ActiveX1>>DataProvider>>Create()
END
ActiveXEvent(CAL_DoRetrieveDayEvents,AX_ActiveX1,"DoRetrieveDayEvents")
ActiveXEvent(CAL_DoReadRPattern,AX_ActiveX1,"DoReadRPattern")
...


// DoRetrieveDayEvents
PROCEDURE CAL_DoRetrieveDayEvents(laDate,pEvents)

sReqSQL is string
dhVdate is DateTime
nVannee, nVmois, nVjour are strings
MaRequete is Data Source

dhVdate         = laDate

nVannee         = Left(dhVdate,4)
nVmois            = Middle(dhVdate,5,2)
nVjour             = Middle(dhVdate,7,2)

sReqSQL         = "SELECT * FROM TBLEvenement WHERE"
sReqSQL         += " (ReccurenceState = 0 OR ReccurenceState = 1) AND "
sReqSQL         += "( LEFT(StartDateTime,4) < " + "'"+  nVannee + "'" 
sReqSQL         += " OR ( Left(StartDateTime,4) = " +  "'" + nVannee + "'"  + " AND "
sReqSQL         += "(MID(StartDateTime,5,2) < " +  "'" + nVmois  + "'" + " OR "
sReqSQL         += "MID(StartDateTime,5,2) = " + "'" + nVmois + "'" + " AND "
sReqSQL         += "MID(StartDateTime,7,2) <= " +  "'" +nVjour + "'" 
sReqSQL         += " ))) AND "
sReqSQL         += "(LEFT(EndDateTime,4) > " +  "'" + nVannee + "'"  
sReqSQL         += " OR ( Left(EndDateTime,4) = " + "'" + nVannee +"'" + " AND "
sReqSQL         += "(MID(EndDateTime,5,2) > " +  "'" + nVmois + "'"  + " OR "
sReqSQL         += "MID(EndDateTime,5,2) = " + "'"+nVmois+ "'"+ " AND "
sReqSQL         += "MID(EndDateTime,7,2) >= " + "'" +nVjour + "'" 
sReqSQL         += " )))"

IF NOT HExecuteSQLQuery(MaRequete,hQueryDefault,sReqSQL) THEN
    Error("Erreur d'initialisation de la requête" + CR+HErrorInfo())
END

pautEvt is object Automation dynamic
HReadFirst(MaRequete)
WHILE NOT HOut(MaRequete)
   
    pautEvt = TRT_CreateEventFromDB(MaRequete,False)
    IF pautEvt <> Null THEN
        pEvents>>Add(pautEvt)
    END
 
    HReadNext(MaRequete)
END
HCancelDeclaration(MaRequete)

//  TRT_CreateEventFromDB
PROCEDURE TRT_CreateEventFromDB(sdSource is Data Source, bRException is boolean)

pautEvt is object Automation dynamic
nEventID is int
dhDateDebut, dhDateFin are DateHeures

nEventID = sdSource.EventID

pautEvt   =  FEN_Principale.AX_ActiveX1>>DataProvider>>createEventEx(nEventID)
pautEvt>>Subject       = sdSource.Subject
pautEvt>>Body           = sdSource.Body
dhDateDebut..Date     = sdSource.StartDateTime
dhDateDebut..Time      = sdSource.StartTime
dhDateFin..Date           = sdSource.EndDateTime
dhDateFin..Time            = sdSource.EndTime

pautEvt>>StartTime      = dhDateDebut
pautEvt>>EndTime       = dhDateFin

IF sdSource.IsAllDayEvent = 1 THEN
    pautEvt>>AllDayEvent = True
ELSE
    pautEvt>>AllDayEvent = False   
END

pautEvt>>CustomProperties>>LoadFromString(sdSource.CustomPropertiesXMLData)

IF bRException THEN
    // TO DO
END

IF NOT bRException THEN
    pautEvt>>CustomProperties("process_RecurrenceState")         = sdSource.ReccurenceState
    pautEvt>>CustomProperties("process_RecurrencePatternID")    = sdSource.RecurrencePatternID
 END

RESULT pautEvt

// DoReadRPattern

PROCEDURE CAL_DoReadRPattern(patternID,pPattern)

sdRequeteReadRPattern is Data Source
sStrSQL is string

sStrSQL = "SELECT * FROM CalendarRecurrencePatterns WHERE RP_ID = " + patternID
IF NOT HExecuteSQLQuery(sdRequeteReadRPattern,hQueryDefault,sStrSQL) THEN
    Error("Erreur d'initialisation de la requête" + CR+HErrorInfo())
END

HReadFirst(sdRequeteReadRPattern)
pPattern = TRT_CreateRPatternFromDB(sdRequeteReadRPattern)
HCancelDeclaration(sdRequeteReadRPattern)

//TRT_CreateRPatternFromDB
PROCEDURE TRT_CreateRPatternFromDB(sdSource is Data Source)


pautMonPattern is object Automation dynamic
patternID is int
dhDateDebut, dhHeureDebut, dhDateFin  are DateHeures


patternID                         = sdSource.RP_ID
pautMonPattern               = FEN_Principale.AX_ActiveX1>>DataProvider>>CreateRecurrencePattern(patternID)

pautMonPattern>>MasterEventId     = sdSource.RP_MasterEventID

dhDateDebut = sdSource.RP_StartDate
dhHeureDebut = sdSource.RP_StartTime

pautMonPattern>>StartDate         = dhDateDebut
pautMonPattern>>StartTime         = dhHeureDebut

pautMonPattern>>DurationMinutes    = sdSource.RP_Duration

pautMonPattern>>CustomProperties>>LoadFromString(sdSource.CustomPropertiesXMLData)
pautMonPattern>>EndMethod         = sdSource.RP_EndMethod
SWITCH pautMonPattern>>EndMethod
    CASE 0 // EndDate
        dhDateFin = sdSource.RP_EndDate
        pautMonPattern>>EndDate     = dhDateFin
    CASE 1 // EndAfterOccurences
        pautMonPattern>>EndAfterOccurrences = sdSource.RP_EndAfterOccurrences
    OTHER CASE
END

pautMonPattern>>Options>>RecurrenceType = sdSource.RPO_RecurrenceType

IF pautMonPattern>>Options>>RecurrenceType = 2 THEN  // RecurrenceWeekly pour les tests
    Trace("Récurrence weekly")
    pautMonPattern>>Options>>WeeklyDayOfWeekMask = sdSource.RPO_WeeklyDayOfWeekMask
    pautMonPattern>>options>>WeeklyIntervalWeeks = sdSource.RPO_WeeklyIntervalWeeks
ELSE
    IF pautMonPattern>>Options>>RecurrenceType = 1 THEN
        pautMonPattern>>Options>>DailyEveryWeekDayOnly = sdSource.RPO_DailyEveryWeekDayOnly
        pautMonPattern>>Options>>DailyIntervalDays = sdSource.RPO_DailyIntervalDays
    END
END

RESULT pautMonPattern

// End of snipped code

What's wrong with my code ? I really don't understand why occurences are not well-generated by the dataProvider from the masterEvent .

Please i need help.

Thanks
Back to Top
Yan59 View Drop Down
Newbie
Newbie


Joined: 29 April 2009
Location: France
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Yan59 Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2009 at 4:32am
Hello,

I am using Codejock with windev too.

Did you solved the problem or may I help you ?

For my side, I have a question about integration of Calendar activex in Windev

How setup the license number to the activex ?

I would be very pleased to share with you experiences on this activex..

Best Regards,

Yannick
French Speaker
Back to Top
austro View Drop Down
Newbie
Newbie


Joined: 03 October 2008
Location: Australia
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote austro Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2009 at 6:12pm
Hi Yannick,
I have solved the license issue.
Just add these lines of code to the initialization of the window that holds the control.

CalSet is object Automation dynamic

CalSet =new object Automation "Codejock.CalendarGlobalSettings.13.0.0"

CalSet>>License("Calendar Control Copyright (c) 2003-2009 Codejock Software"+CR+"PRODUCT-ID: Codejock.Calendar.ActiveX.v13.0"+CR+"VALIDATE-CODE: xxx-xxx-xxx-xxx")

Also be careful with your registry entries it seems to want to find it in the original codejock directory.
 
Yes I am interested in collaberation, some other developers are doing interesting things with it.
But I still have not fixed this recurrence issue.
Are you using classes or procedures to work the calendar?
Regards
Mark Irwin 
Back to Top
francois_m View Drop Down
Newbie
Newbie


Joined: 05 September 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote francois_m Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2009 at 7:35am
Hello Yannick

Have you found information, I have the same problem as you.

Thank you
 
Francois
Back to Top
Yan59 View Drop Down
Newbie
Newbie


Joined: 29 April 2009
Location: France
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote Yan59 Quote  Post ReplyReply Direct Link To This Post Posted: 09 September 2009 at 1:54pm
Hello François,

Yes the solution I use is the following lines :


You have to write on the Declaration code of the window :

CALGlobalSettings est un objet Automation "Codejock.CalendarGlobalSettings.13.0.0"
CALGlobalSettings>>License="Calendar Control Copyright (c) 2003-2009 Codejock Software" +Caract(13)+Caract(10)+"PRODUCT-ID: Codejock.Calendar.ActiveX.v13.0" +Caract(13)+Caract(10)+ "VALIDATE-CODE: XXX-XXX-XXX-XXX"


(where XXX-XXX-XXX-XXX is your licence code)

it works well for me !

If you have other questions don't hesitate to mail me your email adress,( French & English speaker)

Enjoy your dev with Windev !

Bye , A+


Yan
 
Back to Top
francois_m View Drop Down
Newbie
Newbie


Joined: 05 September 2009
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote francois_m Quote  Post ReplyReply Direct Link To This Post Posted: 03 October 2009 at 11:55am
Bonjour Yan et merci d'avoir pris le temps de me répondre.
 
Je vous répond tardivement car j'étais malade.
 
Je débute dans windev et c'est mon premier activeX que j'essaye de faire fonctionner avec windev.
Je m'arrache les cheveux car je galère depuis 2 mois pour y comprendre quelque chose en
essayant un début de projet Windev avec des bouts de code CodeJock trouvé ici et là.
 
Je recherche un bout de code qui fonctionne à peut près qui me mettrait sur la bonne voie.
 
Merci
 
François
francois_at_moinel.org
Back to Top
austro View Drop Down
Newbie
Newbie


Joined: 03 October 2008
Location: Australia
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote austro Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2010 at 4:05am
Hi Francois
 
I have still been having this license issue with new versions V13.3 and v13.4.
I solved it by adding the license code to the project initilisation code.
 
Regards
Mark 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.