Files
BeWoPlaner/BeWoPlanerMobil/Models/AbstractModel.cs
Lyndon Jetten 9783999104 MoK:
Medikamentenlistenansicht ausgeblendet, wenn man nicht im Debug-Modus ist
5- und 7-tägige Ansicht implementiert

Fat-Client:
Das Ändern von Zeitelementen von Serienterminen ist nun möglich und es werden dabei auch keine Ausnahmen gelöscht.
2021-11-08 20:24:26 +01:00

122 lines
6.7 KiB
C#

using System.Collections.Generic;
using System.Linq;
using BeWoPlanerMobil.Service;
using BeWoPlanerMobil.Util;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
namespace BeWoPlanerMobil.Models
{
public class AbstractModel
{
public static bool IsDeleteBtnVisible => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_Delete);
public static bool IsAllowedToSeeScheduler => MobileSessionFacade.LoggedInUser != null && MobileSessionFacade.CheckForUserRight(UserRightType.KalenderAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll);
public static bool IsAllowedToSeeCustomers => MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll) || MobileSessionFacade.CheckForUserRight(UserRightType.CustomerView_View) || MobileSessionFacade.CheckForUserRight(UserRightType.Customer_ViewMyCustomers);
public static bool IsEmployeeSelectionVisible => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) || MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember);
public static bool HasRightForGroupBookings => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking);
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);
public EmployeeDC Employee { get; set; }
public string LoggedInEmplyeeFirstNameLastName => Employee != null ? $"{Employee.FirstName} {Employee.LastName}" : "BeWoPlaner";
public static bool HasRightToSeeAllSupportConcepts => MobileSessionFacade.CheckForUserRight(UserRightType.SupportConcept_ViewAllSupportConcepts) || MobileSessionFacade.CheckForUserRight(UserRightType.ViewAll);
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);
public static string TimeOfLastAction { get; set; }
public static bool HasRightToInsertRessourceAppointments => MobileSessionFacade.CheckForUserRight(UserRightType.KalenderRessourcentermineAnlegen) || MobileSessionFacade.CheckForUserRight(UserRightType.CreateAll);
public static bool IsAllowedToSeeBills
{
get
{
var mandator = new MobileSessionFacade().OperationsService.GetMandator();
var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowEmployeeSignature);
return MobileSessionFacade.CheckForUserRight(UserRightType.Analysis_ServiceOverview_View) && showEmployeeSignatureSetting != null && showEmployeeSignatureSetting.Equals("1");
}
}
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;
}
}
public static string UserSettings
{
get
{
var user = MobileSessionFacade.LoggedInUser;
return user?.SettingList.FirstOrDefault(f => f.Type.Equals(SettingsType.ApplicationSettings))?.Value;
}
}
public static bool IsAllowedToSeeCustomerFilter
{
get
{
var user = MobileSessionFacade.LoggedInUser;
if(user != null)
{
return
user.CheckForRight(UserRightType.ViewAll) ||
user.CheckForRight(UserRightType.Customer_ViewMyTeams);
}
return false;
}
}
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;
}
}
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);
}
}