2026-03-30 13:06:03 +02:00
|
|
|
using BeWo.Service.ServiceContracts.Enhanced;
|
2026-07-10 13:28:04 +02:00
|
|
|
using BeWo.Service.Status;
|
2026-07-09 14:49:13 +02:00
|
|
|
using BS.Shared;
|
2026-03-30 13:06:03 +02:00
|
|
|
using BS.Shared.DataContracts;
|
2026-07-24 13:21:52 +02:00
|
|
|
using DevExpress.Xpo.Helpers;
|
2026-03-30 13:06:03 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2026-05-26 13:03:08 +02:00
|
|
|
using System.Net;
|
2026-03-30 13:06:03 +02:00
|
|
|
using System.Reflection;
|
|
|
|
|
using System.ServiceModel;
|
|
|
|
|
using System.ServiceModel.Web;
|
|
|
|
|
|
|
|
|
|
namespace BeWo.Service.ServiceImplementations.Enhanced
|
|
|
|
|
{
|
|
|
|
|
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall,
|
|
|
|
|
ConcurrencyMode = ConcurrencyMode.Single)]
|
|
|
|
|
public class StatusServiceImp : IStatusService
|
|
|
|
|
{
|
|
|
|
|
public ServerStatusDC GetStatus()
|
|
|
|
|
{
|
|
|
|
|
var result = new ServerStatusDC
|
|
|
|
|
{
|
|
|
|
|
ServerTime = DateTime.Now.ToString("o"),
|
2026-07-09 14:49:13 +02:00
|
|
|
AssemblyVersion = Assembly.GetExecutingAssembly()
|
2026-03-30 13:06:03 +02:00
|
|
|
.GetName().Version?.ToString() ?? "unbekannt",
|
2026-07-09 15:15:30 +02:00
|
|
|
ServerVersion = BeWoAppInfo.BeWoAppVersion.ToString(),
|
2026-03-30 13:06:03 +02:00
|
|
|
Services = new List<ServiceStatusDC>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Datenbankverbindung prüfen
|
2026-07-10 13:28:04 +02:00
|
|
|
result.DatabaseOk = new DatenbankStatusService().DoHealthCheckup();
|
2026-03-30 13:06:03 +02:00
|
|
|
|
|
|
|
|
// Einzelne Subsysteme prüfen
|
2026-07-13 11:39:36 +02:00
|
|
|
var statusServices = new List<BaseStatusService>
|
|
|
|
|
{
|
|
|
|
|
new GeneralStatusService(),
|
|
|
|
|
new AiStatusService()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach (var service in statusServices)
|
|
|
|
|
result.Services.Add(service.DoHealthCheckup());
|
2026-05-26 13:03:08 +02:00
|
|
|
|
2026-07-24 13:21:52 +02:00
|
|
|
var allHealthy = result.DatabaseOk.IsOk && result.Services.All(x => x is object && x.IsOk);
|
2026-05-26 13:03:08 +02:00
|
|
|
if (!allHealthy)
|
|
|
|
|
{
|
|
|
|
|
WebOperationContext.Current.OutgoingResponse.StatusCode =
|
|
|
|
|
HttpStatusCode.InternalServerError;
|
|
|
|
|
}
|
2026-03-30 13:06:03 +02:00
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|