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

Custom context menu item and recurring appointments

11 Answers 75 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Mitchell
Top achievements
Rank 1
Mitchell asked on 10 Apr 2011, 04:48 PM
Hi Guys,

So I have a custom context menu item I added to the right click menu of the appointments. My client has several recurring appoints they put on their schedule as placeholders that they want to then later be able to assign customers to. Easy enough on a non-recurring appointment like so:

if (e.MenuItem.Value == "CommandSelectClient") {
            Response.Redirect("browse_clients.aspx?go=appointments.aspx&m=select&appointment_id=" + e.Appointment.ID.ToString());
        }

But, the problem comes when I try do it on a recurring event  which is the whole point of this exercise. It passes the recurring event ID through the above URL.

How can I convert the recurring appointment to a non-recurring appointment in this event handler, and then get the non recurring ID passed across to my new page?

Thanks!

11 Answers, 1 is accepted

Sort by
0
Mitchell
Top achievements
Rank 1
answered on 12 Apr 2011, 06:35 PM
Any update? Thanks :)
0
Nikolay Tsenkov
Telerik team
answered on 13 Apr 2011, 03:04 PM
Hi Mitchell,

The recurrence rule is stored in a single appointment (especially useful when you have to deal with abstractions such as infinity). In order to pass a unique identifier for any appointment to your other page, you can still pass the AppointmentId, but in combination with the StartTime of the appointment.


Regards,
Nikolay Tsenkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mitchell
Top achievements
Rank 1
answered on 13 Apr 2011, 03:06 PM
That doesn't help too much. Can you clarify?

When I pass the appointment ID of a recurring appointment, it's coming across in a strange format, IE, 607_0, instead of just 607. I need to drop the recurrence rule when the command is executed and only get the single appointment ID (IE, 607)

Thoughts?
0
Mitchell
Top achievements
Rank 1
answered on 18 Apr 2011, 02:21 PM
Can someone please help with this?
0
Nikolay Tsenkov
Telerik team
answered on 18 Apr 2011, 03:15 PM
Hi Mitchell,

You can split the string and get just the first returned item. Something like the following:
// this should get '607' out of '607_0', and at the
// same time it should get '607' out of '607'
string aptID = receivedAptID.Split('_')[0];


Regards,
Nikolay Tsenkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mitchell
Top achievements
Rank 1
answered on 18 Apr 2011, 03:20 PM
That makes sense, but then if I do that, how do I convert that instance of the recurring appointment into a single appointment, while retaining the original series in the other days for that time slot?

IE, if I have a recurring appointment that goes every day at 10AM, I would want to make tuesday's into a regular appointment using the right click menu item I talked about below.
0
Nikolay Tsenkov
Telerik team
answered on 21 Apr 2011, 11:02 AM
Hi Mitchell,

You can turn the occurrence in a separate appointment if you make it as exception to the recurrence rule of the RecurrenceMaster appointment.
You can achieve this using the following:
// with this method a RecurrenceException appointment is created
var apt = RadScheduler1.PrepareToEdit(occurence, false);
 
//... any editing of the appointment goes here
// for example you can edit the subject: apt.Subject = apt.Subject + " x";
//...
 
// here the RecurrenceException is being added to the recurrence rule
// and an actual appointment is created and saved in the source
RadScheduler1.UpdateAppointment(apt);


Regards,
Nikolay Tsenkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mitchell
Top achievements
Rank 1
answered on 24 Apr 2011, 02:31 PM
That appears to be client side code. How could I get that same result from the AppointmentContextMenuItemClicked on the server side code?
0
Mitchell
Top achievements
Rank 1
answered on 24 Apr 2011, 03:00 PM
I'm at little closer.. I was able to get it to work under server side code:

Appointment a = radAppointmentsDoctors.PrepareToEdit(e.Appointment, false);
radAppointmentsDoctors.UpdateAppointment(a);

But I can't seem to get the new ID number without re-databinding the schedule. Can you advise how I can get a handle on the new ID number?

0
Mitchell
Top achievements
Rank 1
answered on 25 Apr 2011, 04:06 PM
I came up with a temporary(!) solution. I still really need to know how to generate a new ID number for the recurrence exception within the command procedure.

In the meantime, I made a "get new id" function that gets the MAX(id) From the appointments table, which in a "quiet" application will be ok, but in a busy office, that isn't safe.

CURRENT SOLUTION:
if (e.MenuItem.Value == "CommandSelectClient") {
            Appointment a = radAppointmentsDoctors.PrepareToEdit(e.Appointment, false);
            radAppointmentsDoctors.UpdateAppointment(a, e.Appointment);
            
            Response.Redirect("browse_clients.aspx?go=appointments.aspx&m=select&appointment_id=" + bvAppointmentDoctor.getNewID());
        }

PREFERRED SOLUTION:

if (e.MenuItem.Value == "CommandSelectClient") {
            Appointment a = radAppointmentsDoctors.PrepareToEdit(e.Appointment, false);
            radAppointmentsDoctors.UpdateAppointment(a, e.Appointment);

// GET NEW ID HERE SOMEHOW!
            
            Response.Redirect("browse_clients.aspx?go=appointments.aspx&m=select&appointment_id=" + new_id);
        }

I know if I do a select * on the appointments table right after UpdateAppointment is called, the new ID is there.. but the scheduler isn't aware of it yet.

Thanks for any help
0
Peter
Telerik team
answered on 28 Apr 2011, 03:56 PM
Hi Mitchell,

Thank you for sharing your findings with us.

We don't have any ideas for the moment, but if we can think of some workaround, we will follow up and let you know.

Best wishes,
Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Scheduler
Asked by
Mitchell
Top achievements
Rank 1
Answers by
Mitchell
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Peter
Telerik team
Share this question
or