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

Moving, Resizing Appoitments

24 Answers 478 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
santosh
Top achievements
Rank 1
santosh asked on 05 May 2009, 11:47 PM
Hi ,
 I created a custom data provider as directed in http://www.telerik.com/help/winforms/using_a_data_provider.html to populate my appoitnment from the database.

Now How do I save the appointment details when the appointment is moved or resized.

thanks
santosh

24 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 06 May 2009, 08:29 AM
Hello santosh,

I can suggest you take a look at the Data Binding example of RadScheduler in our Demo application. You will find there a Save Button which updates the database when it is clicked. I think the logic which updates the database in this example will be the solution in your case. Please contact me again if you have more questions.

Best wishes,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
santosh
Top achievements
Rank 1
answered on 11 May 2009, 03:50 AM
Hi Boyko Markov , 
                            What you are suggesting me is that the user move/ resizes the appointment and then has to press a button (save) in order to save it. And say if they forget which is highly possible there changes will be lost.

Also I am using a custom data provider,so I have to iterate through all the appointment, check  if the data has been updated by the user and then save it to the database.

What I am trying to achive is when the user rezises or moves the selected appointment, save the appointment details then and stop the user for going through the hassel  to click the button.

Is there a way to achieve this.


santosh
0
santosh
Top achievements
Rank 1
answered on 12 May 2009, 11:30 PM
Hi,
Let me rephrase the question. 
I have populated the scheduler using the logic defined in your demo application(2009) where the scheduler is bound using the business object.
The only difference is the appointment data is acquired from the database.

Now is there a way to automatically save the appointment after it has been moved or resized?


santosh

0
Boyko Markov
Telerik team
answered on 14 May 2009, 07:01 AM
Hello santosh,

Automatic saving when you move/drag with the mouse is performed in the data set. You can also manually update your data set by using events in RadScheduler such as AppointmentMouseUp and AppointmentMouseDown you can use to check whether the appointment is moved or resized. For example in the AppointmentMouseDown handler you can save the appointment start and end times, after that in the AppointmentMouseUp handler you can test whether appointment start and end dates have changed and update your database. I have previously told you in my last post that you can see a code which updates the database when the Save button in our example is pressed and here is the exact code snippet:

    AppointmentsTableAdapter appointmentsAdapter = new AppointmentsTableAdapter();
            appointmentsAdapter.Update(this.schedulerDataSet.Appointments);

            AppointmentsResourcesTableAdapter appointmentsResourcesAdapter = new AppointmentsResourcesTableAdapter();
            appointmentsResourcesAdapter.Update(this.schedulerDataSet.AppointmentsResources);

This code updates the database. Before saving the changes on the disk you could manually update the appointments in the DataSet using code like this:

  if (this.changedAppointment != null)
            {
                if (this.Scheduler != null && this.Scheduler.DataSource != null)
                {
                    this.Scheduler.DataSource.GetEventProvider().Update(this.changedAppointment);
                }
                this.changedAppointment = null;
            }

Where changedAppointment is IEvent instance. By default the changes in the DataSet are automatically updated by RadScheduler.

I suggest you take a look at the sample demonstrating databinding for RadScheduler that you can find in the Demo application.

Greetings,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
santosh
Top achievements
Rank 1
answered on 15 May 2009, 12:46 AM
Hi Boyko Markov , 
    Thanks for you assistance so far.

I am still having trouble saving a particular appointment after its been moved or resized.

I have created an demo applcation and as I could not attach it to the following post have raised a support ticket which can be accessed in the following link.
http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=212581

Please have a look at my application a suggest me a solution

thanks
santosh.
0
Jordan
Telerik team
answered on 16 May 2009, 12:50 PM
Hello santosh,

Thank you for attaching the application.
Please find the response to your question in the support ticket.

Best wishes,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
towpse
Top achievements
Rank 2
answered on 17 Nov 2009, 05:07 PM
can other users still access that 212581 Support Ticket?

Cheers.
0
Nikolay
Telerik team
answered on 20 Nov 2009, 10:28 AM

Hi towps,

The 212581 support ticket is a private ticket and only santosh can access it. However, if you are interested in the answer, you can find it below:

"Unfortunately the AppointmentMouseUp event cannot be used to check if an appointment has been moved because it is currently fired a little too early (we will address this in the next release of RadControls for WinForms together with the original issue).

So it turns out that the only workaround is to save the appointment data from the scheduler to the data source using a method like bellow:

private void SaveAppointmentsToDataSource()  
{  
    ISchedulerProvider<IEvent> eventProvider = this.radSchedulerDemo.DataSource.GetEventProvider();  
    foreach (IEvent appointment in this.radSchedulerDemo.Appointments)  
    {  
        eventProvider.Update(appointment);  
    }  
}  

If you do not want to make your users click a save button you can call this method just before the form is closed."

Best wishes,

Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
javas
Top achievements
Rank 1
answered on 23 Dec 2009, 02:12 PM
Nikolay,
  Are you sure that attached coded works in q3 2009, i tested it and it doesn't save appointements to database. I confused i could't save appointements to database.
Actually i use such code:
            for (int i = 0; i < this.radScheduler1.Appointments.Count; i++) 
            { 
                IEvent ie = this.radScheduler1.Appointments[i]; 
                try{ 
                eventProvider.Update(ie, null); 
                } 
                catch(Exception ex) 
                { 
                } 
            } 

Pavel.
0
Boyko Markov
Telerik team
answered on 25 Dec 2009, 10:00 AM
Hello javas,

Please take a look at the DataBinding example of RadScheduler in the QSF. It demonstrates the data binding feature of RadScheduler and especially how to bind the scheduler to a data source, make some changes and then save the changes back in the data base.

If you require more information, do nto hesitate to contact us.

Greetings,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Diego
Top achievements
Rank 1
answered on 02 May 2010, 05:28 PM
By default the changes in the DataSet are automatically updated by RadScheduler. 
Is possible that this default behaviour was lost and overwritten with other behaviour..

I track change and the AppointmentsTableAdapter() save all change that I do in my appointments
But AppointmentsResourcesTableAdapter(), does´t get the change in resource.. this always show the same values that are in database.. And if I add a new appointment, this error appears. 
Unable to cast object of type 'System.Guid' to type 'System.IConvertible'.Couldn't store <797b4d38-63da-4421-b728-f875fd3c5f46> in ID Column.  Expected type is Int32.

Follow this post I add  that methow before save.. but After Execute that method.. next statements are not executed.
Note: I call btnSAve in formisclosing event.

Database is the same that is located in your examples projects.

 private void btnSave_Dataset() 
        { 
             
                ISchedulerProvider<IEvent> eventProvider = this.radSchedulerDemo.DataSource.GetEventProvider();   
                foreach (IEvent appointment in this.radSchedulerDemo.Appointments)   
                { 
                    try 
                    { 
                        eventProvider.Update(appointment,null); 
                    } 
                    catch (Exception ex) 
                    { 
                    }  
                       
                } 
 
////////////After Execute the previous method.. following lines never execute.. 
 
            //see http://msdn.microsoft.com/en-us/library/ms171933.aspx 
            AppointmentsTableAdapter appointmentsAdapter = new AppointmentsTableAdapter(); 
            AppointmentsResourcesTableAdapter appointmentsResourcesAdapter = new AppointmentsResourcesTableAdapter(); 
 
            appointmentsAdapter.Update(this.schedulerDataSet.Appointments); 
            appointmentsResourcesAdapter.Update(this.schedulerDataSet.AppointmentsResources); 
 
            SchedulerDataBDDataSet.AppointmentsResourcesDataTable deletedChildRecords = 
                this.schedulerDataSet.AppointmentsResources.GetChanges(DataRowState.Deleted) 
                as SchedulerDataBDDataSet.AppointmentsResourcesDataTable; 

0
Dobry Zranchev
Telerik team
answered on 05 May 2010, 12:03 PM
Hello Diego,

There are a few problems that we are aware of with working with Access: when you create your dataset from an access database the Id of the appointment is not read only in the dataset but it should be read only. Also AutoincrementSeed and AutoincrementStep have values -1, but the value should be 1. Please take a look carefully the example that we provide for the scheduler binding (QSF->Scheduler->Binding example) with our installation.

If you have additional questions feel free to ask.

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
Jim
Top achievements
Rank 1
answered on 21 May 2010, 03:48 PM
I'm jumping into this thread a bit late, but have recently dealt with the issue of updating an appointment to the database as soon as it is moved or resized. An appointment cannot be so manipulated without eventually throwing an mouse-up event. But in that event handler, the appointment in the RadScheduler's collection has not yet updated its ResourceID.

I resorted to the following approach, which I think is reasonably clear from the code snippet below. By the time the timer-elapsed eventhandler runs, the appointment is up to date. You just need to keep track of its unique identifier so that you can update it to the database when the timer goes off.

Private Sub RadScheduler1_AppointmentMouseUp(ByVal sender As System.Object, _
                                                 ByVal e As Telerik.WinControls.UI.SchedulerAppointmentMouseEventArgs) _
                                                 Handles RadScheduler1.AppointmentMouseUp

        ' The appointment does not have its ResourceID updated yet, so we must wait
        ' until this event handler has run to completion before updating the database.

        Dim aTimer As System.Timers.Timer = New System.Timers.Timer(12)
        AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
        aTimer.Enabled = True
        aTimer.AutoReset = False
        m_ApptId = CShort(e.Appointment.UniqueId().KeyValue())

    End Sub
0
Dobry Zranchev
Telerik team
answered on 24 May 2010, 02:30 PM
Hello Jim Benson,

Thank you for writing.

Please use the CollectionChanged event in the Appointments collection of the scheduler and do your updates there. This event is call for each change of the collection insert, update or delete actions.

A bit off topic, please ask the person who has purchased our controls in your company to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: www.telerik.com/account/faqs.aspx.


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
FB
Top achievements
Rank 1
answered on 29 Jun 2011, 04:42 PM
Hi,

I am using the 2011 Q1 version and have the exact same issue. Can someone outline the steps? The solution mentioned by Jim Benson is unclear to me.

Thanks,
FB
0
Ivan Todorov
Telerik team
answered on 04 Jul 2011, 03:54 PM
Hello all,

You might find it useful to check this forum thread.

Hope this helps.

All the best,
Ivan Todorov
the Telerik team
Registration for Q2 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting July 18th and book your seat for a walk through all the exciting stuff we ship with the new release!
0
jeff357
Top achievements
Rank 2
answered on 07 Jul 2011, 01:36 AM
Santosh,
      THIS IS A BUG IN the scheduler I am usaingQ1 .315 Version till q2 11
comes out...?
                                                                                                    Dr Jeff Link :)

0
Ivan Todorov
Telerik team
answered on 13 Jul 2011, 09:39 AM
Hi All,

I would just like to inform you that the Q2 release should be available for download later this week.

If you have any questions, do not hesitate to ask.

Kind regards,
Ivan Todorov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Andrew
Top achievements
Rank 2
answered on 26 Oct 2011, 01:55 PM
I am using 2011.2.11.712 version of the scheduler and this is still not fixed.  There is no change to the event apointment when you drag and drop an appointment.  If you check start, end and resourceID at mouse down and mouse up, they are always the same.

Should I be looking somewhere else for the latest appointment data not the event argument object?

Thanks
Andrew
0
Ivan Todorov
Telerik team
answered on 28 Oct 2011, 02:03 PM
Hello Andrew,

The issue that was discussed here was addressed in the Q2 2011 release, as you can see in the release notes. You might be experiencing a different issue, so please provide us with more details about your scenario.
 
A bit off topic, I would like to remind you that your Trial support package has already expired. If you would like to continue receiving support from us, you will have to consider a purchase of some of the licenses that we offer. At this link - http://www.telerik.com/purchase.aspx - you can find the available options. These licenses comes with Dev priority support where the tickets should be answered in a guaranteed period of time. Shortly said, we will provide you with quicker responses.

In case have already purchased the tools under another account, please send us the company name, account name and email under which the controls were purchased so that we can update your account and provide you with proper support services. Alternatively, please ask the purchase holder to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: http://www.telerik.com/account/faqs.aspx.

Do not hesitate to contact us if you have any further questions.

Regards,
Ivan Todorov
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Andrew
Top achievements
Rank 2
answered on 31 Oct 2011, 07:54 AM
Hi Ivan,

Thanks for your reply, please add the following code and subscribe to the associated events to your Scheduler Grouping example and you will see what I mean.  I have update to version 2011.2.11.831.

1.  The appointment mouse up event has exactly the same appointment details as the mouse down.

2.  The move event is fired everytime you move past a given time interval, eg. in the demo it is set to hourly segments so every hour you move an appointment a move event is fired.

3.  None of the events pick up the fact you have dragged an appointment from one resource to another.

Yes I have gone past my trial period but I have not had the time, now I am doing the evaluation and will be very happy to pay when I know it will do what I need.  I figured this behaviour is not what is meant to happy and you would be happy to know.

Thanks
Andrew
private void radSchedulerDemo_AppointmentMouseDown(object sender, SchedulerAppointmentMouseEventArgs e)
{
    Console.WriteLine("Down:" + e.Appointment.Start.ToString() + ":" + e.Appointment.End.ToString() + ":" + e.Appointment.ResourceId.KeyValue.ToString());
}
 
private void radSchedulerDemo_AppointmentMouseUp(object sender, SchedulerAppointmentMouseEventArgs e)
{
    Console.WriteLine("Up:" + e.Appointment.Start.ToString() + ":" + e.Appointment.End.ToString() + ":" + e.Appointment.ResourceId.KeyValue.ToString());
}
 
private void radSchedulerDemo_AppointmentMoved(object sender, AppointmentMovedEventArgs e)
{
    Console.WriteLine("Moved:" + e.Appointment.Start.ToString() + ":" + e.Appointment.End.ToString() + ":" + e.Appointment.ResourceId.KeyValue.ToString());
}
0
Andrew
Top achievements
Rank 2
answered on 31 Oct 2011, 07:58 AM
Hi Ivan,

I forgot to mention that it works fine if you dray the appoinment edges to extend or shrink an appoinment, but not if you actually move the whole appoinment.

Thanks
Andrew
0
Ivan Todorov
Telerik team
answered on 02 Nov 2011, 03:00 PM
Hi Andrew,

If I understand you correctly, you want to get the resource id of the view that an appointment is being dropped to. The AppointmentMouseUp event is the one that causes the drop of appointments so at this point the appointment have not yet changed its resource. You should subscribe to the AppointmentDropped event and you will see that the resource id is changed when the event fires.

As to the AppointmentMoved event, this is its behavior by design. If you think this behavior is incorrect, we will be glad to hear your feedback on how it should behave.

I hope you find this useful. Feel free to write back if you have any further questions.

Best wishes,
Ivan Todorov
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Shah
Top achievements
Rank 1
answered on 23 Nov 2012, 06:30 PM
  i did what you said and inside button i used this code but still appointment are not updated to database plz help me em beginer on telerik


private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
              
   
                ISchedulerProvider<IEvent> eventProvider = this.radScheduler1.DataSource.GetEventProvider();
                for (int i = 0; i < this.radScheduler1.Appointments.Count; i++)
                {
                    IEvent ie = this.radScheduler1.Appointments[i];
                    MessageBox.Show(ie.ToString());
                    try
                    {

                       eventProvider.Update(ie,null);
            
                    }
                    catch (Exception ex)
                    {
                    }
                }
Tags
Scheduler and Reminder
Asked by
santosh
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
santosh
Top achievements
Rank 1
Jordan
Telerik team
towpse
Top achievements
Rank 2
Nikolay
Telerik team
javas
Top achievements
Rank 1
Diego
Top achievements
Rank 1
Dobry Zranchev
Telerik team
Jim
Top achievements
Rank 1
FB
Top achievements
Rank 1
Ivan Todorov
Telerik team
jeff357
Top achievements
Rank 2
Andrew
Top achievements
Rank 2
Shah
Top achievements
Rank 1
Share this question
or