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

Scheduler Appointment move issue

3 Answers 46 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Felipe
Top achievements
Rank 1
Felipe asked on 28 May 2014, 02:00 PM
Hi, 

I have a problem with the appointment move in the asp.net scheduler. Sometimes when i move the appointment to another slot, it doesn´t stay there. In some machines it never works in some months like (november and december 2014). It happens in all views (month, week, day...). I debbugged the app and when the problem happens it doesn´t show any erros in the pageMethod that update the appointment date. I need a solution for this issue.

Asp.net framework: 3.5
Telerik Version: 2013.1.417.35

Thanks

3 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 02 Jun 2014, 10:23 AM
Hi Felipe,

We are not aware of this issue. Please provide more info about your scenario. How do you populate the Scheduler? Do you have any custom logic related to the appointments Drag and Drop functionality? Are there any javascript errors.

The best would be if you can attach sample project.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Felipe
Top achievements
Rank 1
answered on 02 Jun 2014, 02:20 PM
Hi Hristo,

I populate the scheduler using a view from my database. I use the client event OnClientAppointmentMoveEnd to update the appointments date. I attached the code that i used to move the appointments. When the problem happens, i get no errors, even debugging with chrome browser.

Regards

/Javascript Function
   function OnClientAppointmentMoveEnd(sender, eventArgs) {
                var apt = eventArgs.get_appointment();
                var originalStartTime = apt.get_start();
                var startTime = eventArgs.get_targetSlot().get_startTime();
                var endTime = eventArgs.get_targetSlot().get_endTime();

                var dataAtual = apt.get_attributes().getAttribute("DataAtual");
                var dataAnomalia = apt.get_attributes().getAttribute("DataRegistro");

                var diaAnl = dataAnomalia.substring(2, 0);
                var mesAnl = dataAnomalia.substring(5, 3);
                var anoHoraAnl = dataAnomalia.substring(19, 6);

                var diaAtl = dataAtual.substring(2, 0);
                var mesAtl = dataAtual.substring(5, 3);
                var anoHoraAtl = dataAtual.substring(19, 6);

                var dataAnl = mesAnl + '/' + diaAnl + '/' + anoHoraAnl;
                var dataAtl = mesAtl + '/' + diaAtl + '/' + anoHoraAtl;

                var editSeries = eventArgs.get_editingRecurringSeries();

                var canc = false;

                if ((apt.get_id().indexOf("CE") != -1 || apt.get_id().indexOf("AN") != -1) && Date.parse(startTime) > Date.parse(dataAtl)) {
                    eventArgs.set_cancel(true);
                    canc = true;
                }

                if ((apt.get_id().indexOf("C") != -1) && Date.parse(startTime) < Date.parse(dataAnl)) {
                    eventArgs.set_cancel(true);
                    canc = true;
                }

                if (!canc) {
                    PageMethods.Move(apt.get_id(), originalStartTime, startTime, endTime, OnMovingSuccess, OnError);
                }

                return false;
            }

//Code Behind Function
<System.Web.Services.WebMethod()> _
        Public Shared Sub Move(ByVal codigo As String, ByVal dataHoraInicioOriginal As DateTime, ByVal dataHoraInicio As DateTime, ByVal dataHoraFim As DateTime)
            Dim tipo As String = codigo.Split(New String() {"_"}, StringSplitOptions.None)(0)

            codigo = codigo.Split(New String() {"_"}, StringSplitOptions.None)(1)

            Try
                DbUtils.StartTransaction()

                Dim inicio As DateTime = dataHoraInicioOriginal.Add(TimeSpan.Parse(timeSpanHours))
                Dim novoInicio As DateTime = dataHoraInicio.Add(TimeSpan.Parse(timeSpanHours))

                service.AplicacaoService.Instance().alterarDataPrevistaTarefas(codigo, inicio, novoInicio)
               

                DbUtils.CommitTransaction()
            Catch ex As Exception
                DbUtils.RollBackTransaction()
            Finally
                DbUtils.EndTransaction()
            End Try

        End Sub

  Public Sub alterarDataPrevistaTarefas(ByVal aplicacaoPlanoAtividadeID As String, ByVal dataPrevistaOriginal As DateTime, ByVal dataPrevista As DateTime)
            Dim dataHoraOriginal As String = dataPrevistaOriginal.ToShortDateString() & " " & dataPrevistaOriginal.ToShortTimeString()
            Dim dataHora As String = dataPrevista.ToShortDateString() & " " & dataPrevista.ToShortTimeString()
            Dim tarefasAplicacao() As TarefasRecord = TarefasTable.GetRecords(" AplicacaoPlanoAtividade = " & aplicacaoPlanoAtividadeID & " And DataPrevista = '" & dataHoraOriginal & "'")

            If dataPrevista.ToShortTimeString() = "0:00" Then
                dataHora = dataPrevista.ToShortDateString() & " " & dataPrevistaOriginal.ToShortTimeString()
            End If

            For Each tarefa As TarefasRecord In tarefasAplicacao
                tarefa = CType(tarefa.GetWritableRecord(), TarefasRecord)

                tarefa.Parse(dataHora, TarefasTable.DataPrevista)

                tarefa.Save()                
            Next
        End Sub



0
Hristo Valyavicharski
Telerik team
answered on 04 Jun 2014, 12:37 PM
Hi Felipe,

Everything in your code looks normal. Please attach sample project which demonstrates the problem. Once we have it we will be able to make additional research.

Thanks.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Scheduler
Asked by
Felipe
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Felipe
Top achievements
Rank 1
Share this question
or