106 lines
2.6 KiB
C#
106 lines
2.6 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.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.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 object 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 sum = DAOFactory.ScriptDAO.GetGkvSumByDateRange(start, end);
|
|
|
|
if (detail != "true")
|
|
{
|
|
var json = JsonUtils.ToSimpleJson("sum", sum);
|
|
|
|
return json;
|
|
}
|
|
|
|
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 objs = abrechnung.Select(x =>
|
|
{
|
|
var t = x.TransferProtokolle.First();
|
|
return new
|
|
{
|
|
oid = x.Oid,
|
|
toid = t.Oid,
|
|
created = x.ErstelltAm,
|
|
rec = t.BezDatenannahmestelle,
|
|
str = x.AbrechnungsZeitraumStart,
|
|
end = x.AbrechnungsZeitraumEnde,
|
|
ver = x.Verfahrensstufe.ToString(),
|
|
sta = x.GetState().ToString(),
|
|
urg = x.UrbelegeGesendet,
|
|
bez = x.Bezahlt,
|
|
sum = x.Betrag.ToString("0.00€")
|
|
};
|
|
});
|
|
|
|
detail_res = JsonUtils.ConvertToJson(objs);
|
|
}
|
|
else
|
|
{
|
|
detail_res = "no records found";
|
|
}
|
|
|
|
var rtn = new
|
|
{
|
|
sum = sum?.ToString("0.00") ?? "0.00",
|
|
predicate = detail_res,
|
|
};
|
|
|
|
var json2 = JsonUtils.ConvertToJson(rtn);
|
|
|
|
return json2;
|
|
}
|
|
}
|
|
}
|