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
|
|
|
|
|
|
{
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool IsDeleteBtnVisible => CheckRight(UserRightType.ServiceRecordView_Delete);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool IsAllowedToSeeScheduler => MobileSessionFacade.LoggedInUser != null && CheckRight(UserRightType.KalenderAnsehen) || CheckRight(UserRightType.ViewAll);
|
2019-07-29 19:40:14 +02:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool IsAllowedToSeeCustomers => CheckRight(UserRightType.ViewAll) || CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool IsEmployeeSelectionVisible => CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) || CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightForGroupBookings => CheckRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
|
2023-03-16 13:57:04 +01:00
|
|
|
|
public static bool HasRightToViewCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAlleAnsehen) || CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers) || CheckRight(UserRightType.Customer_ViewMyTeams);
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToViewEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnsehen) || CheckRight(UserRightType.ViewAll);
|
|
|
|
|
|
public static bool HasRightToViewAllResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnsehen) || CheckRight(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";
|
|
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToSeeAllSupportConcepts => CheckRight(UserRightType.SupportConcept_ViewAllSupportConcepts) || CheckRight(UserRightType.ViewAll);
|
2020-04-02 13:19:14 +02:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToSeeTextModules => CheckRight(UserRightType.TextbausteineNurEigeneAnsehen) || CheckRight(UserRightType.TextbausteineAlleAnsehen);
|
2023-03-29 15:49:20 +02:00
|
|
|
|
public static bool HasRightToSeeOwnTextModules => CheckRight(UserRightType.TextbausteineNurEigeneAnsehen);
|
|
|
|
|
|
public static bool HasRightToSeeGlobalTextModules => CheckRight(UserRightType.TextbausteineAlleAnsehen);
|
2020-04-02 13:19:14 +02:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToSeeServiceRecords => CheckRight(UserRightType.ServiceRecordView_View) && CheckRight(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
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToInsertRessourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnlegen) || CheckRight(UserRightType.CreateAll);
|
2020-11-09 17:55:01 +01:00
|
|
|
|
|
|
|
|
|
|
public static bool IsAllowedToSeeBills
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var mandator = new MobileSessionFacade().OperationsService.GetMandator();
|
|
|
|
|
|
|
2023-01-17 00:12:33 +01:00
|
|
|
|
var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowSignature);
|
2020-11-09 17:55:01 +01:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
return CheckRight(UserRightType.Analysis_ServiceOverview_View) && showEmployeeSignatureSetting != null && showEmployeeSignatureSetting.Equals("1");
|
2020-11-09 17:55:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
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";
|
|
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
var hasRight = CheckRight(UserRightType.Customer_ViewMedication);
|
2021-10-13 16:00:33 +02:00
|
|
|
|
|
|
|
|
|
|
return hasSetting && hasRight;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-11-08 20:24:26 +01:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool CheckRight(UserRightType userRightType)
|
|
|
|
|
|
{
|
|
|
|
|
|
return MobileSessionFacade.CheckForUserRight(userRightType);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToInsertEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnlegen) ||
|
|
|
|
|
|
CheckRight(UserRightType.CreateAll);
|
2021-11-08 20:24:26 +01:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToEditEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAendern) || CheckRight(UserRightType.EditAll);
|
2021-11-08 20:24:26 +01:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToEditResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAendern) || CheckRight(UserRightType.EditAll);
|
|
|
|
|
|
public static bool HasRightToEditOthersResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAndererAendern) || CheckRight(UserRightType.EditAll);
|
2021-11-08 20:24:26 +01:00
|
|
|
|
|
2022-12-30 16:28:23 +01:00
|
|
|
|
public static bool HasRightToInsertCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAnlegen) &&
|
|
|
|
|
|
(CheckRight(UserRightType.CustomerView_View) ||
|
|
|
|
|
|
CheckRight(UserRightType.Customer_ViewMyCustomers) ||
|
|
|
|
|
|
CheckRight(UserRightType.Customer_ViewMyTeams)) ||
|
|
|
|
|
|
CheckRight(UserRightType.CreateAll);
|
|
|
|
|
|
public static bool HasRightToEditCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAendern) || CheckRight(UserRightType.EditAll);
|
2022-10-11 16:48:36 +02:00
|
|
|
|
|
|
|
|
|
|
public static bool ShowServiceRecordInsertedOn { get; set; }
|
2022-12-30 16:28:23 +01:00
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToViewCustomerSelectionInScheduler => CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers) || CheckRight(UserRightType.Customer_ViewMyTeams);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToViewTeams => CheckRight(UserRightType.TeamView_ViewMyTeams) || CheckRight(UserRightType.TeamView_ViewAll);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightForMultiBooking => CheckRight(UserRightType.ServiceRecord_AllowCreatingMultiBooking);
|
2023-01-26 12:55:56 +01:00
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToDeleteReceiptSignatures => CheckRight(UserRightType.ConfirmationReceiptSignatures_Delete);
|
|
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToRateGoals => CheckRight(UserRightType.BewertenInZeiterfassung);
|
2023-04-04 19:30:03 +02:00
|
|
|
|
|
|
|
|
|
|
public static bool HasRightToEditCustomers => CheckRight(UserRightType.CustomerView_Edit);
|
2019-07-25 14:58:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|