Json Context wird korrekt zusammengebaut
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
namespace AICore.Context.Summary
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AICore.Context.Summary
|
||||
{
|
||||
public abstract class BaseContextSummary
|
||||
{
|
||||
[JsonIgnore]
|
||||
public object Context { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace AICore.Context.Summary.Detail
|
||||
{
|
||||
internal abstract class BaseDetailContextSummary<TEntry> : BaseContextSummary where TEntry : DetailContextEntry
|
||||
{
|
||||
internal TEntry DataContext { get; set; }
|
||||
public virtual TEntry DataContext { get; set; }
|
||||
|
||||
protected BaseDetailContextSummary(TEntry dataContext)
|
||||
{
|
||||
|
||||
@@ -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<ServiceRecordContextEntry> 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<ServiceRecordContextEntry> 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<ServiceRecordContextEntry> serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept, string dokutext)
|
||||
: base()
|
||||
{
|
||||
Context = serviceRecords;
|
||||
//Context = serviceRecords;
|
||||
ServiceRecords = serviceRecords;
|
||||
Customer = customer;
|
||||
CostBearer = costBearer;
|
||||
|
||||
@@ -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<TEntry> : BaseContextSummary where TEntry : NavigationContextEntry
|
||||
{
|
||||
internal IEnumerable<TEntry> DataContext { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual IEnumerable<TEntry> DataContext { get; set; }
|
||||
|
||||
protected BaseNavigationCS(IEnumerable<TEntry> dataContext)
|
||||
{
|
||||
|
||||
@@ -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<ServiceRecordContextEntry>
|
||||
{
|
||||
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<ServiceRecordContextEntry> DataContext { get; set; }
|
||||
|
||||
internal ServiceRecordNavigationCS(IEnumerable<ServiceRecordContextEntry> serviceRecords, CustomerNavigationContextEntry customer, string costBearer, string supportConcept)
|
||||
: base(serviceRecords)
|
||||
@@ -16,5 +26,7 @@ namespace AICore.Context.Summary.Navigation
|
||||
CostBearer = costBearer;
|
||||
SupportConcept = supportConcept;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,9 +86,9 @@ namespace AICore.Context.SummaryParser
|
||||
sb.AppendLine(ToCsvString(fcs.ServiceRecords));
|
||||
sb.AppendLine($"</Zeiterfassungseinträge>");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"<Dokumentationseinträge>");
|
||||
sb.AppendLine($"<Dokumentationstext>");
|
||||
sb.AppendLine(fcs.Dokutext);
|
||||
sb.AppendLine($"</Dokumentationseinträge>");
|
||||
sb.AppendLine($"</Dokumentationstext>");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user