This commit is contained in:
2025-07-25 14:27:57 +02:00
parent e286cb4109
commit b635f3ee00
67 changed files with 1166 additions and 883 deletions

View File

@@ -48,12 +48,48 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Context\Core\ContextEntryMapperFactory.cs" />
<Compile Include="Context\EntryMapper\CustomerContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\CustomerNavigationContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\EmployeeContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\EmployeeNavigationContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\OrganisationContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\OrganisationNavigationContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\PersonContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\PersonNavigationContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\ServiceRecordContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\SupportConceptContextEntryMapper.cs" />
<Compile Include="Context\EntryMapper\SupportConceptNavigationContextEntryMapper.cs" />
<Compile Include="Context\Entry\BaseContextEntry.cs" />
<Compile Include="Context\EntryMapper\BaseContextEntryMapper.cs" />
<Compile Include="Context\Core\ContextSummaryFactory.cs" />
<Compile Include="Context\Entry\CustomerDetailContextEntry.cs" />
<Compile Include="Context\Entry\CustomerNavigationContextEntry.cs" />
<Compile Include="Context\Entry\DetailContextEntry.cs" />
<Compile Include="Context\Entry\EmployeeDetailContextEntry.cs" />
<Compile Include="Context\Entry\EmployeeNavigationContextEntry.cs" />
<Compile Include="Context\Entry\NavigationContextEntry.cs" />
<Compile Include="Context\Entry\OrganisationDetailContextEntry.cs" />
<Compile Include="Context\Entry\OrganisationNavigationContextEntry.cs" />
<Compile Include="Context\Entry\PersonDetailContextEntry.cs" />
<Compile Include="Context\Entry\PersonNavigationContextEntry.cs" />
<Compile Include="Context\Entry\ServiceRecordContextEntry.cs" />
<Compile Include="Context\Entry\SupportConceptDetailContextEntry.cs" />
<Compile Include="Context\Entry\SupportConceptNavigationContextEntry.cs" />
<Compile Include="Context\Summary\BaseContextSummary.cs" />
<Compile Include="Context\Summary\CustomerDetailContextSummary.cs" />
<Compile Include="Context\Summary\CustomerNavigationContextSummary.cs" />
<Compile Include="Context\Summary\DetailContextSummary.cs" />
<Compile Include="Context\Summary\EmployeeDetailContextSummary.cs" />
<Compile Include="Context\Summary\EmployeeNavigationContextSummary.cs" />
<Compile Include="Context\Summary\NavigationContextSummary.cs" />
<Compile Include="Context\Summary\OrganisationDetailContextSummary.cs" />
<Compile Include="Context\Summary\OrganisationNavigationContextSummary.cs" />
<Compile Include="Context\Summary\PersonDetailContextSummary.cs" />
<Compile Include="Context\Summary\PersonNavigationContextSummary.cs" />
<Compile Include="Context\Summary\ServiceRecordNavigationContextSummary.cs" />
<Compile Include="Context\Summary\SupportConceptDetailContextSummary.cs" />
<Compile Include="Context\Summary\SupportConceptNavigationContextSummary.cs" />
<Compile Include="Prompt\Core\AiUtils.cs" />
<Compile Include="Prompt\Factories\BaseAiPromptFactory.cs" />
<Compile Include="Prompt\Factories\JsonAiPromptFactory.cs" />
<Compile Include="Prompt\Models\AiConversationContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@@ -1,11 +1,6 @@
using AICore.Context.Entry;
using AICore.Context.EntryMapper;
using BeWo.Data.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AICore.Context.Core
{

View File

@@ -1,86 +1,58 @@
using AICore.Context.Core;
using AICore.Context.Entry;
using AICore.Context.EntryMapper;
using AICore.Context.Summary;
using BeWo.Data.Entities;
using System;
using BS.Shared.Exceptions;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AICore.Context.SummaryMapper
{
public static class ContextSummaryFactory
{
public static CustomerDetailContextSummary CreateCustomerDetailContextSummary(Customer customer)
public static DetailContextSummary<TEntry, TEntity> CreateDetailContext<TEntry, TEntity>(TEntity entity)
where TEntry : DetailContextEntry<TEntity>
where TEntity : BeWoEntityBase, new()
{
var entry = ContextEntryMapperFactory.CustomerMapper.MapToNewContext(customer);
object obj = null;
return new CustomerDetailContextSummary(entry);
if (entity is Customer customer)
obj = CreateCustomerDetailContextSummary(customer);
else if (entity is Employee employee)
obj = CreateEmployeeDetailContextSummary(employee);
else if (entity is Person person)
obj = CreatePersonDetailContextSummary(person);
else if (entity is Organisation organisation)
obj = CreateOrganisationDetailContextSummary(organisation);
else if (entity is SupportConcept support)
obj = CreateSupportConceptDetailContextSummary(support);
if (obj == null)
throw BeWoNotImplementedException.CreateFromInvalidObject(entity);
return obj as DetailContextSummary<TEntry, TEntity>;
}
public static EmployeeDetailContextSummary CreateEmployeeDetailContextSummary(Employee employee)
public static NavigationContextSummary<TEntry, TEntity> CreateNavigationContext<TEntry, TEntity>(IEnumerable<TEntity> entities)
where TEntry : NavigationContextEntry<TEntity>
where TEntity : BeWoEntityBase, new()
{
var entry = ContextEntryMapperFactory.EmployeeMapper.MapToNewContext(employee);
object obj = null;
return new EmployeeDetailContextSummary(entry);
}
if (entities is IEnumerable<Customer> customer)
obj = CreateCustomerNavigationContextSummary(customer);
else if (entities is IEnumerable<Employee> employee)
obj = CreateEmployeeNavigationContextSummary(employee);
else if (entities is IEnumerable<Person> person)
obj = CreatePersonNavigationContextSummary(person);
else if (entities is IEnumerable<Organisation> organisation)
obj = CreateOrganisationNavigationContextSummary(organisation);
else if (entities is IEnumerable<SupportConcept> support)
obj = CreateSupportConceptNavigationContextSummary(support);
public static PersonDetailContextSummary CreatePersonDetailContextSummary(Person person)
{
var entry = ContextEntryMapperFactory.PersonMapper.MapToNewContext(person);
if (obj == null)
throw BeWoNotImplementedException.CreateFromInvalidObject(entities);
return new PersonDetailContextSummary(entry);
}
public static OrganisationDetailContextSummary CreateOrganisationDetailContextSummary(Organisation organisation)
{
var entry = ContextEntryMapperFactory.OrganisationMapper.MapToNewContext(organisation);
return new OrganisationDetailContextSummary(entry);
}
public static SupportConceptDetailContextSummary CreateSupportConceptDetailContextSummary(SupportConcept supportConcept)
{
var entry = ContextEntryMapperFactory.SupportConceptMapper.MapToNewContext(supportConcept);
return new SupportConceptDetailContextSummary(entry);
}
public static CustomerNavigationContextSummary CreateCustomerNavigationContextSummary(IEnumerable<Customer> customer)
{
var entry = ContextEntryMapperFactory.CustomerNavigationMapper.MapToNewContexts(customer);
return new CustomerNavigationContextSummary(entry);
}
public static EmployeeNavigationContextSummary CreateEmployeeNavigationContextSummary(IEnumerable<Employee> employee)
{
var entry = ContextEntryMapperFactory.EmployeeNavigationMapper.MapToNewContexts(employee);
return new EmployeeNavigationContextSummary(entry);
}
public static PersonNavigationContextSummary CreatePersonNavigationContextSummary(IEnumerable<Person >person)
{
var entry = ContextEntryMapperFactory.PersonNavigationMapper.MapToNewContexts(person);
return new PersonNavigationContextSummary(entry);
}
public static OrganisationNavigationContextSummary CreateOrganisationNavigationContextSummary(IEnumerable<Organisation >organisation)
{
var entry = ContextEntryMapperFactory.OrganisationNavigationMapper.MapToNewContexts(organisation);
return new OrganisationNavigationContextSummary(entry);
}
public static SupportConceptNavigationContextSummary CreateSupportConceptNavigationContextSummary(IEnumerable<SupportConcept> supportConcept)
{
var entry = ContextEntryMapperFactory.SupportConceptNavigationMapper.MapToNewContexts(supportConcept);
return new SupportConceptNavigationContextSummary(entry);
return obj as NavigationContextSummary<TEntry, TEntity>;
}
public static ServiceRecordNavigationContextSummary CreateServiceRecordNavigationContextSummary(IEnumerable<ServiceRecord> serviceRecords, Customer customer, string costBearer, string supportConcept)
@@ -91,19 +63,74 @@ namespace AICore.Context.SummaryMapper
return new ServiceRecordNavigationContextSummary(entries, customer_entry, costBearer, supportConcept);
}
public class ServiceRecordNavigationContextSummary : NavigationContextSummary<ServiceRecordContextEntry>
private static CustomerDetailContextSummary CreateCustomerDetailContextSummary(Customer customer)
{
public CustomerNavigationContextEntry Customer { get; set; }
public string CostBearer { get; set; }
public string SupportConcept { get; set; }
var entry = ContextEntryMapperFactory.CustomerMapper.MapToNewContext(customer);
public ServiceRecordNavigationContextSummary(IEnumerable<ServiceRecordContextEntry> serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept)
: base(serviceRecords)
{
Customer = customer;
CostBearer = costBearer;
SupportConcept = supportConcept;
}
return new CustomerDetailContextSummary(entry);
}
private static EmployeeDetailContextSummary CreateEmployeeDetailContextSummary(Employee employee)
{
var entry = ContextEntryMapperFactory.EmployeeMapper.MapToNewContext(employee);
return new EmployeeDetailContextSummary(entry);
}
private static PersonDetailContextSummary CreatePersonDetailContextSummary(Person person)
{
var entry = ContextEntryMapperFactory.PersonMapper.MapToNewContext(person);
return new PersonDetailContextSummary(entry);
}
private static OrganisationDetailContextSummary CreateOrganisationDetailContextSummary(Organisation organisation)
{
var entry = ContextEntryMapperFactory.OrganisationMapper.MapToNewContext(organisation);
return new OrganisationDetailContextSummary(entry);
}
private static SupportConceptDetailContextSummary CreateSupportConceptDetailContextSummary(SupportConcept supportConcept)
{
var entry = ContextEntryMapperFactory.SupportConceptMapper.MapToNewContext(supportConcept);
return new SupportConceptDetailContextSummary(entry);
}
private static CustomerNavigationContextSummary CreateCustomerNavigationContextSummary(IEnumerable<Customer> customer)
{
var entry = ContextEntryMapperFactory.CustomerNavigationMapper.MapToNewContexts(customer);
return new CustomerNavigationContextSummary(entry);
}
private static EmployeeNavigationContextSummary CreateEmployeeNavigationContextSummary(IEnumerable<Employee> employee)
{
var entry = ContextEntryMapperFactory.EmployeeNavigationMapper.MapToNewContexts(employee);
return new EmployeeNavigationContextSummary(entry);
}
private static PersonNavigationContextSummary CreatePersonNavigationContextSummary(IEnumerable<Person> person)
{
var entry = ContextEntryMapperFactory.PersonNavigationMapper.MapToNewContexts(person);
return new PersonNavigationContextSummary(entry);
}
private static OrganisationNavigationContextSummary CreateOrganisationNavigationContextSummary(IEnumerable<Organisation> organisation)
{
var entry = ContextEntryMapperFactory.OrganisationNavigationMapper.MapToNewContexts(organisation);
return new OrganisationNavigationContextSummary(entry);
}
private static SupportConceptNavigationContextSummary CreateSupportConceptNavigationContextSummary(IEnumerable<SupportConcept> supportConcept)
{
var entry = ContextEntryMapperFactory.SupportConceptNavigationMapper.MapToNewContexts(supportConcept);
return new SupportConceptNavigationContextSummary(entry);
}
}
}

View File

@@ -1,131 +1,7 @@
using BeWo.Data.Entities;
using BS.Shared.DataContracts.Compact;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace AICore.Context.Entry
namespace AICore.Context.Entry
{
public abstract class BaseContextEntry
{
}
public abstract class DetailContextEntry : BaseContextEntry
{
}
public class CustomerDetailContextEntry : DetailContextEntry
{
}
public class EmployeeDetailContextEntry : DetailContextEntry
{
}
public class PersonDetailContextEntry : DetailContextEntry
{
}
public class OrganisationDetailContextEntry : DetailContextEntry
{
}
public class SupportConceptDetailContextEntry : DetailContextEntry
{
}
public abstract class NavigationContextEntry : BaseContextEntry
{
}
public class CustomerNavigationContextEntry : NavigationContextEntry
{
[JsonPropertyName("Adresse")]
public string AddressString { get; set; }
[JsonPropertyName("Alias")]
public string CustomerAlias { get; set; }
[JsonPropertyName("Klient-ID")]
public long CustomerOid { get; set; }
[JsonPropertyName("Geburtstag")]
public string DateOfBirthString { get; set; }
[JsonPropertyName("EigenkapitalBeitrag")]
public decimal EquityContribution { get; set; }
[JsonPropertyName("Name")]
public string EquityConFullNametribution { get; set; }
[JsonPropertyName("Rechnungsadresse")]
public string InvoiceAddressString { get; set; }
}
public class EmployeeNavigationContextEntry : NavigationContextEntry {
[JsonPropertyName("Mitarbeiter-ID")]
public long EmployeeOid { get; set; }
[JsonPropertyName("Personalnummer")]
public string PersonnelNumber { get; set; }
[JsonPropertyName("Name")]
public string FirstNameLastName { get; set; }
}
public class PersonNavigationContextEntry : NavigationContextEntry {
public string AddressString { get; set; }
public DateTime Birthday { get; set; }
public long CustomerOid { get; set; }
public long EmployeeOid { get; set; }
public string FullName { get; set; }
public string Geschlecht { get; set; }
public string Function { get; set; }
}
public class OrganisationNavigationContextEntry : NavigationContextEntry {
public long OrganisationOid { get; set; }
public string Name { get; set; }
public string Name2 { get; set; }
public string DebitorNumber { get; set; }
public string BusinessPartnerId { get; set; }
public string AddressString { get; set; }
public string IKDatenannahmestelle { get; set; }
public string IKKostentrager { get; set; }
public string IKKrankenkasse { get; set; }
}
public class SupportConceptNavigationContextEntry : NavigationContextEntry {
public long SupportConceptOid { get; set; }
public string AddressString { get; set; }
public string AllCostBearerNames { get; set; }
public object CostBearer { get; set; }
public string CostBearerDetailStrings { get; set; }
public long CustomerOid { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
}
public class ServiceRecordContextEntry : NavigationContextEntry
{
public string ServiceRecordOid { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public decimal DurationInStunden { get; set; }
public string CategoryName { get; set; }
public string Name { get; set; }
public string Notice { get; set; }
public decimal DistanceInMeter { get; set; }
public DateTime InsertedOn { get; set; }
public decimal Betrag { get; set; }
public object InsUser { get; set; }
public object Employee { get; set; }
}
}

View File

@@ -0,0 +1,78 @@
using BeWo.Data.Entities;
using System;
using System.Text.Json.Serialization;
namespace AICore.Context.Entry
{
public class CustomerDetailContextEntry : DetailContextEntry<Customer>
{
[JsonPropertyName("Klient-ID")]
public long CustomerOid { get; set; }
[JsonPropertyName("Name")]
public string FullName { get; set; }
[JsonPropertyName("Alias")]
public string CustomerAlias { get; set; }
[JsonPropertyName("Geburtstag")]
public DateTime? DateOfBirth { get; set; }
[JsonPropertyName("Geschlecht")]
public string Sex { get; set; }
[JsonPropertyName("Nationalität")]
public string NationalitaetDisplayName { get; set; }
[JsonPropertyName("HatMigrationshintergrund")]
public bool IsMigrant { get; set; }
[JsonPropertyName("Migrationshintergrund")]
public string Migrationshintergrund { get; set; }
[JsonPropertyName("Aufenthaltsstatus")]
public string AufenthaltsStatusDisplayName { get; set; }
[JsonPropertyName("Familienstand")]
public string FamilyStatus { get; set; }
[JsonPropertyName("Beruf")]
public string Profession { get; set; }
[JsonPropertyName("Kinder")]
public string Childs { get; set; }
[JsonPropertyName("Eigenbeteiligung")]
public decimal? EquityContribution { get; set; }
[JsonPropertyName("Krankenkasse")]
public string HealthInsurance { get; set; }
[JsonPropertyName("Versichertennummer")]
public string InsuranceNumber { get; set; }
[JsonPropertyName("Versichertenstatus")]
public string VersichertenStatus { get; set; }
[JsonPropertyName("Kommentar")]
public string Notice { get; set; }
[JsonPropertyName("Adressezeile 1")]
public string AddressLine1 { get; set; }
[JsonPropertyName("Straße")]
public string Street { get; set; }
[JsonPropertyName("PLZ")]
public string PostalCode { get; set; }
[JsonPropertyName("Ort")]
public string Town { get; set; }
[JsonPropertyName("Distanz in km")]
public double? DistanceInMeter { get; set; }
[JsonPropertyName("Rechnungsadresse")]
public string InvoiceAddress { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
using BeWo.Data.Entities;
using System;
using System.Text.Json.Serialization;
namespace AICore.Context.Entry
{
public class CustomerNavigationContextEntry : NavigationContextEntry<Customer>
{
[JsonPropertyName("Adresse")]
public string AddressString { get; set; }
[JsonPropertyName("Alias")]
public string CustomerAlias { get; set; }
[JsonPropertyName("Klient-ID")]
public long CustomerOid { get; set; }
[JsonPropertyName("Geburtstag")]
public DateTime? DateOfBirth { get; set; }
[JsonPropertyName("EigenkapitalBeitrag")]
public decimal? EquityContribution { get; set; }
[JsonPropertyName("FullName")]
public string FullName { get; set; }
[JsonPropertyName("Rechnungsadresse")]
public string InvoiceAddressString { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace AICore.Context.Entry
{
public abstract class DetailContextEntry<T> : BaseContextEntry
{
}
}

View File

@@ -0,0 +1,9 @@
using BeWo.Data.Entities;
namespace AICore.Context.Entry
{
public class EmployeeDetailContextEntry : DetailContextEntry<Employee>
{
}
}

View File

@@ -0,0 +1,17 @@
using BeWo.Data.Entities;
using System.Text.Json.Serialization;
namespace AICore.Context.Entry
{
public class EmployeeNavigationContextEntry : NavigationContextEntry<Employee>
{
[JsonPropertyName("Mitarbeiter-ID")]
public long EmployeeOid { get; set; }
[JsonPropertyName("Personalnummer")]
public string PersonnelNumber { get; set; }
[JsonPropertyName("Name")]
public string FirstNameLastName { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace AICore.Context.Entry
{
public abstract class NavigationContextEntry<T> : BaseContextEntry
{
}
}

View File

@@ -0,0 +1,9 @@
using BeWo.Data.Entities;
namespace AICore.Context.Entry
{
public class OrganisationDetailContextEntry : DetailContextEntry<Organisation>
{
}
}

View File

@@ -0,0 +1,35 @@
using BeWo.Data.Entities;
using System.Text.Json.Serialization;
namespace AICore.Context.Entry
{
public class OrganisationNavigationContextEntry : NavigationContextEntry<Organisation>
{
[JsonPropertyName("Organisation-ID")]
public long OrganisationOid { get; set; }
[JsonPropertyName("Name")]
public string Name { get; set; }
[JsonPropertyName("Abteilung")]
public string Name2 { get; set; }
[JsonPropertyName("Kundennummer")]
public string DebitorNumber { get; set; }
[JsonPropertyName("Geschäftspartnernummer")]
public string BusinessPartnerId { get; set; }
[JsonPropertyName("Adress")]
public string AddressString { get; set; }
[JsonPropertyName("IKDatenannahmestelle")]
public string IKDatenannahmestelle { get; set; }
[JsonPropertyName("IKKostentrager")]
public string IKKostentrager { get; set; }
[JsonPropertyName("IKKrankenkasse")]
public string IKKrankenkasse { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using BeWo.Data.Entities;
namespace AICore.Context.Entry
{
public class PersonDetailContextEntry : DetailContextEntry<Person>
{
}
}

View File

@@ -0,0 +1,30 @@
using BeWo.Data.Entities;
using System;
using System.Text.Json.Serialization;
namespace AICore.Context.Entry
{
public class PersonNavigationContextEntry : NavigationContextEntry<Person>
{
[JsonPropertyName("Adresse")]
public string AddressString { get; set; }
[JsonPropertyName("Geburtstag")]
public DateTime? DateOfBirth { get; set; }
//[JsonPropertyName("Klient-ID")]
//public string CustomerOid { get; set; }
//[JsonPropertyName("Mitarbeiter-ID")]
//public string EmployeeOid { get; set; }
[JsonPropertyName("Name")]
public string FullName { get; set; }
[JsonPropertyName("Geschlecht")]
public string Geschlecht { get; set; }
[JsonPropertyName("Funktion")]
public string Function { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using BeWo.Data.Entities;
using System;
using System.Text.Json.Serialization;
namespace AICore.Context.Entry
{
public class ServiceRecordContextEntry : NavigationContextEntry<ServiceRecord>
{
[JsonPropertyName("Zeiteintrag-ID")]
public long ServiceRecordOid { get; set; }
[JsonPropertyName("Startdatum")]
public DateTime? Start { get; set; }
[JsonPropertyName("Enddatum")]
public DateTime? End { get; set; }
[JsonPropertyName("Dauer in Minuten")]
public double DurationInMinuten { get; set; }
[JsonPropertyName("Leistungskategorie")]
public string CategoryName { get; set; }
[JsonPropertyName("Leistungsbeschreibung")]
public string DescriptionName { get; set; }
[JsonPropertyName("Dokumentation")]
public string Notice { get; set; }
[JsonPropertyName("Dokumentation2")]
public string Notice2 { get; set; }
[JsonPropertyName("Dokumentation3")]
public string Notice3 { get; set; }
[JsonPropertyName("Dokumentation4")]
public string Notice4 { get; set; }
[JsonPropertyName("Dokumentation5")]
public string Notice5 { get; set; }
[JsonPropertyName("Distanze in Meter")]
public decimal? DistanceInMeter { get; set; }
[JsonPropertyName("Eingetragen am")]
public DateTime InsertedOn { get; set; }
[JsonPropertyName("Betrag")]
public decimal? Betrag { get; set; }
[JsonPropertyName("Eingetragen von")]
public string InsUser { get; set; }
[JsonPropertyName("Mitarbeiter")]
public string Employee { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using BeWo.Data.Entities;
namespace AICore.Context.Entry
{
public class SupportConceptDetailContextEntry : DetailContextEntry<SupportConcept>
{
}
}

View File

@@ -0,0 +1,33 @@
using BeWo.Data.Entities;
using System;
using System.Text.Json.Serialization;
namespace AICore.Context.Entry
{
public class SupportConceptNavigationContextEntry : NavigationContextEntry<SupportConcept>
{
[JsonPropertyName("Hilfeplan-ID")]
public long SupportConceptOid { get; set; }
[JsonPropertyName("Adresse")]
public string AddressString { get; set; }
[JsonPropertyName("Kostentraegernamen")]
public string AllCostBearerNames { get; set; }
[JsonPropertyName("Kostentraeger")]
public string CostBearer { get; set; }
[JsonPropertyName("Kostentraeger Details")]
public string CostBearerDetailStrings { get; set; }
[JsonPropertyName("Klient")]
public object Customer { get; set; } // Typ ist unsicher, daher object
[JsonPropertyName("Startdatum")]
public DateTime? StartDate { get; set; }
[JsonPropertyName("Enddatum")]
public DateTime? EndDate { get; set; }
}
}

View File

@@ -1,7 +1,4 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -12,7 +9,11 @@ namespace AICore.Context.EntryMapper
{
public virtual TContext MapToNewContext(TObject pObject)
{
return MergeWithObject(pObject, CreateNewContext());
var context = CreateNewContext();
MergeWithObject(pObject, context);
return context;
}
public virtual TContext CreateNewContext()
@@ -22,125 +23,12 @@ namespace AICore.Context.EntryMapper
public virtual IEnumerable<TContext> MapToNewContexts(IEnumerable<TObject> pObjects)
{
if(pObjects is null || !pObjects.Any())
if (pObjects is null || !pObjects.Any())
return Enumerable.Empty<TContext>();
return pObjects.Select(MapToNewContext);
}
public abstract TContext MergeWithObject(TObject pDataContract, TContext pContext);
}
public class CustomerContextEntryMapper : BaseContextEntryMapper<Customer, CustomerDetailContextEntry>
{
public override CustomerDetailContextEntry MergeWithObject(Customer pObject, CustomerDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class EmployeeContextEntryMapper : BaseContextEntryMapper<Employee, EmployeeDetailContextEntry>
{
public override EmployeeDetailContextEntry MergeWithObject(Employee pObject, EmployeeDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class PersonContextEntryMapper : BaseContextEntryMapper<Person, PersonDetailContextEntry>
{
public override PersonDetailContextEntry MergeWithObject(Person pObject, PersonDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class OrganisationContextEntryMapper : BaseContextEntryMapper<Organisation, OrganisationDetailContextEntry>
{
public override OrganisationDetailContextEntry MergeWithObject(Organisation pObject, OrganisationDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class SupportConceptContextEntryMapper : BaseContextEntryMapper<SupportConcept, SupportConceptDetailContextEntry>
{
public override SupportConceptDetailContextEntry MergeWithObject(SupportConcept pObject, SupportConceptDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class CustomerNavigationContextEntryMapper : BaseContextEntryMapper<Customer, CustomerNavigationContextEntry>
{
public override CustomerNavigationContextEntry MergeWithObject(Customer pObject, CustomerNavigationContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class EmployeeNavigationContextEntryMapper : BaseContextEntryMapper<Employee, EmployeeNavigationContextEntry>
{
public override EmployeeNavigationContextEntry MergeWithObject(Employee pObject, EmployeeNavigationContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class PersonNavigationContextEntryMapper : BaseContextEntryMapper<Person, PersonNavigationContextEntry>
{
public override PersonNavigationContextEntry MergeWithObject(Person pObject, PersonNavigationContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class OrganisationNavigationContextEntryMapper : BaseContextEntryMapper<Organisation, OrganisationNavigationContextEntry>
{
public override OrganisationNavigationContextEntry MergeWithObject(Organisation pObject, OrganisationNavigationContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class SupportConceptNavigationContextEntryMapper : BaseContextEntryMapper<SupportConcept, SupportConceptNavigationContextEntry>
{
public override SupportConceptNavigationContextEntry MergeWithObject(SupportConcept pObject, SupportConceptNavigationContextEntry pContext)
{
throw new NotImplementedException();
}
}
public class ServiceRecordContextEntryMapper : BaseContextEntryMapper<ServiceRecord, ServiceRecordContextEntry>
{
public override ServiceRecordContextEntry MergeWithObject(ServiceRecord pObject, ServiceRecordContextEntry pContext)
{
throw new NotImplementedException();
}
//public override Dictionary<string, object> ToJsonDictionary(ServiceRecordDC service_record)
//{
// var record_dict = new Dictionary<string, object>
// {
// { "Zeiteintrag-ID", service_record.ServiceRecordOid},
// { "Startdatum", service_record.Start },
// { "Enddatum", service_record.End },
// { "Dauer in Stunden", service_record.DurationInStunden },
// { "Leistungskategorie", service_record.ServiceDescription.Category.Name },
// { "Leistungsbeschreibung", service_record.ServiceDescription.Name },
// { "Dokumentation", service_record.Notice
// + "\n" + service_record.Notice2
// + "\n" + service_record.Notice3
// + "\n" + service_record.Notice4
// + "\n" + service_record.Notice5},
// { "Distanze in Meter", service_record.DistanceInMeter ?? 0 },
// { "Eingetragen am", service_record.InsertedOn },
// { "Betrag", service_record.Betrag },
// { "Eingetragen von", service_record.InsUser },
// { "Mitarbeiter", service_record.Employee }
// };
// return record_dict;
//}
public abstract void MergeWithObject(TObject pDataContract, TContext pContext);
}
}

View File

@@ -0,0 +1,35 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class CustomerContextEntryMapper : BaseContextEntryMapper<Customer, CustomerDetailContextEntry>
{
public override void MergeWithObject(Customer pObject, CustomerDetailContextEntry pContext)
{
pContext.CustomerOid = pObject.Oid ?? 0;
pContext.FullName = pObject.Person.FirstNameLastName;
pContext.CustomerAlias = pObject.CustomerAlias;
pContext.DateOfBirth = pObject.Person.DateOfBirth;
pContext.Sex = pObject.Person.Sex?.ToString() ?? "null";
pContext.NationalitaetDisplayName = pObject.Person.Nationalitaet.Value;
pContext.IsMigrant = pObject.Person.IsMigrant;
pContext.Migrationshintergrund = pObject.Person.Migrationshintergrund;
pContext.AufenthaltsStatusDisplayName = pObject.Person.AufenthaltsStatus.Value;
pContext.FamilyStatus = pObject.Person.FamilyStatus?.ToString() ?? "null";
pContext.Profession = pObject.Person.Profession;
pContext.Childs = pObject.Childs;
pContext.EquityContribution = pObject.EquityContribution;
pContext.HealthInsurance = pObject.HealthInsurance;
pContext.InsuranceNumber = pObject.InsuranceNumber;
pContext.VersichertenStatus = pObject.VersichertenStatus;
pContext.Notice = pObject.Notice;
pContext.AddressLine1 = pObject.Person.Address.AddressLine1;
pContext.Street = pObject.Person.Address.Street;
pContext.PostalCode = pObject.Person.Address.PostalCode;
pContext.Town = pObject.Person.Address.Town;
pContext.DistanceInMeter = pObject.DistanceInMeter;
pContext.InvoiceAddress = "---";
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class CustomerNavigationContextEntryMapper : BaseContextEntryMapper<Customer, CustomerNavigationContextEntry>
{
public override void MergeWithObject(Customer pObject, CustomerNavigationContextEntry pContext)
{
pContext.AddressString = "---";
pContext.CustomerAlias = pObject.CustomerAlias;
pContext.CustomerOid = pObject.Oid.Value;
pContext.DateOfBirth = pObject.Person.DateOfBirth;
pContext.EquityContribution = pObject.EquityContribution;
pContext.FullName = pObject.Person.FirstNameLastName;
pContext.InvoiceAddressString = "---";
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class EmployeeContextEntryMapper : BaseContextEntryMapper<Employee, EmployeeDetailContextEntry>
{
public override void MergeWithObject(Employee pObject, EmployeeDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class EmployeeNavigationContextEntryMapper : BaseContextEntryMapper<Employee, EmployeeNavigationContextEntry>
{
public override void MergeWithObject(Employee pObject, EmployeeNavigationContextEntry pContext)
{
pContext.EmployeeOid = pObject.Oid.Value;
pContext.PersonnelNumber = pObject.PersonnelNumber;
pContext.FirstNameLastName = pObject.Person.FirstNameLastName;
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class OrganisationContextEntryMapper : BaseContextEntryMapper<Organisation, OrganisationDetailContextEntry>
{
public override void MergeWithObject(Organisation pObject, OrganisationDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class OrganisationNavigationContextEntryMapper : BaseContextEntryMapper<Organisation, OrganisationNavigationContextEntry>
{
public override void MergeWithObject(Organisation pObject, OrganisationNavigationContextEntry pContext)
{
pContext.OrganisationOid = pObject.Oid.Value;
pContext.Name = pObject.Name;
pContext.Name2 = pObject.Name2;
pContext.DebitorNumber = pObject.DebitorNumber;
pContext.BusinessPartnerId = pObject.BusinessPartnerId;
pContext.AddressString = "---";
pContext.IKDatenannahmestelle = pObject.IKDatenannahmestelle;
pContext.IKKostentrager = pObject.IKKostentrager;
pContext.IKKrankenkasse = pObject.IKKrankenkasse;
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class PersonContextEntryMapper : BaseContextEntryMapper<Person, PersonDetailContextEntry>
{
public override void MergeWithObject(Person pObject, PersonDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class PersonNavigationContextEntryMapper : BaseContextEntryMapper<Person, PersonNavigationContextEntry>
{
public override void MergeWithObject(Person pObject, PersonNavigationContextEntry pContext)
{
pContext.AddressString = "---";
pContext.DateOfBirth = pObject.DateOfBirth;
//pContext.CustomerOid = "---";
//pContext.EmployeeOid = "---";
pContext.FullName = pObject.FirstNameLastName;
pContext.Geschlecht = pObject.Sex.ToString();
pContext.Function = pObject.Function.Value;
}
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class ServiceRecordContextEntryMapper : BaseContextEntryMapper<ServiceRecord, ServiceRecordContextEntry>
{
public override void MergeWithObject(ServiceRecord pObject, ServiceRecordContextEntry pContext)
{
pContext.ServiceRecordOid = pObject.Oid.Value;
pContext.Start = pObject.Start;
pContext.End = pObject.End;
pContext.DurationInMinuten = pObject.DurationMinutes;
pContext.CategoryName = pObject.ServiceDescription.ServiceCategory.Name;
pContext.DescriptionName = pObject.ServiceDescription.Name;
pContext.Notice = pObject.Notice;
pContext.Notice2 = pObject.Notice2;
pContext.Notice3 = pObject.Notice3;
pContext.Notice4 = pObject.Notice4;
pContext.Notice5 = pObject.Notice5;
pContext.DistanceInMeter = pObject.DistanceInMeter;
pContext.InsertedOn = pObject.InsTs.Value;
pContext.Betrag = pObject.Betrag;
pContext.InsUser = pObject.InsUser;
pContext.Employee = pObject.Employee.Person.FirstNameLastName;
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class SupportConceptContextEntryMapper : BaseContextEntryMapper<SupportConcept, SupportConceptDetailContextEntry>
{
public override void MergeWithObject(SupportConcept pObject, SupportConceptDetailContextEntry pContext)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Linq;
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.EntryMapper
{
public class SupportConceptNavigationContextEntryMapper : BaseContextEntryMapper<SupportConcept, SupportConceptNavigationContextEntry>
{
public override void MergeWithObject(SupportConcept pObject, SupportConceptNavigationContextEntry pContext)
{
pContext.SupportConceptOid = pObject.Oid.Value;
pContext.AddressString = "---";
pContext.AllCostBearerNames = "---";//pObject.AllCostBearerNames;
pContext.CostBearer = "---";//pObject.CostBearer;
pContext.CostBearerDetailStrings = "---";//pObject.CostBearerDetailStrings;
pContext.Customer = pObject.Customer; //Typ ist unsicher, daher object
pContext.StartDate = pObject.StartDate;
pContext.EndDate = pObject.EndDate;
}
}
}

View File

@@ -1,115 +1,7 @@
using AICore.Context.Entry;
using AICore.Context.EntryMapper;
using BeWo.Data.Entities;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AICore.Context.Summary
namespace AICore.Context.Summary
{
public abstract class BaseContextSummary
{
}
public abstract class DetailContext<T> : BaseContextSummary where T : DetailContextEntry
{
public T DataContext { get; set; }
protected DetailContext(T dataContext)
{
DataContext = dataContext;
}
}
public abstract class NavigationContextSummary<T> : BaseContextSummary where T : NavigationContextEntry
{
public IEnumerable<T> DataContext { get; set; }
protected NavigationContextSummary(IEnumerable<T> dataContext)
{
DataContext = dataContext;
}
}
public class CustomerDetailContextSummary : DetailContext<CustomerDetailContextEntry>
{
public CustomerDetailContextSummary(CustomerDetailContextEntry customer) : base(customer) { }
}
public class EmployeeDetailContextSummary : DetailContext<EmployeeDetailContextEntry>
{
public EmployeeDetailContextSummary(EmployeeDetailContextEntry employee) : base(employee) { }
}
public class PersonDetailContextSummary : DetailContext<PersonDetailContextEntry>
{
public PersonDetailContextSummary(PersonDetailContextEntry person) : base(person) { }
}
public class OrganisationDetailContextSummary : DetailContext<OrganisationDetailContextEntry>
{
public OrganisationDetailContextSummary(OrganisationDetailContextEntry organisation) : base(organisation) { }
}
public class SupportConceptDetailContextSummary : DetailContext<SupportConceptDetailContextEntry>
{
public SupportConceptDetailContextSummary(SupportConceptDetailContextEntry supportConcept) : base(supportConcept) { }
}
public class CustomerNavigationContextSummary : NavigationContextSummary<CustomerNavigationContextEntry>
{
public CustomerNavigationContextSummary(IEnumerable<CustomerNavigationContextEntry> customers) : base(customers) { }
}
public class EmployeeNavigationContextSummary : NavigationContextSummary<EmployeeNavigationContextEntry>
{
public EmployeeNavigationContextSummary(IEnumerable<EmployeeNavigationContextEntry> employee) : base(employee) { }
}
public class PersonNavigationContextSummary : NavigationContextSummary<PersonNavigationContextEntry>
{
public PersonNavigationContextSummary(IEnumerable<PersonNavigationContextEntry> person) : base(person) { }
}
public class OrganisationNavigationContextSummary : NavigationContextSummary<OrganisationNavigationContextEntry>
{
public OrganisationNavigationContextSummary(IEnumerable<OrganisationNavigationContextEntry> organisation) : base(organisation) { }
}
public class SupportConceptNavigationContextSummary : NavigationContextSummary<SupportConceptNavigationContextEntry>
{
public SupportConceptNavigationContextSummary(IEnumerable<SupportConceptNavigationContextEntry> supportConcept) : base(supportConcept) { }
}
public class ServiceRecordNavigationContextSummary : NavigationContextSummary<ServiceRecordContextEntry>
{
public CustomerNavigationContextEntry Customer { get; set; }
public string CostBearer { get; set; }
public string SupportConcept { get; set; }
public ServiceRecordNavigationContextSummary(List<ServiceRecordContextEntry> serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept)
: base(serviceRecords)
{
Customer = customer;
CostBearer = costBearer;
SupportConcept = supportConcept;
}
//var customer = LoadEntity(bewoobjects, TableID.Customer, MapperFactory.CompactCustomerDC_Customer);
//var costbearer = LoadProperty(bewoobjects, TableID.CostBearer, MapperFactory.CompactOrganisationDC_Organisation, dc => dc.Name);
//var supportconcept = LoadProperty(bewoobjects, TableID.SupportConcept, MapperFactory.CompactSupportConceptDC_SupportConcept, dc => $"{dc.StartDate?.Date} - {dc.EndDate?.Date}");
//var records = LoadEntities(bewoobjects, TableID.ServiceRecord, MapperFactory.ServiceRecordDC_ServiceRecord);
//var result = new Dictionary<TableID, object>
// {
// { TableID.ServiceRecord, records },
// { TableID.Customer, customer },
// { TableID.CostBearer, costbearer },
// { TableID.SupportConcept, supportconcept }
// };
// return result;
}
}

View File

@@ -0,0 +1,10 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.Summary
{
public class CustomerDetailContextSummary : DetailContextSummary<CustomerDetailContextEntry, Customer>
{
public CustomerDetailContextSummary(CustomerDetailContextEntry customer) : base(customer) { }
}
}

View File

@@ -0,0 +1,11 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
using System.Collections.Generic;
namespace AICore.Context.Summary
{
public class CustomerNavigationContextSummary : NavigationContextSummary<CustomerNavigationContextEntry, Customer>
{
public CustomerNavigationContextSummary(IEnumerable<CustomerNavigationContextEntry> customers) : base(customers) { }
}
}

View File

@@ -0,0 +1,14 @@
using AICore.Context.Entry;
namespace AICore.Context.Summary
{
public abstract class DetailContextSummary<TEntry, TEntity> : BaseContextSummary where TEntry : DetailContextEntry<TEntity>
{
public TEntry DataContext { get; set; }
protected DetailContextSummary(TEntry dataContext)
{
DataContext = dataContext;
}
}
}

View File

@@ -0,0 +1,10 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.Summary
{
public class EmployeeDetailContextSummary : DetailContextSummary<EmployeeDetailContextEntry, Employee>
{
public EmployeeDetailContextSummary(EmployeeDetailContextEntry employee) : base(employee) { }
}
}

View File

@@ -0,0 +1,11 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
using System.Collections.Generic;
namespace AICore.Context.Summary
{
public class EmployeeNavigationContextSummary : NavigationContextSummary<EmployeeNavigationContextEntry, Employee>
{
public EmployeeNavigationContextSummary(IEnumerable<EmployeeNavigationContextEntry> employee) : base(employee) { }
}
}

View File

@@ -0,0 +1,15 @@
using AICore.Context.Entry;
using System.Collections.Generic;
namespace AICore.Context.Summary
{
public abstract class NavigationContextSummary<TEntry, TEntity> : BaseContextSummary where TEntry : NavigationContextEntry<TEntity>
{
public IEnumerable<TEntry> DataContext { get; set; }
protected NavigationContextSummary(IEnumerable<TEntry> dataContext)
{
DataContext = dataContext;
}
}
}

View File

@@ -0,0 +1,10 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.Summary
{
public class OrganisationDetailContextSummary : DetailContextSummary<OrganisationDetailContextEntry, Organisation>
{
public OrganisationDetailContextSummary(OrganisationDetailContextEntry organisation) : base(organisation) { }
}
}

View File

@@ -0,0 +1,11 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
using System.Collections.Generic;
namespace AICore.Context.Summary
{
public class OrganisationNavigationContextSummary : NavigationContextSummary<OrganisationNavigationContextEntry, Organisation>
{
public OrganisationNavigationContextSummary(IEnumerable<OrganisationNavigationContextEntry> organisation) : base(organisation) { }
}
}

View File

@@ -0,0 +1,10 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.Summary
{
public class PersonDetailContextSummary : DetailContextSummary<PersonDetailContextEntry, Person>
{
public PersonDetailContextSummary(PersonDetailContextEntry person) : base(person) { }
}
}

View File

@@ -0,0 +1,11 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
using System.Collections.Generic;
namespace AICore.Context.Summary
{
public class PersonNavigationContextSummary : NavigationContextSummary<PersonNavigationContextEntry, Person>
{
public PersonNavigationContextSummary(IEnumerable<PersonNavigationContextEntry> person) : base(person) { }
}
}

View File

@@ -0,0 +1,36 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
using System.Collections.Generic;
namespace AICore.Context.Summary
{
public class ServiceRecordNavigationContextSummary : NavigationContextSummary<ServiceRecordContextEntry, ServiceRecord>
{
public CustomerNavigationContextEntry Customer { get; set; }
public string CostBearer { get; set; }
public string SupportConcept { get; set; }
public ServiceRecordNavigationContextSummary(IEnumerable<ServiceRecordContextEntry> serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept)
: base(serviceRecords)
{
Customer = customer;
CostBearer = costBearer;
SupportConcept = supportConcept;
}
//var customer = LoadEntity(bewoobjects, TableID.Customer, MapperFactory.CompactCustomerDC_Customer);
//var costbearer = LoadProperty(bewoobjects, TableID.CostBearer, MapperFactory.CompactOrganisationDC_Organisation, dc => dc.Name);
//var supportconcept = LoadProperty(bewoobjects, TableID.SupportConcept, MapperFactory.CompactSupportConceptDC_SupportConcept, dc => $"{dc.StartDate?.Date} - {dc.EndDate?.Date}");
//var records = LoadEntities(bewoobjects, TableID.ServiceRecord, MapperFactory.ServiceRecordDC_ServiceRecord);
//var result = new Dictionary<TableID, object>
// {
// { TableID.ServiceRecord, records },
// { TableID.Customer, customer },
// { TableID.CostBearer, costbearer },
// { TableID.SupportConcept, supportconcept }
// };
// return result;
}
}

View File

@@ -0,0 +1,10 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
namespace AICore.Context.Summary
{
public class SupportConceptDetailContextSummary : DetailContextSummary<SupportConceptDetailContextEntry, SupportConcept>
{
public SupportConceptDetailContextSummary(SupportConceptDetailContextEntry supportConcept) : base(supportConcept) { }
}
}

View File

@@ -0,0 +1,11 @@
using AICore.Context.Entry;
using BeWo.Data.Entities;
using System.Collections.Generic;
namespace AICore.Context.Summary
{
public class SupportConceptNavigationContextSummary : NavigationContextSummary<SupportConceptNavigationContextEntry, SupportConcept>
{
public SupportConceptNavigationContextSummary(IEnumerable<SupportConceptNavigationContextEntry> supportConcept) : base(supportConcept) { }
}
}

View File

@@ -1,16 +1,8 @@
using BS.Shared;
using BS.Shared.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AICore.Prompt.Core
namespace AICore.Prompt.Core
{
public static class AiUtils
{
}
}

View File

@@ -1,306 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using AICore.Context.Summary;
using AICore.Context.SummaryMapper;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.ServiceUtils.Core;
using BS.Shared;
using BS.Shared.Exceptions;
using BS.Shared.Translation;
namespace AICore.Prompt.Factories
{
public abstract class BaseAiPromptFactory
{
public string CreateSystemInstructions(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
var sb = new StringBuilder();
sb.AppendLine(getCustomSystemPrompt());
sb.AppendLine($"Ich befinde mich aktuell in der \"{Translator.Translate(uicontext)}\" meiner Anwendung.");
sb.AppendLine("Es ist kein Filter gesetzt.");
if (bewoobjects is null || bewoobjects.Count == 0)
{
sb.AppendLine("Dir wurden keine Daten bereitgestellt.");
}
else
{
sb.AppendLine("Du erhälst folgendes:");
var parsed = LoadContext(uicontext, bewoobjects);
sb.AppendLine(parsed);
}
return sb.ToString();
}
private string LoadContext(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
var context = GetContext(uicontext, bewoobjects);
var parsed = Parse(uicontext, null);
return parsed;
}
protected virtual string Parse(AiContextType uicontext, Dictionary<TableID, object> data)
{
throw new NotImplementedException();
}
protected BaseContextSummary GetContext(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
switch (uicontext)
{
case AiContextType.SupportConcept:
case AiContextType.Customer:
case AiContextType.Person:
case AiContextType.Employee:
case AiContextType.Organisation:
return GetNavigationContext(uicontext, bewoobjects);
case AiContextType.ServiceRecord:
return GetServiceRecordsContext(bewoobjects);
case AiContextType.CustomerSingle:
case AiContextType.PersonSingle:
case AiContextType.EmployeeSingle:
return GetSingleContext(uicontext, bewoobjects);
default:
break;
}
throw BeWoNotImplementedException.CreateFromEnum(uicontext);
}
private BaseContextSummary GetNavigationContext(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
switch (uicontext)
{
case AiContextType.SupportConcept:
return new SupportConceptNavigationContextSummary(LoadEntities<SupportConcept>(bewoobjects, TableID.SupportConcept));
case AiContextType.Customer:
return new CustomerNavigationContextSummary(LoadEntities<Customer>(bewoobjects, TableID.Customer));
case AiContextType.Person:
return new PersonNavigationContextSummary(LoadEntities<Person>(bewoobjects, TableID.Person));
case AiContextType.Employee:
return new EmployeeNavigationContextSummary(LoadEntities<Employee>(bewoobjects, TableID.Employee));
case AiContextType.Organisation:
return new OrganisationNavigationContextSummary(LoadEntities<Organisation>(bewoobjects, TableID.Organisation));
}
throw BeWoNotImplementedException.CreateFromEnum(uicontext);
}
private BaseContextSummary GetServiceRecordsContext(Dictionary<TableID, long[]> bewoobjects)
{
var context = new ServiceRecordNavigationContext()
}
private BaseContextSummary GetSingleContext(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
switch (uicontext)
{
case AiContextType.CustomerSingle:
return new CustomerDetailContextSummary(LoadEntity<Customer>(bewoobjects, TableID.Customer));
case AiContextType.PersonSingle:
return new PersonDetailContextSummary(LoadEntity<Person>(bewoobjects, TableID.Person));
case AiContextType.EmployeeSingle:
return new EmployeeDetailContextSummary(LoadEntity<Employee>(bewoobjects, TableID.Employee));
default:
break;
}
throw BeWoNotImplementedException.CreateFromEnum(uicontext);
}
public Dictionary<TableID, object> LoadContext(int uicontext, Dictionary<TableID, long[]> bewoobjects)
{
var result = new Dictionary<TableID, object>();
switch (uicontext)
{
case 0: return LoadNavigationContext(TableID.SupportConcept, bewoobjects);
case 1: return LoadNavigationContext(TableID.Customer, bewoobjects);
case 2: return LoadNavigationContext(TableID.Person, bewoobjects);
case 3: return LoadNavigationContext(TableID.Employee, bewoobjects);
case 4: return LoadNavigationContext(TableID.Organisation, bewoobjects);
//case 5: return "Team Navigation";
//case 6: return "Dokumente Navigation";
//case 7: return "Benutzer Navigation";
//case 8: return "Benutzergruppe Navigation";
//case 9: return "Bericht Navigation";
//case 10: return "Planer Navigation";
//case 11: return "Wohnheim Navigation";
//case 12: return "Vertretungen Navigation";
//case 13: return "Kunden-Team Navigation";
//case 14: return "Terminplanung Navigation";
//case 15: return "Finanz Navigation";
//case 16: return "Verwaltung Navigation";
//case 17: return "KI-Gesprächs Navigation";
//case 18: return "KI-Gesprächs Popup Navigation";
case 19: return LoadServiceRecordsContext(bewoobjects);
case 20: return LoadSingleContext(TableID.Customer, bewoobjects);
//case 21: return "Person Einzelansicht Navigation";
//case 22: return "Mitarbeiter Einzelansicht Navigation";
default:
throw new NotImplementedException($"UI Kontext {uicontext} ist nicht implementiert.");
//Alternativ könnte man auch einen Standard-String zurückgeben,
//z.B. return "Unbekannter UI-Kontext";
}
}
private Dictionary<TableID, object> LoadNavigationContext(TableID tableid, Dictionary<TableID, long[]> bewoobjects)
{
IList<Dictionary<string, object>> entities;
switch (tableid)
{
case TableID.Person:
entities = LoadEntities(bewoobjects, tableid, MapperFactory.CompactPersonDC_Person);
break;
case TableID.Customer:
entities = LoadEntities(bewoobjects, tableid, MapperFactory.CompactCustomerDC_Customer);
break;
case TableID.Employee:
entities = LoadEntities(bewoobjects, tableid, MapperFactory.CompactEmployeeDC_Employee);
break;
case TableID.SupportConcept:
entities = LoadEntities(bewoobjects, tableid, MapperFactory.CompactSupportConceptDC_SupportConcept);
break;
case TableID.Organisation:
entities = LoadEntities(bewoobjects, tableid, MapperFactory.CompactOrganisationDC_Organisation, (entity, dc) =>
{
if (entity.Address != null)
{
dc.AddressLine1 = entity.Address.AddressLine1;
dc.Street = entity.Address.Street;
dc.PostalCode = entity.Address.PostalCode;
dc.Town = entity.Address.Town;
}
});
break;
default:
throw new NotImplementedException($"TableID {tableid} not implemented as navigation context");
}
var result = new Dictionary<TableID, List<Dictionary<string, object>>>
{
{ tableid, entities.ToList() }
};
return result;
}
private Dictionary<TableID, object> LoadSingleContext(TableID tableid, Dictionary<TableID, long[]> bewoobjects)
{
var result = new Dictionary<TableID, Dictionary<string, object>>();
Dictionary<string, object> entity;
switch (tableid)
{
case TableID.Person:
entity = LoadEntity(bewoobjects, tableid, MapperFactory.PersonDC_Person);
break;
case TableID.Customer:
entity = LoadEntity(bewoobjects, tableid, MapperFactory.CustomerDC_Customer);
break;
case TableID.Employee:
entity = LoadEntity(bewoobjects, tableid, MapperFactory.EmployeeDC_Employee);
break;
case TableID.SupportConcept:
entity = LoadEntity(bewoobjects, tableid, MapperFactory.SupportConceptDC_SupportConcept);
break;
//case TableID.Organisation:
// entity = LoadEntity(bewoobjects, tableid, MapperFactory.OrganisationDC_OrganisationMapper, (entity, dc) =>
// {
// if (entity.Address != null)
// {
// dc.AddressLine1 = entity.Address.AddressLine1;
// dc.Street = entity.Address.Street;
// dc.PostalCode = entity.Address.PostalCode;
// dc.Town = entity.Address.Town;
// }
// });
// break;
default:
throw new NotImplementedException($"TableID {tableid} not implemented as navigation context");
}
return result;
}
private TRet LoadProperty<TEntity, TRet>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, Func<TEntity, TRet> getPropertyFunc)
where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return default;
var entity = DAOFactory.GenericDAO.GetByID<TEntity>(oids[0]);
var property = getPropertyFunc(entity);
return property;
}
private TEntity LoadEntity<TEntity>
(Dictionary<TableID, long[]> bewoobjects, TableID tid)
where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
var entity = DAOFactory.GenericDAO.GetByID<TEntity>(oids[0]);
return entity;
}
private List<TEntity> LoadEntities<TEntity>
(Dictionary<TableID, long[]> bewoobjects, TableID tid)
where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
var entities = DAOFactory.GenericDAO.GetByIDs<TEntity>(oids);
//if(afterLoad != null)
//{
// foreach( var entity in entities)
// {
// afterLoad(entity);
// }
//}
return entities;
}
private string getSystemPrompt(int i)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceName = $"AICore.Prompt.SystemPrompts.system_prompt{i}.txt";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
return result;
}
}
private string getCustomSystemPrompt()
{
var path = MergedConfig.GetSetting("AiSystemPromptPath");
return File.ReadAllText(path);
}
}
}

View File

@@ -1,10 +1,201 @@
namespace AICore.Prompt.Factories
using AICore.Context.Entry;
using AICore.Context.Summary;
using AICore.Context.SummaryMapper;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.ServiceUtils.Core;
using BS.Shared;
using BS.Shared.Exceptions;
using BS.Shared.Translation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.Json;
namespace AICore.Prompt.Factories
{
public class JsonAiPromptFactory : BaseAiPromptFactory
public class JsonAiPromptFactory
{
//protected override string Parse(int uicontext, object data)
//{
//}
public string CreateSystemInstructions(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
var sb = new StringBuilder();
sb.AppendLine(getCustomSystemPrompt());
sb.AppendLine($"Ich befinde mich aktuell in der \"{Translator.Translate(uicontext)}\" meiner Anwendung.");
sb.AppendLine("Es ist kein Filter gesetzt.");
if (bewoobjects is null || bewoobjects.Count == 0)
{
sb.AppendLine("Dir wurden keine Daten bereitgestellt.");
}
else
{
sb.AppendLine("Du erhälst folgendes:");
var parsed = LoadContext(uicontext, bewoobjects);
sb.AppendLine(parsed);
}
return sb.ToString();
}
private string LoadContext(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
var context = GetContext(uicontext, bewoobjects);
var parsed = Parse(uicontext, context);
return parsed;
}
protected virtual string Parse(AiContextType uicontext, BaseContextSummary context)
{
var str = JsonSerializer.Serialize(context);
return str;
}
protected BaseContextSummary GetContext(AiContextType uicontext, Dictionary<TableID, long[]> bewoobjects)
{
switch (uicontext)
{
case AiContextType.SupportConcept:
return GetNavigationContext<SupportConceptNavigationContextEntry, SupportConcept>(bewoobjects);
case AiContextType.Customer:
return GetNavigationContext<CustomerNavigationContextEntry, Customer>(bewoobjects);
case AiContextType.Person:
return GetNavigationContext<PersonNavigationContextEntry, Person>(bewoobjects);
case AiContextType.Employee:
return GetNavigationContext<EmployeeNavigationContextEntry, Employee>(bewoobjects);
case AiContextType.Organisation:
return GetNavigationContext<OrganisationNavigationContextEntry, Organisation>(bewoobjects);
case AiContextType.ServiceRecord:
return GetServiceRecordsContext(bewoobjects);
case AiContextType.CustomerSingle:
return GetDetailContext<CustomerDetailContextEntry, Customer>(bewoobjects);
case AiContextType.PersonSingle:
return GetDetailContext<PersonDetailContextEntry, Person>(bewoobjects);
case AiContextType.EmployeeSingle:
return GetDetailContext<EmployeeDetailContextEntry, Employee>(bewoobjects);
default:
throw BeWoNotImplementedException.CreateFromEnum(uicontext);
}
}
private DetailContextSummary<TEntry, TEntity> GetDetailContext<TEntry, TEntity>(Dictionary<TableID, long[]> bewoobjects)
where TEntry : DetailContextEntry<TEntity>
where TEntity : BeWoEntityBase, new()
{
var entity = LoadEntity<TEntity>(bewoobjects);
var context = ContextSummaryFactory.CreateDetailContext<TEntry, TEntity>(entity);
return context;
}
private NavigationContextSummary<TEntry, TEntity> GetNavigationContext<TEntry, TEntity>(Dictionary<TableID, long[]> bewoobjects)
where TEntry : NavigationContextEntry<TEntity>
where TEntity : BeWoEntityBase, new()
{
var entities = LoadEntities<TEntity>(bewoobjects);
var context = ContextSummaryFactory.CreateNavigationContext<TEntry, TEntity>(entities);
return context;
}
private ServiceRecordNavigationContextSummary GetServiceRecordsContext(Dictionary<TableID, long[]> bewoobjects)
{
var customer = LoadEntity<Customer>(bewoobjects);
var costbearer = LoadProperty<Organisation, string>(bewoobjects, dc => dc.Name);
var supportconcept = LoadProperty<SupportConcept, string>(bewoobjects, dc => $"{dc.StartDate?.Date} - {dc.EndDate?.Date}");
var records = LoadEntities<ServiceRecord>(bewoobjects);
var context = ContextSummaryFactory.CreateServiceRecordNavigationContextSummary(records, customer, costbearer, supportconcept);
return context;
}
private TRet LoadProperty<TEntity, TRet>
(Dictionary<TableID, long[]> bewoobjects, Func<TEntity, TRet> getPropertyFunc)
where TEntity : BeWoEntityBase, new()
{
var tid = GetTableId<TEntity>();
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return default;
var entity = DAOFactory.GenericDAO.GetByID<TEntity>(oids[0]);
var property = getPropertyFunc(entity);
return property;
}
private TEntity LoadEntity<TEntity>
(Dictionary<TableID, long[]> bewoobjects)
where TEntity : BeWoEntityBase, new()
{
var tid = GetTableId<TEntity>();
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
var entity = DAOFactory.GenericDAO.GetByID<TEntity>(oids[0]);
return entity;
}
private List<TEntity> LoadEntities<TEntity>
(Dictionary<TableID, long[]> bewoobjects)
where TEntity : BeWoEntityBase, new()
{
var instance = new TEntity();
var tid = GetTableId<TEntity>();
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
var entities = DAOFactory.GenericDAO.GetByIDs<TEntity>(oids);
//if(afterLoad != null)
//{
// foreach( var entity in entities)
// {
// afterLoad(entity);
// }
//}
return entities;
}
private TableID GetTableId<TEntity>(TEntity entity = null) where TEntity : BeWoEntityBase, new()
{
if (entity == null)
entity = new TEntity();
return entity.Tid;
}
private string getSystemPrompt(int i)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceName = $"AICore.Prompt.SystemPrompts.system_prompt{i}.txt";
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string result = reader.ReadToEnd();
return result;
}
}
private string getCustomSystemPrompt()
{
var path = MergedConfig.GetSetting("AiSystemPromptPath");
return File.ReadAllText(path);
}
}
}

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace AICore.Prompt.Models
{
@@ -13,7 +9,7 @@ namespace AICore.Prompt.Models
public AiConversationContext()
{
}
}
}

View File

@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden

View File

@@ -632,7 +632,7 @@ namespace BeWo
//AppSettings.AllowGkvAbrechnung = true;
//AppSettings.AllowGkvAbrechnung = false;
//showInfoButtonInCalender = true;
//IsInDeveloperMode = true;
IsInDeveloperMode = true;
//IsInDeveloperMode = false;
//AppSettings.ModuleAiEnabled = true;
//AppSettings.ModuleAiSettingsEnabled = false;

View File

@@ -28,7 +28,7 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiConversations", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiConversationsResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiConversationsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(int uicontext, System.Nullable<long> oid);
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiContextType uicontext, System.Nullable<long> oid);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CreateAiConversation", ReplyAction="http://tempuri.org/IAiEnhancedService/CreateAiConversationResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CreateAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
@@ -106,7 +106,7 @@ namespace BeWo.ServiceProxy
return base.Channel.GetAiModels();
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(int uicontext, System.Nullable<long> oid)
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiContextType uicontext, System.Nullable<long> oid)
{
return base.Channel.GetAiConversations(uicontext, oid);
}

View File

@@ -23,46 +23,42 @@ namespace BeWo.Services
return control;
}
private string getStyleString(UIContext uIContext) {
private string getStyleString(AiContextType uIContext) {
switch (uIContext)
{
case UIContext.SupportConcept: return "ModuleAiControlSupportConceptStyle";
case UIContext.Customer: return "ModuleAiControlCustomerStyle";
case UIContext.Person: return "ModuleAiControlPersonStyle";
case UIContext.Employee: return "ModuleAiControlEmployeeStyle";
case UIContext.Organisation: return "ModuleAiControlOrganisationStyle";
case UIContext.Team:
case AiContextType.SupportConcept: return "ModuleAiControlSupportConceptStyle";
case AiContextType.Customer: return "ModuleAiControlCustomerStyle";
case AiContextType.Person: return "ModuleAiControlPersonStyle";
case AiContextType.Employee: return "ModuleAiControlEmployeeStyle";
case AiContextType.Organisation: return "ModuleAiControlOrganisationStyle";
case AiContextType.Team:
break;
case UIContext.Dokumente:
case AiContextType.Dokumente:
break;
case UIContext.User:
case AiContextType.User:
break;
case UIContext.UserGroup:
case AiContextType.UserGroup:
break;
case UIContext.Report:
case AiContextType.Report:
break;
case UIContext.Scheduler:
case AiContextType.Scheduler:
break;
case UIContext.Wohnheim:
case AiContextType.Wohnheim:
break;
case UIContext.Vertretungen:
case AiContextType.Vertretungen:
break;
case UIContext.CustomerTeam:
case AiContextType.CustomerTeam:
break;
case UIContext.Scheduling:
case AiContextType.Scheduling:
break;
case UIContext.Finance:
case AiContextType.Finance:
break;
case UIContext.Administration:
case AiContextType.Administration:
break;
case UIContext.AiConversation:
break;
case UIContext.AiConversationPopup:
break;
case UIContext.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
case UIContext.CustomerSingle: return "ModuleAiControlCustomerStyle";
case UIContext.PersonSingle: return "ModuleAiControlPersonStyle";
case UIContext.EmployeeSingle: return "ModuleAiControlEmployeeStyle";
case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
case AiContextType.CustomerSingle: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonSingle: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeSingle: return "ModuleAiControlEmployeeStyle";
}
return null;

View File

@@ -15,15 +15,15 @@ namespace BeWo.Services
{
internal class BeWoWindowFactory : IWindowFactory
{
public Dictionary<UIContext, string> UIContext2Header { get; set; } = new Dictionary<UIContext, string>()
public Dictionary<AiContextType, string> UIContext2Header { get; set; } = new Dictionary<AiContextType, string>()
{
{UIContext.ServiceRecord, "KI Chat: Zeiterfassung" },
{UIContext.Customer, "KI Chat: Klienten Übersicht" },
{UIContext.Person, "KI Chat: Personen Übersicht" },
{UIContext.Employee, "KI Chat: Mitarbeiter Übersicht" },
{UIContext.Organisation, "KI Chat: Organisation Übersicht" },
{UIContext.SupportConcept, "KI Chat: Hilfeplan Übersicht" },
{UIContext.CustomerSingle, "KI Chat: Klient" },
{AiContextType.ServiceRecord, "KI Chat: Zeiterfassung" },
{AiContextType.Customer, "KI Chat: Klienten Übersicht" },
{AiContextType.Person, "KI Chat: Personen Übersicht" },
{AiContextType.Employee, "KI Chat: Mitarbeiter Übersicht" },
{AiContextType.Organisation, "KI Chat: Organisation Übersicht" },
{AiContextType.SupportConcept, "KI Chat: Hilfeplan Übersicht" },
{AiContextType.CustomerSingle, "KI Chat: Klient" },
};
public AnimatedBeWoWindow GetAiConversationWindow(AiConversationChatViewModel viewModel, Control control, double height = 600, double width = 1200)

View File

@@ -320,7 +320,7 @@ namespace BeWo.View.Detail
var customer_oid = ViewModel.DataContract.CustomerOid;
var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(UIContext.CustomerSingle, context, customer_oid);
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerSingle, context, customer_oid);
return vm;
}

View File

@@ -5106,7 +5106,7 @@ namespace BeWo.View.Detail.Zeiterfassung
var context = ViewModel.GetVisibleInformationReferences(records);
var oid = supportConceptSelectionControl.SelectedItem.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
var vm = VMFactory.CreateAiConversationChatViewModel(UIContext.ServiceRecord, context, oid);
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.ServiceRecord, context, oid);
return vm;
}

View File

@@ -207,7 +207,7 @@ namespace BeWo.View.Navigation
{
var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(UIContext.Customer, context);
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Customer, context);
return vm;
}

View File

@@ -113,7 +113,7 @@ namespace BeWo.View.Navigation
{
var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(UIContext.Employee, context);
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Employee, context);
return vm;
}

View File

@@ -79,7 +79,7 @@ namespace BeWo.View.Navigation
{
var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(UIContext.Organisation, context);
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Organisation, context);
return vm;
}

View File

@@ -116,7 +116,7 @@ namespace BeWo.View.Navigation
{
var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(UIContext.Person, context);
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.Person, context);
return vm;
}

View File

@@ -230,7 +230,7 @@ namespace BeWo.View.Navigation
{
var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(UIContext.SupportConcept, context);
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConcept, context);
return vm;
}

View File

@@ -910,7 +910,7 @@ namespace BeWo.ViewModel
einheit_vm_list.VMList.Sort(WohneinheitVM.Compare);
}
public static AiConversationChatViewModel CreateAiConversationChatViewModel(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null)
public static AiConversationChatViewModel CreateAiConversationChatViewModel(AiContextType uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null)
{
var vm = new AiConversationChatViewModel();
@@ -921,10 +921,10 @@ namespace BeWo.ViewModel
return vm;
}
public static void CreateAiConversationListVM(UIContext uIContext, long? reference_oid, Action<AiConversationListVM> callback)
public static void CreateAiConversationListVM(AiContextType uIContext, long? reference_oid, Action<AiConversationListVM> callback)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(
s => s.GetAiConversations((int)uIContext, reference_oid),
s => s.GetAiConversations(uIContext, reference_oid),
cb =>
{
cb.Reverse();

View File

@@ -151,7 +151,7 @@ namespace BeWo.ViewModel.View
}
public bool IsNewConversationVisible => ListVM.SelectedVM is null;
public UIContext UIContext { get; set; }
public AiContextType UIContext { get; set; }
public long? ReferenceObjectOid { get; set; }
public Dictionary<TableID, long[]> ContextBeWoObjects { get; set; }
@@ -167,7 +167,7 @@ namespace BeWo.ViewModel.View
conv.Created = DateTime.Now;
conv.Updated = DateTime.Now;
conv.UIContext = (int)UIContext;
conv.UIContext = UIContext;
conv.ContextBeWoObjects = ContextBeWoObjects;
conv.Messages = new List<AiConversationMessageDC>()
{

View File

@@ -11,7 +11,7 @@ using BS.Shared.Extensions;
namespace BeWo.Service.DCEntityMapper
{
public abstract class AbstractIDCEntityMapper<TEntity, TDC> : IDCEntityMapper<TEntity, TDC>, IJsonMapper<TEntity, TDC>
public abstract class AbstractIDCEntityMapper<TEntity, TDC> : IDCEntityMapper<TEntity, TDC>
where TDC : class, new() where TEntity : BeWoEntityBase, new()
{
public bool ConcurrencyCheck(long? pDataContractVersion, BeWoEntityBase pEntity)
@@ -158,36 +158,37 @@ namespace BeWo.Service.DCEntityMapper
protected abstract bool AreDCAndEntityEqual(TDC pDC, TEntity pEntity);
public virtual Dictionary<string, object> ToJsonDictionary(TDC pDC)
{
throw new NotImplementedException("ToJsonDictionary");
}
// Ausgelagert in AiCore - Kann bei Zeit entfernt werden
//public virtual Dictionary<string, object> ToJsonDictionary(TDC pDC)
//{
// throw new NotImplementedException("ToJsonDictionary");
//}
public Dictionary<string, object> ToJsonDictionary(TEntity pEntity)
{
var dc = MapToNewDC(pEntity);
var dict = ToJsonDictionary(dc);
return dict;
}
//public Dictionary<string, object> ToJsonDictionary(TEntity pEntity)
//{
// var dc = MapToNewDC(pEntity);
// var dict = ToJsonDictionary(dc);
// return dict;
//}
public IList<Dictionary<string, object>> ToJsonDictionary(IList<TEntity> pEntities)
{
var dcs = MapToNewDCs(pEntities);
var dicts = ToJsonDictionary(dcs);
return dicts;
}
//public IList<Dictionary<string, object>> ToJsonDictionary(IList<TEntity> pEntities)
//{
// var dcs = MapToNewDCs(pEntities);
// var dicts = ToJsonDictionary(dcs);
// return dicts;
//}
public IList<Dictionary<string, object>> ToJsonDictionary(IList<TDC> pDCs)
{
var dicts = new List<Dictionary<string, object>>();
//public IList<Dictionary<string, object>> ToJsonDictionary(IList<TDC> pDCs)
//{
// var dicts = new List<Dictionary<string, object>>();
if (pDCs == null)
return dicts;
// if (pDCs == null)
// return dicts;
foreach (var dc in pDCs)
dicts.Add(ToJsonDictionary(dc));
// foreach (var dc in pDCs)
// dicts.Add(ToJsonDictionary(dc));
return dicts;
}
// return dicts;
//}
}
}

View File

@@ -432,43 +432,5 @@ namespace BeWo.Service.DCEntityMapper
return pDC.CustomerOid == pEntity.Oid;
}
public override Dictionary<string, object> ToJsonDictionary(CustomerDC c)
{
var jsonObject = new Dictionary<string, object>()
{
{"Klient-ID", c.CustomerOid },
{ "Name", $"{c.FirstName} {c.LastName}"},
{"Alias", c.CustomerAlias },
{ "Geburtstag", c.DateOfBirth },
{"Geschlecht", c.Sex.ToString() },
{"Nationalität", c.Nationalitaet?.DisplayName },
{"HatMigrationshintergrund", c.IsMigrant },
{"Migrationshintergrund", c.Migrationshintergrund },
{"Aufenthaltsstatus", c.AufenthaltsStatus?.DisplayName },
{"Familienstand", c.FamilyStatus.ToString() },
{"Beruf", c.Profession },
{"Kinder", c.Childs },
{"Eigenbeteiligung", c.EquityContribution },
{"Krankenkasse", c.HealthInsurance },
{"Versichertennummer", c.InsuranceNumber },
{"Versichertenstatus", c.VersichertenStatus },
{"Kommentar", c.Notice },
{"Adressezeile 1", c.AddressLine1 },
{"Straße", c.Street },
{"PLZ", c.PostalCode },
{"Ort", c.Town },
{"Distanz in km", c.DistanceInMeter },
{"Rechnungsadresse", new Dictionary<string, object>()
{
{ "Adresszeile 1", c.InvoiceAddressLine1 },
{ "Strasse ", c.InvoiceAddressStreet},
{ "Ort", c.InvoiceAddressTown },
{ "PLZ", c.InvoiceAddressPostalCode },
}}
};
return jsonObject;
}
}
}

View File

@@ -75,7 +75,7 @@ namespace BeWo.Service.Plugins
// ======================[ Conversations ]======================
public IEnumerable<AiConversationDC> GetAiConversations(int uicontext, long? oid)
public IEnumerable<AiConversationDC> GetAiConversations(AiContextType uicontext, long? oid)
{
// SearchDAO
var current_user = UserRightHelper.GetLoggedInUserWithOid();
@@ -95,7 +95,7 @@ namespace BeWo.Service.Plugins
var main_ref_obj = conv.ContextBeWoObjects?.FirstOrDefault();
// ServiceRecord
if (uicontext == 19)
if (uicontext == AiContextType.ServiceRecord)
main_ref_obj = conv.ContextBeWoObjects.FirstOrDefault(x => x.Tid == TableID.SupportConcept);
if (main_ref_obj?.Oid != ref_oid)
@@ -271,7 +271,7 @@ namespace BeWo.Service.Plugins
return models;
}
private AiConversation createAiConversation(int uicontext, Dictionary<TableID, long[]> context, long modell_oid, AiDataContextType context_Type)
private AiConversation createAiConversation(AiContextType uicontext, Dictionary<TableID, long[]> context, long modell_oid, AiDataContextType context_Type)
{
var current_user = UserRightHelper.GetLoggedInUserWithOid();
var factory = getFactory(context_Type);
@@ -302,7 +302,7 @@ namespace BeWo.Service.Plugins
return conv;
}
private BaseAiPromptFactory getFactory(AiDataContextType context_Type)
private JsonAiPromptFactory getFactory(AiDataContextType context_Type)
{
if (context_Type == AiDataContextType.json)
return new JsonAiPromptFactory();

View File

@@ -33,7 +33,7 @@ namespace BeWo.Service.ServiceContracts
[FaultContract(typeof(BeWoFault))]
[OperationContract]
[RequirePermission(UserRightType.AiModuleView, UserRightType.AiModuleView2)]
IEnumerable<AiConversationDC> GetAiConversations(int uicontext, long? oid);
IEnumerable<AiConversationDC> GetAiConversations(AiContextType uicontext, long? oid);
[FaultContract(typeof(BeWoFault))]
[OperationContract]

View File

@@ -1,5 +1,6 @@
using BeWo.Service.Plugins;
using BeWo.Service.ServiceContracts;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Feature.AI;
using System.Collections.Generic;
@@ -13,7 +14,7 @@ namespace BeWo.Service.ServiceImplementations
public AiConfigDC GetAiConfig() => GetAiService().GetAiConfig();
public AiConfigDC UpdateAiConfig(AiConfigDC toUpdate) => GetAiService().UpdateAiConfig(toUpdate);
public IEnumerable<AiModelDC> GetAiModels() => GetAiService().GetAiModels();
public IEnumerable<AiConversationDC> GetAiConversations(int uicontext, long? oid) => GetAiService().GetAiConversations(uicontext, oid);
public IEnumerable<AiConversationDC> GetAiConversations(AiContextType uicontext, long? oid) => GetAiService().GetAiConversations(uicontext, oid);
public AiConversationDC CreateAiConversation(AiConversationDC conversation, long modell_oid) => GetAiService().CreateAiConversation(conversation, modell_oid);
public AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, long modell_oid, string message) => GetAiService().CreateAiConversationWithMessage(conversation, modell_oid, message);
public AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid) => GetAiService().CloneAiConversation(conversation_oid, last_message_oid);

View File

@@ -32,5 +32,13 @@ namespace BS.Shared.Exceptions
return new BeWoNotImplementedException($"{type} {value} ist nicht implementiert.");
}
public static BeWoNotImplementedException CreateFromInvalidObject(object obj)
{
var type = obj.GetType().Name;
var str = obj.ToString();
return new BeWoNotImplementedException($"{type}, {str}");
}
}
}