Files

118 lines
3.2 KiB
C#
Raw Permalink Normal View History

using BeWo.Data.Access;
2025-06-13 11:37:19 +02:00
using BeWo.Service.Core;
using BeWo.Service.ServiceContracts;
using BS.Shared.Core;
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
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.AdminService;
using DevExpress.Pdf.Native.BouncyCastle.Ocsp;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
2025-06-13 11:37:19 +02:00
using System.Diagnostics;
using System.IO;
using System.Linq;
2025-06-05 14:03:55 +02:00
using System.Security.Principal;
using System.ServiceModel;
2025-06-13 11:37:19 +02:00
using System.ServiceModel.Channels;
using System.ServiceModel.Web;
using System.Text;
2025-06-13 11:37:19 +02:00
using System.Threading;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceImplementations
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class ApiServiceImp : IApiService
{
public ApiResponse<string> Test()
{
2025-06-13 11:37:19 +02:00
try
{
2026-06-30 11:20:33 +02:00
//generateApiServiceTestFile();
2025-06-13 11:37:19 +02:00
return ApiResponse<string>.SuccessResponse("Hello World!");
}
catch (Exception ex)
{
return ApiResponse<string>.FailureResponse(ex.ToString());
}
}
public ApiResponse<decimal> GetGkvAbrechnungSumme(AdminServiceSumReqDC request)
{
if (request == null)
{
throw new ArgumentException("request darf nicht null sein");
}
2025-06-13 11:37:19 +02:00
if (!BS.Shared.Core.Utils.TryParseISO8601(request.Start, out var start))
{
throw new ArgumentException("start entspricht nicht ISO8601 Norm.");
}
2025-06-13 11:37:19 +02:00
if (!BS.Shared.Core.Utils.TryParseISO8601(request.End, out var end))
{
throw new ArgumentException("end entspricht nicht ISO8601 Norm.");
}
var sum = DAOFactory.ScriptDAO.GetGkvSumByDateRange(start, end);
return ApiResponse<decimal>.SuccessResponse(sum ?? 0);
}
2026-06-30 11:20:33 +02:00
private void generateApiServiceTestFile()
{
var winIdentity = WindowsIdentity.GetCurrent();
var securityContext = ServiceSecurityContext.Current;
var principal = Thread.CurrentPrincipal;
var proc = Process.GetCurrentProcess();
var ipInfo = OperationContext.Current?.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
var httpInfo = OperationContext.Current?.IncomingMessageProperties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
var basedir = AppDomain.CurrentDomain.BaseDirectory;
var log = new
{
WindowsIdentity = new
{
winIdentity?.Name,
winIdentity?.IsAuthenticated,
winIdentity?.AuthenticationType
},
ServiceSecurityContext = new
{
PrimaryIdentity = securityContext?.PrimaryIdentity?.Name,
WindowsIdentity = securityContext?.WindowsIdentity?.Name,
},
Process = new
{
proc.ProcessName,
proc.StartTime
},
AppDomain = new
{
AppDomain.CurrentDomain.BaseDirectory,
AppDomain.CurrentDomain.FriendlyName
},
Environment = new
{
Environment.UserName,
Environment.MachineName,
Environment.OSVersion,
Environment.CurrentDirectory,
Environment.Is64BitProcess
},
ThreadPrincipal = principal?.Identity?.Name,
IP = ipInfo?.Address,
Port = ipInfo?.Port,
UserAgent = httpInfo?.Headers["User-Agent"],
};
var str = JsonConvert.SerializeObject(log, Formatting.Indented);
File.WriteAllText(BeWoServerPathHelper.GetApiServiceTestFile(), str, Encoding.UTF8);
}
}
}