102 lines
2.9 KiB
C#
102 lines
2.9 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Data.Entities.Light;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.ServiceContracts;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts.AdminService;
|
|
using BS.Shared.Extensions;
|
|
using DevExpress.Pdf.Native.BouncyCastle.Ocsp;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.ServiceModel;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.Service.ServiceImplementations
|
|
{
|
|
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
|
|
public class AdminServiceImp : IAdminService
|
|
{
|
|
public string Test()
|
|
{
|
|
return "Test erfolgreich!";
|
|
}
|
|
|
|
public string Echo(string echo)
|
|
{
|
|
return echo;
|
|
}
|
|
|
|
public AdminServiceSumResponseDC GetGkvAbrechnungSumme(AdminServiceSumReqDC request, string detail)
|
|
{
|
|
if (request == null)
|
|
{
|
|
throw new ArgumentException("request darf nicht null sein");
|
|
}
|
|
|
|
if(!Utils.TryParseISO8601(request.Start, out var start))
|
|
{
|
|
throw new ArgumentException("start entspricht nicht ISO8601 Norm.");
|
|
}
|
|
|
|
if (!Utils.TryParseISO8601(request.End, out var end))
|
|
{
|
|
throw new ArgumentException("end entspricht nicht ISO8601 Norm.");
|
|
}
|
|
|
|
var res = new AdminServiceSumResponseDC();
|
|
res.Sum = DAOFactory.ScriptDAO.GetGkvSumByDateRange(start, end);
|
|
|
|
if (detail != "true")
|
|
{
|
|
return res;
|
|
}
|
|
|
|
string detail_res;
|
|
|
|
var protokolle_oids = DAOFactory.ScriptDAO.GetGkvSumByDateRange2(start, end);
|
|
if (protokolle_oids.HasContent())
|
|
{
|
|
var protokolle = DAOFactory.GenericDAO.LoadByIDs<GkvTransferProtokollLight>(protokolle_oids);
|
|
var abrechnung_oids = protokolle.Select(x => x.GkvAbrechnungOid).Distinct();
|
|
var abrechnung = DAOFactory.GenericDAO.LoadByIDs<GkvAbrechnungLight>(abrechnung_oids);
|
|
var abrechnung_dc = MapperFactory.GkvAbrechnungLight.MapToNewDCs(abrechnung);
|
|
|
|
res.Details = abrechnung_dc.Select(x =>
|
|
{
|
|
var t = x.TransferProtokolle.First();
|
|
var state = x.GetState();
|
|
|
|
return new AdminServiceSumResponseDetailDC()
|
|
{
|
|
Oid = x.Oid,
|
|
ProtokollOid = t.Oid.Value,
|
|
ErstelltAm = x.ErstelltAm.ToString("o", CultureInfo.InvariantCulture),
|
|
Empfanger = t.BezDatenannahmestelle,
|
|
AbrechnungsZeitraumStart = x.AbrechnungsZeitraumStart?.ToString("o", CultureInfo.InvariantCulture),
|
|
AbrechnungsZeitraumEnde = x.AbrechnungsZeitraumEnde?.ToString("o", CultureInfo.InvariantCulture),
|
|
VerfahrensstufeInt = x.Verfahrensstufe,
|
|
Verfahrensstufe = ((GkvVerfahrensstufe)x.Verfahrensstufe).ToString(),
|
|
StateInt = (int)state,
|
|
State = state.ToString(),
|
|
UrbelegeGesendet = x.UrbelegeGesendet,
|
|
Bezahlt = x.Bezahlt,
|
|
Betrag = x.Betrag
|
|
};
|
|
});
|
|
}
|
|
else
|
|
{
|
|
res.Details = new List<AdminServiceSumResponseDetailDC>();
|
|
}
|
|
|
|
return res;
|
|
}
|
|
}
|
|
}
|