diff --git a/BeWo/View/Detail/CustomerView.xaml b/BeWo/View/Detail/CustomerView.xaml
index 6c398385c..120927a2c 100644
--- a/BeWo/View/Detail/CustomerView.xaml
+++ b/BeWo/View/Detail/CustomerView.xaml
@@ -804,6 +804,7 @@
+
@@ -3786,10 +3787,10 @@
Selector.Selected="tabitem_log_Selected" />
@@ -3798,12 +3799,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BeWo/View/Detail/CustomerView.xaml.cs b/BeWo/View/Detail/CustomerView.xaml.cs
index 132206356..bc708849f 100644
--- a/BeWo/View/Detail/CustomerView.xaml.cs
+++ b/BeWo/View/Detail/CustomerView.xaml.cs
@@ -51,6 +51,9 @@ using Hyperlink = System.Windows.Documents.Hyperlink;
using MessageBox = System.Windows.MessageBox;
using VerticalAlignment = System.Windows.VerticalAlignment;
using BeWo.AI;
+using BeWo.View.Navigation;
+using DevExpress.Mvvm;
+using System.Collections;
namespace BeWo.View.Detail
{
@@ -96,10 +99,12 @@ namespace BeWo.View.Detail
public CustomerView(CustomerVM pCustomerVM)
{
InitializeComponent();
+ DataContext = ViewModel;
- DataContext = ViewModel;
+ OpenAiWindowCommand = new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView));
+ OpenAiPopupCommand = new DelegateCommand(OpenAiPopup, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2));
- BehinderungsartenSelection.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => this.Dispatch(() => { PopupBehinderungsarten.IsOpen = false; })));
+ BehinderungsartenSelection.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => this.Dispatch(() => { PopupBehinderungsarten.IsOpen = false; })));
MerkzeichenSelection.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => this.Dispatch(() => { PopupMerkzeichen.IsOpen = false; })));
_AlleEintragKategorien = pCustomerVM.EintragKategorien;
@@ -289,7 +294,40 @@ namespace BeWo.View.Detail
#endif
}
- void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
+ public DelegateCommand OpenAiWindowCommand { get; }
+ public DelegateCommand OpenAiPopupCommand { get; }
+
+ public Dictionary GetVisibleInformationReferences()
+ {
+ var visible = ViewModel;
+
+ return GetVisibleInformationReferences(visible);
+ }
+
+ private Dictionary GetVisibleInformationReferences(CustomerVM customer)
+ {
+ var dict = new Dictionary() {
+ { TableID.Customer, new long[]{customer.DataContract.CustomerOid.Value } }
+ };
+
+ return dict;
+ }
+
+ private void OpenAiWindow()
+ {
+ var context = GetVisibleInformationReferences();
+
+ MainControl.WindowService.ShowAiConversationWindow(UIContext.CustomerSingle, context);
+ }
+
+ private void OpenAiPopup()
+ {
+ var context = GetVisibleInformationReferences();
+
+ MainControl.WindowService.ShowAiConversationModalViewWindow(UIContext.CustomerSingle, context);
+ }
+
+ void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{
_ViewModel.CustomerImage = Img.EditValue as byte[];
}
@@ -361,7 +399,7 @@ namespace BeWo.View.Detail
//get { return BeWoApp.Tenant == "demo" && BeWoApp.UserName == "demo"; }
}
- private void Log(string log)
+ private void Log(string log)
{
if (ShouldLog)
{
diff --git a/Service/DCEntityMapper/AbstractIDCEntityMapper.cs b/Service/DCEntityMapper/AbstractIDCEntityMapper.cs
index fbc1345f0..cf21ca76f 100644
--- a/Service/DCEntityMapper/AbstractIDCEntityMapper.cs
+++ b/Service/DCEntityMapper/AbstractIDCEntityMapper.cs
@@ -5,12 +5,13 @@ using System.Linq;
using BeWo.Data.Entities;
using BeWo.Service.Core;
+using BeWo.Service.Interfaces;
using BS.Shared;
using BS.Shared.Extensions;
namespace BeWo.Service.DCEntityMapper
{
- public abstract class AbstractIDCEntityMapper : IDCEntityMapper
+ public abstract class AbstractIDCEntityMapper : IDCEntityMapper, IJsonMapper
where TDC : new() where TEntity : BeWoEntityBase, new()
{
public bool ConcurrencyCheck(long? pDataContractVersion, BeWoEntityBase pEntity)
diff --git a/Service/DCEntityMapper/CustomerDC_Customer.cs b/Service/DCEntityMapper/CustomerDC_Customer.cs
index 18d8d2586..cdc9078a2 100644
--- a/Service/DCEntityMapper/CustomerDC_Customer.cs
+++ b/Service/DCEntityMapper/CustomerDC_Customer.cs
@@ -347,5 +347,10 @@ namespace BeWo.Service.DCEntityMapper
return pDC.CustomerOid == pEntity.Oid;
}
+
+ public override Dictionary ToJsonDictionary(CustomerDC pDC)
+ {
+ return base.ToJsonDictionary(pDC);
+ }
}
}
\ No newline at end of file
diff --git a/Service/DCEntityMapper/IDCEntityMapper.cs b/Service/DCEntityMapper/IDCEntityMapper.cs
index fda5ef580..54f9dc582 100644
--- a/Service/DCEntityMapper/IDCEntityMapper.cs
+++ b/Service/DCEntityMapper/IDCEntityMapper.cs
@@ -19,10 +19,5 @@ namespace BeWo.Service.DCEntityMapper
TDC MergeWithDC(TEntity pEntity, TDC pDataContract);
TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity);
-
- Dictionary ToJsonDictionary(TDC pDC);
- Dictionary ToJsonDictionary(TEntity pEntity);
- IList> ToJsonDictionary(IList pEntities);
- IList> ToJsonDictionary(IList pDCs);
}
}
\ No newline at end of file
diff --git a/Service/Interfaces/IJsonMapper.cs b/Service/Interfaces/IJsonMapper.cs
new file mode 100644
index 000000000..9c622b569
--- /dev/null
+++ b/Service/Interfaces/IJsonMapper.cs
@@ -0,0 +1,18 @@
+using BeWo.Data.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BeWo.Service.Interfaces
+{
+ public interface IJsonMapper
+ where TDC : new() where TEntity : BeWoEntityBase, new()
+ {
+ Dictionary ToJsonDictionary(TDC pDC);
+ Dictionary ToJsonDictionary(TEntity pEntity);
+ IList> ToJsonDictionary(IList pEntities);
+ IList> ToJsonDictionary(IList pDCs);
+ }
+}
diff --git a/Service/Service.csproj b/Service/Service.csproj
index 3eddb439c..b781566e7 100644
--- a/Service/Service.csproj
+++ b/Service/Service.csproj
@@ -417,6 +417,7 @@
+
@@ -546,7 +547,7 @@
-
+
diff --git a/Service/ServiceImplementations/AiEnhancedServiceImp.cs b/Service/ServiceImplementations/AiEnhancedServiceImp.cs
index 8ff4b26c2..823ebd9b7 100644
--- a/Service/ServiceImplementations/AiEnhancedServiceImp.cs
+++ b/Service/ServiceImplementations/AiEnhancedServiceImp.cs
@@ -2,6 +2,7 @@
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Data.Security;
+using BeWo.Service.AI;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceProxy;
@@ -82,7 +83,7 @@ namespace BeWo.Service.ServiceImplementations
{
var current_user = UserRightHelper.GetLoggedInUserWithOid();
- var system_prompt = AiSystemBuilder.CreateSystemInstructions(conversation.UIContext, conversation.ContextBeWoObjects);
+ var system_prompt = AiPromptFactory.CreateSystemInstructions(conversation.UIContext, conversation.ContextBeWoObjects);
var conv = new AiConversation();
conv.Created = DateTime.Now;
diff --git a/Service/ServiceUtils/AiSystemBuilder.cs b/Service/ai/AiPromptFactory.cs
similarity index 86%
rename from Service/ServiceUtils/AiSystemBuilder.cs
rename to Service/ai/AiPromptFactory.cs
index 1de8033a2..e154ecca3 100644
--- a/Service/ServiceUtils/AiSystemBuilder.cs
+++ b/Service/ai/AiPromptFactory.cs
@@ -16,9 +16,9 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
-namespace BeWo.Service.ServiceUtils
+namespace BeWo.Service.AI
{
- public static class AiSystemBuilder
+ public static class AiPromptFactory
{
public static string CreateSystemInstructions(int uicontext, Dictionary bewoobjects)
{
@@ -87,11 +87,15 @@ namespace BeWo.Service.ServiceUtils
case 17: break;
case 18: break;
case 19: return createServiceRecordContext(bewoobjects);
+ case 20: break;
+ case 21: break;
+ case 22: break;
}
throw new NotImplementedException("UI Context unknown");
}
+ #region Navigation
private static Dictionary createSupportConceptNavigationContext(Dictionary bewoobjects)
{
var supports = LoadEntities(bewoobjects, TableID.SupportConcept, MapperFactory.CompactSupportConceptDC_SupportConcept);
@@ -177,9 +181,9 @@ namespace BeWo.Service.ServiceUtils
var sub_dict = new Dictionary()
{
- { "CustomerName Ansicht", customer },
- { "CostBearerName", costbearer },
- { "SupportConceptDuration", supportconcept }
+ { "Klient", customer },
+ { "Kostenträger", costbearer },
+ { "Hilfeplan", supportconcept }
};
var dict = new Dictionary
@@ -192,9 +196,29 @@ namespace BeWo.Service.ServiceUtils
return dict;
}
+ #endregion
+ #region SinglePage
+
+ private static Dictionary createCustomerContext(Dictionary bewoobjects)
+ {
+ var supports = LoadEntity(bewoobjects, TableID.Customer, MapperFactory.CustomerDC_Customer);
+
+ var dict = new Dictionary
+ {
+ { "Aktuelle Ansicht", "Hilfeplan Navigation" },
+ { "Aktueller Ansichtsfilter", "Funktion noch nicht verfügbar" },
+ { "Hilfeplanliste", (object)supports ?? "keine Hilfepläne sichtbar" }
+ };
+
+ return dict;
+ }
+
+ #endregion
+
+ #region LOAD Methods
private static object LoadProperty
- (Dictionary bewoobjects, TableID tid, IDCEntityMapper mapper, Func getPropertyFunc)
+ (Dictionary bewoobjects, TableID tid, AbstractIDCEntityMapper mapper, Func getPropertyFunc)
where TDC : new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
@@ -208,7 +232,7 @@ namespace BeWo.Service.ServiceUtils
}
private static Dictionary LoadEntity
- (Dictionary bewoobjects, TableID tid, IDCEntityMapper mapper)
+ (Dictionary bewoobjects, TableID tid, AbstractIDCEntityMapper mapper)
where TDC : new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
@@ -221,7 +245,7 @@ namespace BeWo.Service.ServiceUtils
}
private static IList> LoadEntities
- (Dictionary bewoobjects, TableID tid, IDCEntityMapper mapper)
+ (Dictionary bewoobjects, TableID tid, AbstractIDCEntityMapper mapper)
where TDC : new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
@@ -235,7 +259,7 @@ namespace BeWo.Service.ServiceUtils
}
private static IList> LoadEntities
- (Dictionary bewoobjects, TableID tid, IDCEntityMapper mapper, Action afterDC)
+ (Dictionary bewoobjects, TableID tid, AbstractIDCEntityMapper mapper, Action afterDC)
where TDC : new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
@@ -256,6 +280,8 @@ namespace BeWo.Service.ServiceUtils
return dict;
}
+ #endregion
+
private static string getSystemPrompt(int i)
{