Get all appointments for a specific date

2 posts, 0 answers
  1. T
    T avatar
    8 posts
    Member since:
    Jan 2015

    Posted 10 Mar 2017 Link to this post

    How can this be done without looping over all the appointments in the appointments collection? Is there a method like "GetAppointmentsInRange"?

    Thanks.

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3047 posts

    Posted 13 Mar 2017 Link to this post

    Hello Tom,

    Thank you for writing.  

    It is appropriate to use the multiday view which shows multiple date-time intervals with appointments arranged one next to another. The SchedulerMultiDayView provides the public GetAppointmentsInInterval method which returns a List of the appointments in the specified interval. Here is a sample code snippet:
    public RadForm1()
    {
        InitializeComponent();
     
        SchedulerMultiDayView multiDayView = new SchedulerMultiDayView();
        DateTime startDate = DateTime.Today;
        multiDayView.Intervals.Add(startDate, 2);
        multiDayView.Intervals.Add(startDate.AddDays(4), 3);
        this.radScheduler1.ActiveView = multiDayView;
    }
     
    private void radButton1_Click(object sender, EventArgs e)
    {
        SchedulerMultiDayView multiDayView = this.radScheduler1.ActiveView as SchedulerMultiDayView;
        DateTime start = DateTime.Today;
        DateTime end = DateTime.Today.AddDays(2);
        List<IEvent> appointments = multiDayView.GetAppointmentsInInterval(new DateTimeInterval(start, end));
    }

    For the other views, it is suitable to iterate the appointments and get which events belong to the specified time interval.

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

    Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top