This is a migrated thread and some comments may be shown as answers.

[Solved] Get Recurrence

5 Answers 305 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Yamil
Top achievements
Rank 1
Yamil asked on 14 Jun 2008, 08:45 PM
Hi. I am saving an appointment with recurrence in my database. The field has the following value:

DTSTART:20080609T120000Z
DTEND:20080609T180000Z
RRULE:FREQ=WEEKLY;UNTIL=20081231T040000Z;INTERVAL=1;BYDAY=MO

And when i load the appointments my method return a List of CalendarioMedicoList that it is a subclass of Appointment. My code is
For Each rowData In ds.Tables(0).Rows 
   cm = New CalendarioMedico() 
 
   cm.ID = rowData("IdeSeq") 
   Dim s As String = rowData("FECINI").ToString().Substring(0, 10) + " " + rowData("HORAINI").ToString() 
   cm.StartTime = DateTime.Parse(rowData("FECINI").ToString().Substring(0, 10) + " " + rowData("HORAINI").ToString()) 
   cm.EndTime = DateTime.Parse(rowData("FECFIN").ToString().Substring(0, 10) + " " + rowData("HORAFIN").ToString()) 
   cm.RecurrenceRule = rowData("RECURRENCERULE").ToString() 
 
  cm.CodPais = rowData("CODPAIS").ToString() 
  cm.CodCia = rowData("CODCIA").ToString() 
  cm.CodOfi = rowData("CODOFI").ToString() 
  cm.CodId = rowData("CODID").ToString() 
  cm.NumId = rowData("NUMID").ToString() 
 
  If rowData("INDTIPOHORARIO").ToString() = "01" Then 
    cm.TipoInfo = CalendarioMedico.TipoInfoCalendario.Especialidad 
    cm.Subject = rowData("NOMESPECIALIDAD").ToString() 
    cm.IdeEspecialidad = rowData("IDEESPECIALIDAD") 
  Else 
    cm.TipoInfo = CalendarioMedico.TipoInfoCalendario.NoDisponible 
    cm.Subject = "Feriado:" + rowData("DESMOTIVO").ToString() 
    cm.IdeEspecialidad = rowData("CODMOTIVO") 
  End If 
 lista.Add(cm) 
 

Note that I do cm.RecurrenceRule = recurrence string from my table, however when I saw the RadScheduler I don't get any recurrence dates and there is no visual clue on my starting date that it is recurrence.

Any clue ?

5 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 18 Jun 2008, 02:45 PM
Hi Yamil,

Everything looks correct in your code. I assume that you are binding the RadScheduler to a list of such objects? If this is the case, then you should check if you have correctly set the DataRecurrenceField and DataRecurrenceParentKeyField. For example:

<telerik:RadScheduler runat="server" ID="RadScheduler1" 
    Width="750px" EnableEmbeddedSkins="True" Skin="Mac" 
    DayStartTime="08:00:00" DayEndTime="18:00:00" TimeZoneOffset="03:00:00" 
    OnAppointmentInsert="RadScheduler1_AppointmentInsert" 
    OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" 
    OnAppointmentDelete="RadScheduler1_AppointmentDelete" 
    DataKeyField="ID" DataSubjectField="Subject" DataStartField="Start" DataEndField="End" 
    DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentId"
    <TimelineView UserSelectable="false" /> 
</telerik:RadScheduler> 


Greetings,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
zac
Top achievements
Rank 1
answered on 18 Jun 2008, 09:27 PM
Hi Yamil,

From my experience, there is no need for the RecurrenceState property - it's handled by the Scheduler implicitly. As for the RecurrenceParentId, you do need this when it comes to those appointments which are exceptions to the recurrence rule.

Hope this helps,
Cheers,
Zac
0
Yamil
Top achievements
Rank 1
answered on 18 Jun 2008, 10:59 PM
Thanks ZAC.
I build using pure code a recurrence and works OK but now I am trying to do the same getting the info from a database.

I am doing the following when I save the appointment
 (some parts of coding are not shown)

Dim untilDate = New DateTime(2008, 12, 31)  
Dim rgo As RecurrenceRange = New RecurrenceRange(inicio.AddHours(-4), New TimeSpan(final.Ticks - inicio.Ticks), untilDate, Int32.MaxValue)  '1 Hora  
Dim rr As WeeklyRecurrenceRule = New WeeklyRecurrenceRule(1, daysOfWeekMask, rgo)  
 
recurrentRule = (New RecurrenceRuleConverter()).ConvertToInvariantString(rr)  
 
Dim rowData As DataRow = table.NewRow()  
rowData("Recurrencia") = recurrentRule  
rowData("RecurrenceParentId") = 1  
rowData("RecurrenceState") = Telerik.Web.UI.RecurrenceState.Master.ToString  
 
 
 

And in my table in the database I got :

RecurrenceRule=DTSTART:20080617T083000Z
DTEND:20080617T090000Z
RRULE:FREQ=WEEKLY;UNTIL=20081231T043000Z;INTERVAL=1;BYDAY=TU
RecurrentParent=1
RecurrentState=1

When I retrieve the data I do 8Note I am hardcoding the recurrentparentId and the RecurrenceState)

Dim strRecurrente As String = IIf(rowData.IsNull("RECURRENCERULE"), "", rowData("RECURRENCERULE").ToString())  
If strRecurrente.Length > 0 Then  
   cm.RecurrenceRule = strRecurrente 
   cm.RecurrenceParentID = 1 'Int32.Parse(rowData("RECURRENTPARENT").ToString())  
   cm.RecurrenceState = Telerik.Web.UI.RecurrenceState.Master  
End If  
 

RadScheduler shows the appoint as recurrent because I can see the "special" sign on it. Also when I try to delete it, I can see the dialog telling me is I want to delete only this appointment or all the serie. However when i move to the next week i do not get the day show as recurrent nor as appointment.

My Radscheduler is defined as

<telerik:RadScheduler ID="RadScheduler1"   
runat="server"   
Skin="Sunset"   
DataKeyField="ID"   
DataSubjectField="Subject" 
DataStartField="StartTime"   
DataEndField="EndTime"   
DataRecurrenceField="RecurrenceRule"   
DataRecurrenceParentKeyField="RecurrenceParentID" 
Culture="Spanish (Venezuela)" 
ShowAllDayRow="False" 
ShowViewTabs="False" 
ShowFooter="False"   
OnClientAppointmentInserting="AppointmentInserting" 
Height="600px">  
</telerik:RadScheduler> 
 


Any hint ?

TIA
0
Yamil
Top achievements
Rank 1
answered on 18 Jun 2008, 10:59 PM
Thanks ZAC.
I build using pure code a recurrence and works OK but now I am trying to do the same getting the info from a database.

I am doing the following when I save the appointment
 (some parts of coding are not shown)

Dim untilDate = New DateTime(2008, 12, 31)  
Dim rgo As RecurrenceRange = New RecurrenceRange(inicio.AddHours(-4), New TimeSpan(final.Ticks - inicio.Ticks), untilDate, Int32.MaxValue)  '1 Hora  
Dim rr As WeeklyRecurrenceRule = New WeeklyRecurrenceRule(1, daysOfWeekMask, rgo)  
 
recurrentRule = (New RecurrenceRuleConverter()).ConvertToInvariantString(rr)  
 
Dim rowData As DataRow = table.NewRow()  
rowData("Recurrencia") = recurrentRule  
rowData("RecurrenceParentId") = 1  
rowData("RecurrenceState") = Telerik.Web.UI.RecurrenceState.Master.ToString  
 
 
 

And in my table in the database I got :

RecurrenceRule=DTSTART:20080617T083000Z
DTEND:20080617T090000Z
RRULE:FREQ=WEEKLY;UNTIL=20081231T043000Z;INTERVAL=1;BYDAY=TU
RecurrentParent=1
RecurrentState=1

When I retrieve the data I do 8Note I am hardcoding the recurrentparentId and the RecurrenceState)

Dim strRecurrente As String = IIf(rowData.IsNull("RECURRENCERULE"), "", rowData("RECURRENCERULE").ToString())  
If strRecurrente.Length > 0 Then  
   cm.RecurrenceRule = strRecurrente 
   cm.RecurrenceParentID = 1 'Int32.Parse(rowData("RECURRENTPARENT").ToString())  
   cm.RecurrenceState = Telerik.Web.UI.RecurrenceState.Master  
End If  
 

RadScheduler shows the appoint as recurrent because I can see the "special" sign on it. Also when I try to delete it, I can see the dialog telling me is I want to delete only this appointment or all the serie. However when i move to the next week i do not get the day show as recurrent nor as appointment.

My Radscheduler is defined as

<telerik:RadScheduler ID="RadScheduler1"   
runat="server"   
Skin="Sunset"   
DataKeyField="ID"   
DataSubjectField="Subject" 
DataStartField="StartTime"   
DataEndField="EndTime"   
DataRecurrenceField="RecurrenceRule"   
DataRecurrenceParentKeyField="RecurrenceParentID" 
Culture="Spanish (Venezuela)" 
ShowAllDayRow="False" 
ShowViewTabs="False" 
ShowFooter="False"   
OnClientAppointmentInserting="AppointmentInserting" 
Height="600px">  
</telerik:RadScheduler> 
 


Any hint ?

TIA
Tags
Scheduler
Asked by
Yamil
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Yamil
Top achievements
Rank 1
zac
Top achievements
Rank 1
Share this question
or