Avoiding the overlap of 2 appointments

30 posts, 0 answers
  1. Humberto
    Humberto avatar
    4 posts
    Member since:
    Nov 2007

    Posted 06 Nov 2007 Link to this post

    Hi,

        Just I am starting the evaluation of your control, but i have a big question: Is it possible to avoid the overlapping of 2 appointments ?
        It's means that when the user finish the drag&drop of the one of them, the control returns it to the original position, if it drops inside the time interval of the second  (avoiding the overlapping each other)...
        I need this feature in my application because my real cases can't be happening at the same or parallel time.

    Thanks for your help.
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 07 Nov 2007 Link to this post

    Hi Humberto,

    Thank you for using RadScheduler.

    You can reduce the value of the MinutesPerRow property which by default is 30. Try for example:
    MinutesPerRow ="15". Let us know how it goes.



    Kind regards,

    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Humberto
    Humberto avatar
    4 posts
    Member since:
    Nov 2007

    Posted 27 Nov 2007 Link to this post

    Peter, thanks for your response.... tomorrow, i'll test your advice...
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Nov 2007 Link to this post

    Hello Humberto,

    It occurred to me that you may be asking for for different functionality than what I initially thought. If you want to limit the number of simultaneous appointments so that only one appointment is allowed per time slot, please, use the following code:

    protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)  
        {  
            if (RadScheduler1.Appointments.GetAppointmentsInRange(e.Appointment.Start, e.Appointment.End).Count > 0)  
            {  
                e.Cancel = true;          
                  
            }  
     
        }  
        protected void RadScheduler1_AppointmentUpdate(object sender, Telerik.Web.UI.AppointmentUpdateEventArgs e)  
        {  
            if (RadScheduler1.Appointments.GetAppointmentsInRange(e.ModifiedAppointment.Start, e.ModifiedAppointment.End).Count > 0)  
            {  
                foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(e.ModifiedAppointment.Start, e.ModifiedAppointment.End))  
                {  
                    if (a.ID != e.Appointment.ID)  
                    {  
                        e.Cancel = true;  
                    }  
                }  
            }  
     
        } 


    All the best,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Humberto
    Humberto avatar
    4 posts
    Member since:
    Nov 2007

    Posted 28 Nov 2007 Link to this post

    Peter, thanks a lot.... it works very well...
    great... we'll buy the suite... i said to my boss...
    obviously, the solution was the second reply from you...
  7. Scott
    Scott avatar
    29 posts
    Member since:
    Nov 2007

    Posted 22 Jan 2008 Link to this post

    is there any way for the scheduler to allow simultaneous appointments?  say two appointments on the same day starting and ending at the same times (yet they are two different appointments).  right now i have two simultaneous appointments and only one shows.  debugging shows both events are rendered, with the last being hte one that is shown (rendered over the first).
  8. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 23 Jan 2008 Link to this post

    Hello Scott,

    This is the default behavior of RadScheduler - it supports multiple simultaneous appointments. Please, refer to the attached screenshot and the online examples.

    If there is something specific around your case which causes different behavior of RadScheduler than the expected one, please elaborate and we will see to it.


    Cheers,
    Peter
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Corey Alguire
    Corey Alguire avatar
    43 posts
    Member since:
    Sep 2004

    Posted 16 Jun 2008 Link to this post

    Peter,
    I am having essentially the same problem. In most cases, when times for appointments overlap, the appointments are rendered in RadScheduler side-by-side. However, when the appointments have exactly the same start and end times, they are rendered on top of each other, with only one visible. As far as I can tell, there is no way for users to know that multiple appointments are present - practically speaking, the information just disappears.

    This behavior is less than ideal, at best. A few seconds difference in the start or end times between two appointments, and they render side-by-side, but if the times are the same, all disappear except one.  

    Is there any good way around this? Thanks for your help.
  10. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 16 Jun 2008 Link to this post

    Hello Corey,

    You are correct, appointments with exactly same start and end time (zero duration) overlap in the latest official release. The issue is already resolved in the latest builds. You can open a formal support ticket to request a hotfix or you can wait a few days, as the SP2 release is scheduled for the end of this week. Sorry for the inconvenience.

    Regards,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  11. Corey Alguire
    Corey Alguire avatar
    43 posts
    Member since:
    Sep 2004

    Posted 17 Jun 2008 Link to this post

    Thanks, Tsvetomir
    I can wait a few days for the official SP release. I worked out a temporary fix for my scenario on my own, but I look forward to the update.
  12. Steven
    Steven avatar
    1 posts
    Member since:
    Nov 2006

    Posted 01 May 2009 Link to this post

    I'm actually having a similar problem to what was originally answered.

    I have a scheduling application where I have lots of concurrent appointments that do not run in traditional time blocks.  An example might be as follows:

    1:00-1:23
    1:23-1:42
    1:42-2:18
    2:18-2:25

    When I use the scheduler it is showing them side by side, but its a little misleading since they are really one after another.  We tried setting it to 1 minute interval with 1 pixel each, but it really didn't work.  Somehow we want to make them look like they each happen after another without the entire day being very long vertically.

    Is there any way to make the RAD Scheduler do this?  I saw the DayPilot demo (which is not as good of a tool), but it does do this particular function.  What am I doing wrong here?

    Thanks.
  13. Lucas Filer
    Lucas Filer avatar
    1 posts
    Member since:
    Oct 2009

    Posted 13 Dec 2009 Link to this post

    Steven

    I'm having the exact same issue - need to have two appointments that meet at the same unusual time (i.e. 9:46).

    I tried doing 5 minute blocks, though I can't then get the RowHeight to a sufficiently low value (14px is the current min I believe) for this to be useful.

    Any thoughts from the Telerik team?

    Lucas
  14. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Dec 2009 Link to this post

    Hello Lucas,

    We plan to implement exact time rendering of appointments probably for Q2 2010.


    Kind regards,

    Peter
    the Telerik team

     


    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  15. Pravesh
    Pravesh avatar
    5 posts
    Member since:
    Jun 2008

    Posted 16 Mar 2010 Link to this post

    Hi Peter,

    I tried the code extract for Avoiding the overlap of 2 appointments, and found the following line does not work:
     foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(e.ModifiedAppointment.Start, e.ModifiedAppointment.End))
    As it does not recognise or accept the the underlined part of the line above. It says the following: "The type of namespace name 'Appointment' could not be found (are you missing a using derictive or an assembly reference?)".


    Also I set the MinutesPerRow property to 15, however the dropdown list of timeslots in the AdvancedEditForm for a new/existing appointment show time at 30minute intervals instead of 15. How do I change this?
  16. Vesko
    Vesko avatar
    122 posts
    Member since:
    Mar 2009

    Posted 17 Mar 2010 Link to this post

    Hey Pravesh,

    did you include the Telerik.Web.UI namespace?

    using Telerik.Web.UI in C#
    Imports Telerik.Web.UI in VB
  17. Adam Jones
    Adam Jones avatar
    6 posts
    Member since:
    Mar 2010

    Posted 22 Mar 2010 Link to this post

    I am using a trial to test functionality, but it does not see conflicts that occur in the future.

    Example

    On Tuesday there is a single appointment that occurs between 09:15 and 11:15, the next appointment is created on Monday with a start time of 10:30 to 12:30 for example, but with the recurring information as daily for the next three days, creating a conflict with the Tuesday appointment, however when you call RadScheduler1.Appointments.GetAppointmentsInRange(e.Appoinment.Start, e.Appointment.End) the count is 0, I also checked GetAppointmentsEnclosingRange and GetAppointmentsStartingInRange but they also return 0.

    Any suggestions...
  18. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 23 Mar 2010 Link to this post

    Hello Adam,

    This is expected, because in your code -
    RadScheduler1.Appointments.GetAppointmentsInRange(e.Appoinment.Start, e.Appointment.End) ,
    e.Appoinment is the master appointment which is on Monday and it does not conflict with any appointments on Tuesday or the days after. To handle recurring appointments and to ensure that occurrences do not conflict, you need to parse the recurrence rule and check each occurence individually if it creates conflicts with other appointments. Here are a kb article and a help topic on enumerating occurrences:

    http://www.telerik.com/help/aspnet-ajax/schedule_serversideworkingwithrecurringappointments.html

    http://www.telerik.com/support/kb/aspnet-ajax/scheduler/how-to-display-all-radscheduler-appointments-in-gridview.aspx


    Best wishes,
    Peter
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  19. Adam Jones
    Adam Jones avatar
    6 posts
    Member since:
    Mar 2010

    Posted 23 Mar 2010 Link to this post

    Hi Peter,

    Thanks for the idea, seem to have got it working,

        Protected Sub RadScheduler1_AppointmentInsert(ByVal sender As ObjectByVal e As Telerik.Web.UI.SchedulerCancelEventArgs) Handles RadScheduler1.AppointmentInsert 
     
            Dim r As RecurrenceRule 
            Dim d As DateTime 
     
            If e.Appointment.RecurrenceState = RecurrenceState.Master Then 
                RecurrenceRule.TryParse(e.Appointment.RecurrenceRule.ToString, r) 
                For Each d In r.Occurrences 
                    If RadScheduler1.Appointments.GetAppointmentsInRange(d, d.Add(e.Appointment.Duration)).Count Then 
                        e.Cancel = True 
                    End If 
                Next 
            ElseIf e.Appointment.RecurrenceState <> RecurrenceState.Occurrence Then 
                If RadScheduler1.Appointments.GetAppointmentsInRange(e.Appointment.Start, e.Appointment.End).Count Then 
                    e.Cancel = True 
                End If 
            End If 
            If e.Cancel Then RadAjaxManager1.Alert("Apointment Overlaps Another"
        End Sub 

    Hope this helps someone else....

    Adam


  20. Adam Jones
    Adam Jones avatar
    6 posts
    Member since:
    Mar 2010

    Posted 15 Apr 2010 Link to this post

    You will also need to deal with appointments being dropped on top of another appointment, the following code will stop this problem..
        Protected Sub Diary_RecurrenceExceptionCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.RecurrenceExceptionCreatedEventArgs) Handles Diary.RecurrenceExceptionCreated 
     
            Dim a As Appointment 
     
            For Each a In RadScheduler1.Appointments.GetAppointmentsInRange(e.ExceptionAppointment.Start, e.ExceptionAppointment.End
                Try 
                    If a.ID <> e.Appointment.ID Then 
                        e.Cancel = True 
                    End If 
                Catch 
                    If a.RecurrenceParentID <> e.Appointment.ID Then 
                        e.Cancel = True 
                    End If 
                End Try 
            Next 
            If e.Cancel Then RadAjaxManager1.Alert("Appointment Overlaps Another"
        End Sub 
     

    Hope this helps someone...
  21. dmetge
    dmetge avatar
    7 posts
    Member since:
    Jun 2007

    Posted 29 Jul 2010 Link to this post

    Hello,

    Last december, Peter from the Telerik team was writing "We plan to implement exact time rendering of appointments probably for Q2 2010"... but we made a test with the Q2 and we still have the same issue.

    An event starting at 10:05 and ending at 11:05 renders in the RadScheduler from 10:00 to 11:15, which is not accurate at all.
    Furthermore if we plan a second envent starting at 11:05 (or even 11:06), the RadScheduler shows it next from the first, as if it were simultaneous while it's a later event.

    (for this test we set the DayStartTime of the RadScheduler to 8:00 and the MinutesPerRow to 15 min., which seems to be the minimum possible value).

    Is there really a solution with the Q2 ? Or another way to use the control in order to obtain a proper display ? It gets really annoying...

    Thanks in advance,
    Daniel
  22. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 30 Jul 2010 Link to this post

    Hello Daniel,

    Unfortunately, we had to postpone implementation of this feature. We are not sure we will be able to support it for all view types. A realistic commitment would be to implement exact time rendering for Timeline view for Q3 2010.


    Best wishes,
    Peter
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  23. Arsalan Ansari
    Arsalan Ansari avatar
    10 posts
    Member since:
    Jan 2010

    Posted 10 Oct 2010 Link to this post

    sorry to post in an old thread but how do i make sure there are no overlapping appointments for a specific time range AND by resource.

    example: i can have two appointments at 1 PM if they are for different rooms but only 1 appointment per room at a time.

    in my case, the radscheduler is only available for people to see availability.  the appointment details are captured in a form and then programmatically entered into the calendar only to verify that an appoint doesnt already exist, currently, i can check if any appointments exist at all but not by resource.

    protected bool ExceedsLimit(Appointment apt)
    {
            int appointmentsCount = RadScheduler1.Appointments.GetAppointmentsInRange(apt.Start, apt.End).Count;
            return (appointmentsCount > 0);
    }

     

    protected void btnContinue_Click(object sender, System.EventArgs e)
    {
            var newAppointment = new Appointment();
      
            newAppointment.Start = (Convert.ToDateTime(rdtpReserveStart.SelectedDate.ToString()));
            newAppointment.End = (Convert.ToDateTime(rdtpReserveEnd.SelectedDate.ToString()));
            newAppointment.Subject = txtName.Text;
      
            if (ExceedsLimit(newAppointment))
            {
                RadAjaxManager1.Alert("An existing reservation conflicts with the time you have specified");
            }
            else
            {
                    ...
            }
    }

    that above will check if an appointment exists in the time range but cant filter by resource

    i have seen the tutorial for the javascript way of doing it but i rather avoid that, unless someone has a good reason for why it may be more efficient.

  24. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 13 Oct 2010 Link to this post

    Hi Arsalan,

    You'll have to iterate over the resources of each appointment returned by Appointments.GetAppointmentsInRange to see if they match the resources for the new appointment.

    // Pseudo-code
    foreach (Appointment existingApt in GetAppointmentsInRange(...))
    {
        foreach (Resource existingRes in existingApt.Resources)
        {
            if (apt.Resources.GetResource(existingRes.Type, existingRes.Key) != null)
            {
                // Conflict
            }
        }
    }

    I hope this helps.

    All the best,
    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  25. Matthew
    Matthew avatar
    26 posts
    Member since:
    Dec 2007

    Posted 13 Oct 2010 Link to this post

    Hi Peter,

    Sorry again to resurrect an old thread, but exact time rendering of appointments is something that is very important to me as well.  I've had a look at the Q3 2010 roadmap and there doesn't seem to be any mention of exact rendering in there - has this feature been pushed back again?  If not, I think I may be able to get what I am after by setting MinutesPerRow to 1, then fiddling around with the stylesheets to make the row heights only 1 px, but I then have the issue of not being able to line up the hours column (without also setting that font height to 1px, which makes it unreadable).  Can you tell me if a Telerik Premium Collection for .NET license would contain the source code to enable me to modify this myself?

    Thanks for your help.
  26. Arsalan Ansari
    Arsalan Ansari avatar
    10 posts
    Member since:
    Jan 2010

    Posted 13 Oct 2010 Link to this post

    Thanks for the reply Tsvetomir.

    i was actually able to achieve the effect by adding the CustomAttributeNames="RoomTypeID" to the RadScheduler and then inserting appointments with the Custom Attribute specified

    protected bool ExceedsLimit(Appointment apt)
        {
            var appointments = rsReservations.Appointments.GetAppointmentsInRange(apt.Start, apt.End);
            int appointmentsCount = 0;
            foreach (Appointment existingApt in appointments)
            {
                if (existingApt.Attributes["RoomTypeID"].ToString() == apt.Attributes["RoomTypeID"].ToString())
                    appointmentsCount++;
            }
      
            return (appointmentsCount > 0);
        }
  27. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 13 Oct 2010 Link to this post

    Hello Arsalan,

    Yes, this will work too, great.

    Matthew, the exact time rendering was not included in the original roadmap, but we've managed to implement it for Day and Week view. The Q3 Beta is coming in a week or so and you'll be able to test it yourself. Here's a little teaser:



    Have a great day!

    Regards,
    Tsvetomir Tsonev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  28. Matthew
    Matthew avatar
    26 posts
    Member since:
    Dec 2007

    Posted 13 Oct 2010 Link to this post

    Thanks Tsvetomir, that's fantastic news.  I look forward to the Q3 Beta.  Thanks for your help.
  29. Mike
    Mike avatar
    7 posts
    Member since:
    May 2012

    Posted 08 May 2012 Link to this post

    Sorry to post on an old thread but this is the closest I've seen to my issue.  What I need to do is just display a small image preferably in the date header next to the day in the MonthView if a conflict exist on that day. Is this possible?

    Thanks for all your help
  30. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 10 May 2012 Link to this post

    Hello Michael,

    You can insert html in RadScheduler's header using jQuery similarly to the way this is done here.

    For a client side validation for overlapping appointments please use this demo as reference.


    Greetings,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  31. Abod
    Abod avatar
    2 posts
    Member since:
    May 2013

    Posted 12 Jun 2013 Link to this post

    How to enable only one appointment per time slot in windows form not WPF or Web application ?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017