We have some trouble with WinSchedule in Version 8.3.20083.2138 (I know, old version, but our customer is still using this one). When saving an UltraWinSchedule.AppointmentRecurrence object to a byte array all variances are lost. Example in VB.NET:
Dim count1 = myRecurrence.Variances.CountDim b As Byte() = myRecurrence.Save()Dim r2 As AppointmentRecurrence = AppointmentRecurrence.FromBytes(b)Dim count2 = r2.Variances.Count
Hello Neils,
Could you please provide a sample project in your next post reproducing the mentioned behavior since I was not able to do so when I tried.
Hello, Boris!
Just take the example code out of the online help for recurrence:
' To programatically create a recurring appointment,' you need to create an appointment object and assign' an 'AppointmentRecurrence' that provides the recurrence' information. Note, an AppointmentRecurrence instance can' only be associated with one appointment.
Dim dt As DateTime = DateTime.Now Dim rootAppt As Appointment = Me.ultraCalendarInfo1.Appointments.Add(dt, "New Recurring Appointment") ' create a recurrence that will occur every day for 30 days rootAppt.Recurrence = New AppointmentRecurrence() rootAppt.Recurrence.PatternFrequency = RecurrencePatternFrequency.Daily rootAppt.Recurrence.PatternInterval = 1 rootAppt.Recurrence.RangeLimit = RecurrenceRangeLimit.LimitByNumberOfOccurrences rootAppt.Recurrence.RangeMaxOccurrences = 30 ' now let's get an occurence of this appointment ' we'll start by getting the appointments that occur ' tomorrow Dim appts As AppointmentsSubsetCollection = Me.ultraCalendarInfo1.GetDay(dt.AddDays(1D), True).Appointments ' now get the appointment that represents an occurrence of ' the above appt Dim occurrence As Appointment = appts(0) ' By changing values such as the StartDateTime, AllDayEvent, ' Locked, Visible, etc. of an occurrence of a recurring ' appointment, a variance is created. occurrence.AllDayEvent = True
After that put this code:
Dim count1 = rootAppt.Recurrence.Variances.Count Dim b as Byte() = rootAppt.Recurrence.Save() Dim r2 As AppointmentRecurrence = AppointmentRecurrence.FromBytes(b) Dim count2 = r2.Variances.Count
As a result, count1 is 1, count2 is 0
P. S.: same happens if you do a .Save() on the appointment object itself - no more variances although the recurrence object is correctly set.
Hello,
Could you please take a look at the following thread and see if it will clear out this issue for you :http://community.infragistics.com/forums/p/20052/100540.aspx.
Please do not hesitate to contact us if you need any additional assistance.
Sorry, simple answer: No! Did you try the short code example I sent you? Did it work for you? Where you able to see the variance that has been in the first recurrence object after restoring it from memory? - You can also try it with the .SaveAsXML-method of the appointment object. The XML includes the variance, fine. BUT: a new appointment created by the FromXML-method is missing these variances. This is what the guy in the other thread was telling in the first place and in my opinion he did not get any answer to it!
What we like to do is save an appointment with its recurrence and ALL OF ITS VARIANCES into a database table and restore it from there. Could you please explain how this can be achieved? Maybe we got a wrong understanding of how Infragistics tools are working.
Regards
Neils
I contacted our development team and they explained the situation as follows:
This is because the recurrence does not store that information. The variances are 'Appointment' instances with references back to that recurrence and there is nothing in the byte array in which the recurrence is stored that tracks variances or anything like that.
So basically this is the way our tools work.