Hello,
I wonder how I can add a variance of a recurring appointment programmatically. The CalendarInfo is not bound to a datasource. I expected something like: myRecurringAppointment.Recurrence.Variances.Add(new Appointment(...)), but there is no Add method.
Also some "tricks" like assigning the RecurrenceId of the root appointment to the variance isn't possible due to the missing setter of the RecurrenceId property.
So, how can I add a variance programmatically? Every help with this is highly appreciated.
Hi, I have the same requirement as you, do you have the solution?
Hi gem_he,
Could you please let me know what exactly is bothering you? I was not able to catch what your requirements are, after reading the thread.
Please take a look at the following link, which explains what 'Variance' means in our scheduling: http://help.infragistics.com/NetAdvantage/WinForms/2013.1/CLR4.0/?page=Infragistics4.Win.UltraWinSchedule.v13.1~Infragistics.Win.UltraWinSchedule.Appointment~IsVariance.html.
Hi,
I know this is an old thread, but the subject refects exactly my problem. I want to save my appointments to a database, so I created database structures for both Appointment and AppoinmentRecurrence. I create the AppoinmentRecurrence through a custom window and save the recurrence in the database. When I want to display the information in a CalendarView, I load back the database structures and create Appointment and AppointmentRecurence objects from them. Il all works fine and I see my appointments in the CalendarView. When a variance is created from the CalendarView, I can save the variance in the database. Fine. But, when I load back information, I do not know how to reassign the variance to the AppoinmentRecurrence. I cannot set the RecurringAppointmentRoot because it has no setter. There has to be a way to specify that an appointment is a variance of a given recurrence. Or am I way out?
After some further investigation, I suspect that I simply cannot do what I am trying to do. Here is my new understanding of how it works and what I should do:
Could you please confirm this interpretation because, if it is right, I have a lot of rework to do.
Real Forte,
I found that working with variances are a bit tricky at first, but become simple once you understand what Infragistics has done and how to reference the variance within the root appointment.
First, you need a place to hold the variance in your database table. Either put it in a special "variance" table, or add it to your appointment table. To hold a variance in your appointment table, you must have the following:
1. The variance itself.
2. Record that it is a variance, and not a single appointment (I used a boolean flag called is_variance)
3. Reference to the initial recurrence appointment (In my table, I used a unique appointment_id field, and reference directly to it)
4. Reference to the DATE of the original variance. If the date is what has changed in the variance, you need to know what was the original date or you won't be able to find it within the original appointment recurrence.
Once you've stored that information, you can then tie it to the original recurrence by first loading the entire recurrence, then accessing each occurrance (assuming you've assigned the original recurrence id to the appointment_id field I mentioned above). After loading the original recurrence, you can then find it using the following function:
public static Appointment getSubsetAppointmentForVariance(Infragistics.Win.UltraWinSchedule.Day myDay,
Appointment myRecurrenceAppointment, String strRecurAppointmentID)
{
AppointmentsSubsetCollection ApptSubsetCol = myDay.Appointments;
foreach (Appointment mySubSetAppt in ApptSubsetCol)
if (mySubSetAppt.DataKey.ToString() == strRecurAppointmentID)
myRecurrenceAppointment = mySubSetAppt;
}
return myRecurrenceAppointment;
Now that you have the appointment recurrence, you just need to alter the original date of the variance to a possible new date...or any other items within the object!
Hope that helps!
Well, what you describe is basically what we ended up doing. Managing variances has a lot of side-effect, though. It requires much code to do it properly.
Than you for your reply.