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

Event for Appointment created?

7 Answers 119 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Anastasios
Top achievements
Rank 1
Anastasios asked on 12 May 2010, 05:06 PM
Does an event who fires when an Appointment is created  exists? For example, when the Appointment Factory creates an appointment based in Database data.
My purpose is to calculate dynamical the start date of an appointment based on the end date.


7 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 13 May 2010, 12:09 PM
Hello Anastasios,

Thank you for writing.

You could subscribe for the CollectionChanged event of the Appointments collection of the scheduler:
 
this.radScheduler1.Appointments.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(Appointments_CollectionChanged);
 
In this event you could check the action state and if it is an Add state do the changes that you want:
 
void Appointments_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
    if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
    {
           //Add your code here
    }
}

If you have additional questions feel free to contact us.

Sincerely yours,
Dobry Zranchev
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
Anastasios
Top achievements
Rank 1
answered on 13 May 2010, 12:39 PM
Thank you very much again Dobry.

But  I cant get it to work.I have used the code you provided but it seems that the event doesn't fire.
My scheduler is data bonded.Normally the event should fire when the scheduler creates the appointments from the database,right?
 

0
Dobry Zranchev
Telerik team
answered on 14 May 2010, 12:43 PM
Hello Anastasios,

Thank you getting back.

This event is fired when the appointments collection of the scheduler is changed. Could you provide more details on your scenario in order to give you best way to implement it? Feel free to open a new support ticket and send us your project as well - this will be the best way to proceed and will take the least amount of time to find where the problem is.

Kind regards,
Dobry Zranchev
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
Anastasios
Top achievements
Rank 1
answered on 14 May 2010, 12:50 PM
The scenario I have in mind is the following:
Consider that my appointment datatable has not any Start date field.Only End date field and a Timespan field.
I want  the start date to be calculated on the fly (on scheduler load/data bind maybe is more accurate)  based on the End date. Actually like this Start Date = ( End date - Timespan).


0
Dobry Zranchev
Telerik team
answered on 17 May 2010, 03:22 PM
Hello Anastasios,

RadScheduler does not support this functionality out-of-the-box, however you can calculate the start date/time on the fly in the DataSet based on the End date and duration. Once the start date/time is determined, you can pass it to the Scheduler, together with the end date, and the appointment will show fine with the appropriate time span.

Note that the start and end dates are the most important fields for the scheduler and you cannot show an appointment where the start date is null.
 
Kind regards,
Dobry Zranchev
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
Anastasios
Top achievements
Rank 1
answered on 17 May 2010, 06:12 PM
Thank you again for your excellent help Dobry.

I found a workaround by executing this custom function on Form load:
private void setAppointmentsDate_scheduler() 
        { 
            if (scheduler.Appointments.Count > 0) 
                  foreach (QuickTask task in scheduler.Appointments) 
                     { 
                          DateTime startDate = task.OurDeadline; 
                          TimeSpan hours = new TimeSpan(Convert.ToInt32(task.TimeEstimation), 0, 0); 
                            startDate = startDate.Subtract(hours); 
                            task.Start = startDate; 
                       } 
        } 

 Where QuickTask is my custom Appointment class and the start Date is calculated from the OurDeadline - TimeEstimation.
Could you please provide me some more information about calculating Date start on the fly in the Dataset? Its sounds interesting :)

Thank you again
0
Dobry Zranchev
Telerik team
answered on 18 May 2010, 10:31 PM
Hello Anastasios,

Please take a look at this article in the help. If you have an issue fill free to contact me back.

Kind regards,
Dobry Zranchev
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.
Tags
Scheduler and Reminder
Asked by
Anastasios
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Anastasios
Top achievements
Rank 1
Share this question
or