ServiceRecord-Fremdschlüssel zu NewSchedulerAppointment-Tabelle hinzugefügt. Funktionalität ist noch nicht implementiert. MoK: Ziele/Maßnahmen verbessert; Suche funktioniert jetzt richtig Mehrfachbuchung implementiert Kalender: Termine sind jetzt löschbar, wenn Recht zu bearbeiten vorhanden ist. Unterscheidung zwischen Mitarbeiter-, Klienten-, und Ressourcenauswahl bei Ansicht und Formular
140 lines
6.8 KiB
C#
140 lines
6.8 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 => CheckRight(UserRightType.ServiceRecordView_Delete);
|
|
|
|
public static bool IsAllowedToSeeScheduler => MobileSessionFacade.LoggedInUser != null && CheckRight(UserRightType.KalenderAnsehen) || CheckRight(UserRightType.ViewAll);
|
|
|
|
public static bool IsAllowedToSeeCustomers => CheckRight(UserRightType.ViewAll) || CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.Customer_ViewMyCustomers);
|
|
|
|
public static bool IsEmployeeSelectionVisible => CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherEmployees) || CheckRight(UserRightType.ServiceRecord_AllowCreationForOtherTeamMember);
|
|
|
|
public static bool HasRightForGroupBookings => CheckRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking);
|
|
|
|
public static bool HasRightToViewCustomerAppointments => CheckRight(UserRightType.KalenderKliententermineAlleAnsehen) && CheckRight(UserRightType.CustomerView_View) || CheckRight(UserRightType.ViewAll);
|
|
public static bool HasRightToViewEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnsehen) || CheckRight(UserRightType.ViewAll);
|
|
public static bool HasRightToViewAllResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnsehen) || CheckRight(UserRightType.ViewAll);
|
|
|
|
public EmployeeDC Employee { get; set; }
|
|
|
|
public string LoggedInEmplyeeFirstNameLastName => Employee != null ? $"{Employee.FirstName} {Employee.LastName}" : "BeWoPlaner";
|
|
|
|
public static bool HasRightToSeeAllSupportConcepts => CheckRight(UserRightType.SupportConcept_ViewAllSupportConcepts) || CheckRight(UserRightType.ViewAll);
|
|
|
|
public static bool HasRightToSeeTextModules => CheckRight(UserRightType.TextbausteineNurEigeneAnsehen) || CheckRight(UserRightType.TextbausteineAlleAnsehen);
|
|
|
|
public static bool HasRightToSeeServiceRecords => CheckRight(UserRightType.ServiceRecordView_View) && CheckRight(UserRightType.ServiceRecordView_Create);
|
|
|
|
public static string TimeOfLastAction { get; set; }
|
|
|
|
public static bool HasRightToInsertRessourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAnlegen) || CheckRight(UserRightType.CreateAll);
|
|
|
|
public static bool IsAllowedToSeeBills
|
|
{
|
|
get
|
|
{
|
|
var mandator = new MobileSessionFacade().OperationsService.GetMandator();
|
|
|
|
var showEmployeeSignatureSetting = MobileUtils.GetSettingValue(mandator.Settings, SettingsKeys.ShowEmployeeSignature);
|
|
|
|
return CheckRight(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 = CheckRight(UserRightType.Customer_ViewMedication);
|
|
|
|
return hasSetting && hasRight;
|
|
}
|
|
}
|
|
|
|
public static bool CheckRight(UserRightType userRightType)
|
|
{
|
|
return MobileSessionFacade.CheckForUserRight(userRightType);
|
|
}
|
|
|
|
public static bool HasRightToInsertEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAnlegen) ||
|
|
CheckRight(UserRightType.CreateAll);
|
|
|
|
public static bool HasRightToEditEmployeeAppointments => CheckRight(UserRightType.KalenderMitarbeitertermineAendern) || CheckRight(UserRightType.EditAll);
|
|
|
|
public static bool HasRightToEditResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAendern) || CheckRight(UserRightType.EditAll);
|
|
public static bool HasRightToEditOthersResourceAppointments => CheckRight(UserRightType.KalenderRessourcentermineAndererAendern) || CheckRight(UserRightType.EditAll);
|
|
|
|
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);
|
|
|
|
public static bool ShowServiceRecordInsertedOn { get; set; }
|
|
|
|
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);
|
|
}
|
|
} |