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

How to delete one exception occurence issued from recurrence ?

2 Answers 72 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
luc bonenfant
Top achievements
Rank 1
luc bonenfant asked on 23 Aug 2015, 10:16 AM

Hello,

1. I create an appointment with recurrence : 3 occurrences A,B,C.
2. I update only one occurrence : B.
3. I delete B.

But deleting B doesn't work... indeed, no event is firing... (none from OnOccurrenceDelete​/OnAppointmentDelete/Delete method from provider)
More, if i try to edit this occurrence B, i can choose series/occurrence illogically (and nothing happen if i choose edting series...) 

If I update series from A or B to reset exception, the original B takes place, but my "orphan" occurrence B always exists and i still can not delete it.
The own way for user to delete orphan B is to add a reccurence to B then deleting the series...

Is it something i didn't understand ? ​How to force the removal of B please ?

2 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 26 Aug 2015, 02:43 PM
Hello Luc,

Could you demonstrate us the implementation of the RadScheduler that you use at your and, along with the data-binding approach that you use. This we could get a clearer picture on your implementation and try to replicate the experienced issue.

Regards,
Nencho
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
luc bonenfant
Top achievements
Rank 1
answered on 29 Aug 2015, 12:53 PM

In fact, i deleted this code from GetAppointments ​into the provider :

if (apt.RecurrenceParentID != null)
{
   apt.RecurrenceState = RecurrenceState.Exception;
}

 Because, for me, this ocurrence (previously moved from series) is now with a type NotRecuring.
And it's working great like this.

The original code is here :

http://docs.telerik.com/devtools/aspnet-ajax/controls/scheduler/data-binding/providers/implementing-a-provider-that-supports-multi-valued-resources

To answer to you previous post, this is a part of my code for the GetAppointments method :

public override IEnumerable<Appointment> GetAppointments(RadScheduler owner)
{
    List<Appointment> appointments = new List<Appointment>();
    List<CAppointmentInfo> appointmentInfos = new List<CAppointmentInfo>();
    List<CAppointmentInfo> uniqueAppointmentInfos = AppointmentInfos.Where(x => x.Start >= owner.VisibleRangeStart && x.End <= owner.VisibleRangeEnd && x.RecurrenceRule == string.Empty).ToList();
    List<CAppointmentInfo> recurrenceAppointmentInfos = AppointmentInfos.Where(x => x.RecurrenceRule != string.Empty).ToList();
    appointmentInfos.AddRange(uniqueAppointmentInfos);
    appointmentInfos.AddRange(recurrenceAppointmentInfos);
 
    foreach (CAppointmentInfo appointmentInfo in appointmentInfos)
    {
        Appointment apt = new Appointment();
        apt.Owner = owner;
        apt.ID = appointmentInfo.ID;
        apt.Subject = appointmentInfo.Subject;
        apt.Start = DateTime.SpecifyKind(appointmentInfo.Start, DateTimeKind.Utc);
        apt.End = DateTime.SpecifyKind(appointmentInfo.End, DateTimeKind.Utc);
        apt.RecurrenceRule = appointmentInfo.RecurrenceRule;
        apt.RecurrenceParentID = appointmentInfo.RecurrenceParentID;
        if (appointmentInfo.Reminder != null)
        {
            IList<Reminder> reminders = Reminder.TryParse(appointmentInfo.Reminder);
            if (reminders != null)
            {
                apt.Reminders.AddRange(reminders);
            }
        }
 
        if (apt.RecurrenceRule != string.Empty)
        {
            apt.RecurrenceState = RecurrenceState.Master;
        }
 
        LoadResources(appointmentInfo, apt);
        appointments.Add(apt);
    }
 
    return appointments;
}

Tags
Scheduler
Asked by
luc bonenfant
Top achievements
Rank 1
Answers by
Nencho
Telerik team
luc bonenfant
Top achievements
Rank 1
Share this question
or