How to support drag and drop functionality when we are saving appointments in db with unique ids?

We are directly saving appointment records to our db via our custom provider. So you can imagine that we need to track the Id/UniqueId of the appointment on AddItem and RemoveItem. However, when doing a drag and drop the control appears to call RemoveItem then AddItem which causes the provider to delete the appointment in the db and insert a new appointment (with new Id instead of the old Id). Unfortunately, the ItemChanging event is called after the call to AddItem and RemoveItem so we can't seem to cancel the change since the changes are already persisted in our db. Is there a way or a different approach for us to handle this?

Thanks in advance.

5 Replies 1 reply marked as answer

AR Arulpriya Ramalingam Syncfusion Team June 25, 2020 12:21 AM UTC

Hi Peregrino, 
 
Thank you for your interest in Syncfusion products. 
 
We could understand the scenario that an appointment in a ScheduleProvider changes UniqueID when dragging the item from a data to another. We have forwarded the query to our development team for further validation and update you with proper details on 29th June 2020. 
 
We appreciate your patience till then. 
 
Regards, 
Arulpriya 



PE Peregrino June 25, 2020 05:06 AM UTC

Thank you so much for your assistance, Arulpriya!


AR Arulpriya Ramalingam Syncfusion Team June 28, 2020 06:27 PM UTC

Hi Peregrino, 
 
Thank you for your patience. 
 
We have validated the reported case that the ItemChanging event is triggered after the items are deleted and added in the ScheduleDataProvider class. As per the validation, the item changing event will be occurred after the mouse up is occurred and it could not be changed from sample level. So, we request you to have a property in your custom schedule provider which will notify that the MouseDown for the ScheduleGrid is occurred runtime. Using that property, you avoid deleting and adding in the schedule provide class. Please make use of the below code example. 
 
Example code 
 
//Event subscription in form1 
this.scheduleControl1.GetScheduleHost().MouseDown += Form1_MouseDown; 
this.scheduleControl1.GetScheduleHost().MouseUp += Form1_MouseUp; 
 
//Event customization 
private void Form1_MouseDown(object sender, MouseEventArgs e) 
{ 
scheduleProvider.IsMouseDown = true; 
} 
private void Form1_MouseUp(object sender, MouseEventArgs e) 
{ 
scheduleProvider.IsMouseDown = false; 
} 
 
public class SimpleScheduleDataProvider : ScheduleDataProvider, IRecurringScheduleDataProvider 
{ 
    /// <summary> 
    /// Default constructor. 
    /// </summary> 
    public SimpleScheduleDataProvider() 
        : base() 
    { 
    } 
public bool IsMouseDown { get; set; } 
} 
 
Please get back to us, if you need any further assistance. 
 
Regards, 
Arulpriya 


Marked as answer

PE Peregrino June 29, 2020 10:25 AM UTC

Hi Arulpriya,

Thank you so much for your assistance. The example seemed to work and we also added some handling to the ItemChanging event handler.



Regards,
Peregrino


AR Arulpriya Ramalingam Syncfusion Team June 30, 2020 02:58 PM UTC

Hi Peregrino, 
 
Thank you for the update. 
 
We are glad that the reported issue has been resolved at your end and please get back to us, if you need any further assistance. 
 
Regards, 
Arulpriya 


Loader.
Up arrow icon