Files
BeWoPlaner/BeWoPlanerMobil/Service/MobileSessionFacade.cs
2026-06-29 13:45:41 +02:00

131 lines
4.4 KiB
C#

using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceContracts.Enhanced;
using BeWo.Service.ServiceImplementations;
using BeWo.Service.ServiceImplementations.Enhanced;
using BeWoPlanerMobil.Models;
using ReportingService.ServiceContracts;
using ReportingService.ServiceImplementations;
using System.Web;
namespace BeWoPlanerMobil.Service
{
public class MobileSessionFacade
{
public MobileSessionFacade()
{
CustomerService = new CustomerServiceImp();
EmployeeService = new EmployeeServiceImp();
OperationsService = new OperationsServiceImp();
ResourceService = new ResourceServiceImp();
AnalysisService = new AnalysisServiceImp();
ValueListService = new ValueListServiceImp();
UserService = new UserServiceImp();
DownloadService = new DownloadServiceImp();
ReportService = new ReportServiceImp();
QueryService = new QueryServiceImp();
AiService = new AiEnhancedServiceImp();
}
public ICustomerService CustomerService { get; }
public IEmployeeService EmployeeService { get; }
public IOperationsService OperationsService { get; }
public IValueListService ValueListService { get; }
public ResourceServiceImp ResourceService { get; }
public IAnalysisService AnalysisService { get; }
public IUserService UserService { get; }
public IDownloadService DownloadService { get; }
public IReportService ReportService { get; }
public IQueryService QueryService { get; }
public IAiEnhancedService AiService { get; }
public static long? LoggedInUserOid
{
get => HttpContext.Current.Session["LoggedInUserOid"] as long?;
set => HttpContext.Current.Session["LoggedInUserOid"] = value;
}
public static long? LoggedInEmployeeOid
{
get => HttpContext.Current.Session["LoggedInEmployeeOid"] as long?;
set => HttpContext.Current.Session["LoggedInEmployeeOid"] = value;
}
//public static UserDC LoggedInUser
//{
// get => HttpContext.Current.Session["apuser"] as UserDC;
// set => HttpContext.Current.Session["apuser"] = value;
//}
//public static EmployeeDC LoggedInEmployee
//{
// get => HttpContext.Current.Session["LoggedInEmployee"] as EmployeeDC;
// set => HttpContext.Current.Session["LoggedInEmployee"] = value;
//}
//public static string EmployeeFullname => LoggedInUser != null ? LoggedInUser.Employee.FirstNameLastName : string.Empty;
// public static CompactEmployeeDC LoggedInCompactEmployee => LoggedInUser == null ? null : LoggedInUser.Employee;
// public static List<SettingsDC> UserSettings => LoggedInUser.Settings;
public static string LocalStorageKey => LoggedInUserOid.HasValue ? $"bwp_{Tenant}_{LoggedInUserOid}" : null;
public static string EmployeeFullname
{
get => HttpContext.Current.Session["EmployeeFullname"] as string;
set => HttpContext.Current.Session["EmployeeFullname"] = value;
}
public static string Tenant
{
get => HttpContext.Current.Session["tenant"] as string;
set => HttpContext.Current.Session["tenant"] = value;
}
public static string TimeOfLastAction
{
get => HttpContext.Current.Session["TimeOfLastAction"] as string;
set => HttpContext.Current.Session["TimeOfLastAction"] = value;
}
//public long? MandatorOid
//{
// get => HttpContext.Current.Session["MandatorOid"] as long?;
// set => HttpContext.Current.Session["MandatorOid"] = value;
//}
public static MokMandator Mandator
{
get => HttpContext.Current.Session["mandator"] as MokMandator;
set => HttpContext.Current.Session["mandator"] = value;
}
public static bool IsUserLoggedIn()
{
return LoggedInUserOid.HasValue;
}
public static void LogUserOut()
{
HttpContext.Current.Session["LoggedInUserOid"] = null;
HttpContext.Current.Session.Abandon();
}
//public static bool CheckForUserRight(UserRightType userRightType)
//{
// return LoggedInUser != null && LoggedInUser.UserGroups.Any(ug => ug.Rights.Any(rr => rr.Equals(userRightType)));
//}
public static string CookieName => "tenantKeks";
public static int PasswordStrength;
}
}