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
This commit is contained in:
@@ -11,16 +11,45 @@ namespace BS.Shared.Core
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Message { get; set; }
|
||||
public Dictionary<string, string> Arguments { get; set; }
|
||||
public List<AppError> InnerErrors { get; set; }
|
||||
|
||||
public string Displayname => $"AppError {Code}: {Message}";
|
||||
|
||||
// Private damit zentral alle Errors
|
||||
private AppError(string code, string message)
|
||||
private AppError(string code, string message, Dictionary<string, string> arguments = null, List<AppError> innerErrors = null)
|
||||
{
|
||||
Code = code;
|
||||
Message = message;
|
||||
Arguments = arguments;
|
||||
InnerErrors = innerErrors;
|
||||
}
|
||||
|
||||
//public static readonly AppError Example = new AppError("Code", "Message");
|
||||
public AppError()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Muster:
|
||||
// - public static readonly AppError Example = new AppError("Code", "Message");
|
||||
// - Usage: var error = AppError.Example;
|
||||
// Oder mit Abhängigkeit:
|
||||
// - public static Func<object1, object2, ..., AppError> ExampleFunc = (obj1, obj2, ...) => new AppError(...);
|
||||
// - Usage: var error = AppError.ExampleFunc(obj1, obj2, ...);
|
||||
|
||||
/// <summary>
|
||||
/// Tenant ist in Anfrage null oder unbekannt
|
||||
/// </summary>
|
||||
public static AppError MultitenancyOperationTenantUnknown => new AppError("SERV.HLP.10001", "Tenant unbekannt");
|
||||
|
||||
/// <summary>
|
||||
/// Logger Ordner kann nicht gefunden werden. Hinweis: Web.config
|
||||
/// </summary>
|
||||
public static AppError LoggerPathDoNotExist => new AppError("SERV.LOG.10002", "Server falsch konfiguriert");
|
||||
|
||||
public static AppError FileNameInvalidChar => new AppError("DATA.LFS.60001", "Fehler beim Speichern");
|
||||
public static AppError FileNameNotEqFilePath => new AppError("DATA.LFS.60002", "Fehler beim Speichern");
|
||||
public static AppError StoredFileAlreadyExists => new AppError("DATA.LFS.60003", "Fehler beim Speichern");
|
||||
|
||||
|
||||
public static readonly AppError ApiResponseFailed = new AppError("API.100001", "Api Fehler");
|
||||
|
||||
58
Shared/Core/BeWoFault.cs
Normal file
58
Shared/Core/BeWoFault.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace BS.Shared.Core
|
||||
{
|
||||
public enum BeWoFaultType
|
||||
{
|
||||
Unknown,
|
||||
Concurrency,
|
||||
DeleteNotPossible,
|
||||
LoginNameTaken,
|
||||
CustomWithoutDetails
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class BeWoFault
|
||||
{
|
||||
public BeWoFault(Exception ex)
|
||||
{
|
||||
this.Message = ex.Message;
|
||||
this.StackTrace = ex.StackTrace;
|
||||
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
this.InnerExceptionMessage = ex.InnerException.Message;
|
||||
this.InnerExceptionStackTrace = ex.InnerException.StackTrace;
|
||||
}
|
||||
|
||||
this.FaultType = BeWoFaultType.Unknown;
|
||||
}
|
||||
|
||||
public BeWoFault(string pMessage)
|
||||
: this(pMessage, BeWoFaultType.Unknown)
|
||||
{
|
||||
}
|
||||
|
||||
public BeWoFault(string pMessage, BeWoFaultType pFaultType)
|
||||
{
|
||||
this.Message = pMessage;
|
||||
this.FaultType = pFaultType;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public BeWoFaultType FaultType { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string InnerExceptionMessage { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string InnerExceptionStackTrace { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string Message { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string StackTrace { get; set; }
|
||||
}
|
||||
}
|
||||
84
Shared/Core/Facade/HttpClientFacade.cs
Normal file
84
Shared/Core/Facade/HttpClientFacade.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Core.Facade
|
||||
{
|
||||
public class HttpClientFacade
|
||||
{
|
||||
public string Base_Url { get; set; }
|
||||
public HttpMethod Method { get; set; } = HttpMethod.Get;
|
||||
public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();
|
||||
public Dictionary<string, string> Parameters { get; set; } = new Dictionary<string, string>();
|
||||
public string ContentType { get; set; } = "application/x-www-form-urlencoded";
|
||||
public Encoding Encoding { get; set; } = Encoding.UTF8;
|
||||
public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30);
|
||||
|
||||
public HttpClientFacade(string base_url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(base_url))
|
||||
throw new ArgumentNullException("HttpClient: base_url is missing");
|
||||
|
||||
Base_Url = base_url;
|
||||
}
|
||||
|
||||
public virtual async Task<byte[]> SendAsync(string method)
|
||||
{
|
||||
using (var client = new HttpClient { Timeout = Timeout })
|
||||
{
|
||||
var requestUri = Utilities.WebUtils.CombineUrl(Base_Url, method);
|
||||
|
||||
if (Method == HttpMethod.Get && Parameters.Count > 0)
|
||||
{
|
||||
var query = string.Join("&", Parameters.Select(p => $"{Uri.EscapeDataString(p.Key)}={Uri.EscapeDataString(p.Value)}"));
|
||||
requestUri += (Base_Url.Contains("?") ? "&" : "?") + query;
|
||||
}
|
||||
|
||||
using (var request = new HttpRequestMessage(Method, requestUri))
|
||||
{
|
||||
// Add headers
|
||||
foreach (var header in Headers)
|
||||
request.Headers.TryAddWithoutValidation(header.Key, header.Value);
|
||||
|
||||
// Add body if POST or PUT
|
||||
if (Method == HttpMethod.Post || Method == HttpMethod.Put)
|
||||
{
|
||||
var content = new FormUrlEncodedContent(Parameters);
|
||||
var bytes = await content.ReadAsByteArrayAsync().ConfigureAwait(false);
|
||||
request.Content = new ByteArrayContent(bytes);
|
||||
request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(ContentType);
|
||||
}
|
||||
|
||||
var response = await client.SendAsync(request).ConfigureAwait(false);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var responseBytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
|
||||
|
||||
return responseBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetToken(string token)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(token))
|
||||
throw new ArgumentNullException("HttpClient: base_url is missing");
|
||||
|
||||
var key = nameof(HttpRequestHeader.Authorization);
|
||||
|
||||
if (Headers.ContainsKey(key))
|
||||
{
|
||||
Headers[key] = token;
|
||||
}
|
||||
else
|
||||
{
|
||||
Headers.Add(key, token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Shared/Core/Facade/JsonHttpClientFacade.cs
Normal file
51
Shared/Core/Facade/JsonHttpClientFacade.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Core.Facade
|
||||
{
|
||||
public class JsonHttpClientFacade : HttpClientFacade
|
||||
{
|
||||
public object JsonObject { get; set; }
|
||||
|
||||
public JsonHttpClientFacade(string base_url) : base(base_url)
|
||||
{
|
||||
ContentType = "application/json";
|
||||
Method = HttpMethod.Post;
|
||||
}
|
||||
|
||||
public override async Task<byte[]> SendAsync(string method)
|
||||
{
|
||||
using (var client = new HttpClient { Timeout = Timeout })
|
||||
{
|
||||
var requestUri = Utilities.WebUtils.CombineUrl(Base_Url, method);
|
||||
|
||||
using (var request = new HttpRequestMessage(Method, requestUri))
|
||||
{
|
||||
// Add headers
|
||||
foreach (var header in Headers)
|
||||
request.Headers.TryAddWithoutValidation(header.Key, header.Value);
|
||||
|
||||
// Add body if POST or PUT
|
||||
if (Method == HttpMethod.Post || Method == HttpMethod.Put)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(JsonObject);
|
||||
request.Content = new StringContent(json, Encoding, "application/json");
|
||||
}
|
||||
|
||||
var response = await client.SendAsync(request).ConfigureAwait(false);
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var responseBytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
|
||||
|
||||
return responseBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Core
|
||||
{
|
||||
public static class Validator
|
||||
public static class GkvValidator
|
||||
{
|
||||
public static bool? IsValid(ValidationType val_type, string val_str)
|
||||
{
|
||||
@@ -72,7 +73,7 @@ namespace BS.Shared.Core
|
||||
if (mandatordc == null)
|
||||
throw new GkvException("Mandator ist null");
|
||||
|
||||
if (!Validator.IsIKNumberValid(mandatordc.IKLeistungserbringer))
|
||||
if (!IsIKNumberValid(mandatordc.IKLeistungserbringer))
|
||||
throw new GkvException($"Die IK Nummer des Leistungserbringers \"{mandatordc.IKLeistungserbringer}\" ist ungültig.");
|
||||
}
|
||||
public static void ValidateCustomer(CustomerDC customerDC)
|
||||
@@ -109,16 +110,35 @@ namespace BS.Shared.Core
|
||||
if (error != null)
|
||||
throw new GkvException(error);
|
||||
}
|
||||
public static bool IsOrganisationInformationValid(IOrganisation orga)
|
||||
public static string ValidateInvoiceBases(IEnumerable<IInvoiceBase> invoices)
|
||||
{
|
||||
foreach (var invoice in invoices)
|
||||
{
|
||||
if (ValidateInvoiceBase(invoice) is string error)
|
||||
return error;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public static string ValidateInvoiceBase(IInvoiceBase invoice)
|
||||
{
|
||||
if (!IsInvoiceNumberValid(invoice.InvoiceNumber))
|
||||
return $"Rechnungsnummer \"{invoice.InvoiceNumber}\" ist ungültig";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool IsOrganisationInformationValid(IOrganisation orga)
|
||||
{
|
||||
return IsOrganisationInformationValid(orga.IKDatenannahmestelle, orga.IKKostentrager, orga.IKKrankenkasse, orga.BezDatenannahmestelle);
|
||||
}
|
||||
public static bool IsOrganisationInformationValid(string ik_datenannahmestelle, string ik_kostentrager, string ik_krankenkasse, string bez_datenannahmestelle)
|
||||
}
|
||||
public static bool IsOrganisationInformationValid(string ik_datenannahmestelle, string ik_kostentrager, string ik_krankenkasse, string bez_datenannahmestelle)
|
||||
=> IsIKNumberValid(ik_datenannahmestelle, ik_kostentrager, ik_krankenkasse) && IsBezDatenannahmestelleValid(bez_datenannahmestelle);
|
||||
public static bool IsIKNumberValid(params string[] iks)
|
||||
=> iks?.All(IsIKNumberValid) ?? false;
|
||||
|
||||
public static bool IsBezDatenannahmestelleValid(string bez_datenannahmestelle)
|
||||
|
||||
public static bool IsBezDatenannahmestelleValid(string bez_datenannahmestelle)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(bez_datenannahmestelle);
|
||||
}
|
||||
@@ -179,5 +199,14 @@ namespace BS.Shared.Core
|
||||
|
||||
return true;
|
||||
}
|
||||
public static bool IsInvoiceNumberValid(string invoiceNumber)
|
||||
{
|
||||
if (string.IsNullOrEmpty(invoiceNumber))
|
||||
return false;
|
||||
|
||||
var pattern = @"^(?!.*[-/]{2})(?![-/])(?!.*[-/]$)[A-Za-z0-9]+(?:[/-][A-Za-z0-9]+)*$";
|
||||
|
||||
return Regex.IsMatch(invoiceNumber, pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Shared/Core/SecurityUtils.cs
Normal file
40
Shared/Core/SecurityUtils.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Core
|
||||
{
|
||||
public static class SecurityUtils
|
||||
{
|
||||
private static readonly char[] InvalidFilenameChars = Path.GetInvalidFileNameChars();
|
||||
|
||||
public static bool ContainsInvalidFilenameChars(string fileName)
|
||||
{
|
||||
return fileName.IndexOfAny(InvalidFilenameChars) >= 0;
|
||||
}
|
||||
|
||||
public static string GetChecksum(string filePath)
|
||||
{
|
||||
using (FileStream stream = File.OpenRead(filePath))
|
||||
{
|
||||
var sha = new SHA256Managed();
|
||||
byte[] checksum = sha.ComputeHash(stream);
|
||||
return BitConverter.ToString(checksum).Replace("-", String.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetChecksumBuffered(Stream stream)
|
||||
{
|
||||
using (var bufferedStream = new BufferedStream(stream, 1024 * 32))
|
||||
{
|
||||
var sha = new SHA256Managed();
|
||||
byte[] checksum = sha.ComputeHash(bufferedStream);
|
||||
return BitConverter.ToString(checksum).Replace("-", String.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace BS.Shared.Core
|
||||
{
|
||||
var allSettingsKeys = new List<string>();
|
||||
|
||||
foreach(var propertyInfo in typeof(SettingsKeys).GetProperties())
|
||||
foreach (var propertyInfo in typeof(SettingsKeys).GetProperties())
|
||||
{
|
||||
allSettingsKeys.AddIfNotIn(propertyInfo.GetValue(null, null)?.ToString());
|
||||
}
|
||||
@@ -18,97 +18,96 @@ namespace BS.Shared.Core
|
||||
}
|
||||
|
||||
|
||||
public static string ShowExpiredSupportConcepts => "ShowExpiredSupportConcepts";
|
||||
public static string ShowOnlyMySupportConcepts => "ShowOnlyMySupportConcepts";
|
||||
public static string LastSelectedServiceRecordTimeInterval => "LastSelectedServiceRecordTimeInterval";
|
||||
public static string CustomerFilterInZeiterfassung => "CustomerFilterInZeiterfassung";
|
||||
public static string ShowSignature => "ShowSignature";
|
||||
public static string ShowDistanceFields => "ShowDistanceFields";
|
||||
public static string IsServiceRecordNoticeMandatory => "IsServiceRecordNoticeMandatory";
|
||||
public static string IsServiceRecordGoalMandatory => "IsServiceRecordGoalMandatory";
|
||||
public static string IsServiceRecordRatingMandatory => "IsServiceRecordRatingMandatory";
|
||||
public static string IsEndDateVisible => "IsEndDateVisible";
|
||||
public static string IsZeiterfassungInStdMin => "IsZeiterfassungInStdMin";
|
||||
public static string ShowExpiredSupportConcepts => "ShowExpiredSupportConcepts";
|
||||
public static string ShowOnlyMySupportConcepts => "ShowOnlyMySupportConcepts";
|
||||
public static string LastSelectedServiceRecordTimeInterval => "LastSelectedServiceRecordTimeInterval";
|
||||
public static string CustomerFilterInZeiterfassung => "CustomerFilterInZeiterfassung";
|
||||
public static string ShowSignature => "ShowSignature";
|
||||
public static string ShowDistanceFields => "ShowDistanceFields";
|
||||
public static string IsServiceRecordNoticeMandatory => "IsServiceRecordNoticeMandatory";
|
||||
public static string IsServiceRecordGoalMandatory => "IsServiceRecordGoalMandatory";
|
||||
public static string IsServiceRecordRatingMandatory => "IsServiceRecordRatingMandatory";
|
||||
public static string IsEndDateVisible => "IsEndDateVisible";
|
||||
public static string IsZeiterfassungInStdMin => "IsZeiterfassungInStdMin";
|
||||
|
||||
public static string EinheitZeiterfassung => "EinheitZeiterfassung";
|
||||
public static string HilfeplanAuslaufAuswahl => "HilfeplanAuslaufAuswahl";
|
||||
public static string AnzTageZeiterfassErfolgt => "AnzTageZeiterfassErfolgt";
|
||||
public static string EinheitZeiterfassung => "EinheitZeiterfassung";
|
||||
public static string HilfeplanAuslaufAuswahl => "HilfeplanAuslaufAuswahl";
|
||||
public static string AnzTageZeiterfassErfolgt => "AnzTageZeiterfassErfolgt";
|
||||
public static string AnzTageUnterschriftErfolgt => "AnzTageUnterschriftErfolgt";
|
||||
public static string MaxDaysEditServiceRecordsAllowed => "MaxDaysEditServiceRecordsAllowed";
|
||||
public static string TimeUntilUILock => "TimeUntilUILock";
|
||||
public static string WindowStateType => "WindowStateType";
|
||||
public static string CustomerFilterSupportConcepts => "CustomerFilterSupportConcepts";
|
||||
public static string CustomerFilterCustomers => "CustomerFilterCustomers";
|
||||
public static string ShowServiceRecordGridControl => "ShowServiceRecordGridControl";
|
||||
public static string StartupPanelMaximized => "StartupPanelMaximized";
|
||||
public static string HideServiceRecordInsertedByAndInsertedOn => "HideServiceRecordInsertedByAndInsertedOn";
|
||||
public static string DocumentationFontSize => "DocumentationFontSize";
|
||||
public static string ZeigeNurMeineTermine => "ZeigeNurMeineTermine";
|
||||
public static string MaxDaysEditServiceRecordsAllowed => "MaxDaysEditServiceRecordsAllowed";
|
||||
public static string TimeUntilUILock => "TimeUntilUILock";
|
||||
public static string WindowStateType => "WindowStateType";
|
||||
public static string CustomerFilterSupportConcepts => "CustomerFilterSupportConcepts";
|
||||
public static string CustomerFilterCustomers => "CustomerFilterCustomers";
|
||||
public static string ShowServiceRecordGridControl => "ShowServiceRecordGridControl";
|
||||
public static string StartupPanelMaximized => "StartupPanelMaximized";
|
||||
public static string HideServiceRecordInsertedByAndInsertedOn => "HideServiceRecordInsertedByAndInsertedOn";
|
||||
public static string DocumentationFontSize => "DocumentationFontSize";
|
||||
public static string ZeigeNurMeineTermine => "ZeigeNurMeineTermine";
|
||||
public static string LastSelectedServiceRecordTimeIntervalDays => "LastSelectedServiceRecordTimeIntervalDays";
|
||||
public static string LastSelectedServiceRecordMonth => "LastSelectedServiceRecordMonth";
|
||||
public static string LastKassenSortOrder => "LastKassenSortOrder";
|
||||
public static string LastBewilligungSortOrder => "LastBewilligungSortOrder";
|
||||
|
||||
public static string LastSelectedServiceRecordMonth => "LastSelectedServiceRecordMonth";
|
||||
public static string LastKassenSortOrder => "LastKassenSortOrder";
|
||||
public static string LastBewilligungSortOrder => "LastBewilligungSortOrder";
|
||||
public static string ServiceRecordAllowChangeHours => "ServiceRecordAllowChangeHours";
|
||||
public static string LetzteZeiterfassungsDauer => "LetzteZeiterfassungsDauer";
|
||||
public static string StartupPanelOrder => "StartupPanelOrder";
|
||||
public static string ShowMedication => "ShowMedication";
|
||||
public static string ShowScheduler => "ShowScheduler";
|
||||
public static string ShowWohnheime => "ShowWohnheime";
|
||||
public static string ShowChat => "ShowChat";
|
||||
public static string ShowOwnChatSettings => "ShowOwnChatSettings";
|
||||
public static string SetStartTimeToEndTimeAfterSave => "SetStartTimeToEndTimeAfterSave";
|
||||
public static string IsPasswordSecurityActiv => "IsPasswordSecurityActiv";
|
||||
public static string IsOnlyYearMonthVisible => "IsOnlyYearMonthVisible";
|
||||
public static string IsZeiterfassDateNormal => "IsZeiterfassDateNormal";
|
||||
public static string LastSelectedStundenkontoIntervall => "LastSelectedStundenkontoIntervall";
|
||||
public const string ZeiterfassungsSchwellwert = "ZeiterfassungsSchwellwert";
|
||||
public static string ShowBetrag => "ShowBetrag";
|
||||
public static string ShowHilfeplanBezeichnung => "ShowHilfeplanBezeichnung";
|
||||
public static string ShowArbeitszeiten => "ShowArbeitszeiten";
|
||||
public static string ShowRessources => "ShowRessources";
|
||||
public static string ShowTeamNews => "ShowTeamNews";
|
||||
public static string ShowPivotGrid => "ShowPivotGrid";
|
||||
public static string ShowUrlaubsplanung => "ShowUrlaubsplanung";
|
||||
public static string DontShowSpitzabrechnung => "DontShowSpitzabrechnung";
|
||||
public static string ShowDienstplanung => "ShowDienstplanung";
|
||||
|
||||
public static string ServiceRecordAllowChangeHours => "ServiceRecordAllowChangeHours";
|
||||
public static string LetzteZeiterfassungsDauer => "LetzteZeiterfassungsDauer";
|
||||
public static string StartupPanelOrder => "StartupPanelOrder";
|
||||
public static string ShowMedication => "ShowMedication";
|
||||
public static string ShowScheduler => "ShowScheduler";
|
||||
public static string ShowWohnheime => "ShowWohnheime";
|
||||
public static string ShowChat => "ShowChat";
|
||||
public static string ShowOwnChatSettings => "ShowOwnChatSettings";
|
||||
public static string SetStartTimeToEndTimeAfterSave => "SetStartTimeToEndTimeAfterSave";
|
||||
public static string IsPasswordSecurityActiv => "IsPasswordSecurityActiv";
|
||||
public static string IsOnlyYearMonthVisible => "IsOnlyYearMonthVisible";
|
||||
public static string IsZeiterfassDateNormal => "IsZeiterfassDateNormal";
|
||||
public static string LastSelectedStundenkontoIntervall => "LastSelectedStundenkontoIntervall";
|
||||
public static string ZeiterfassungsSchwellwert => "ZeiterfassungsSchwellwert";
|
||||
public static string ShowBetrag => "ShowBetrag";
|
||||
public static string ShowHilfeplanBezeichnung => "ShowHilfeplanBezeichnung";
|
||||
public static string ShowArbeitszeiten => "ShowArbeitszeiten";
|
||||
public static string ShowRessources => "ShowRessources";
|
||||
public static string ShowTeamNews => "ShowTeamNews";
|
||||
public static string ShowPivotGrid => "ShowPivotGrid";
|
||||
public static string ShowUrlaubsplanung => "ShowUrlaubsplanung";
|
||||
public static string DontShowSpitzabrechnung => "DontShowSpitzabrechnung";
|
||||
public static string ShowDienstplanung => "ShowDienstplanung";
|
||||
public static string ShowWorktime => "ShowWorktime";
|
||||
public static string EnableArbeitszeiterfassung => "EnableArbeitszeiterfassung";
|
||||
public static string EnableAutomaticPauses => "EnableAutomaticPauses";
|
||||
public static string EnableRestTimeWarning => "EnableRestTimeWarning";
|
||||
public static string MaxWorkTimeHoursBeforeWarning => "MaxWorkTimeHoursBeforeWarning";
|
||||
|
||||
public static string ShowWorktime => "ShowWorktime";
|
||||
public static string EnableArbeitszeiterfassung => "EnableArbeitszeiterfassung";
|
||||
public static string EnableAutomaticPauses => "EnableAutomaticPauses";
|
||||
public static string EnableRestTimeWarning => "EnableRestTimeWarning";
|
||||
public static string MaxWorkTimeHoursBeforeWarning => "MaxWorkTimeHoursBeforeWarning";
|
||||
public const string AnzTageArbeitszeiterfassungErfolgt = "AnzTageArbeitszeiterfassungErfolgt";
|
||||
public const string StartStundenkonto = "StartStundenkonto";
|
||||
|
||||
public static string DienstplanungStandardZeilenAnzahl => "DienstplanungStandardZeilenAnzahl";
|
||||
public static string ShowMarker => "ShowMarker";
|
||||
public static string ShowAnnualReport => "ShowAnnualReport";
|
||||
public static string ShowCustomerDistanceFields => "ShowCustomerDistanceFields";
|
||||
public static string ShowAdditionalService => "ShowAdditionalService";
|
||||
public static string ShowRoundedDurationInEmployeeAnalysis => "ShowRoundedDurationInEmployeeAnalysis";
|
||||
public static string ShowDatevFields => "ShowDatevFields";
|
||||
public static string PrinterSettingsUseLandscape => "PrinterSettingsUseLandscape";
|
||||
public static string PrinterSettingsUseMargins => "PrinterSettingsUseMargins";
|
||||
public static string PrinterSettingsUsePaperKind => "PrinterSettingsUsePaperKind";
|
||||
public static string ShowRtfTextfield => "ShowRtfTextfield";
|
||||
public static string ShowEmployeeSignature => "ShowEmployeeSignature";
|
||||
public static string SchedulerViewType => "SchedulerViewType";
|
||||
public static string SchedulerTimelineViewDayCount => "SchedulerTimelineViewDayCount";
|
||||
public static string SchedulerDayViewDayCount => "SchedulerDayViewDayCount";
|
||||
public static string ShowMultipleResourceColors => "ShowMultipleResourceColors";
|
||||
|
||||
public static string AllowStorno => "AllowStorno";
|
||||
public static string UseDistanceApi => "UseDistanceApi";
|
||||
|
||||
public static string DienstplanungStandardZeilenAnzahl => "DienstplanungStandardZeilenAnzahl";
|
||||
public static string ShowMarker => "ShowMarker";
|
||||
public static string ShowAnnualReport => "ShowAnnualReport";
|
||||
public static string ShowCustomerDistanceFields => "ShowCustomerDistanceFields";
|
||||
public static string ShowAdditionalService => "ShowAdditionalService";
|
||||
public static string ShowRoundedDurationInEmployeeAnalysis => "ShowRoundedDurationInEmployeeAnalysis";
|
||||
public static string ShowDatevFields => "ShowDatevFields";
|
||||
public static string PrinterSettingsUseLandscape => "PrinterSettingsUseLandscape";
|
||||
public static string PrinterSettingsUseMargins => "PrinterSettingsUseMargins";
|
||||
public static string PrinterSettingsUsePaperKind => "PrinterSettingsUsePaperKind";
|
||||
public static string ShowRtfTextfield => "ShowRtfTextfield";
|
||||
public static string ShowEmployeeSignature => "ShowEmployeeSignature";
|
||||
public static string SchedulerViewType => "SchedulerViewType";
|
||||
public static string SchedulerTimelineViewDayCount => "SchedulerTimelineViewDayCount";
|
||||
public static string SchedulerDayViewDayCount => "SchedulerDayViewDayCount";
|
||||
public static string ShowMultipleResourceColors => "ShowMultipleResourceColors";
|
||||
public static string AllowStorno => "AllowStorno";
|
||||
public const string AllowXRechnung = "AllowXRechnung";
|
||||
public static string UseDistanceApi => "UseDistanceApi";
|
||||
// Keys Für die Web.config von Host
|
||||
public static string FileRootDirectory => "FileRootDirectory";
|
||||
|
||||
public static string ShowKlientenBetreuungszeiten => "ShowKlientenBetreuungszeiten";
|
||||
public static string ShowInfoButtonInCalender => "ShowInfoButtonInCalender";
|
||||
public static string ShowHilfeplanStatistikReport => "ShowHilfeplanStatistikReport";
|
||||
public static string ShowAI => "ShowAI";
|
||||
public static string ShowAIInternal => "ShowAIInternal";
|
||||
public static string FileRootDirectory => "FileRootDirectory";
|
||||
|
||||
public static string ShowKlientenBetreuungszeiten => "ShowKlientenBetreuungszeiten";
|
||||
public static string ShowInfoButtonInCalender => "ShowInfoButtonInCalender";
|
||||
public static string ShowHilfeplanStatistikReport => "ShowHilfeplanStatistikReport";
|
||||
public static string ShowAI => "ShowAI";
|
||||
public static string ShowAIInternal => "ShowAIInternal";
|
||||
public static string MoKSessionTimeout => "MoKSessionTimeout";
|
||||
|
||||
public static string FilterGroupServiceCategories => "FilterGroupServiceCategories";
|
||||
@@ -132,9 +131,15 @@ namespace BS.Shared.Core
|
||||
public static string ShowServicesOverviewHalfOrWholeMonth => "ShowServicesOverviewHalfOrWholeMonth";
|
||||
public static string OpenReportInNewWindow => "OpenReportInNewWindow";
|
||||
|
||||
public const string HidePrintQBPopup = "HidePrintQBPopup";
|
||||
/// <summary>
|
||||
/// Aktiviert AI Module
|
||||
/// </summary>
|
||||
public const string ModuleAiEnabled = "ModuleAiEnabled";
|
||||
|
||||
// Module Ai
|
||||
public static string ModuleAiEnabled => "ModuleAiEnabled";
|
||||
public static string ModuleAiSettingsEnabled => "ModuleAiSettingsEnabled";
|
||||
}
|
||||
/// <summary>
|
||||
/// Aktiviert AI Einstellungen (Modell, ...)
|
||||
/// </summary>
|
||||
public const string ModuleAiSettingsEnabled = "ModuleAiSettingsEnabled";
|
||||
}
|
||||
}
|
||||
|
||||
34
Shared/Core/TokenUtils.cs
Normal file
34
Shared/Core/TokenUtils.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Core
|
||||
{
|
||||
public static class TokenUtils
|
||||
{
|
||||
public static string CreateTemporaryUrlByToken(string link, string token)
|
||||
{
|
||||
if (link.Contains("tenant"))
|
||||
link = RemoveAuthenticationInfoFromUri(link);
|
||||
|
||||
var addChar = link.Contains("?") ? "&" : "?";
|
||||
|
||||
var finalUri = string.Format("{0}{1}token={2}", link, addChar, token);
|
||||
|
||||
return finalUri;
|
||||
}
|
||||
|
||||
public static string RemoveAuthenticationInfoFromUri(string navigateUri)
|
||||
{
|
||||
var regex = new Regex(@"[\&|\?]?token\=[A-Za-z0-9]+|[\&|\?]?tenant\=[A-Za-z0-9]+|[\&|\?]?username\=[A-Za-z0-9.]+");
|
||||
var splittedUri = regex.Split(navigateUri.Split('?')[1]);
|
||||
var cleanedSplittedUri = splittedUri.Where(t => !string.IsNullOrWhiteSpace(t)).ToArray();
|
||||
var uriValues = cleanedSplittedUri.Aggregate(string.Empty, (current, item) => current + item);
|
||||
|
||||
return navigateUri.Split('?')[0] + "?" + uriValues;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,13 @@
|
||||
using System;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using DevExpress.XtraScheduler;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
@@ -13,10 +20,6 @@ using System.Text.RegularExpressions;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Xml.Serialization;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using DevExpress.XtraScheduler;
|
||||
|
||||
namespace BS.Shared.Core
|
||||
{
|
||||
@@ -950,7 +953,7 @@ namespace BS.Shared.Core
|
||||
|
||||
public static string GetSexAbbrevation(Sex? sex)
|
||||
{
|
||||
switch (sex)
|
||||
switch(sex)
|
||||
{
|
||||
case Sex.Male:
|
||||
return "m";
|
||||
@@ -1162,6 +1165,17 @@ namespace BS.Shared.Core
|
||||
return age;
|
||||
}
|
||||
|
||||
public static NameValueCollection ToNameValueCollection<T>(T dynamicObject)
|
||||
{
|
||||
var nameValueCollection = new NameValueCollection();
|
||||
foreach (PropertyDescriptor propertyDescriptor in TypeDescriptor.GetProperties(dynamicObject))
|
||||
{
|
||||
string value = propertyDescriptor.GetValue(dynamicObject).ToString();
|
||||
nameValueCollection.Add(propertyDescriptor.Name, value);
|
||||
}
|
||||
return nameValueCollection;
|
||||
}
|
||||
|
||||
public static bool TryParseISO8601(string iso8601String, out DateTime date)
|
||||
{
|
||||
return DateTime.TryParse(iso8601String, out date);
|
||||
@@ -1185,7 +1199,42 @@ namespace BS.Shared.Core
|
||||
string msg = iso.GetString(isoBytes);
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wandelt einen JSON-String in ein Wörterbuch vom Typ Dictionary<long, long?> um.
|
||||
/// </summary>
|
||||
/// <param name="json">Die serialisierte Map</param>
|
||||
/// <returns>Dictionary vom Typ Dictionary<long, long?>.</returns>
|
||||
public static Dictionary<long, long?> JsonMap2Dictionary(string json)
|
||||
{
|
||||
var dictionary = new Dictionary<long, long?>();
|
||||
|
||||
var pairs = JsonConvert.DeserializeObject<List<List<long?>>>(json);
|
||||
|
||||
foreach(var pair in pairs)
|
||||
{
|
||||
if(pair.Count >= 2 && pair[0].HasValue)
|
||||
{
|
||||
dictionary[pair[0].Value] = pair[1];
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public static List<long> ConvertCharSeparatedValuesToLongList(string csv, char separatorChar)
|
||||
{
|
||||
var split = csv.Split(separatorChar);
|
||||
var result = new List<long>();
|
||||
|
||||
foreach(var splitValue in split)
|
||||
{
|
||||
result.Add(long.Parse(splitValue.Trim()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public struct NullCompareResult
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.Core
|
||||
@@ -21,6 +22,8 @@ namespace BS.Shared.Core
|
||||
error = "Unterschiedliche Rechnungspositionen";
|
||||
else if (GetInvalidUnitDescription(invoiceBases) is IInvoiceItem invalid)
|
||||
error = $"Ungültige Rechnungsposition: {invalid.ItemDescription}:{invalid.UnitDescription}";
|
||||
else if (GkvValidator.ValidateInvoiceBases(invoiceBases) is string rtn_error)
|
||||
error = rtn_error;
|
||||
|
||||
if(error is string)
|
||||
throw new GkvException(error, "Validierung");
|
||||
@@ -69,5 +72,7 @@ namespace BS.Shared.Core
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user