using System.Windows;

using BS.Shared.DataContracts.Compact;

using DevExpress.Xpf.Scheduler;
using DevExpress.Xpf.Scheduler.UI;
using DevExpress.XtraScheduler;

namespace BeWo.Scheduler.View
{
	public partial class CommonCalendarEditForm
	{
		public CommonCalendarEditForm(SchedulerControl schedulerControl, Appointment appointment)
			: base(schedulerControl, appointment)
		{
			InitializeComponent();
		}

		public override AppointmentFormController CreateFormController(SchedulerControl schedulerControl, Appointment appointment)
		{
			return new CommonCalendarFormController(schedulerControl, appointment);
		}

		public CommonCalendarFormController CommonCalendarController { get { return Controller as CommonCalendarFormController; } }

		private void button_cancel_Click(object sender, RoutedEventArgs e)
		{
			Cancel();
		}
	}

	public class CommonCalendarFormController : AppointmentFormController
	{
		public CompactCustomerDC Customer
		{
			get
			{
				return (CompactCustomerDC)EditedAppointmentCopy.CustomFields["CustomerOid"];
			}
			set
			{
				EditedAppointmentCopy.CustomFields["CustomerOid"] = value;
			}
		}

		public CompactSupportConceptDC SupportConcept
		{
			get
			{
				return (CompactSupportConceptDC)EditedAppointmentCopy.CustomFields["SupportConcept"];
			}
			set
			{
				EditedAppointmentCopy.CustomFields["SupportConcept"] = value;
			}
		}

		public CommonCalendarFormController(SchedulerControl control, Appointment apt) : base(control, apt)
		{
		}
	}
}
