Files
BeWoPlaner/BeWo/DebugConfig.cs
Rene Evertz c5ba4bd0ad Kleines Mergechen
Merge branch 'feature_rene_18_ai'

# Conflicts:
#	BeWo/BeWo.csproj
#	BeWo/BeWoApp.xaml.cs
#	BeWo/ServiceProxy/GeneratedCustomerService.cs
#	BeWo/ServiceProxy/GeneratedEmployeeService.cs
#	BeWo/ServiceProxy/GeneratedOperationsService.cs
#	BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs
#	BeWo/View/Detail/EmployeeView.xaml
#	BeWo/app.config
#	BeWoAllReports.sln
#	BeWoPlanerMobil.sln
#	Data/Access/SearchDAO.cs
#	Data/Data.csproj
#	Data/Security/UserRightHelper.cs
#	Server/Components/AICore/Prompt/SystemPrompts/Examples/TranscriptionService.cs
#	Service/DCEntityMapper/GkvAbrechnungDC_GkvAbrechnung.cs
#	Service/ServiceImplementations/EmployeeServiceImp.cs
#	Shared/BeWoEntityEnums.cs
#	Shared/Core/EnumTranslations.cs
#	Shared/Core/GkvValidator.cs
#	Shared/Core/ValidatorExtended.cs
#	Shared/Shared.csproj
2026-02-20 16:36:41 +01:00

176 lines
4.5 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
namespace BeWo
{
public enum DebugConfigMode
{
SimpleAutoLogin,
FeatureCustomerWohnhilfe,
FeatureWohnheimWohneinheit,
FeatureAuswertungenQuittierungsbelege,
FeatureDakota,
FeatureXRechnung,
FeatureAiModule
}
public class DebugConfig
{
private static readonly string config_file_name = "DebugConfig.txt";
public static DebugConfig CurrentConfig { get; } = LoadCurrentDebugConfig();
/// <summary>
/// Wird verwendet, wenn keine DebugConfig geladen wurde oder DefaultProfilename empty ist
/// </summary>
public static string ServerUrl { get; set; }
//= "https://app5.bewoplaner.de/service";
= "http://localhost:3777/Host";
// = "http://178.63.79.124/service";
public DebugConfigMode DebugConfigMode { get; set; }
public string DefaultLoginUsername { get; set; }
public string DefaultLoginPassword { get; set; }
public string DefaultProfilename { get; set; }
public bool AutoLogin { get; set; }
public UIContext? SelectView { get; set; }
/// <summary>
/// Beschreibt den Index der jeweils gewählten View (UIContext)
///
/// Z.b.:
/// Customer:
/// - Details: 0
/// - ...: 1
/// - ...: 2
/// - ...: 3
/// - VermittlungArbeit: 4
/// - Wohnhilfe: 5
/// </summary>
public int? SelectIndex { get; set; }
public bool EnableAutoRemoteDebugging { get; set; }
public bool EnableAllUserRightsInDebug { get; set; } = false;
public static DebugConfig SimpleAutoLogin => new DebugConfig()
{
DebugConfigMode = DebugConfigMode.SimpleAutoLogin,
AutoLogin = !Environment.MachineName.Equals("OWNSOFT-JETTEN")
};
private static DebugConfig LoadCurrentDebugConfig()
{
#if DEBUG
try
{
var path = AppDomain.CurrentDomain.BaseDirectory;
var project_path = Directory.GetParent(path).Parent.Parent.FullName;
var config_path = Path.Combine(project_path, config_file_name);
if (!File.Exists(config_path))
return null;
var current_config = File.ReadAllText(config_path);
if (string.IsNullOrWhiteSpace(current_config))
return null;
var name2config = GetName2Config();
if (name2config.TryGetValue(current_config, out DebugConfig current))
{
return current;
}
}
catch (Exception)
{
}
#endif
return null;
}
#if DEBUG
private static Dictionary<string, DebugConfig> GetName2Config()
{
var name2config = new Dictionary<string, DebugConfig>();
name2config.Add("SimpleAutoLogin",
new DebugConfig()
{
DebugConfigMode = DebugConfigMode.SimpleAutoLogin,
AutoLogin = true
});
name2config.Add("FeatureCustomerWohnhilfe",
new DebugConfig()
{
DebugConfigMode = DebugConfigMode.FeatureCustomerWohnhilfe,
AutoLogin = true,
SelectView = UIContext.Customer,
SelectIndex = 5
});
name2config.Add("FeatureWohnheimWohneinheit",
new DebugConfig()
{
DebugConfigMode = DebugConfigMode.FeatureWohnheimWohneinheit,
AutoLogin = true,
SelectView = UIContext.Wohnheim
});
name2config.Add("FeatureAuswertungenQuittierungsbelege",
new DebugConfig()
{
DebugConfigMode = DebugConfigMode.FeatureAuswertungenQuittierungsbelege,
AutoLogin = true,
SelectView = UIContext.Report
});
name2config.Add("FeatureDakota",
new DebugConfig()
{
DebugConfigMode = DebugConfigMode.FeatureDakota,
AutoLogin = true,
//SelectView = UIContext.Organisation,
//SelectIndex = 8,
//DefaultLoginUsername = "admin",
//DefaultLoginPassword = "bewobewo",
//DefaultProfilename = "5000000000",
EnableAutoRemoteDebugging = true
});
name2config.Add("FeatureAiModule",
new DebugConfig()
{
DebugConfigMode = DebugConfigMode.FeatureAiModule,
AutoLogin = true,
//SelectView = UIContext.Administration,
//SelectIndex = 8,
//DefaultLoginUsername = "m1",
//DefaultLoginPassword = "bewobewo",
//DefaultProfilename = "5000000000",
EnableAutoRemoteDebugging = true
});
name2config.Add("FeatureXRechnung",
new DebugConfig()
{
DebugConfigMode = DebugConfigMode.FeatureXRechnung,
AutoLogin = true,
SelectView = UIContext.Finance,
SelectIndex = 7,
//DefaultLoginUsername = "m1",
//DefaultLoginPassword = "bewobewo",
//DefaultProfilename = "5000000000",
EnableAutoRemoteDebugging = true
});
return name2config;
}
#endif
}
}