2020-12-16 21:49:47 +01:00
|
|
|
|
using System.Collections.Generic;
|
2021-03-17 18:44:40 +01:00
|
|
|
|
using System.Linq;
|
2020-11-09 17:55:01 +01:00
|
|
|
|
using BeWoPlanerMobil.Service;
|
|
|
|
|
|
using BeWoPlanerMobil.Util;
|
2019-07-25 14:58:13 +02:00
|
|
|
|
using BS.Shared;
|
2021-03-17 19:51:48 +01:00
|
|
|
|
using BS.Shared.Core;
|
2020-02-07 15:21:36 +01:00
|
|
|
|
using BS.Shared.DataContracts;
|
2019-07-25 14:58:13 +02:00
|
|
|
|
|
|
|
|
|
|
namespace BeWoPlanerMobil.Models
|
|
|
|
|
|
{
|
|
|
|
|
|
public class AbstractModel
|
|
|
|
|
|
{
|
2020-06-29 19:24:24 +02:00
|
|
|
|
public static bool IsDeleteBtnVisible => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_Delete);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
|
2020-06-29 19:24:24 +02:00
|
|
|
|
public static bool IsAllowedToSeeScheduler => MobileSessionFacade.LoggedInUser != null && MobileSessionFacade.CheckForUserRight(UserRightType.KalenderAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll);
|
2019-07-29 19:40:14 +02:00
|
|
|
|
|
2020-06-29 19:24:24 +02:00
|
|
|
|
public static bool IsAllowedToSeeCustomers => MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll) || MobileSessionFacade.CheckForUserRight(UserRightType.CustomerView_View) || MobileSessionFacade.CheckForUserRight(UserRightType.Customer_ViewMyCustomers);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
|
|
|
|
|
|
public static bool IsEmployeeSelectionVisible => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) || MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightForGroupBookings => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking);
|
|
|
|
|
|
|
2019-07-29 19:40:14 +02:00
|
|
|
|
public static bool HasRightToSeeAllCustomerAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderKliententermineAlleAnsehen) && MobileSessionFacade.CheckForUserRight(UserRightType.CustomerView_View) || MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll);
|
|
|
|
|
|
public static bool HasRightToSeeAllEmployeeAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderMitarbeitertermineAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll);
|
|
|
|
|
|
public static bool HasRightToSeeAllResourceAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderRessourcentermineAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll);
|
2020-02-07 15:21:36 +01:00
|
|
|
|
|
|
|
|
|
|
public EmployeeDC Employee { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string LoggedInEmplyeeFirstNameLastName => Employee != null ? $"{Employee.FirstName} {Employee.LastName}" : "BeWoPlaner";
|
|
|
|
|
|
|
2020-12-16 21:49:47 +01:00
|
|
|
|
public static bool HasRightToSeeAllSupportConcepts => MobileSessionFacade.CheckForUserRight(UserRightType.SupportConcept_ViewAllSupportConcepts) || MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll);
|
2020-04-02 13:19:14 +02:00
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToSeeTextModules => MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineNurEigeneAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToSeeServiceRecords => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_View) && MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_Create);
|
2020-05-27 18:15:54 +02:00
|
|
|
|
|
|
|
|
|
|
public static string TimeOfLastAction { get; set; }
|
2020-06-29 19:24:24 +02:00
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToInsertRessourceAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderRessourcentermineAnlegen) || MobileSessionFacade.CheckForUserRight(UserRightType.CreateAll);
|
2020-11-09 17:55:01 +01:00
|
|
|
|
|
|
|
|
|
|
public static bool IsAllowedToSeeBills
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var mandator = new MobileSessionFacade().OperationsService.GetMandator();
|
|
|
|
|
|
|
2021-03-17 19:47:38 +01:00
|
|
|
|
var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowEmployeeSignature);
|
2020-11-09 17:55:01 +01:00
|
|
|
|
|
|
|
|
|
|
return MobileSessionFacade.CheckForUserRight(UserRightType.Analysis_ServiceOverview_View) && showEmployeeSignatureSetting != null && showEmployeeSignatureSetting.Equals("1");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-12-16 21:49:47 +01:00
|
|
|
|
|
|
|
|
|
|
public static bool IsAllowedToSeeSupportConceptFilter
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var user = MobileSessionFacade.LoggedInUser;
|
|
|
|
|
|
|
|
|
|
|
|
if(user != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return
|
|
|
|
|
|
user.CheckForAtLeastOneRight(new List<UserRightType> { UserRightType.ViewAll, UserRightType.SupportConcept_ViewAllSupportConcepts }) ||
|
|
|
|
|
|
user.CheckForRight(UserRightType.SupportConcept_ViewMyTeams);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-03-17 18:44:40 +01:00
|
|
|
|
|
|
|
|
|
|
public static string UserSettings
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var user = MobileSessionFacade.LoggedInUser;
|
|
|
|
|
|
|
|
|
|
|
|
return user?.SettingList.FirstOrDefault(f => f.Type.Equals(SettingsType.ApplicationSettings))?.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-04-19 04:38:29 +02:00
|
|
|
|
|
|
|
|
|
|
public static bool IsAllowedToSeeCustomerFilter
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var user = MobileSessionFacade.LoggedInUser;
|
|
|
|
|
|
|
|
|
|
|
|
if(user != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return
|
|
|
|
|
|
user.CheckForRight(UserRightType.ViewAll) ||
|
|
|
|
|
|
user.CheckForRight(UserRightType.Customer_ViewMyTeams);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-10-13 16:00:33 +02:00
|
|
|
|
|
|
|
|
|
|
public static bool IsAllowedToSeeMedikamentenliste
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var mandator = new MobileSessionFacade().OperationsService.GetMandator();
|
|
|
|
|
|
|
|
|
|
|
|
var hasSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowMedication) == "1";
|
|
|
|
|
|
|
|
|
|
|
|
var hasRight = MobileSessionFacade.CheckForUserRight(UserRightType.Customer_ViewMedication);
|
|
|
|
|
|
|
|
|
|
|
|
return hasSetting && hasRight;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-11-08 20:24:26 +01:00
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToInsertEmployeeAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderMitarbeitertermineAnlegen) || MobileSessionFacade.CheckForUserRight(UserRightType.CreateAll);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToEditEmployeeAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderMitarbeitertermineAendern) || MobileSessionFacade.CheckForUserRight(UserRightType.EditAll);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToEditResourceAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderRessourcentermineAendern) || MobileSessionFacade.CheckForUserRight(UserRightType.EditAll);
|
|
|
|
|
|
public static bool HasRightToEditOthersResourceAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderRessourcentermineAndererAendern) || MobileSessionFacade.CheckForUserRight(UserRightType.EditAll);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToInsertCustomerAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderKliententermineAnlegen) || MobileSessionFacade.CheckForUserRight(UserRightType.CreateAll);
|
|
|
|
|
|
public static bool HasRightToEditCustomerAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderKliententermineAendern) || MobileSessionFacade.CheckForUserRight(UserRightType.EditAll);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|