Error resizing recurring appointment using webservices

5 posts, 0 answers
  1. Datamex
    Datamex avatar
    161 posts
    Member since:
    Jun 2012

    Posted 10 Aug 2009 Link to this post

    Hi,

    We are using the Radscheduler with webservices.

    Now i got a problem when i am resizing an appointment. Usually the client side event AppointmentResized fires and the then the webservice UpdateAppointmentData is being called. With a normal appointment this works fine, but when i'm trying to resize a recurring appointment i get the following error:  the conversion is not valid.

    The code i'm using in the AppointmentResized  event is :
    function AppointmentResized(sender, e) {  
     
          var appointment = e.get_appointment();  
          var Employee = appointment.get_resources().getResourceByType("Employee").get_key();  
          var eendTime = e.get_newTime();  
          var startTime = e.get_appointment().get_start();  
          var eeditSeries = e.get_editingRecurringSeries();  
     
          // Retrieve appointments this appointment may be overlapping  
          var appOverlap = sender.get_appointments().getAppointmentsInRange(startTime, endTime);  
     
          if (appOverlap.get_count() != 0) {  
     
            // Cancel the event, we simulate an move if user autherizes  
            e.set_cancel(true);  
     
     
            var appString = "";  
            var IsOverlapping = false;  
            // Check if the appointments are overlapping  
            for (q = 0; q < appOverlap.get_count(); q++) {  
              var curApp = appOverlap.getAppointment(q);  
              var curKey = curApp.get_resources().getResourceByType("Employee").get_key();  
              if (curKey == Employee) {  
                if (appOverlap.getAppointment(q) != appointment) {  
                  IsOverlapping = true;  
                  var appStringappString = appString + "<br />\n\r" + appOverlap.getAppointment(q).get_subject();  
                }  
              }  
            }  
            if (IsOverlapping) {  
              // Pop a confirmation window  
              var confirmMessage = "Het wijzigen van afspraak: <br />\n'" + appointment.get_subject()  
                                    + "' <br />\r\n <br />\r\nZorgt ervoor dat deze afspraak in conflict komt met de volgende afspraken: <br />\r\n" + appString  
                                    + "<br />\r\n<br />\r\nWilt u doorgaan?";  
              radconfirm(confirmMessage,  
              function(arg) {  
                if (arg) {  
                  var scheduler = sender;  
     
                  // The user has confirmed moving the appointment. Update the start and end time.  
                  appointment.set_start(startTime);  
                  appointment.set_end(endTime);  
                  sender.updateAppointment(appointment, editSeries);  
                }  
              }, 330, 100);  
            } else {  
              appointment.set_start(startTime);  
              appointment.set_end(endTime);  
              sender.updateAppointment(appointment, editSeries);  
            }  
          } else {  
            appointment.set_start(startTime);  
            appointment.set_end(endTime);  
            sender.updateAppointment(appointment, editSeries);  
          }  
        } 

    With a normal appointment this code works fine and the webservice is being called by the
    sender.updateAppointment(appointment, editSeries);  method. And the appointment is being resized succesfully.

    But when i'm resizing a recurring appointment the sender.updateAppointment(appointment, editSeries);  method is being called, but my breakpoint in the webservice method never fires. So it seems that there is an error calling the webservice.

    The logfile gives the following error:

    10-08-2009 13:19:47 - WebDev.WebServer.exe Error: 0 : 10-08-2009 13:19:47 - System.NotSupportedException: Cultuur nl is een neutrale cultuur. Deze kan niet voor het indelen en parseren worden gebruikt en kan daarom niet als de huidige cultuur van de thread worden ingesteld.
       bij System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture)
       bij System.Threading.Thread.set_CurrentCulture(CultureInfo value)
       bij System.Web.HttpApplication.SetAppLevelCulture()
       bij System.Web.HttpApplication.ProcessSpecialRequest(HttpContext context, MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs, HttpSessionState session)

    I'm running the newest internal build: Telerik.Web.UI_2009_2_806_dev_hotfix

    Greetings William
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 13 Aug 2009 Link to this post

    Hello William ,

    We are currently investigating this case, but you could speed things up if you can send us a simple working demo via a support ticket.


    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Datamex
    Datamex avatar
    161 posts
    Member since:
    Jun 2012

    Posted 14 Aug 2009 Link to this post

    Hello Peter,

    I made a mistake, i used a appointmentid like 256_0 and try to parse is to an integer. My fault.

    Now i do have another question:

    We are using a custom LinqSchedulerProvider that inherits your SchedulerProviderBase where i override the update method:

    /// <summary> 
      /// Personal scheduler provider (LINQ to SQL)  
      /// </summary> 
      public class LinqSchedulerProvider : SchedulerProviderBase  
      {  
        private DALDataContext _database = new DALDataContext();  
     
        public override void Update(RadScheduler owner, Telerik.Web.UI.Appointment appointmentToUpdate)  
        {  
          // When the appoinment is not recurring update the current appointment  
          if(??? == RecurrenceState.NotRecurring)  
          {  
            // Update the appointment  
            DataAccess.Appointment appointment = _database.GetAppointmentByID((int)appointmentToUpdate.ID);  
            appointment = UpdateAppointmentData(appointment, appointmentToUpdate);  
          }  
          // When the appointment is recurring and only one specific appointment is being moved  
          // Add exception to parent appointment and insert a new appointment  
          else if(??? == RecurrenceState.Occurence)  
          {  
            // Update the current appoinment with the recurrence exception  
            DataAccess.Appointment appointment = _database.GetAppointmentByID((int)appointmentToUpdate.RecurrenceParentID);  
            Telerik.Web.UI.Appointment Oldappointment = owner.Appointments.FindByID(appointmentToUpdate.ID);  
            appointment = AddRecurrenceException(appointment, Oldappointment);  
     
            _database.SubmitChanges();  
              
            // Insert the new appointment  
            Datamex.Projects.Saturnus.DataAccess.Appointment newnewAppointment = new Datamex.Projects.Saturnus.DataAccess.Appointment();  
            newAppointment = CopyAppointment(appointment, appointmentToUpdate);  
     
            _database.Appointments.InsertOnSubmit(newAppointment);  
          }  
          // When the whole recurrence is being moved then update the parent appointment  
          else if(??? == RecurrenceState.Master)  
          {  
            // Update the parent appointment  
            DataAccess.Appointment appointment = _database.GetAppointmentByID((int)  appointmentToUpdate.RecurrenceParentID);  
            appointment = UpdateAppointmentData(appointment, appointmentToUpdate);  
          }  
     
          _database.SubmitChanges();  
     
      } 

    And a schedulerwebservice that uses the WebServiceAppointmentController. Which calls the methods from the LinqSchedulerProvider. 

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
      [WebService(Namespace = "http://localhost/webservices")]  
      [ScriptService]  
      public class SchedulerWebService : WebService  
      {  
        private WebServiceAppointmentController _controller;  
     
        /// <summary> 
        /// The WebServiceAppointmentController class is used as a facade to the SchedulerProvider.  
        /// </summary> 
        private WebServiceAppointmentController Controller  
        {  
          get  
          {  
            if (_controller == null)  
            {  
              this._controller = new WebServiceAppointmentController(new LinqSchedulerProvider());  
            }  
     
            return _controller;  
          }  
        }  
          
        [WebMethod]  
        public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)  
        {  
          return Controller.GetAppointments(schedulerInfo);  
        }  
     
        [WebMethod]  
        public IEnumerable<AppointmentData> InsertAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)  
        {  
          return Controller.InsertAppointment(schedulerInfo, appointmentData);  
        }  
     
        [WebMethod]  
        public IEnumerable<AppointmentData> UpdateAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData)  
        {  
          return Controller.UpdateAppointment(schedulerInfo, appointmentData);  
        }  

        [

    WebMethod]

     

     

        public IEnumerable<AppointmentData> DeleteAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData, bool deleteSeries)

        {

     

          return Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries);

        }

     

     


    Now when i want to update the appointment when it was moved or resized i need to know if the user wants to move or resize the appointment or the whole recurrence. Now in the de DeleteAppointment method i have the property "deleteseries" which indicates the choise of the user. I also need that property in the UpdateAppointment method. Can you provide this functionality or is there a workaround?

    Thanks in advance
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Aug 2009 Link to this post

    Hi William ,

    We have had similar question recently, but RadSheduler's UpdateAppointment method does not have provisions for handling recurring appointments at the moment. I will forward this case to our development team to review it and decide what should be the best course of action. We will follow up next week.

    Best wishes,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 19 Aug 2009 Link to this post

    Hello,

    Please, excuse us for the delayed response.

    The provider is not really supposed to care if the appointment is recurring or not. At least not in the majority of the scenarios. It's only responsible for processing the appointment instance that is being passed. It's a responsibility of the WebServiceAppointmentController to issue the correct operations for the correct appointments when processing recurring appointments.

    That said, you can still distinguish between updating the series or a single appointment by using the ProviderContext property, but this shouldn't be necessary in your scenario.

    I hope this helps.

    All the best,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017