44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using AICore.Context.Summary;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using AICore.Context.Core;
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWo.Service.ServiceUtils
|
|
{
|
|
public class AiFunctionContextLoader
|
|
{
|
|
public static BaseContextSummary LoadServiceRecordDocumentationContext(AiFunctionDocRequest request, int samplesCount)
|
|
{
|
|
IEnumerable<ServiceRecordDC> srs_loaded = null;
|
|
|
|
if(samplesCount > 0)
|
|
{
|
|
var srs = request.ServiceRecords;
|
|
srs_loaded = DataContractLoader.LoadServiceRecordDCs(srs)
|
|
.OrderByDescending(x => x.Start)
|
|
.Take(samplesCount);
|
|
}
|
|
|
|
var sc_ref = request.SupportConcept;
|
|
var sc_loaded = DataContractLoader.LoadSupportConceptDC(sc_ref);
|
|
|
|
var customer_loaded = sc_loaded.Customer;
|
|
var costbearer_loaded = sc_loaded.CostBearerList.First(x => request.CostBearer.Oid == x.Oid);
|
|
|
|
var doku = request.Dokumentation;
|
|
|
|
var context = AiContextSummaryFactory.CreateServiceRecordDocumentationFunction(srs_loaded, customer_loaded, costbearer_loaded, sc_loaded, doku);
|
|
|
|
return context;
|
|
}
|
|
}
|
|
}
|