Konflikte gelöst

This commit is contained in:
2025-06-12 15:42:52 +02:00
411 changed files with 33600 additions and 23215 deletions

View File

@@ -2,9 +2,13 @@
using System.Diagnostics;
using System.Web.Mvc;
using System.Web.Security;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts;
using BeWoPlanerMobil.Models;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
@@ -30,6 +34,8 @@ namespace BeWoPlanerMobil.Controllers
public static readonly string IsSessionTimedOut = "isSessionTimedOut";
private UserDC loggedInUserDc = null;
private EmployeeDC loggedInEmployeeDC = null;
protected ActionResult Logout()
{
@@ -45,9 +51,60 @@ namespace BeWoPlanerMobil.Controllers
return RedirectToActionPermanent("Index", "Login", new {tenant = MobileSessionFacade.Tenant});
}
protected UserDC GetUser()
protected virtual void InitModel(AbstractModel model)
{
return UserService.LoadUser(MobileSessionFacade.LoggedInUser.Oid.Value);
model.LoggedInUser = LoggedInUser;
model.LoggedInEmployee = LoggedInEmployee;
model.Mandator = Mandator;
if (model.SessionModel != null)
{
String sessionkey = model.GetType().Name;
if (Session[sessionkey] is null)
{
Session[sessionkey] = model.SessionModel;
}
else
{
model.SessionModel = (ISessionModel)Session[sessionkey];
}
}
}
protected UserDC LoggedInUser
{
get
{
if (loggedInUserDc == null)
{
var user = DAOFactory.GenericDAO.LoadByID<ApplicationUser>(MobileSessionFacade.LoggedInUserOid.Value);
loggedInUserDc = MapperFactory.UserDC_User.MapToNewDC(user);
loggedInEmployeeDC = MapperFactory.EmployeeDC_Employee.MapToNewDC(user.Employee);
}
return loggedInUserDc;
}
}
protected EmployeeDC LoggedInEmployee
{
get
{
if(loggedInEmployeeDC == null)
{
var tmp = LoggedInUser; //Sets employee
}
return loggedInEmployeeDC;
}
}
protected MokMandator Mandator
{
get
{
return MobileSessionFacade.Mandator;
}
}
protected override void OnActionExecuting(ActionExecutingContext filterContext)
@@ -63,15 +120,14 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public ActionResult UpdateApplicationSettings(string pKey, string pValue)
{
var userSettings = GetUser().Settings;
var userSettings = LoggedInUser.Settings;
UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, pKey, pValue, userSettings);
var loggedInUser = GetUser();
if(loggedInUser?.UserOid.HasValue ?? false)
if(LoggedInUser?.UserOid.HasValue ?? false)
{
UserService.UpdateUserSettings(loggedInUser.UserOid.Value, userSettings);
UserService.UpdateUserSettings(LoggedInUser.UserOid.Value, userSettings);
}
return RedirectToAction("Main");
@@ -80,11 +136,11 @@ namespace BeWoPlanerMobil.Controllers
[Authorize]
public void UpdateUserSettingsWithoutReload(string key, string value)
{
var userSettings = GetUser().Settings;
var userSettings = LoggedInUser.Settings;
UserSettingsUtils.SetSettingValue(SettingsType.ApplicationSettings, key, value, userSettings);
var loggedInUser = GetUser();
var loggedInUser = LoggedInUser;
if(loggedInUser?.UserOid.HasValue ?? false)
{