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

Avoiding the overlap of 2 appointments

29 Answers 1131 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Humberto
Top achievements
Rank 1
Humberto asked on 07 Nov 2007, 03:47 AM
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.

29 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 07 Nov 2007, 10:11 AM

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
0
Humberto
Top achievements
Rank 1
answered on 28 Nov 2007, 02:25 AM
Peter, thanks for your response.... tomorrow, i'll test your advice...
0
Peter
Telerik team
answered on 28 Nov 2007, 01:07 PM
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
0
Humberto
Top achievements
Rank 1
answered on 29 Nov 2007, 02:46 AM
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...
0
Scott
Top achievements
Rank 1
answered on 22 Jan 2008, 08:31 PM
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).
0
Peter
Telerik team
answered on 23 Jan 2008, 08:12 AM
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
0
Corey Alguire
Top achievements
Rank 1
answered on 16 Jun 2008, 09:36 AM
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.
0
T. Tsonev
Telerik team
answered on 16 Jun 2008, 04:00 PM
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
0
Corey Alguire
Top achievements
Rank 1
answered on 17 Jun 2008, 11:55 AM
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.
0
Steven
Top achievements
Rank 1
answered on 02 May 2009, 03:13 AM
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.
0
Lucas Filer
Top achievements
Rank 1
answered on 13 Dec 2009, 01:25 PM
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
0
Peter
Telerik team
answered on 14 Dec 2009, 03:10 PM
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.
0
Pravesh
Top achievements
Rank 1
answered on 16 Mar 2010, 10:20 AM
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?
0
Vesko
Top achievements
Rank 2
answered on 17 Mar 2010, 11:19 AM
Hey Pravesh,

did you include the Telerik.Web.UI namespace?

using Telerik.Web.UI in C#
Imports Telerik.Web.UI in VB
0
Adam Jones
Top achievements
Rank 1
answered on 23 Mar 2010, 01:00 AM
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...
0
Peter
Telerik team
answered on 23 Mar 2010, 10:46 AM
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.
0
Adam Jones
Top achievements
Rank 1
answered on 23 Mar 2010, 06:54 PM
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


0
Adam Jones
Top achievements
Rank 1
answered on 15 Apr 2010, 11:38 PM
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...
0
dmetge
Top achievements
Rank 1
answered on 29 Jul 2010, 09:54 AM
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
0
Peter
Telerik team
answered on 30 Jul 2010, 04:29 PM
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.
0
Arsalan Ansari
Top achievements
Rank 1
answered on 10 Oct 2010, 10:50 AM

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.

0
T. Tsonev
Telerik team
answered on 13 Oct 2010, 12:25 PM
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
0
Matthew
Top achievements
Rank 1
answered on 13 Oct 2010, 12:25 PM
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.
0
Arsalan Ansari
Top achievements
Rank 1
answered on 13 Oct 2010, 12:29 PM
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);
    }
0
T. Tsonev
Telerik team
answered on 13 Oct 2010, 12:40 PM
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
0
Matthew
Top achievements
Rank 1
answered on 13 Oct 2010, 12:56 PM
Thanks Tsvetomir, that's fantastic news.  I look forward to the Q3 Beta.  Thanks for your help.
0
Mike
Top achievements
Rank 1
answered on 08 May 2012, 02:29 PM
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
0
Peter
Telerik team
answered on 10 May 2012, 12:49 PM
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.
0
Abod
Top achievements
Rank 1
answered on 12 Jun 2013, 06:08 PM
How to enable only one appointment per time slot in windows form not WPF or Web application ?
Tags
Scheduler
Asked by
Humberto
Top achievements
Rank 1
Answers by
Peter
Telerik team
Humberto
Top achievements
Rank 1
Scott
Top achievements
Rank 1
Corey Alguire
Top achievements
Rank 1
T. Tsonev
Telerik team
Steven
Top achievements
Rank 1
Lucas Filer
Top achievements
Rank 1
Pravesh
Top achievements
Rank 1
Vesko
Top achievements
Rank 2
Adam Jones
Top achievements
Rank 1
dmetge
Top achievements
Rank 1
Arsalan Ansari
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Abod
Top achievements
Rank 1
Share this question
or