I have a RadScheduler with a datasource initated like this:
The appointments are initiated and updated by calling the method below. The problem is that it takes "forever" if the number of appointments exceeds approx 50. Is there a way to speed it up? I have tried async await, but as I am new to that procedure I haven't been able to implement it successfully.
Regards, Jill-Connie Lorentsen
private void InitiateBookingDataSource()
{
if (_appointmentBookings == null) _appointmentBookings = new BindingList<
Booking
>();
var dataSource = new SchedulerBindingDataSource();
var mappingInfo = new AppointmentMappingInfo
{
Start = "StartTime",
End = "EndTime",
Summary = "BookingSubject",
Description = "BookingDescription",
BackgroundId = "BackgroundId",
AllDay = "AllDay",
RecurrenceRule = "RecurrenceRule",
Exceptions = "Exceptions",
MasterEventId = "MasterEventId",
Visible = "Visible"
};
mappingInfo.Mappings.Add(new SchedulerMapping("CaseId", "CaseId"));
mappingInfo.Mappings.Add(new SchedulerMapping("PratId", "PratId"));
mappingInfo.Mappings.Add(new SchedulerMapping("BoothId", "BoothId"));
mappingInfo.Mappings.Add(new SchedulerMapping("CaseDesc", "CaseDesc"));
mappingInfo.Mappings.Add(new SchedulerMapping("BoothDesc", "BoothDesc"));
dataSource.EventProvider.Mapping = mappingInfo;
dataSource.EventProvider.DataSource = _appointmentBookings;
dataSource.EventProvider.AppointmentFactory = rsBookings.AppointmentFactory;
rsBookings.DataSource = dataSource;
}
The appointments are initiated and updated by calling the method below. The problem is that it takes "forever" if the number of appointments exceeds approx 50. Is there a way to speed it up? I have tried async await, but as I am new to that procedure I haven't been able to implement it successfully.
Regards, Jill-Connie Lorentsen
private void InitiateAppointments(IEnumerable<
Booking
> bookings)
{
try
{
if (_appointmentBookings == null) _appointmentBookings = new BindingList<
Booking
>();
rsBookings.Appointments.Clear();
_appointmentBookings.Clear();
foreach (var booking in bookings)
{
var appointment = booking;
appointment.BackgroundId = _booths.Find(b => b.BoothId == booking.BoothId).BackgroundId;
appointment.Exceptions.ForEach(b => b.BackgroundId = _booths.Find(x => x.BoothId == b.BoothId).BackgroundId);
_appointmentBookings.Add(appointment);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}