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?
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
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.
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.
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:
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?
I think that you would have to do this manually they way you suggested.
Please feel free to let me know if a question about our toolset comes up on your mind.
I've built a list of valid dates for the week, and am trying to iterate through them. However, since the interval on my UltraDayView is 15 minutes, I'm getting four intervals shown as "available" for each hour. Is there any way that you can tell me that would allow me to combine those timeslots into a single time span?
For example, if I'm available from 1:00 to 2:00, I'd like to see "1:00 - 2:00" rather than:
1:00 - 1:151:16 - 1:301:31 - 1:451:46 - 2:00