samplecount null oder 0 -> nichts
-1 -> alle -> sonst einfach n laden
This commit is contained in:
@@ -15,6 +15,7 @@ using AICore.Context.Core;
|
||||
using DevExpress.DataAccess.Native.Sql;
|
||||
using BS.Shared.Exceptions;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace BeWo.Service.ServiceUtils
|
||||
{
|
||||
@@ -108,19 +109,26 @@ namespace BeWo.Service.ServiceUtils
|
||||
private static IContextSummary loadServiceRecordDocumentationContext(Dictionary<TableID, long[]> context_reference, string doku_text, int? sample_count = null)
|
||||
{
|
||||
var customer = loadCompactCustomerDC(context_reference);
|
||||
var serviceRecords = loadServiceRecordDCs(context_reference, sample_count);
|
||||
var supportConcept = loadSupportConceptDC(context_reference);
|
||||
var costBearer = supportConcept.CostBearerList.First(x => x.CostBearerOid == context_reference[TableID.CostBearer][0]);
|
||||
var costBearer2SupportConcept = costBearer.CostBearer2SupportConceptOid;
|
||||
|
||||
var serviceRecords = loadServiceRecordsByExplicitReference(customer.CustomerOid, costBearer2SupportConcept, sample_count);
|
||||
|
||||
return AiContextSummaryFactory.CreateServiceRecordDocumentationFunction(serviceRecords, customer, costBearer, supportConcept, doku_text);
|
||||
}
|
||||
|
||||
private static bool oidsContainsOid(long[] oids, long oid)
|
||||
private static IEnumerable<ServiceRecordDC> loadServiceRecordsByExplicitReference(long customer, long cb2sc, int? sample_count = null)
|
||||
{
|
||||
if (oids == null || oids.Length == 0)
|
||||
return false;
|
||||
if (sample_count is null || sample_count == 0)
|
||||
return null;
|
||||
|
||||
return oids.Contains(oid);
|
||||
var dcs = new OperationsServiceImp().GetCustomerServiceRecordsCompact(customer, cb2sc, null);
|
||||
|
||||
if(sample_count == -1)
|
||||
return dcs;
|
||||
|
||||
return dcs.Take(sample_count.Value);
|
||||
}
|
||||
|
||||
private static CompactCustomerDC loadCompactCustomerDC(Dictionary<TableID, long[]> context_reference)
|
||||
|
||||
Reference in New Issue
Block a user