using System; using System.Collections.Generic; using System.Web.Mvc; using BeWoPlanerMobil.Models; using BeWoPlanerMobil.Service; using BeWoPlanerMobil.Views.DevExpressScheduler; using BS.Shared.DataContracts; using DevExpress.Web.Mvc; namespace BeWoPlanerMobil.Controllers { public class DevExpressSchedulerController : AbstractBaseController { private DevExpressSchedulerModel _Model; public DevExpressSchedulerModel Model { get { if(false == MobileSessionFacade.IsUserLoggedIn()) { Logout(); return null; } if(_Model != null) { return _Model; } _Model = new DevExpressSchedulerModel(); InitModel(_Model); return _Model; } } [Authorize] public ActionResult DevExpressScheduler() { if(!MobileSessionFacade.IsUserLoggedIn() || Model is null) { return RedirectToActionPermanent("Index", "Login"); } var appointments = KalenderService.LoadFilteredAppointments( true, Model.LoggedInEmployee?.EmployeeOid ?? 1, DateTime.Today.AddDays(-60), DateTime.Today.AddDays(60), new List(), new List(), new List(), false, false, false, false, false); Model.Appointments = appointments; Model.Resources = new List(); return View(Model); } [Authorize] public ActionResult SchedulerPagePartial() { return PartialView("SchedulerPagePartial", Model); } [Authorize] public ActionResult EditAppointment() { UpdateAppointment(); return PartialView("SchedulerPagePartial", Model); } [Authorize] private void UpdateAppointment() { var appointmentsToInsert = SchedulerExtension.GetAppointmentsToInsert(SchedulerHelper.GetSchedulerSettings(), Model.Appointments); var appointmentsToUpdate = SchedulerExtension.GetAppointmentsToUpdate(SchedulerHelper.GetSchedulerSettings(), Model.Appointments); var appointmentsToRemove = SchedulerExtension.GetAppointmentsToRemove(SchedulerHelper.GetSchedulerSettings(), Model.Appointments); } [Authorize] public override string SaveCollapsibleStatus(bool isOpen, string identifier) { return SaveCollapsibleStatusToModel(Model, isOpen, identifier); } } }