We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Delete entire series not passing correct params to controller

Thread ID:

Created:

Updated:

Platform:

Replies:

130710 May 27,2017 10:52 PM UTC May 31,2017 05:44 AM UTC ASP.NET MVC 6
loading
Tags: Schedule
Chris Erickson
Asked On May 27, 2017 10:52 PM UTC

Hi,

I am able to delete a stand alone occurance of an appointment.
I am able to "delete" an occurance in an appointment series.
I am able to delete an exception appointment for a series.
However, when I try to delete an entire series the correct values are not being passed.

I have attached a screen shot of what is being passed to the controller when I try to delete the series as well as a text file showing the args being passed into "beforeAppointmentRemove".

Any help and advice as always is appreciated.

Thanks,
Chris

Attachment: SeriesDelete_6df22095.zip

Karthigeyan Krishnamurthi [Syncfusion]
Replied On May 29, 2017 06:30 AM UTC

Hi Chris 
 
Thank you for contacting Syncfusion support. 
 
We suspect that CRUD code examples may not be included correctly which could be the cause for the issue, we have prepared the CRUD sample which can be download from the below location. 
 
<Code> 
public JsonResult Batch(EditParams param) 
        { 
            if (param.action == "insert" || (param.action == "batch" && param.added != null))          // this block of code will execute while inserting the appointments 
            { 
                var value = param.action == "insert" ? param.value : param.added[0]; 
                int intMax = db.ScheduleDatas.ToList().Count > 0 ? db.ScheduleDatas.ToList().Max(p => p.Id) : 1; 
                DateTime startTime = Convert.ToDateTime(value.StartTime); 
                DateTime endTime = Convert.ToDateTime(value.EndTime); 
                var currentTimeZone = TimeZone.CurrentTimeZone; 
                ScheduleData appoint = new ScheduleData() 
                { 
                    Id = intMax + 1, 
                    StartTime = startTime, 
                    EndTime = endTime, 
                    Subject = value.Subject, 
                    Recurrence = value.Recurrence, 
                    AllDay = value.AllDay, 
                    RecurrenceRule = value.RecurrenceRule, 
                }; 
                db.ScheduleDatas.InsertOnSubmit(appoint); 
                db.SubmitChanges(); 
            } 
            if (param.action == "remove" || param.deleted != null)                                        // this block of code will execute while removing the appointment 
            { 
                if (param.action == "remove") 
                { 
                    int key = Convert.ToInt32(param.key); 
                    ScheduleData app = db.ScheduleDatas.Where(c => c.Id == key).FirstOrDefault(); 
                    if (app != null) db.ScheduleDatas.DeleteOnSubmit(app); 
                } 
                else 
                { 
                    foreach (var apps in param.deleted) 
                    { 
                        ScheduleData app = db.ScheduleDatas.Where(c => c.Id == apps.Id).FirstOrDefault(); 
                        if (apps != null) db.ScheduleDatas.DeleteOnSubmit(app); 
                    } 
                } 
                db.SubmitChanges(); 
            } 
            if ((param.action == "batch" && param.changed != null) || param.action == "update")   // this block of code will execute while updating the appointment 
            { 
                var value = param.action == "update" ? param.value : param.changed[0]; 
                var filterData = db.ScheduleDatas.Where(c => c.Id == Convert.ToInt32(value.Id)); 
 
                if (filterData.Count() > 0) 
                { 
                    DateTime startTime = Convert.ToDateTime(value.StartTime); 
                    DateTime endTime = Convert.ToDateTime(value.EndTime); 
                    ScheduleData appoint = db.ScheduleDatas.Single(A => A.Id == Convert.ToInt32(value.Id)); 
                    appoint.StartTime = startTime; 
                    appoint.EndTime = endTime; 
                    appoint.Subject = value.Subject; 
                    appoint.Recurrence = value.Recurrence; 
                    appoint.AllDay = value.AllDay; 
                    appoint.RecurrenceRule = value.RecurrenceRule; 
                } 
                db.SubmitChanges(); 
            } 
            IEnumerable data = new DataClasses1DataContext().ScheduleDatas.Take(500); // nw.Appointment.Take(5); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        } 
</Code> 
 
Regards, 
Karthigeyan 


Chris Erickson
Replied On May 29, 2017 01:01 PM UTC

Thank you for the example, you are correct the provided codes sample does have issues and I had already addressed those. The issue I am referring to specifically is what the javascript is passing to the controller.  Please see the screen shot uploaded in the attachment to the original comment.

Thank you,
Chris

Chris Erickson
Replied On May 29, 2017 01:07 PM UTC

Additionally, I have tested with the ".removeURL" and the same data is being passed to the controller as well.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On May 30, 2017 04:57 AM UTC

  
Thanks for your update. 
 
We suspect that EditParams parameters are not defined correctly which could be the cause for the issue, kindly use the below code example. 
 
<Code> 
public class EditParams 
    { 
        public string key { get; set; } 
        public string action { get; set; } 
        public List<MultipleResource> added { get; set; } 
        public List<MultipleResource> changed { get; set; } 
        public List<MultipleResource> deleted { get; set; } 
        public MultipleResource value { get; set; } 
    } 
</Code> 
 
In our previous update, CRUD sample when an appointment series is deleted, parameters will be retrieved as shown in the below image. We recommend you to follow our sample to perform the CRUD operation in Schedule. 
 
 
  
Regards,  
Karthigeyan  


Chris Erickson
Replied On May 30, 2017 12:23 PM UTC

Hi Karthigeyan,

You are correct. the deleted list was not in the class. Added it and everything is working as intended.

Thank you for your time and support,

Chris

Karthigeyan Krishnamurthi [Syncfusion]
Replied On May 31, 2017 05:44 AM UTC

Hi Chris, 
 
We are happy that our solution has resolved your issue. 
 
Regards, 
Karthigeyan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;