97 lines
3.4 KiB
C#
97 lines
3.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.ServiceContracts;
|
|
using BeWo.Service.ServiceImplementations;
|
|
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using ReportingService.ServiceContracts;
|
|
using ReportingService.ServiceImplementations;
|
|
|
|
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();
|
|
}
|
|
|
|
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 static ApplicationUser LoggedInUser
|
|
{
|
|
get => HttpContext.Current.Session["apuser"] as ApplicationUser;
|
|
|
|
set => HttpContext.Current.Session["apuser"] = value;
|
|
}
|
|
|
|
public static string EmployeeFullname => LoggedInUser != null ? LoggedInUser.Employee.Person.FirstNameLastName : string.Empty;
|
|
|
|
public static EmployeeDC LoggedInEmployee => LoggedInUser == null ? null : MapperFactory.EmployeeDC_Employee.MapToNewDC(LoggedInUser.Employee);
|
|
|
|
public static CompactEmployeeDC LoggedInCompactEmployee => LoggedInUser == null ? null : MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(LoggedInUser.Employee);
|
|
|
|
public static UserDC LoggedInUserDC => LoggedInUser == null ? null : MapperFactory.UserDC_User.MapToNewDC(LoggedInUser);
|
|
|
|
public static List<SettingsDC> UserSettings => LoggedInUserDC.Settings;
|
|
|
|
public static string Tenant
|
|
{
|
|
get => HttpContext.Current.Session["tenant"] as string;
|
|
|
|
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;
|
|
}
|
|
|
|
public static void LogUserOut()
|
|
{
|
|
HttpContext.Current.Session["apuser"] = null;
|
|
HttpContext.Current.Session.Abandon();
|
|
}
|
|
|
|
public static bool CheckForUserRight(UserRightType userRightType)
|
|
{
|
|
return LoggedInUser != null && LoggedInUser.UserGroups.Any(ug => ug.Rights.Any(rr => rr.RightType.Equals(userRightType)));
|
|
}
|
|
|
|
public static string CookieName => "tenantKeks";
|
|
|
|
public static int PasswordStrength;
|
|
}
|
|
} |