I am trying to add appointments fetched from the database. I fetch them “manually”. I store them in a datatable called dt. The data is present in the datatable.
foreach (Resource r in schedulerStorage1.Resources.Items)
{
Console.WriteLine(r.Caption + " - " + r.Id);
}
Appointment app;
foreach (DataRow dr in result.DataTable_Result.Rows)
{
Console.WriteLine(dr[0] + " - " + dr[1] + " - " + dr[2]);
app = schedulerControl1.Storage.CreateAppointment(AppointmentType.Normal);
app.ResourceId = dr[0];
app.Start = DateTime.Parse(dr[1].ToString());
app.End = DateTime.Parse(dr[2].ToString());
schedulerControl1.Storage.Appointments.Add(app);
}
Output of the Console.WriteLines:
Room1 – 1
Room2 – 2
1 – 16/01/2013 8:00:00 AM – 16/01/2013 8:05:00 AM
1 – 16/01/2013 9:00:00 AM – 16/01/2013 9:05:00 AM
2 – 16/01/2013 8:00:00 AM – 16/01/2013 8:30:00 AM
Any ideas about why the appointments are not added ?
Alright I managed to find out the source of the problem.
dr[0] is the resource id.
When I added a resource I wrote:
When I added an appointment I wrote:
The following will fix the appointments not showing up.
Now everything works perfectly.
Thank you Aphelion for your help. 😀