#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.4200
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;



[System.Data.Linq.Mapping.DatabaseAttribute(Name="Telerik")]
public partial class TelerikSchedulerDataContext : System.Data.Linq.DataContext
{
	
	private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
	
  #region Extensibility Method Definitions
  partial void OnCreated();
  partial void InsertAppointment(Appointment instance);
  partial void UpdateAppointment(Appointment instance);
  partial void DeleteAppointment(Appointment instance);
  partial void InsertRoom(Room instance);
  partial void UpdateRoom(Room instance);
  partial void DeleteRoom(Room instance);
  #endregion
	
	public TelerikSchedulerDataContext() : 
			base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, mappingSource)
	{
		OnCreated();
	}
	
	public TelerikSchedulerDataContext(string connection) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public TelerikSchedulerDataContext(System.Data.IDbConnection connection) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public TelerikSchedulerDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public TelerikSchedulerDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 
			base(connection, mappingSource)
	{
		OnCreated();
	}
	
	public System.Data.Linq.Table<Appointment> Appointments
	{
		get
		{
			return this.GetTable<Appointment>();
		}
	}
	
	public System.Data.Linq.Table<Room> Rooms
	{
		get
		{
			return this.GetTable<Room>();
		}
	}
	
	[Function(Name="dbo.AppointmentsFilteredByRoom")]
	public ISingleResult<AppointmentsFilteredByRoomResult> AppointmentsFilteredByRoom([Parameter(Name="RoomID", DbType="Int")] System.Nullable<int> roomID)
	{
		IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), roomID);
		return ((ISingleResult<AppointmentsFilteredByRoomResult>)(result.ReturnValue));
	}
	
	[Function(Name="dbo.insertAppointment1")]
	public int insertAppointment1([Parameter(Name="Subject", DbType="NVarChar(255)")] string subject, [Parameter(Name="Start", DbType="DateTime")] System.Nullable<System.DateTime> start, [Parameter(Name="End", DbType="DateTime")] System.Nullable<System.DateTime> end, [Parameter(Name="RoomID", DbType="Int")] System.Nullable<int> roomID, [Parameter(Name="RecurrenceRule", DbType="NVarChar(1024)")] string recurrenceRule, [Parameter(Name="RecurrenceParentID", DbType="Int")] System.Nullable<int> recurrenceParentID)
	{
		IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), subject, start, end, roomID, recurrenceRule, recurrenceParentID);
		return ((int)(result.ReturnValue));
	}
	
	[Function(Name="dbo.updateAppointment")]
	public int updateAppointment([Parameter(Name="ID", DbType="Int")] System.Nullable<int> iD, [Parameter(Name="Subject", DbType="NVarChar(255)")] string subject, [Parameter(Name="Start", DbType="DateTime")] System.Nullable<System.DateTime> start, [Parameter(Name="End", DbType="DateTime")] System.Nullable<System.DateTime> end, [Parameter(Name="RoomID", DbType="Int")] System.Nullable<int> roomID, [Parameter(Name="RecurrenceRule", DbType="NVarChar(1024)")] string recurrenceRule, [Parameter(Name="RecurrenceParentID", DbType="Int")] System.Nullable<int> recurrenceParentID)
	{
		IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), iD, subject, start, end, roomID, recurrenceRule, recurrenceParentID);
		return ((int)(result.ReturnValue));
	}
	
	[Function(Name="dbo.deleteAppointment")]
	public int deleteAppointment([Parameter(Name="ID", DbType="Int")] System.Nullable<int> iD)
	{
		IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), iD);
		return ((int)(result.ReturnValue));
	}
}

[Table(Name="dbo.Appointments")]
public partial class Appointment : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _ID;
	
	private string _Subject;
	
	private System.DateTime _Start;
	
	private System.DateTime _End;
	
	private System.Nullable<int> _UserID;
	
	private System.Nullable<int> _RoomID;
	
	private string _RecurrenceRule;
	
	private System.Nullable<int> _RecurrenceParentID;
	
	private string _Annotations;
	
	private string _DayBetween;
	
	private string _TicklerCode;
	
	private EntitySet<Appointment> _Appointments;
	
	private EntityRef<Appointment> _Appointment1;
	
	private EntityRef<Room> _Room;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnIDChanging(int value);
    partial void OnIDChanged();
    partial void OnSubjectChanging(string value);
    partial void OnSubjectChanged();
    partial void OnStartChanging(System.DateTime value);
    partial void OnStartChanged();
    partial void OnEndChanging(System.DateTime value);
    partial void OnEndChanged();
    partial void OnUserIDChanging(System.Nullable<int> value);
    partial void OnUserIDChanged();
    partial void OnRoomIDChanging(System.Nullable<int> value);
    partial void OnRoomIDChanged();
    partial void OnRecurrenceRuleChanging(string value);
    partial void OnRecurrenceRuleChanged();
    partial void OnRecurrenceParentIDChanging(System.Nullable<int> value);
    partial void OnRecurrenceParentIDChanged();
    partial void OnAnnotationsChanging(string value);
    partial void OnAnnotationsChanged();
    partial void OnDayBetweenChanging(string value);
    partial void OnDayBetweenChanged();
    partial void OnTicklerCodeChanging(string value);
    partial void OnTicklerCodeChanged();
    #endregion
	
	public Appointment()
	{
		this._Appointments = new EntitySet<Appointment>(new Action<Appointment>(this.attach_Appointments), new Action<Appointment>(this.detach_Appointments));
		this._Appointment1 = default(EntityRef<Appointment>);
		this._Room = default(EntityRef<Room>);
		OnCreated();
	}
	
	[Column(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
	public int ID
	{
		get
		{
			return this._ID;
		}
		set
		{
			if ((this._ID != value))
			{
				this.OnIDChanging(value);
				this.SendPropertyChanging();
				this._ID = value;
				this.SendPropertyChanged("ID");
				this.OnIDChanged();
			}
		}
	}
	
	[Column(Storage="_Subject", DbType="NVarChar(255) NOT NULL", CanBeNull=false)]
	public string Subject
	{
		get
		{
			return this._Subject;
		}
		set
		{
			if ((this._Subject != value))
			{
				this.OnSubjectChanging(value);
				this.SendPropertyChanging();
				this._Subject = value;
				this.SendPropertyChanged("Subject");
				this.OnSubjectChanged();
			}
		}
	}
	
	[Column(Storage="_Start", DbType="DateTime NOT NULL")]
	public System.DateTime Start
	{
		get
		{
			return this._Start;
		}
		set
		{
			if ((this._Start != value))
			{
				this.OnStartChanging(value);
				this.SendPropertyChanging();
				this._Start = value;
				this.SendPropertyChanged("Start");
				this.OnStartChanged();
			}
		}
	}
	
	[Column(Name="[End]", Storage="_End", DbType="DateTime NOT NULL")]
	public System.DateTime End
	{
		get
		{
			return this._End;
		}
		set
		{
			if ((this._End != value))
			{
				this.OnEndChanging(value);
				this.SendPropertyChanging();
				this._End = value;
				this.SendPropertyChanged("End");
				this.OnEndChanged();
			}
		}
	}
	
	[Column(Storage="_UserID", DbType="Int")]
	public System.Nullable<int> UserID
	{
		get
		{
			return this._UserID;
		}
		set
		{
			if ((this._UserID != value))
			{
				this.OnUserIDChanging(value);
				this.SendPropertyChanging();
				this._UserID = value;
				this.SendPropertyChanged("UserID");
				this.OnUserIDChanged();
			}
		}
	}
	
	[Column(Storage="_RoomID", DbType="Int")]
	public System.Nullable<int> RoomID
	{
		get
		{
			return this._RoomID;
		}
		set
		{
			if ((this._RoomID != value))
			{
				if (this._Room.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnRoomIDChanging(value);
				this.SendPropertyChanging();
				this._RoomID = value;
				this.SendPropertyChanged("RoomID");
				this.OnRoomIDChanged();
			}
		}
	}
	
	[Column(Storage="_RecurrenceRule", DbType="NVarChar(1024)")]
	public string RecurrenceRule
	{
		get
		{
			return this._RecurrenceRule;
		}
		set
		{
			if ((this._RecurrenceRule != value))
			{
				this.OnRecurrenceRuleChanging(value);
				this.SendPropertyChanging();
				this._RecurrenceRule = value;
				this.SendPropertyChanged("RecurrenceRule");
				this.OnRecurrenceRuleChanged();
			}
		}
	}
	
	[Column(Storage="_RecurrenceParentID", DbType="Int")]
	public System.Nullable<int> RecurrenceParentID
	{
		get
		{
			return this._RecurrenceParentID;
		}
		set
		{
			if ((this._RecurrenceParentID != value))
			{
				if (this._Appointment1.HasLoadedOrAssignedValue)
				{
					throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
				}
				this.OnRecurrenceParentIDChanging(value);
				this.SendPropertyChanging();
				this._RecurrenceParentID = value;
				this.SendPropertyChanged("RecurrenceParentID");
				this.OnRecurrenceParentIDChanged();
			}
		}
	}
	
	[Column(Storage="_Annotations", DbType="NVarChar(50)")]
	public string Annotations
	{
		get
		{
			return this._Annotations;
		}
		set
		{
			if ((this._Annotations != value))
			{
				this.OnAnnotationsChanging(value);
				this.SendPropertyChanging();
				this._Annotations = value;
				this.SendPropertyChanged("Annotations");
				this.OnAnnotationsChanged();
			}
		}
	}
	
	[Column(Storage="_DayBetween", DbType="NVarChar(50)")]
	public string DayBetween
	{
		get
		{
			return this._DayBetween;
		}
		set
		{
			if ((this._DayBetween != value))
			{
				this.OnDayBetweenChanging(value);
				this.SendPropertyChanging();
				this._DayBetween = value;
				this.SendPropertyChanged("DayBetween");
				this.OnDayBetweenChanged();
			}
		}
	}
	
	[Column(Storage="_TicklerCode", DbType="NVarChar(50)")]
	public string TicklerCode
	{
		get
		{
			return this._TicklerCode;
		}
		set
		{
			if ((this._TicklerCode != value))
			{
				this.OnTicklerCodeChanging(value);
				this.SendPropertyChanging();
				this._TicklerCode = value;
				this.SendPropertyChanged("TicklerCode");
				this.OnTicklerCodeChanged();
			}
		}
	}
	
	[Association(Name="Appointment_Appointment", Storage="_Appointments", ThisKey="ID", OtherKey="RecurrenceParentID")]
	public EntitySet<Appointment> Appointments
	{
		get
		{
			return this._Appointments;
		}
		set
		{
			this._Appointments.Assign(value);
		}
	}
	
	[Association(Name="Appointment_Appointment", Storage="_Appointment1", ThisKey="RecurrenceParentID", OtherKey="ID", IsForeignKey=true)]
	public Appointment Appointment1
	{
		get
		{
			return this._Appointment1.Entity;
		}
		set
		{
			Appointment previousValue = this._Appointment1.Entity;
			if (((previousValue != value) 
						|| (this._Appointment1.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._Appointment1.Entity = null;
					previousValue.Appointments.Remove(this);
				}
				this._Appointment1.Entity = value;
				if ((value != null))
				{
					value.Appointments.Add(this);
					this._RecurrenceParentID = value.ID;
				}
				else
				{
					this._RecurrenceParentID = default(Nullable<int>);
				}
				this.SendPropertyChanged("Appointment1");
			}
		}
	}
	
	[Association(Name="Room_Appointment", Storage="_Room", ThisKey="RoomID", OtherKey="ID", IsForeignKey=true)]
	public Room Room
	{
		get
		{
			return this._Room.Entity;
		}
		set
		{
			Room previousValue = this._Room.Entity;
			if (((previousValue != value) 
						|| (this._Room.HasLoadedOrAssignedValue == false)))
			{
				this.SendPropertyChanging();
				if ((previousValue != null))
				{
					this._Room.Entity = null;
					previousValue.Appointments.Remove(this);
				}
				this._Room.Entity = value;
				if ((value != null))
				{
					value.Appointments.Add(this);
					this._RoomID = value.ID;
				}
				else
				{
					this._RoomID = default(Nullable<int>);
				}
				this.SendPropertyChanged("Room");
			}
		}
	}
	
	public event PropertyChangingEventHandler PropertyChanging;
	
	public event PropertyChangedEventHandler PropertyChanged;
	
	protected virtual void SendPropertyChanging()
	{
		if ((this.PropertyChanging != null))
		{
			this.PropertyChanging(this, emptyChangingEventArgs);
		}
	}
	
	protected virtual void SendPropertyChanged(String propertyName)
	{
		if ((this.PropertyChanged != null))
		{
			this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
		}
	}
	
	private void attach_Appointments(Appointment entity)
	{
		this.SendPropertyChanging();
		entity.Appointment1 = this;
	}
	
	private void detach_Appointments(Appointment entity)
	{
		this.SendPropertyChanging();
		entity.Appointment1 = null;
	}
}

[Table(Name="dbo.Rooms")]
public partial class Room : INotifyPropertyChanging, INotifyPropertyChanged
{
	
	private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
	
	private int _ID;
	
	private string _RoomName;
	
	private EntitySet<Appointment> _Appointments;
	
    #region Extensibility Method Definitions
    partial void OnLoaded();
    partial void OnValidate(System.Data.Linq.ChangeAction action);
    partial void OnCreated();
    partial void OnIDChanging(int value);
    partial void OnIDChanged();
    partial void OnRoomNameChanging(string value);
    partial void OnRoomNameChanged();
    #endregion
	
	public Room()
	{
		this._Appointments = new EntitySet<Appointment>(new Action<Appointment>(this.attach_Appointments), new Action<Appointment>(this.detach_Appointments));
		OnCreated();
	}
	
	[Column(Storage="_ID", DbType="Int NOT NULL", IsPrimaryKey=true)]
	public int ID
	{
		get
		{
			return this._ID;
		}
		set
		{
			if ((this._ID != value))
			{
				this.OnIDChanging(value);
				this.SendPropertyChanging();
				this._ID = value;
				this.SendPropertyChanged("ID");
				this.OnIDChanged();
			}
		}
	}
	
	[Column(Storage="_RoomName", DbType="NVarChar(255) NOT NULL", CanBeNull=false)]
	public string RoomName
	{
		get
		{
			return this._RoomName;
		}
		set
		{
			if ((this._RoomName != value))
			{
				this.OnRoomNameChanging(value);
				this.SendPropertyChanging();
				this._RoomName = value;
				this.SendPropertyChanged("RoomName");
				this.OnRoomNameChanged();
			}
		}
	}
	
	[Association(Name="Room_Appointment", Storage="_Appointments", ThisKey="ID", OtherKey="RoomID")]
	public EntitySet<Appointment> Appointments
	{
		get
		{
			return this._Appointments;
		}
		set
		{
			this._Appointments.Assign(value);
		}
	}
	
	public event PropertyChangingEventHandler PropertyChanging;
	
	public event PropertyChangedEventHandler PropertyChanged;
	
	protected virtual void SendPropertyChanging()
	{
		if ((this.PropertyChanging != null))
		{
			this.PropertyChanging(this, emptyChangingEventArgs);
		}
	}
	
	protected virtual void SendPropertyChanged(String propertyName)
	{
		if ((this.PropertyChanged != null))
		{
			this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
		}
	}
	
	private void attach_Appointments(Appointment entity)
	{
		this.SendPropertyChanging();
		entity.Room = this;
	}
	
	private void detach_Appointments(Appointment entity)
	{
		this.SendPropertyChanging();
		entity.Room = null;
	}
}

public partial class AppointmentsFilteredByRoomResult
{
	
	private int _ID;
	
	private string _Subject;
	
	private System.DateTime _Start;
	
	private System.DateTime _End;
	
	private System.Nullable<int> _UserID;
	
	private System.Nullable<int> _RoomID;
	
	private string _RecurrenceRule;
	
	private System.Nullable<int> _RecurrenceParentID;
	
	private string _Annotations;
	
	private string _DayBetween;
	
	private string _TicklerCode;
	
	public AppointmentsFilteredByRoomResult()
	{
	}
	
	[Column(Storage="_ID", DbType="Int NOT NULL")]
	public int ID
	{
		get
		{
			return this._ID;
		}
		set
		{
			if ((this._ID != value))
			{
				this._ID = value;
			}
		}
	}
	
	[Column(Storage="_Subject", DbType="NVarChar(255) NOT NULL", CanBeNull=false)]
	public string Subject
	{
		get
		{
			return this._Subject;
		}
		set
		{
			if ((this._Subject != value))
			{
				this._Subject = value;
			}
		}
	}
	
	[Column(Storage="_Start", DbType="DateTime NOT NULL")]
	public System.DateTime Start
	{
		get
		{
			return this._Start;
		}
		set
		{
			if ((this._Start != value))
			{
				this._Start = value;
			}
		}
	}
	
	[Column(Name="[End]", Storage="_End", DbType="DateTime NOT NULL")]
	public System.DateTime End
	{
		get
		{
			return this._End;
		}
		set
		{
			if ((this._End != value))
			{
				this._End = value;
			}
		}
	}
	
	[Column(Storage="_UserID", DbType="Int")]
	public System.Nullable<int> UserID
	{
		get
		{
			return this._UserID;
		}
		set
		{
			if ((this._UserID != value))
			{
				this._UserID = value;
			}
		}
	}
	
	[Column(Storage="_RoomID", DbType="Int")]
	public System.Nullable<int> RoomID
	{
		get
		{
			return this._RoomID;
		}
		set
		{
			if ((this._RoomID != value))
			{
				this._RoomID = value;
			}
		}
	}
	
	[Column(Storage="_RecurrenceRule", DbType="NVarChar(1024)")]
	public string RecurrenceRule
	{
		get
		{
			return this._RecurrenceRule;
		}
		set
		{
			if ((this._RecurrenceRule != value))
			{
				this._RecurrenceRule = value;
			}
		}
	}
	
	[Column(Storage="_RecurrenceParentID", DbType="Int")]
	public System.Nullable<int> RecurrenceParentID
	{
		get
		{
			return this._RecurrenceParentID;
		}
		set
		{
			if ((this._RecurrenceParentID != value))
			{
				this._RecurrenceParentID = value;
			}
		}
	}
	
	[Column(Storage="_Annotations", DbType="NVarChar(50)")]
	public string Annotations
	{
		get
		{
			return this._Annotations;
		}
		set
		{
			if ((this._Annotations != value))
			{
				this._Annotations = value;
			}
		}
	}
	
	[Column(Storage="_DayBetween", DbType="NVarChar(50)")]
	public string DayBetween
	{
		get
		{
			return this._DayBetween;
		}
		set
		{
			if ((this._DayBetween != value))
			{
				this._DayBetween = value;
			}
		}
	}
	
	[Column(Storage="_TicklerCode", DbType="NVarChar(50)")]
	public string TicklerCode
	{
		get
		{
			return this._TicklerCode;
		}
		set
		{
			if ((this._TicklerCode != value))
			{
				this._TicklerCode = value;
			}
		}
	}
}
#pragma warning restore 1591
