using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

namespace Telerik.Web.Examples.Scheduler.AdvancedFormTemplate
{
	public partial class AdvancedForm : UserControl
	{
		protected RadScheduler Owner
		{
			get
			{
				return Appointment.Owner;
			}
		}

		protected Appointment Appointment
		{
			get
			{
				SchedulerFormContainer container = (SchedulerFormContainer) BindingContainer;
				return container.Appointment;
			}
		}


		#region Properties forwarded to SchedulerDefaultForm user control

		[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
		public string Subject
		{
			get
			{
				return SchedulerDefaultForm1.Subject;
			}

			set
			{
				SchedulerDefaultForm1.Subject = value;
			}
		}

		[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
		public DateTime Start
		{
			get
			{
				return SchedulerDefaultForm1.Start;
			}

			set
			{
				SchedulerDefaultForm1.Start = value;
			}
		}

		[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
		public DateTime End
		{
			get
			{
				return SchedulerDefaultForm1.End;
			}

			set
			{
				SchedulerDefaultForm1.End = value;
			}
		}

		[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
		public string RecurrenceRuleText
		{
			get
			{
				return SchedulerDefaultForm1.RecurrenceRuleText;
			}

			set
			{
				SchedulerDefaultForm1.RecurrenceRuleText = value;
			}
		}

		/// <summary>
		/// Gets a value indicating whether recurrence exceptions should be reset.
		/// </summary>
		/// <value><c>true</c> if recurrence exceptions should be reset; otherwise, <c>false</c>.</value>
		public bool ResetExceptions
		{
			get
			{
				CheckBox ResetExceptions = (CheckBox) SchedulerDefaultForm1.FindControl("ResetExceptions");
				return Owner.RecurrenceSupport ? ResetExceptions.Checked : false;
			}
		}

		#endregion

		#region Attributes and resources

		[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
		public string Description
		{
			get
			{
				return SchedulerDefaultForm1.Description;
			}

			set
			{
				SchedulerDefaultForm1.Description = value;
			}
		}

		[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
		public object RoomID
		{
			get
			{
				return ResourceControl1.Value;
			}

			set
			{
				ResourceControl1.Value = value;
			}
		}

		[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
		public object UserID
		{
			get
			{
				return ResourceControl2.Value;
			}

			set
			{
				ResourceControl2.Value = value;
			}
		}

		#endregion

		protected void Page_Load(object sender, EventArgs e)
		{
            if (Owner.OverflowBehavior == OverflowBehavior.Scroll)
            {
                AdvancedEditOptionsPanel.CssClass += " rsScrollingContent";
            }
		}
	}
}