Das Mehrfachbuchungsformular hat ebenfalls die Schnittmenge der Leistungen und Kategorien von den ausgewählten Hilfeplänen. Das Caching ist wieder aktiviert. Und lädt pro Post-Aufruf nur noch einmal 13 MB und danach nur noch 300 kb herunter. Überall konsequent geprüft, ob das Model nicht null ist und falls dem so ist, wird ausgeloggt, damit es zu keinen Fehlern mehr kommt.
110 lines
4.1 KiB
C#
110 lines
4.1 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.Web.Mvc;
|
|
using System.Web.Security;
|
|
using BeWo.Service.ServiceContracts;
|
|
using BeWoPlanerMobil.Models;
|
|
using BeWoPlanerMobil.Service;
|
|
using BeWoPlanerMobil.Util;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using ReportingService.ServiceContracts;
|
|
|
|
namespace BeWoPlanerMobil.Controllers
|
|
{
|
|
public abstract class AbstractBaseController : Controller
|
|
{
|
|
protected readonly ICustomerService CustomerService = new MobileSessionFacade().CustomerService;
|
|
protected readonly IOperationsService OperationsService = new MobileSessionFacade().OperationsService;
|
|
protected readonly IEmployeeService EmployeeService = new MobileSessionFacade().EmployeeService;
|
|
protected readonly IValueListService ValueListService = new MobileSessionFacade().ValueListService;
|
|
protected readonly IResourceService KalenderService = new MobileSessionFacade().ResourceService;
|
|
protected readonly IUserService UserService = new MobileSessionFacade().UserService;
|
|
protected readonly IDownloadService DownloadService = new MobileSessionFacade().DownloadService;
|
|
protected readonly IReportService ReportService = new MobileSessionFacade().ReportService;
|
|
protected readonly IQueryService QueryService = new MobileSessionFacade().QueryService;
|
|
|
|
protected const string LeerzeichenFuerGetMethoden = " ";
|
|
|
|
protected static readonly log4net.ILog Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
public static readonly string IsSessionTimedOut = "isSessionTimedOut";
|
|
|
|
|
|
protected ActionResult Logout()
|
|
{
|
|
#if DEBUG
|
|
Debug.WriteLine($"+++>Logout aufrufende Methode: {(new StackTrace()).GetFrame(1).GetMethod().Name}");
|
|
#endif
|
|
|
|
MobileSessionFacade.LogUserOut();
|
|
FormsAuthentication.SignOut();
|
|
|
|
AbstractModel.TimeOfLastAction = null;
|
|
|
|
return RedirectToActionPermanent("Index", "Login", new {tenant = MobileSessionFacade.Tenant});
|
|
}
|
|
|
|
protected UserDC GetUser()
|
|
{
|
|
return UserService.LoadUser(MobileSessionFacade.LoggedInUser.Oid.Value);
|
|
}
|
|
|
|
protected override void OnActionExecuting(ActionExecutingContext filterContext)
|
|
{
|
|
if(MobileSessionFacade.IsUserLoggedIn())
|
|
{
|
|
AbstractModel.TimeOfLastAction = $"{DateTime.Now:yyyy-MM-dd}T{DateTime.Now:HH:mm:ss}";
|
|
}
|
|
}
|
|
|
|
public static int TimeoutLimit
|
|
{
|
|
get
|
|
{
|
|
var timeUntilUILock = BS.Shared.Settings.ApplicationSettings.TimeUntilUILock;
|
|
|
|
if(timeUntilUILock > 0 && System.Web.HttpContext.Current.Session.Timeout > timeUntilUILock)
|
|
{
|
|
return timeUntilUILock;
|
|
}
|
|
|
|
return System.Web.HttpContext.Current.Session.Timeout;
|
|
}
|
|
}
|
|
|
|
[Authorize]
|
|
public ActionResult UpdateApplicationSettings(string pKey, string pValue)
|
|
{
|
|
var userSettings = GetUser().Settings;
|
|
|
|
UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, pKey, pValue, userSettings);
|
|
|
|
var loggedInUser = GetUser();
|
|
|
|
if(loggedInUser?.UserOid.HasValue ?? false)
|
|
{
|
|
UserService.UpdateUserSettings(loggedInUser.UserOid.Value, userSettings);
|
|
}
|
|
|
|
return RedirectToAction("Main");
|
|
}
|
|
|
|
[Authorize]
|
|
public void UpdateUserSettingsWithoutReload(string key, string value)
|
|
{
|
|
var userSettings = GetUser().Settings;
|
|
|
|
UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, key, value, userSettings);
|
|
|
|
var loggedInUser = GetUser();
|
|
|
|
if(loggedInUser?.UserOid.HasValue ?? false)
|
|
{
|
|
UserService.UpdateUserSettings(loggedInUser.UserOid.Value, userSettings);
|
|
}
|
|
}
|
|
}
|
|
}
|