Recurring Appointment on webservice bound scheduler

4 posts, 1 answers
  1. Meera
    Meera avatar
    14 posts
    Member since:
    Mar 2012

    Posted 04 Feb 2014 Link to this post

    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
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 07 Feb 2014 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Meera
    Meera avatar
    14 posts
    Member since:
    Mar 2012

    Posted 11 Feb 2014 Link to this post

    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
  5. Answer
    Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 14 Feb 2014 Link to this post

    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.
Back to Top