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?