How to Improve the Performance with Schedule?

3 posts, 1 answers
  1. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 26 May 2014 Link to this post

    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. Answer
    Dess
    Admin
    Dess avatar
    1609 posts

    Posted 29 May 2014 Link to this post

    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.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 29 May 2014 in reply to Dess Link to this post

    My problem was about to solved, it helped me .

    thanks
Back to Top