- Step 1: I created the CustomAppointment.
public class CustomAppointment : Appointment, IDisposable
{
public CustomAppointment();
public string Birthday
public string Dr_id
public string Dr_name
public int EventID
public string User_id
public string User_name
public void Dispose();
protected virtual void Dispose(bool disposing);
}
Step 2: I created the list<CustomAppointment>to read data from Visual FoxProDB.
Setp3: I added list<CustomAppointment>to schedule.Appointment.addRange.
Question: How to improve the performance when list<CustomAppointment>
added to schedule.addRange?
private void bindRadSchedule1(stringstrStartDay, string strEndDay, int intDutyIndex, string[] strFirstDuty, string[]strSecondDuty, string[] strLastDuty)
{
try
{
List<CustomAppointment> liCustomAppointments = new List<CustomAppointment>();
switch (intDutyIndex)
{
case 1:
liCustomAppointments =reloadAppointUsers(hidden_dr_id.Text.ToString().Trim(), strStartDay,strEndDay, strFirstDuty[0].ToString().PadLeft(2, '0'), strFirstDuty[1].ToString().PadLeft(2, '0'));
break;
default:
liCustomAppointments = reloadAppointUsers(hidden_dr_id.Text.ToString().Trim(),strStartDay, strEndDay, "", "");
break;
}
this.radScheduler1.Appointments.Clear();
radScheduler1.Appointments.AddRange(liCustomAppointments.ToArray());
dtHoilday =boundAppointmentObj.listDoctorOffTime(hidden_dr_id.Text.Trim(), strStartDay,strEndDay);
radScheduler1.SchedulerElement.Refresh();
}
catch (Exception ex)
{
writeObj.writeToFile(DateTime.Today.ToString("yyyyMMdd") + "_scheduleError", Directory.GetCurrentDirectory(),
"bindRadSchedule1 函式錯誤 輸入參數區間" + strStartDay + "~" + strEndDay + "班別" + intDutyIndex + " 錯誤訊息" + ex.Message);
}
}