From dc165ef3cb3d37d4d7bf59cb274b7d24423c030f Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Wed, 1 Jul 2026 14:34:18 +0200 Subject: [PATCH] Json Context wird korrekt zusammengebaut --- BeWo/Styles/OrangeBlack.xaml | 2 +- .../Context/Summary/BaseContextSummary.cs | 5 ++++- .../Detail/BaseDetailContextSummary.cs | 2 +- .../Function/ServiceRecordDocumantationFCS.cs | 22 ++++++++++++++----- .../Summary/Navigation/BaseNavigationCS.cs | 4 +++- .../Navigation/ServiceRecordNavigationCS.cs | 18 ++++++++++++--- .../SummaryParser/CsvContextSummaryParser.cs | 4 ++-- .../SummaryParser/JsonContextSummaryParser.cs | 19 +++++++++++++++- 8 files changed, 60 insertions(+), 16 deletions(-) diff --git a/BeWo/Styles/OrangeBlack.xaml b/BeWo/Styles/OrangeBlack.xaml index d3c659e95..4be00468d 100644 --- a/BeWo/Styles/OrangeBlack.xaml +++ b/BeWo/Styles/OrangeBlack.xaml @@ -4048,7 +4048,7 @@ FontSize="14" Foreground="#FFD2D2D2" Text="{Binding Path=Teams}" /> - + : BaseContextSummary where TEntry : DetailContextEntry { - internal TEntry DataContext { get; set; } + public virtual TEntry DataContext { get; set; } protected BaseDetailContextSummary(TEntry dataContext) { diff --git a/Server/Components/AICore/Context/Summary/Function/ServiceRecordDocumantationFCS.cs b/Server/Components/AICore/Context/Summary/Function/ServiceRecordDocumantationFCS.cs index 51dab3828..a02ed7f21 100644 --- a/Server/Components/AICore/Context/Summary/Function/ServiceRecordDocumantationFCS.cs +++ b/Server/Components/AICore/Context/Summary/Function/ServiceRecordDocumantationFCS.cs @@ -3,22 +3,32 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json.Serialization; using System.Threading.Tasks; namespace AICore.Context.Summary.Function { internal class ServiceRecordDocumantationFCS : BaseFunctionContextSummary { - internal IEnumerable ServiceRecords { get; set; } - internal CustomerNavigationContextEntry Customer { get; set; } - internal string CostBearer { get; set; } - internal string SupportConcept { get; set; } - internal string Dokutext { get; set; } + [JsonPropertyName("Zeiterfassungseinträge")] + public IEnumerable ServiceRecords { get; set; } + + [JsonPropertyName("Klient")] + public CustomerNavigationContextEntry Customer { get; set; } + + [JsonPropertyName("Kostenträger")] + public string CostBearer { get; set; } + + [JsonPropertyName("Hilfeplan")] + public string SupportConcept { get; set; } + + [JsonPropertyName("Dokumentationstext")] + public string Dokutext { get; set; } internal ServiceRecordDocumantationFCS(IEnumerable serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept, string dokutext) : base() { - Context = serviceRecords; + //Context = serviceRecords; ServiceRecords = serviceRecords; Customer = customer; CostBearer = costBearer; diff --git a/Server/Components/AICore/Context/Summary/Navigation/BaseNavigationCS.cs b/Server/Components/AICore/Context/Summary/Navigation/BaseNavigationCS.cs index 7cfaf5f08..260463ade 100644 --- a/Server/Components/AICore/Context/Summary/Navigation/BaseNavigationCS.cs +++ b/Server/Components/AICore/Context/Summary/Navigation/BaseNavigationCS.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using System.Text.Json.Serialization; using AICore.Context.Entry.Navigation; namespace AICore.Context.Summary.Navigation { internal abstract class BaseNavigationCS : BaseContextSummary where TEntry : NavigationContextEntry { - internal IEnumerable DataContext { get; set; } + [JsonIgnore] + public virtual IEnumerable DataContext { get; set; } protected BaseNavigationCS(IEnumerable dataContext) { diff --git a/Server/Components/AICore/Context/Summary/Navigation/ServiceRecordNavigationCS.cs b/Server/Components/AICore/Context/Summary/Navigation/ServiceRecordNavigationCS.cs index 7566ef619..63bfd72cd 100644 --- a/Server/Components/AICore/Context/Summary/Navigation/ServiceRecordNavigationCS.cs +++ b/Server/Components/AICore/Context/Summary/Navigation/ServiceRecordNavigationCS.cs @@ -1,13 +1,23 @@ using AICore.Context.Entry.Navigation; +using AICore.Context.Summary.Function; using System.Collections.Generic; +using System.Text.Json.Serialization; namespace AICore.Context.Summary.Navigation { internal class ServiceRecordNavigationCS : BaseNavigationCS { - internal CustomerNavigationContextEntry Customer { get; set; } - internal string CostBearer { get; set; } - internal string SupportConcept { get; set; } + [JsonPropertyName("Klient")] + public CustomerNavigationContextEntry Customer { get; set; } + + [JsonPropertyName("Kostenträger")] + public string CostBearer { get; set; } + + [JsonPropertyName("Hilfeplan")] + public string SupportConcept { get; set; } + + [JsonPropertyName("Zeiterfassungseinträge")] + public override IEnumerable DataContext { get; set; } internal ServiceRecordNavigationCS(IEnumerable serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept) : base(serviceRecords) @@ -16,5 +26,7 @@ namespace AICore.Context.Summary.Navigation CostBearer = costBearer; SupportConcept = supportConcept; } + + } } diff --git a/Server/Components/AICore/Context/SummaryParser/CsvContextSummaryParser.cs b/Server/Components/AICore/Context/SummaryParser/CsvContextSummaryParser.cs index b8b02d648..f9d6f8278 100644 --- a/Server/Components/AICore/Context/SummaryParser/CsvContextSummaryParser.cs +++ b/Server/Components/AICore/Context/SummaryParser/CsvContextSummaryParser.cs @@ -86,9 +86,9 @@ namespace AICore.Context.SummaryParser sb.AppendLine(ToCsvString(fcs.ServiceRecords)); sb.AppendLine($""); sb.AppendLine(); - sb.AppendLine($""); + sb.AppendLine($""); sb.AppendLine(fcs.Dokutext); - sb.AppendLine($""); + sb.AppendLine($""); return sb.ToString(); } diff --git a/Server/Components/AICore/Context/SummaryParser/JsonContextSummaryParser.cs b/Server/Components/AICore/Context/SummaryParser/JsonContextSummaryParser.cs index 546380a30..165316317 100644 --- a/Server/Components/AICore/Context/SummaryParser/JsonContextSummaryParser.cs +++ b/Server/Components/AICore/Context/SummaryParser/JsonContextSummaryParser.cs @@ -1,4 +1,6 @@ using AICore.Context.Summary; +using AICore.Context.Summary.Function; +using AICore.Context.Summary.Navigation; using BS.Shared; using System; using System.Collections.Generic; @@ -15,7 +17,22 @@ namespace AICore.Context.SummaryParser { var options = new JsonSerializerOptions { IncludeFields = true }; - var json = JsonSerializer.Serialize(context, options); + var json = "{}"; + + if(context is ServiceRecordDocumantationFCS fcs) + { + json = JsonSerializer.Serialize(fcs, options); + } + else if(context is ServiceRecordNavigationCS ncs) + { + json = JsonSerializer.Serialize(ncs, options); + } + else + { + json = JsonSerializer.Serialize(context, options); + } + + System.IO.File.WriteAllText("D:\\temp.txt", json); return json; }