using System.Linq; using BeWoPlanerMobil.Service; using BS.Shared; namespace BeWoPlanerMobil.Models { public class AbstractModel { public static bool IsEditBtnVisible { get { return MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Edit))); } } public static bool IsDeleteBtnVisible { get { return MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Delete))); } } public static bool IsAllowedToCreateOrEditRecord { get { return MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Create))) || MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Edit))); } } public static bool IsOnlyAllowedToEdit { get { return !MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Create))) && MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(f => f.RightType.Equals(UserRightType.ServiceRecordView_Edit))); } } public static bool IsAllowedToSeeScheduler { get { return MobileSessionFacade.LoggedInUser != null && MobileSessionFacade.LoggedInUser.UserGroups.Any(a => a.Rights.Any(right => right.RightType.Equals(UserRightType.KalenderAnsehen))); } } public static bool IsAllowedToSeeCustomers => 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 IsTextbausteineVisible => MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineAlleAnsehen) || MobileSessionFacade.CheckForUserRight(UserRightType.TextbausteineNurEigeneAnsehen); //public static bool IsTextbausteineVisible = false; public static bool HasRightForGroupBookings => MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking); public static int DropdownHeight { get; set; } 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); } }