Files
BeWoPlaner/Dakota/DakotaUtils.cs
Rene Evertz 2832bb9c5e Merge branch 'master' into feature_rene_18_ai - kein kommentar...
# Conflicts:
#	BeWo/BeWo.csproj
#	BeWo/BeWoApp.xaml.cs
#	BeWo/ServiceProxy/GeneratedAiEnhancedService.cs
#	BeWo/Services/BeWoControlFactory.cs
#	BeWo/Services/BeWoWindowFactory.cs
#	BeWo/Services/BeWoWindowService.cs
#	BeWo/Services/IControlFactory.cs
#	BeWo/Services/IWindowFactory.cs
#	BeWo/Services/IWindowService.cs
#	BeWo/View/BeWoFileView.xaml
#	BeWo/View/Detail/Report/AbwesenheitsView.xaml
#	BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs
#	BeWo/app.config
#	BeWoAllReports.sln
#	BeWoPlanerMobil.sln
#	BeWoPlanerMobil/.vs/BeWoPlanerMobil.csproj.dtbcache.json
#	BeWoTests.sln
#	Dakota/DakotaUtils.cs
#	Dakota/Logic/DakotaInfoCreator.cs
#	Dakota/Models/DakotaFile.cs
#	Data/Access/GenericDAO.cs
#	Data/Access/SearchDAO.cs
#	Data/Data.csproj
#	Host/Web.config
#	Server/Components/ServerUtils/ApiFacade/WebClientFacade.cs
#	Service/BeWoServiceEnums.cs
#	Service/Core/ServiceHelper.cs
#	Service/Core/ServiceValidator.cs
#	Service/Extensions/ServiceEnumExtension.cs
#	Service/Service.csproj
#	Service/ServiceContracts/Enhanced/IAiEnhancedService.cs
#	Service/ServiceContracts/Enhanced/IOperationsEnhancedService.cs
#	Service/ServiceImplementations/EmployeeServiceImp.cs
#	Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs
#	Service/ServiceImplementations/Enhanced/OperationsEnhancedServiceImp.cs
#	Service/ServiceProxy/OpenWebUIFacade.cs
#	Service/ServiceProxy/ServiceFacade.cs
#	Service/ServiceUtils/DistanceCalculator/GoogleDistanceMatrixAPI.cs
#	Shared/BeWoEntityEnums.cs
#	Shared/Core/AppError.cs
#	Shared/Core/Facade/WebClientFacade.cs
#	Shared/Core/WebClientFacade.cs
#	Shared/Shared.csproj
2025-11-28 12:07:35 +01:00

110 lines
3.1 KiB
C#

using BS.Shared.Core;
using BS.Shared.Exceptions;
using Dakota.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dakota
{
public static class DakotaUtils
{
public static string FillFromLeft(string input, int length, char filler)
{
if (input.Length > length)
return input;
if (input.Length == length)
return input;
var sb = new StringBuilder();
for (int i = 0; i < length - input.Length; i++)
{
sb.Append(filler);
}
sb.Append(input);
return sb.ToString();
}
public static string FillFromRight(string input, int length, char filler)
{
if (input.Length > length)
return input;
if (input.Length == length)
return input;
var sb = new StringBuilder();
sb.Append(input);
for (int i = 0; i < length - input.Length; i++)
{
sb.Append(filler);
}
return sb.ToString();
}
public static string GetAbrechnungscode(string leistungserbringergruppe)
{
var len = leistungserbringergruppe.Length;
if (len == 5)
{
return "69";
}
else if (len == 7)
{
return leistungserbringergruppe.Substring(0, 2);
}
else
{
throw new ArgumentException($"Leistungserbringergruppe \"{leistungserbringergruppe}\" hat ungültige Anzahl Stellen");
}
}
public static string GetTarifkennzeichen(string leistungserbringergruppe)
{
var len = leistungserbringergruppe.Length;
if (len == 5)
{
return leistungserbringergruppe;
}
else if (len == 7)
{
return leistungserbringergruppe.Substring(2);
// return leistungserbringergruppe.Substring(2, 5);
}
else
{
throw new ArgumentException($"Leistungserbringergruppe \"{leistungserbringergruppe}\" hat ungültige Anzahl Stellen");
}
}
public static string ClearTextString(string input)
{
foreach (var specialChar in DakotaConfig.SpecialCollection)
{
input = input.Replace(specialChar, DakotaConfig.Aufhebungszeichen + specialChar);
}
return input.Trim();
}
public static string GetVersichertenstatus(string versichertenStatus)
{
if (versichertenStatus.Length < 5)
return FillFromRight(versichertenStatus, 5, '0');
else if (versichertenStatus.Length == 5)
return versichertenStatus;
else if (versichertenStatus.Length == 7)
return versichertenStatus.Substring(0, 5);
else
throw new ArgumentException($"VersichertenStatus \"{versichertenStatus}\" ist ungültig.");
}
}
}