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

Recurring Appointment on webservice bound scheduler

3 Answers 44 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Meera
Top achievements
Rank 1
Meera asked on 05 Feb 2014, 03:09 AM
I am using a rad scheduler bound with web service. How do I customize the appointment updating with recurring values? I would like to use the advanced form as it is but i want to handle the method of updating/saving the appointment in a different way. I could not find any sample codes handling recurring appointments in a web service bound scheduler. Any help would be appreciated.

Thanks,
Meera

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 07 Feb 2014, 11:33 AM
Hello Meera,

Could you please elaborate a bit more on your scenario? Please explain how exactly do you want to customize a recurring appointment using the advanced form. Please note the RadScheduler does offer a client-side event OnClientFormCreated which is fired when the form is opened for inserting/editing an appointment. In this help article you may find some examples how you can determine whether the advanced form is opened and execute some custom logic ( accessing some advanced form fields or controls and changing the values).

Looking forward to your reply.


Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Meera
Top achievements
Rank 1
answered on 11 Feb 2014, 01:56 PM
Thank You Boyan. 

Your post gave me very helpful ideas. 

This is the scenario I have:

[WebMethod]
 public SchedulerResult UpdateAppointment(M4SchedulerInfo schedulerInfo, AppointmentData appointmentData)
 {
     SchedulerResult result = new SchedulerResult();
     result.Operation = "updating";
 
     var appointmentInfo = new Dictionary<string, string>();
     appointmentInfo.Add("ID", appointmentData.ID.ToString());
     appointmentInfo.Add("Start", Convert.ToString(appointmentData.Start));
     appointmentInfo.Add("End", Convert.ToString(appointmentData.End));
     appointmentInfo.Add("TechID", appointmentData.Resources.ToDictionary(a => a.Type)["TechName"].Key.ToString());
     appointmentInfo.Add("TechName", appointmentData.Resources.ToDictionary(a => a.Type)["TechName"].Text.ToString());
     appointmentInfo.Add("TicketState", appointmentData.Resources.ToDictionary(a => a.Type)["TicketState"].Key.ToString());
 
     var AppointmentManager = new Workforce.CCode.AppointmentManager();
     var _apptID = (int)appointmentData.ID;
     var _startTime = appointmentInfo["Start"];
     var _endTime = appointmentInfo["End"];
     var _techID = int.Parse(appointmentInfo["TechID"]);
     var _ticketState = int.Parse(appointmentInfo["TicketState"]);
     var _subject = appointmentData.Subject;
 
     StatusMessage status = AppointmentManager.RescheduleAppointment(
         _apptID,
         _startTime,
         _endTime,
         _techID,
         _ticketState,
         false);
 
     bool isLocked = AppointmentManager.IsAppointmentLocked(_apptID, _ticketState);
 
     if (!isLocked && status.message.Contains("No conflict found"))
     {
         // Appointment is open to rescheduling.
         // Last argument to the method is an optional value that forces rescheduling.
         AppointmentManager.RescheduleAppointment(
             _apptID,
             _startTime,
             _endTime,
             _techID,
             _ticketState,
             false,
             true);
 
         // Appointment was successfully rescheduled.
         result.Code = 1;
     }
     else
     {
         // Conflict exists. Return the result to the calling client. Client with handle from there.
         var delimiter = "||";
         var _params = new System.Text.StringBuilder()
             .Append(status.message).Append(delimiter)
             .Append(appointmentInfo["ID"]).Append(delimiter)
             .Append(appointmentInfo["Start"]).Append(delimiter)
             .Append(appointmentInfo["End"]).Append(delimiter)
             .Append(appointmentInfo["TechName"]).Append(delimiter)
             .ToString();
 
         result.Params = _params;
 
         // Any code other than 1 implies that a conflict has occured.
         if (isLocked)   result.Code = 2;
         else            result.Code = 10;
     }
 
     AppointmentManager.UpdateAppointmentSubject(_apptID, _subject);
 
     return result;
 }

Here i would like to implement the recurrence series too. I do not need to have an option to create a recurrence series when i create an appointment. I need to have the option only when i update an existing appointment. ie. on UpdateAppointment.

This is what I have on my client side event on update.

function OnAppointmentUpdating (sender, eventArgs)
{
    var appointment = eventArgs.get_appointment();
 
    document.getElementById("<%= CMID.ClientID %>").value             = appointment.get_id();
    document.getElementById("<%= CMStartTime.ClientID %>").value      = appointment.get_start();
    document.getElementById("<%= CMEndTime.ClientID %>").value        = appointment.get_end();
    document.getElementById("<%= CMTechID.ClientID %>").value         = appointment.get_resources().getResourcesByType("TechName").getResource(0).get_key();;
    document.getElementById("<%= CMTicketState.ClientID %>").value    = appointment.get_resources().getResourcesByType("TicketState").getResource(0).get_key();;
    document.getElementById("<%= CMRescheduleAppt.ClientID %>").value = true;
    document.getElementById("<%= CMChangeTech.ClientID %>").value     = false;
    document.getElementById("<%= AppointmentDurationHiddenField.ClientID %>").value = appointment.get_durationInMinutes();
 
}

Any suggestions?

Thanks,
Meera
0
Accepted
Boyan Dimitrov
Telerik team
answered on 14 Feb 2014, 01:21 PM
Hello,

As far as I understand you want to have the recurrence option in the advanced form only when user is going to update an appointment. When user inserts a new appointment the recurrence option will be hidden. As I mentioned in my last response convenient event for such functionality would be the OnClientFormCreated. In this event handler you can check whether the advanced form is opened ( the recurrence editor is only available in the advanced form).
//markup code
<telerik:RadScheduler ID="RadScheduler1" runat="server"
     .........
       OnClientFormCreated="clientFormCreated"
     .............
   </telerik:RadScheduler>
//JavaScript
function clientFormCreated(sender, args) {
            var $ = $telerik.$;
            var mode = args.get_mode();
            if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert) {
 
                var recurrencePanelInsertJQueryObject = $("[id$='AdvancedInsertForm_RecurrenceCheckboxPanel']");
                recurrencePanelInsertJQueryObject.hide();
            }
        }



Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Meera
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Meera
Top achievements
Rank 1
Share this question
or