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

wouldn't let me add, edit or delete.

2 Answers 62 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nyceane
Top achievements
Rank 1
Nyceane asked on 16 Nov 2007, 09:24 PM

Under Resource and Resource Availability, I copied exact code to my system and here are the following problems.

using System;  
using System.Collections.Generic;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using Telerik.QuickStart;  
using Telerik.Web.UI;  
 
namespace Telerik.Web.Examples.Scheduler.ResourceAvailability  
{  
    public partial class DefaultCS : XhtmlPage  
    {  
        private const string UsedResourcesSessionKey = "Telerik.Web.Examples.Scheduler.ResourceAvailability.DefaultCS";  
 
        private List<Resource> UsedResources  
        {  
            get  
            {  
                List<Resource> resources = Session[UsedResourcesSessionKey] as List<Resource>;  
                if (resources == null)  
                {  
                    resources = new List<Resource>();  
                    Session[UsedResourcesSessionKey] = resources;  
                }  
 
                return resources;  
            }  
        }  
 
        private void Page_Load(object sender, EventArgs e)  
        {  
            if (!IsPostBack)  
            {  
                UsedResources.Clear();  
            }  
        }  
 
        private void ReserveResources(ResourceCollection resources)  
        {  
            foreach (Resource res in resources)  
            {  
                if (!UsedResources.Contains(res))  
                {  
                    UsedResources.Add(res);  
                }  
            }  
        }  
 
        private void FreeResources(ResourceCollection resources)  
        {  
            foreach (Resource res in resources)  
            {  
                if (UsedResources.Contains(res))  
                {  
                    UsedResources.Remove(res);  
                }  
            }  
        }  
 
        protected void RadScheduler1_DataBound(object sender, EventArgs e)  
        {  
            foreach (Resource res in RadScheduler1.Resources)  
            {  
                res.Available = !UsedResources.Contains(res);  
            }  
 
            DisplayAvailableResources();  
        }  
 
        protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)  
        {  
            ReserveResources(e.Appointment.Resources);  
        }  
 
        protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)  
        {  
            ReserveResources(e.Appointment.Resources);  
        }  
 
        protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)  
        {  
            FreeResources(e.Appointment.Resources);  
            ReserveResources(e.ModifiedAppointment.Resources);  
        }  
 
        protected void RadScheduler1_AppointmentDelete(object sender, SchedulerCancelEventArgs e)  
        {  
            FreeResources(e.Appointment.Resources);  
        }  
 
        protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)  
        {  
            List<string> users = new List<string>();  
            foreach (Resource user in e.Appointment.Resources.GetResourcesByType("User"))  
            {  
                users.Add(user.Text);  
            }  
 
            Label assignedTo = (Label) e.Container.FindControl("AssignedTo");  
            if (users.Count > 0)  
            {  
                assignedTo.Text = "Assigned to: " + string.Join(", ", users.ToArray());  
            }  
            else  
            {  
                assignedTo.Text = "Not assigned.";  
            }  
 
            Resource room = e.Appointment.Resources.GetResourceByType("Room");  
            if (room != null)  
            {  
                Label location = (Label) e.Container.FindControl("Location");  
                location.Text = "Location: " + room.Text;  
            }  
        }  
 
        private void DisplayAvailableResources()  
        {  
            List<string> users = new List<string>();  
            foreach (Resource user in RadScheduler1.Resources.GetResourcesByType("User"))  
            {  
                if (user.Available)  
                {  
                    users.Add(user.Text);  
                }  
            }  
 
            AvailableUsers.Text = string.Join(", ", users.ToArray());  
 
            List<string> rooms = new List<string>();  
            foreach (Resource room in RadScheduler1.Resources.GetResourcesByType("Room"))  
            {  
                if (room.Available)  
                {  
                    rooms.Add(room.Text);  
                }  
            }  
 
            AvailableRooms.Text = string.Join(", ", rooms.ToArray());  
        }  
    }  
}  
 

AppointmentCreatedEventArgs and AppointmentUpdateEventArgs  are not part of the using Telerik.Web.UI;

and when I remove that part this error message shows up.

CS0117: 'Telerik.Web.UI.Resource' does not contain a definition for 'Available'

How would I update my sqldatasource with the scheduler?

2 Answers, 1 is accepted

Sort by
0
Nyceane
Top achievements
Rank 1
answered on 17 Nov 2007, 12:11 AM
someone please help
0
Peter
Telerik team
answered on 19 Nov 2007, 03:21 PM
Hello Peter,

Which version of Telerik Web.UI do you use? If you use the latest version, the problem is unusual. In this case, could you please open a support ticket and send us an isolated project which we can test locally?


Best wishes,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Nyceane
Top achievements
Rank 1
Answers by
Nyceane
Top achievements
Rank 1
Peter
Telerik team
Share this question
or