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 (!MobileSessionFacade.IsUserLoggedIn()) { Logout(); return null; } if (_Model == null) { _Model = new DevExpressSchedulerModel(); InitModel(_Model); } //if (((DevExpressSchedulerModel)Session["DevExpressSchedulerModel"])?.LoggedInEmployee is null) //{ // _Model = new DevExpressSchedulerModel(); // InitModel(_Model); // Session["DevExpressSchedulerModel"] = _Model; //} //else //{ // _Model = (DevExpressSchedulerModel)Session["DevExpressSchedulerModel"]; //} return _Model; } } [Authorize] public ActionResult DevExpressScheduler() { if (!MobileSessionFacade.IsUserLoggedIn() || Model == 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; 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) { Model.Collapsibles2IsShown[identifier] = isOpen; return LeerzeichenFuerGetMethoden; } } }