RadScheduler How to get resource_ID from Appointment Object

2 posts, 0 answers
  1. Corey
    Corey avatar
    1 posts
    Member since:
    Sep 2012

    Posted 20 Sep 2012 Link to this post

    Hi, I'm currently populating a list of bookings by expanding the taking all the appointments in my scheduler and putting it into a datatable.  However my issue is that I'm unable to retrieve the room_Id or in most causes we refer to it as resource_ID for my bookings.

    Is there a way to call my Appointment object to retrieve the resource_Id assigned to the specific booking.

     DataTable tanning_Availiability = new DataTable();

                tanning_Availiability.Columns.Add("Subject");
                tanning_Availiability.Columns.Add("Start");
                tanning_Availiability.Columns.Add("End");
                tanning_Availiability.Columns.Add("room_Id");

                foreach (Appointment a in scTanning_Availiability.Appointments)
                {
                    //Occurrences of a recurrence master are not generated untill they      
                    //are within RadScheduler's visible range. This mandates the occurrences     
                    //information to be extracted from the Master's recurrence rule as follows:     
                    if (a.RecurrenceState == RecurrenceState.Master)
                    {
                        RecurrenceRule parsedRule;
                        RecurrenceRule.TryParse(a.RecurrenceRule.ToString(), out parsedRule);

                        //If a recurring appointment does not have specified end time it will have     
                        //endless occurrences. In this case you can explicitly put a restriction:  
                        string Date = Request.QueryString["Date"];
                        DateTime ConvDate = Convert.ToDateTime(Date);

                        parsedRule.SetEffectiveRange(ConvDate, ConvDate.AddDays(1));

                        foreach (DateTime occurrence in parsedRule.Occurrences)
                        {
                            tanning_Availiability.Rows.Add(new string[] { a.Subject.ToString(), occurrence.AddHours(-6).ToString(), occurrence.Add(a.Duration).AddHours(-6).ToString(), a.Attributes.Keys.ToString() });
                        }
                    }
                    else //Get the rest of the appointments     

                        //If the SelectedDate of RadScheduler is set so that the visible range encompasses occurences of      
                        //a recurring appointement, these occurences will be generated now so they will be added once again     
                        //to the DataTable. To prevent this, we use the following check:     
                        if (a.RecurrenceState != RecurrenceState.Occurrence)
                        {
                            tanning_Availiability.Rows.Add(new string[] { a.Subject.ToString(), a.Start.AddHours(-6).ToString(), a.End.AddHours(-6).ToString(), a.Attributes.Keys.ToString() });
                        }
                }
  2. Cat Cheshire
    Cat Cheshire avatar
    128 posts
    Member since:
    Jun 2010

    Posted 25 Sep 2012 Link to this post

    Maybe you can use the resource "Key" property stored with the appointment:
    http://www.telerik.com/help/aspnet-ajax/scheduler-working-with-resources.html
Back to Top