How can I easily calculate if there is an ongoing appointment at the current moment ? How can I calculate when is the next appointment ?
6 Answers, 1 is accepted
Please, check the attached sample that demonstrates how to achieve the desired by you functionality. Basically, inside your ViewModel using LINQ queries you could easily check if there is an Appointment ongoing at the moment and get that appointment and which is the next appointment based on the current time (using DateTime.Now).
Hope this helps.
Thank you Nasko for you sample.
Actually your sample doesn't help me.
I use RadScheduleView only to enter the appointments. After that I have an observable collection of Appointments. I need to know based on that collection if there is an ongoing appointment at the current moment without using the UI control. Bear in mind that we could have only one Appointment that repeats every workday for the next three months from 9 am to 6 pm. How you would you find out if there is an ongoing appointment at the current moment based only on the data in the ViewModel ?
I know that you have that code internally in your control since the control provides reminders but I need that logic outside the control.
What I could suggest you is to check the following example from our online SDK Repository that demonstrates a sample solution of implementing Appointment reminders:
It demonstrates how to implement the desired by you functionality.
We hope this will help you.
I took a look at the AppointmentsReminders sample. However, it doesn't work correctly when Recurrence is set.
For example try to set recurrence that starts two days ago and repeats every day.
That's what I need - a correct reminder when recurrence is set.
Anyway, I'll try to implement it myself.
It doesn't seem to be so trivial. :-)
So if you send me a code that shows all appointments for one particular day when recurrence is set, I would appreciate it.
Indeed when Recurrence is set inside the AppoitnmentSource only one appointment is added. In order to get all occurrences of the desired main appointment the GetOccurrences method of the AppointmentExtensions class needs to be used:
You could set the desired time range and the method will return you all recurrent appointments in that time range.
Hope this helps.