This is a migrated thread and some comments may be shown as answers.

How to Improve the Performance with Schedule?

2 Answers 138 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Cooper
Top achievements
Rank 1
Cooper asked on 26 May 2014, 08:08 AM
  1. 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);
                }
            }




     

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 29 May 2014, 06:20 AM
Hello Cooper,

Thank you for writing.

The possible solution, which I can suggest to improve performance in data loading, is to use the RadScheduler.Appointments BeginUpdate() and EndUpdate() methods. Place BeginUpdate() and EndUpdate() just before and after blocks of code that add large numbers of appointemnts. I have attached a sample project as well.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Cooper
Top achievements
Rank 1
answered on 30 May 2014, 02:11 AM
My problem was about to solved, it helped me .

thanks
Tags
Scheduler and Reminder
Asked by
Cooper
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Cooper
Top achievements
Rank 1
Share this question
or