<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadSchedulerSQLDataSource.aspx.cs" Inherits="RadSchedulerSQLDataSource" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
	<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
	<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
		<Scripts>
			<%--Needed for JavaScript IntelliSense in VS2010--%>
			<%--For VS2008 replace RadScriptManager with ScriptManager--%>
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
			<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
		</Scripts>
	</telerik:RadScriptManager>
	<script type="text/javascript">
		//Put your JavaScript code here.
    </script>
	<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
	    <AjaxSettings>
	        <telerik:AjaxSetting AjaxControlID="RadScheduler1">
	            <UpdatedControls>
	                <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
	            </UpdatedControls>
	        </telerik:AjaxSetting>
	    </AjaxSettings>
	</telerik:RadAjaxManager>
	<telerik:RadScheduler runat="server" ID="RadScheduler1" 
        DataDescriptionField="Description" DataEndField="End" DataKeyField="ID" 
        DataRecurrenceField="RecurrenceRule" 
        DataRecurrenceParentKeyField="RecurrenceParentID" DataReminderField="Reminder" 
        DataSourceID="SqlDataSource4" DataStartField="Start" DataSubjectField="Subject" 
        EnableDescriptionField="True" Height="" SelectedView="TimelineView" 
        GroupBy="Rooms" GroupingDirection="Vertical" 
        OnAppointmentInsert="RadScheduler1_AppointmentInsert">
        <ResourceTypes>
            <telerik:ResourceType DataSourceID="SqlDataSource2" ForeignKeyField="RoomID" 
                KeyField="ID" Name="Rooms" TextField="RoomName" />
            <telerik:ResourceType DataSourceID="SqlDataSource3" ForeignKeyField="UserID" 
                KeyField="ID" Name="Users" TextField="UserName" />
        </ResourceTypes>
        <Reminders Enabled="True" />
        <TimelineView SortingMode="Global" />
    </telerik:RadScheduler>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID" 
        InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [UserID], [RoomID], [RecurrenceRule], [RecurrenceParentID], [Annotations], [Description], [Reminder], [LastModified], [TimeZoneID], [Completed], [CategoryID], [ClientID]) VALUES (@Subject, @Start, @End, @UserID, @RoomID, @RecurrenceRule, @RecurrenceParentID, @Annotations, @Description, @Reminder, @LastModified, @TimeZoneID, @Completed, @CategoryID, @ClientID)" 
        SelectCommand="SELECT * FROM [Appointments]" 
        UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [UserID] = @UserID, [RoomID] = @RoomID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Annotations] = @Annotations, [Description] = @Description, [Reminder] = @Reminder, [LastModified] = @LastModified, [TimeZoneID] = @TimeZoneID, [Completed] = @Completed, [CategoryID] = @CategoryID, [ClientID] = @ClientID WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Subject" Type="String" />
            <asp:Parameter Name="Start" Type="DateTime" />
            <asp:Parameter Name="End" Type="DateTime" />
            <asp:Parameter Name="UserID" Type="Int32" />
            <asp:Parameter Name="RoomID" Type="Int32" />
            <asp:Parameter Name="RecurrenceRule" Type="String" />
            <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
            <asp:Parameter Name="Annotations" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Reminder" Type="String" />
            <asp:Parameter Name="LastModified" Type="String" />
            <asp:Parameter Name="TimeZoneID" Type="String" />
            <asp:Parameter Name="Completed" Type="String" />
            <asp:Parameter Name="CategoryID" Type="Int32" />
            <asp:Parameter Name="ClientID" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Subject" Type="String" />
            <asp:Parameter Name="Start" Type="DateTime" />
            <asp:Parameter Name="End" Type="DateTime" />
            <asp:Parameter Name="UserID" Type="Int32" />
            <asp:Parameter Name="RoomID" Type="Int32" />
            <asp:Parameter Name="RecurrenceRule" Type="String" />
            <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
            <asp:Parameter Name="Annotations" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Reminder" Type="String" />
            <asp:Parameter Name="LastModified" Type="String" />
            <asp:Parameter Name="TimeZoneID" Type="String" />
            <asp:Parameter Name="Completed" Type="String" />
            <asp:Parameter Name="CategoryID" Type="Int32" />
            <asp:Parameter Name="ClientID" Type="Int32" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT * FROM [Users]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT * FROM [Rooms]"></asp:SqlDataSource>
    
    </form>
</body>
</html>
