Hello all,
I'm using an UltraDayView to let the user add/resize/drag/schedule appointments on a daily or weekly basis. I'd like to know if there's a simplistic way to calculate what timeslots don't contain any appointments within them from the week standpoint, and then display that list to the user, asking them to account for the empty timeslots.
For example, if my "week" contains Friday through Thursday, and I have an empty timeslot on Monday at 1:00pm, I'd like to add the "1:00 - 2:00 on Monday" timeslot to a list, then pop up a message box displaying that "1:00 - 2:00 on Monday" doesn't have time accounted for it, and it needs to be filled in before any other action can be taken.
Does this functionality currently exist? If not, are there any suggestions on how I might achieve this behavior?
Thanks!
Boris,
Thanks for the reply. Your example is close to what I'm wanting to achieve, but I need to achieve it for a multiple day span. Instead of:
ultraCalendarInfo1.ActiveDay.Date
How would I access all the days within a range? Do I have to do this calculation on my own and then iterate through the days, or does this functionality exist somewhere else on the UltraDayView?
Hello,
Could you please review the sample attached to this post and see if it meets your requirements.Please feel free to let me know if I misunderstood you or if you have any other questions.
Has there been any reviewing of this forum post?
To clarify what I have so far, here it is:
For Each timeslot in udvSchedule.TimeSlots
If ucimain.GetAppointmentsInRange(weekStartDate, weekEndDate).Count > 0 Then
availableTimeslots.Add(timeslot)
End If
Next
If availableTimeslots.Count > 0 Then
Dim sb as StringBuilder = New StringBuilder()
sb.AppendLine("There are " & availableTimeslots.Count.ToString & " timeslots empty on your calendar. The following timeslots need to be accounted for before you can continue: ")
For Each ts in availableTimeslots
sb.AppendLine(ts.StartTime.Date.ToString & " " & ts.StartTime.TimeOfDay.ToString & " - " & ts.EndTime.Date.ToString & " " ts.EndTime.TimeOfDay.ToString)
MessageBox.Show(sb.ToString, "Error", MessageBoxButtons.OK)
With the above code, I'm currently getting 36 available timeslots, which I'm pretty sure isn't correct. And the .Date property of the TimeSlot isn't populated and reverts to 1/1/0001.