diff --git a/BeWoPlanerMobil/Controllers/LoginController.cs b/BeWoPlanerMobil/Controllers/LoginController.cs index 3103008d8..220359324 100644 --- a/BeWoPlanerMobil/Controllers/LoginController.cs +++ b/BeWoPlanerMobil/Controllers/LoginController.cs @@ -52,8 +52,10 @@ namespace BeWoPlanerMobil.Controllers } Log.Info($"LoginController.Index(): Loggedin User: {MobileSessionFacade.LoggedInUser.LoginName}"); + + MobileSessionFacade.Mandator = OperationsService.GetMandator(); - var viewServiceRecords = AbstractModel.HasRightToSeeServiceRecords;//AbstractModel.CheckRight(UserRightType.ServiceRecordView_View); + var viewServiceRecords = AbstractModel.HasRightToSeeServiceRecords;//AbstractModel.CheckRight(UserRightType.ServiceRecordView_View); var viewAll = AbstractModel.CheckRight(UserRightType.ViewAll); var user = UserService.LoadUser(MobileSessionFacade.LoggedInUser.Oid.Value); @@ -140,7 +142,8 @@ namespace BeWoPlanerMobil.Controllers } - public ActionResult Index(string tenant, string returnUrl) + + public ActionResult Index(string tenant, string returnUrl) { if(returnUrl != null) { diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index e60f94cc5..f5c254e90 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -70,20 +70,6 @@ namespace BeWoPlanerMobil.Controllers private static readonly List Zieltypen = new List { ValueListEntryType.SupportConceptGoalCategoryType, ValueListEntryType.SupportConceptIndividualGoalCategoryType }; private static readonly List Massnahmentypen = new List { ValueListEntryType.SupportConceptGoalType, ValueListEntryType.SupportConceptIndividualGoalType }; - private MandatorDC GetMandator() - { - var mandator = (MandatorDC) HttpContext.Session["mandator"]; - - if(!(mandator is null)) - { - return mandator; - } - - mandator = OperationsService.GetMandator(); - HttpContext.Session["mandator"] = mandator; - - return mandator; - } [Authorize] public ActionResult Main() @@ -104,7 +90,7 @@ namespace BeWoPlanerMobil.Controllers if(Model.Mandator is null) { - Model.Mandator = GetMandator(); + Model.Mandator = MobileSessionFacade.Mandator; var mokSessionTimeout = UserSettingsUtils.GetSettingValueAsInteger(Model.Mandator.Settings, SettingsKeys.MoKSessionTimeout, 20); @@ -2424,7 +2410,7 @@ namespace BeWoPlanerMobil.Controllers } } - var mandator = GetMandator(); + var mandator = MobileSessionFacade.Mandator; var maxDaysEditSRsAllowedString = GetSettingValue(mandator.Settings, SettingsKeys.MaxDaysEditServiceRecordsAllowed); var limitFuerZeiterfassungString = GetSettingValue(mandator.Settings, SettingsKeys.AnzTageZeiterfassErfolgt); diff --git a/BeWoPlanerMobil/Models/AbstractModel.cs b/BeWoPlanerMobil/Models/AbstractModel.cs index b5f75863b..b2d632035 100644 --- a/BeWoPlanerMobil/Models/AbstractModel.cs +++ b/BeWoPlanerMobil/Models/AbstractModel.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Web; using BeWoPlanerMobil.Service; using BeWoPlanerMobil.Util; using BS.Shared; @@ -46,7 +47,7 @@ namespace BeWoPlanerMobil.Models { get { - var mandator = new MobileSessionFacade().OperationsService.GetMandator(); + var mandator = MobileSessionFacade.Mandator; var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowSignature); #if DEBUG @@ -89,7 +90,7 @@ namespace BeWoPlanerMobil.Models { get { - var mandator = new MobileSessionFacade().OperationsService.GetMandator(); + var mandator = MobileSessionFacade.Mandator; var hasSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowMedication) == "1"; diff --git a/BeWoPlanerMobil/Service/MobileSessionFacade.cs b/BeWoPlanerMobil/Service/MobileSessionFacade.cs index f424316cf..d355558d9 100644 --- a/BeWoPlanerMobil/Service/MobileSessionFacade.cs +++ b/BeWoPlanerMobil/Service/MobileSessionFacade.cs @@ -67,6 +67,13 @@ namespace BeWoPlanerMobil.Service set => HttpContext.Current.Session["tenant"] = value; } + public static MandatorDC Mandator + { + get => HttpContext.Current.Session["mandator"] as MandatorDC; + + set => HttpContext.Current.Session["mandator"] = value; + } + public static bool IsUserLoggedIn() { return LoggedInUser != null; diff --git a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml index 812ed9897..4379558ce 100644 --- a/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml +++ b/BeWoPlanerMobil/Views/Main/SingleBookingPartial.cshtml @@ -304,7 +304,7 @@
- @Html.PopupWithSearchForIFilterables(Model.AllEmployees, "setSelectedEmployeeForSingleBooking", null, Model.SelectedEmployee?.DetailDescription, "single-booking-employee-modal-popup") + @Html.PopupWithSearchForIFilterables(Model.Employees, "setSelectedEmployeeForSingleBooking", null, Model.SelectedEmployee?.DetailDescription, "single-booking-employee-modal-popup")