Hello all,
I'm working with an v11.2 UltraDayView that allows the user to schedule appointments based on "tasks". Eventually, we'd like to be able to pull back the user's laid-out schedule and create a report based on where they spend their time. For our purposes, it doesn't make much sense to have multiple appointments displaying in the same time slot. Is there a setting on the CalendarInfo or UltraDayView that would prevent more than one appointment from appearing within the same timeslot?
Based on another post, I tried using the GetAppointmentsInRange() method to return the appointments involved with the dragging/rearranging to check against, but I haven't been able to get the logic working like I need it to.
Any suggestions, comments, or ideas are appreciated.
Thanks!
Melissa
Hi Georgi
I tried your code but it doesn't work because it finds appointments across the entire range of owners.
How would I test for appoints overlapping on only the owner in which the new appointment is being added?
Regds
Paul
Hello Melissa,
Have you been able to resolve your issue ? Let me know if you have any questions
Regards
medwards11 said:Is there a setting on the CalendarInfo or UltraDayView that would prevent more than one appointment from appearing within the same timeslot?
Maybe one possible approach could be if you are using the code below:
private void ultraCalendarInfo1_BeforeAppointmentAdded(object sender, CancelableAppointmentEventArgs e) { if (ultraCalendarInfo1.GetAppointmentsInRange(e.Appointment.StartDateTime, e.Appointment.EndDateTime).Count > 0) { e.Cancel = true; MessageBox.Show("There are conflict with another appointment in your Calendar"); } }
private void ultraCalendarInfo1_BeforeAppointmentAdded(object sender, CancelableAppointmentEventArgs e)
{
if (ultraCalendarInfo1.GetAppointmentsInRange(e.Appointment.StartDateTime, e.Appointment.EndDateTime).Count > 0)
e.Cancel = true;
MessageBox.Show("There are conflict with another appointment in your Calendar");
}
Let me know if you have any questions.
Sorry, the code I pasted above didn't format correctly. Here it is:
Private Sub udvSchedule_AppointmentsDragging(ByVal sender As Object, ByVal e As AppointmentsDraggingEventArgs) Handles udvSchedule.AppointmentsDragging 'For i As Integer = 0 To uciMain.Appointments.Count - 13 Dim dragStartDate = (From a In e.Appointments Order By a.StartDateTime Ascending Select a.StartDateTime).First Dim dragEndDate = (From a In e.Appointments Order By a.EndDateTime Descending Select a.EndDateTime).First
Dim appointmentsInRange = udvSchedule.CalendarInfo.GetAppointmentsInRange(dragStartDate, dragEndDate)
If appointmentsInRange.Count > 1 Then e.Appointments(0).StartDateTime = appointmentsInRange(1).EndDateTime 'For i = 0 To appointmentsInRange.Count - 1 ' e.Appointments(i).StartDateTime = IIf(i = 1, appointmentsInRange(appointmentsInRange.Count - 1).EndDateTime, ) 'Next End If 'Next End Sub
I'm still waiting for any input on this question. Here's what I've gotten so far:
Private Sub udvSchedule_AppointmentsDragging(ByVal sender As Object, ByVal e As AppointmentsDraggingEventArgs) Handles udvSchedule.AppointmentsDragging Dim dragStartDate = (From a In e.Appointments Order By a.StartDateTime Ascending Select a.StartDateTime).First Dim dragEndDate = (From a In e.Appointments Order By a.EndDateTime Descending Select a.EndDateTime).First Dim appointmentsInRange = udvSchedule.CalendarInfo.GetAppointmentsInRange(dragStartDate, dragEndDate) If appointmentsInRange.Count > 1 Then e.Appointments(0).StartDateTime = appointmentsInRange(1).EndDateTime End If End Sub
Right now, despite the code above, if I drag an appointment onto a timeslot that already contains another appointment, it will still place them side by side.