using System; using System.Collections.Generic; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.Extensions; namespace BeWoPlanerMobil.Models { public class DevToolsModel : AbstractModel { // Rechtegruppen // Benutzer // Rechte und deren Übersetzungen // Mandatorsettings // Klienten, Mitarbeiter, Hilfepläne + Bewilligungen mit Zielen und gegebenenfalls individuelle Ziele erzeugen public List UserGroups { get; set; } = new List(); public List UserRightTypes { get; set; } = new List(); public List Users { get; set; } = new List(); public List Resources { get; set; } public MandatorSettings MandatorSettings { get => DevToolsSessionModel.MandatorSettings; set => DevToolsSessionModel.MandatorSettings = value; } public DevToolsSessionModel DevToolsSessionModel => SessionModel as DevToolsSessionModel; public DevToolsModel() { SessionModel = new DevToolsSessionModel(); } } public class MandatorSettings { public MandatorSettings(string settingsString) { var bananaSplit = settingsString.Split(';'); foreach(var setting2Value in bananaSplit) { var split2 = setting2Value.Split('='); this[split2[0]] = split2[1]; } } public object this[string propertyName] { get => typeof(MandatorSettings).GetPropertyValue(propertyName); set { var propertyInfo = typeof(MandatorSettings).GetProperty(propertyName); if(propertyInfo is null) { return; } if(value is null) { typeof(MandatorSettings).SetPropertyValue(propertyName, value); return; } var propertyType = propertyInfo.PropertyType; var valueToReplace = value; if(propertyType == typeof(bool)) { typeof(MandatorSettings).SetPropertyValue(propertyName, value.ToString() == "1"); } else { try { valueToReplace = Convert.ChangeType(value, propertyType); } catch(Exception exception) { valueToReplace = value; } finally { typeof(MandatorSettings).SetPropertyValue(propertyName, valueToReplace); var setValue = typeof(MandatorSettings).GetPropertyValue(propertyName); } } } } public Dictionary PossibleServiceRecordUnits { get; set; } = new Dictionary { {"0", "Minuten"}, {"1", "Stunden"}, {"2", "Stunden und Minuten"} }; public bool HideServiceRecordInsertedByAndInsertedOn { get; set; } public bool IsEndDateVisible { get; set; } public bool IsServiceRecordNoticeMandatory { get; set; } public bool IsZeiterfassDateNormal { get; set; } public bool SetStartTimeToEndTimeAfterSave { get; set; } public bool ShowAdditionalService { get; set; } public bool ShowAnnualReport { get; set; } public bool ShowArbeitszeiten { get; set; } public bool ShowBetrag { get; set; } public bool ShowChat { get; set; } public bool ShowCustomerDistanceFields { get; set; } public bool ShowDatevFields { get; set; } public bool ShowDienstplanung { get; set; } public bool ShowDistanceFields { get; set; } public bool ShowEmployeeSignature { get; set; } public bool ShowHilfeplanBezeichnung { get; set; } public bool ShowHilfeplanStatistikReport { get; set; } public bool ShowInfoButtonInCalender { get; set; } public bool ShowKlientenBetreuungszeiten { get; set; } public bool ShowMarker { get; set; } public bool ShowMedication { get; set; } public bool ShowMultipleResourceColors { get; set; } public bool ShowOnlyMySupportConcepts { get; set; } public bool ShowOwnChatSettings { get; set; } public bool ShowPivotGrid { get; set; } public bool ShowRoundedDurationInEmployeeAnalysis { get; set; } public bool ShowRtfTextfield { get; set; } public bool ShowScheduler { get; set; } public bool ShowServicesOverviewHalfOrWholeMonth { get; set; } public bool ShowSignature { get; set; } public bool ShowTeamNews { get; set; } public bool ShowUrlaubsplanung { get; set; } public bool ShowWohnheime { get; set; } public bool AllowStorno { get; set; } public bool DontShowSpitzabrechnung { get; set; } public bool IsOnlyYearMonthVisible { get; set; } public bool IsPasswordSecurityActiv { get; set; } public bool PrinterSettingsUseLandscape { get; set; } public bool PrinterSettingsUseMargins { get; set; } public bool PrinterSettingsUsePaperKind { get; set; } public bool ShowResources { get; set; } public int MaxDaysEditServiceRecordsAllowed { get; set; } public int ZeiterfassungsSchwellwert { get; set; } public int AnzTageZeiterfassErfolgt { get; set; } public int DienstplanungStandardZeilenAnzahl { get; set; } public int HilfeplanAuslaufAuswahl { get; set; } public int TimeUntilUILock { get; set; } public int EinheitZeiterfassung { get; set; } } }