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

Need Individual instances of a recurring appointment

14 Answers 326 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Abhishek Dixit
Top achievements
Rank 1
Abhishek Dixit asked on 07 Apr 2009, 10:51 AM
Hi,
 I have created a recurring appointment, which has a custom attribute 'Status'.
Now I want to get a specific instance (through code) of this recurring appointment so that its indivdual status can be set to a value. This will allow me to set different status values for different instances for the same recurring appointmnet.
Please tell me how can we achieve this.

Thanks,
Abhishek

14 Answers, 1 is accepted

Sort by
0
Abhishek Dixit
Top achievements
Rank 1
answered on 07 Apr 2009, 02:03 PM
Hi,
 To further clarify, what I want is that for a recurring appointment, I want to update the first few instances only and leave the remaining as it is. So the first few instances will have their status modified, and also their start/end time may be modified also. I need to do this through code.

Regards,
Abhishek
0
T. Tsonev
Telerik team
answered on 14 Apr 2009, 10:32 AM
Hi,

As only the first ("master") appointment is stored in the database, you'll need to create "recurrence exceptions" to store the changed status. Those are pretty much normal appointments with association to the master (through the RecurrenceParentID field).

You have several options to create such appointments. If you have a reference to the RadScheduler instance you can use the PrepareToEdit and UpdateAppointment methods to create an exception:

Appointment occurrence = RadScheduler1.Appointments[0];
Appointment recurrenceException = RadScheduler1.PrepareToEdit(occurrence, false);
recurrenceException.Subject = "This is a recurrence exception";
RadScheduler1.UpdateAppointment(recurrenceException);


This is basically what happens:

- The recurrence rule is edited, so it contains an exception date for the occurrence.
- An appointment is inserted with the new data. Its RecurrenceParentID field is set to the ID of the master appointment.

You can also create an exception without having a reference to the RadScheduler. First, evaluate the recurrence rule and determine the occurrence dates. Then add the exception dates and insert the new appointments. Here's how this look in pseudo-code:

RecurrenceRule rrule;
RecurrenceRule.TryParse(ruleString, rrule);
if(rrule == null)
{
    return;
}

DateTime occurrence = rrule.Occurrences[0];
rrule.Exceptions.Add(occurrence);

// Insert appointment for this date
// obj.start = occurrence;
// obj.recurrenceParentId = masterAppointmentId;
// ...

string updatedRule = rrule.ToString();
// Save recurrence rule
// ...


I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Abhishek Dixit
Top achievements
Rank 1
answered on 14 Apr 2009, 10:55 AM
Hi Telerik Team,
 Thanks for the response. But because I am in a tight schedule I worked out another solution - you can verify if that is correct way.
My scenario is that I have to modify/delete occurrences of my appointments based on my database.
So I have a custom attribute TaskID with each recurring appointment. Whenever I need an occurence to be modified, I use this TaskID to first set the visibility false for that occurence in the 

RadScheduler1_DataBound method. Then I add a new appointment with the modified dates. I dont use RecurrenceParentID as I have TaskId mapping.

Is this a valid approach?

Regards,
Abhishek

0
Accepted
T. Tsonev
Telerik team
answered on 14 Apr 2009, 11:19 AM
Hello,

If I understand correctly you've basically implemented recurrence exceptions using the TaskId field. The solution looks valid to me. You lose the integrated support for them, such as the "reset exceptions" button in the advanced form, but this isn't so important.

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Abhishek Dixit
Top achievements
Rank 1
answered on 14 Apr 2009, 11:31 AM
Hi Telerik Team,
 Thanks for the prompt reply.
There is another issue I am getting regarding telerik not defined from AdvancedForm.js. Should I create another thread for that issue. I have tried every thing for taht issue in this forum, but it hasn't worked till now!.

Thanks,
Abhishek
0
T. Tsonev
Telerik team
answered on 15 Apr 2009, 12:54 PM
Hello Abhishek Dixit,

That's a strange error. Are you referencing AdvancedForm.js through ScriptManager like in the example?

If the problem persists, feel free to open a support ticket and send us the page that you're working on, so we can debug it.

Kind regards,
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.
0
Abhishek Dixit
Top achievements
Rank 1
answered on 15 Apr 2009, 01:36 PM
Hi,
 I should have mailed you the details - when I use your standalone example, I dont get any errors and everything works fine.

But when I use the advancedform in my code, then I get the error as 'telerik not defined'. Actually my website has a asp scriptmanager defined in the Master page. So I cant register AdvancedForm.js using the scriptmanager in my telerik page.

So I tried two things. First was I tried to register the script in the Master page itself, then it gave the above error. Second I tried registering on my telerik page using asp:ScriptManagerProxy but then nothing happens (means like when i click recurrence checkbox on the advanced form, no options come up).
I also tried inserting the following line in Web.Config under handlers under system.webServer but nothing happened:
<add  path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />

Regards,
Abhishek
0
Peter
Telerik team
answered on 20 Apr 2009, 06:36 AM
Hello Abhishek,

Using ScriptManagerProxy, can you make sure you handle OnClientFormCreated as follows:

<script type="text/javascript">      
        //<![CDATA[  
 
            function schedulerFormCreated(scheduler, eventArgs)  
            {  
                var $ = $telerik.$;  
                var schedulerElement = scheduler.get_element();  
                var formElement = $("div.rsAdvancedEdit", schedulerElement);  
                  
                if (formElement.length == 1)  
                {  
                    // Initialize the client-side object for the advanced form  
                    var advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement);  
                    advancedTemplate.initialize();  
                }  
            }  
              
        //]]>  
        </script>  
          
        <telerik:RadScheduler runat="server" ID="RadScheduler1"   
                       OnClientFormCreated="schedulerFormCreated">  
           

Let us know if this helps or not.


Regards,
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.
0
roshani
Top achievements
Rank 1
answered on 17 Jan 2011, 11:58 AM
Hello Admin,

I have integrated radscheduler in our project. There some Custom fileds in the appointment table such as IsInactive(Showing the suspended Appointment), IsDelivered(Lesson has been delivered) which I have to update using buttons on the appointmnet template and the onappointmnetcommand event. So the requiremnt is that along with the master appointment all the occurences must be stored in the database when a recurring appointment is inserted. Storing all the appointments in the databsae will also help me in creating reports by day/month.
Please provide a simple demo application using sqldatasource showing the use of  PrepareToEdit and UpdateAppointment so that I can get a clear idea about using these methods? I think this will surely help me a lot. So please provide it as soon as possible.

Thanks in advance,
roshani
0
Peter
Telerik team
answered on 17 Jan 2011, 02:03 PM
Hello Roshani,

Occurrences are not stored in the data source. If you need to retrieve them manually, you should parse the recurring rule. For more details, please see the help topic on Working with Recurring Appointments.

Also, you can review this blog post:

http://blogs.telerik.com/tsvetomirtsonev/posts/08-08-04/working_with_radscheduler_recurring_appointments_on_sql_server.aspx


Greetings,
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.
0
roshani
Top achievements
Rank 1
answered on 18 Jan 2011, 08:34 AM
Hello Peter,

Thanks for reply,
This will really help me in generating reports. Now the requirement is that after clicking the button given on the appointment template, I want to update the IsInactive, IsDelivered status of the individual appointment. I achieved this using the onappointmentcommand event which works fine with simple appointment but for the recurring appointment it should be change.  Following is my current code which works fine with simple appointment and updates the status of the corresponding appointment.
protected void rsAppointments_AppointmentCommand(object sender, AppointmentCommandEventArgs e)
       {
           try
           {
               if (e.CommandName.Equals("Delivered"))
               {
                   //Allows only past Appointments to be marked as delivered
                   if (e.Container.Appointment.Start >= DateTime.Now || e.Container.Appointment.End >= DateTime.Now)
                   {
                       SDSAppointments.UpdateCommand = "UPDATE [Appointment] SET [IsDelivered]=1  WHERE [AppointmentId]" + Convert.ToInt32(e.Container.Appointment.ID);
                       SDSAppointments.Update();
                       upScheduler.Update();
                   }
                   else
                   {
                       lblMessage.Text = "Only past appointments are allowed to be marked as delivered.";
                   }
               }
           }
           catch (Exception ex)
           {
               string ErrorMessage = ex.Message;
               SysLog.LogException(ex, MessageTypeEnum.DatabaseException, MessageSeverityEnum.Error);
           }
           finally
           {
           }
But gives error when I tried to update the status of the occurence of recurring appointment. So here also need the instance of the individual appointmnet. I have gone through the PrepareToEdit And UpdateAppointment methods. I think these methods are useful here.  Please suggest the changes in the above code to work fine with recurring and nonrecurring appointments.

Awaiting your reply,

Thanks,
Roshani
0
Peter
Telerik team
answered on 18 Jan 2011, 03:50 PM
Hello Roshani,

I tried to replicate the problem in a simple test page, but to no avail. Could you please modify the attached sample so that the problem can be observed and send it back for further testing?


Greetings,
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.
0
Kalpana
Top achievements
Rank 1
answered on 04 Apr 2012, 03:04 PM
HI Team,

I have a similar requirement in my project. I am using a recurrence editor in inline edit.I am storing the recurrence rule for a recurring appointment. I have different custom statuses associated with an appointment. On changing the status of an occurrence,it updates the status of the entire appointment series(though I select edit a single occurrence) while I wanted only that particular occurrence to have its status changed. So, I thought that saving individual instances of the recurring appointments would solve the issue, Is it possible? Could you point me to the right resource, please? I am a beginner in telerix products and I would highly appreciate any help provided on the best way to achieve my requirement.

Thanks in advance!
Kalpana
0
Peter
Telerik team
answered on 05 Apr 2012, 10:27 AM
Hi Kalpana,

I tested this online demo in the scenario that you describe, but everything worked as expected. More specifically, an exception was created when editing just the occurrence and changing its resource value. Could you pease view this video capture and let me know if I am testing the case in the same way as you - http://screencast.com/t/sFjJiELxc2?

If you continue to experience problems, I recommend you send us a support ticket with a simple demo of the issue.


Greetings, Peter
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Abhishek Dixit
Top achievements
Rank 1
Answers by
Abhishek Dixit
Top achievements
Rank 1
T. Tsonev
Telerik team
Peter
Telerik team
roshani
Top achievements
Rank 1
Kalpana
Top achievements
Rank 1
Share this question
or