From f9d31341cd32fa6b9cfaf2a27cc98dfb9347d116 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Thu, 6 Mar 2025 08:07:07 +0100 Subject: [PATCH] AachenerLaienhelfer/Validator/ServiceRecordValidator.cs - Warnung auch bei FK Jugendamt nach 1 h --- .../AachenerLaienhelfer.csproj | 1 + .../Validator/ServiceRecordValidator.cs | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 ReportImp/AachenerLaienhelfer/Validator/ServiceRecordValidator.cs diff --git a/ReportImp/AachenerLaienhelfer/AachenerLaienhelfer.csproj b/ReportImp/AachenerLaienhelfer/AachenerLaienhelfer.csproj index e0f0f9a96..ef4b51f44 100644 --- a/ReportImp/AachenerLaienhelfer/AachenerLaienhelfer.csproj +++ b/ReportImp/AachenerLaienhelfer/AachenerLaienhelfer.csproj @@ -101,6 +101,7 @@ SettlementReport2.cs + diff --git a/ReportImp/AachenerLaienhelfer/Validator/ServiceRecordValidator.cs b/ReportImp/AachenerLaienhelfer/Validator/ServiceRecordValidator.cs new file mode 100644 index 000000000..fa0ccd942 --- /dev/null +++ b/ReportImp/AachenerLaienhelfer/Validator/ServiceRecordValidator.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using BeWo.Data.Entities; +using BeWo.Service.DCEntityMapper; +using BeWo.Service.Plugins; +using BS.Shared; +using BS.Shared.DataContracts; +using BS.Shared.Extensions; + +namespace AachenerLaienhelfer.Validator +{ + public class CustomServiceRecordValidator : ServiceRecordValidator + { + public override List ValidateServiceRecord(ServiceRecordDC newServiceRecord, SupportConceptStatisticsDC statistics, + int maxDaysEditServiceRecordsAllowed, IList employeeOids, IList cb2scOids) + { + var result = base.ValidateServiceRecord(newServiceRecord, statistics, maxDaysEditServiceRecordsAllowed, employeeOids, cb2scOids); + if (newServiceRecord.CostBearer != null && (newServiceRecord.CostBearer.Name.ToLower().Contains("jugendamt") || newServiceRecord.CostBearer.Name.ToLower().Contains("amt für"))) + { + var duration = (decimal)newServiceRecord.End.Value.Subtract(newServiceRecord.Start.Value).TotalMinutes; + if (duration > 60 && (newServiceRecord.ServiceDescription.Name.ToLower().Contains("fehlkontakt") || newServiceRecord.ServiceDescription.Category.Name.ToLower().Contains("fehlkontakt"))) + { + String message = String.Format("Die eingegebene Dauer des Fehlkontakts überschreitet die maximal abrechenbare Dauer von 1 Stunde.\nMöchten Sie trotzdem speichern?"); + result.Add(new ServiceRecordValidationResultDC + { + ResultType = ServiceRecordValidationResult.Custom, + Message = message, + Allow = true + + }); + } + } + return result; + } + } +} \ No newline at end of file