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

RadScheduler How to get resource_ID from Appointment Object

1 Answer 84 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Corey
Top achievements
Rank 1
Corey asked on 20 Sep 2012, 04:50 PM
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() });
                    }
            }

1 Answer, 1 is accepted

Sort by
0
Cat Cheshire
Top achievements
Rank 1
answered on 25 Sep 2012, 03:23 PM
Maybe you can use the resource "Key" property stored with the appointment:
http://www.telerik.com/help/aspnet-ajax/scheduler-working-with-resources.html
Tags
Scheduler
Asked by
Corey
Top achievements
Rank 1
Answers by
Cat Cheshire
Top achievements
Rank 1
Share this question
or