95 lines
2.9 KiB
C#
95 lines
2.9 KiB
C#
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<long>(),
|
|
new List<long>(),
|
|
new List<long>(),
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
false);
|
|
|
|
Model.Appointments = appointments;
|
|
|
|
Model.Resources = new List<object>();
|
|
|
|
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<SchedulerAppointmentDC>(SchedulerHelper.GetSchedulerSettings(), Model.Appointments);
|
|
var appointmentsToUpdate = SchedulerExtension.GetAppointmentsToUpdate<SchedulerAppointmentDC>(SchedulerHelper.GetSchedulerSettings(), Model.Appointments);
|
|
var appointmentsToRemove = SchedulerExtension.GetAppointmentsToRemove<SchedulerAppointmentDC>(SchedulerHelper.GetSchedulerSettings(), Model.Appointments);
|
|
}
|
|
|
|
[Authorize]
|
|
public override string SaveCollapsibleStatus(bool isOpen, string identifier)
|
|
{
|
|
Model.Collapsibles2IsShown[identifier] = isOpen;
|
|
|
|
return LeerzeichenFuerGetMethoden;
|
|
}
|
|
}
|
|
} |