Event for Appointment created?

8 posts, 0 answers
  1. Anastasios
    Anastasios avatar
    16 posts
    Member since:
    May 2010

    Posted 12 May 2010 Link to this post

    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.


  2. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 13 May 2010 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Anastasios
    Anastasios avatar
    16 posts
    Member since:
    May 2010

    Posted 13 May 2010 Link to this post

    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?
     

  5. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 14 May 2010 Link to this post

    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.
  6. Anastasios
    Anastasios avatar
    16 posts
    Member since:
    May 2010

    Posted 14 May 2010 Link to this post

    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).


  7. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 17 May 2010 Link to this post

    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.
  8. Anastasios
    Anastasios avatar
    16 posts
    Member since:
    May 2010

    Posted 17 May 2010 Link to this post

    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
  9. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 18 May 2010 Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready