DateTime nach ISO8601 Norm

This commit is contained in:
2025-02-25 15:56:15 +01:00
parent b280aac30a
commit 6b2046ee10
3 changed files with 17 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
using BeWo.Data.Access;
using BeWo.Service.ServiceContracts;
using BS.Shared.Core;
using BS.Shared.DataContracts.AdminService;
using DevExpress.Pdf.Native.BouncyCastle.Ocsp;
using System;
@@ -28,29 +29,22 @@ namespace BeWo.Service.ServiceImplementations
{
if (request == null)
{
throw new ArgumentException("Request darf nicht null sein");
throw new ArgumentException("request darf nicht null sein");
}
if(request.Start == default)
if(!Utils.TryParseISO8601(request.Start, out var start))
{
throw new ArgumentException("Start darf nicht default(DateTime) sein");
throw new ArgumentException("start entspricht nicht ISO8601 Norm.");
}
if(request.End == default)
if (!Utils.TryParseISO8601(request.End, out var end))
{
throw new ArgumentException("End darf nicht default(DateTime) sein");
throw new ArgumentException("end entspricht nicht ISO8601 Norm.");
}
var sum = DAOFactory.ScriptDAO.GetGkvSumByDateRange(request.Start, request.End);
var sum = DAOFactory.ScriptDAO.GetGkvSumByDateRange(start, end);
if (sum is decimal s)
{
return sum;
}
else
{
return "Sum ist null";
};
return sum?.ToString("0.00");
}
}
}