ModuleAiEnabled bei MandatorSetting String
+ CustomerNavigation
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using BeWo.AI.View;
|
||||
using BeWo.View;
|
||||
using BeWo.View.Windows;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Translation;
|
||||
using System;
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
<DependentUpon>AiConversationChatModalPopup.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\TemplateSelectors\AiConversationMessageTemplateSelector.cs" />
|
||||
<Compile Include="View\Windows\AiWindowBuilder.cs" />
|
||||
<Compile Include="View\Windows\AnimatedBeWoWindow.xaml.cs">
|
||||
<DependentUpon>AnimatedBeWoWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -1427,7 +1428,7 @@
|
||||
<Compile Include="View\HilfeplanImportView.xaml.cs">
|
||||
<DependentUpon>HilfeplanImportView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\BeWoWindowBuilder.cs" />
|
||||
<Compile Include="View\Windows\BeWoWindowBuilder.cs" />
|
||||
<Compile Include="View\Controls\DPCtrlEmployeeContractTooltip.xaml.cs">
|
||||
<DependentUpon>DPCtrlEmployeeContractTooltip.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -544,6 +544,8 @@ namespace BeWo
|
||||
val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.DontUpdateApprovalPeriodDates);
|
||||
AppSettings.DontUpdateApprovalPeriodDates = val != null && val.Equals("1");
|
||||
|
||||
// REFACTOR: getUserSetting verwenden?
|
||||
AppSettings.ModuleAiEnabled = getUserSetting(SettingsKeys.ModuleAiEnabled);
|
||||
|
||||
switch (_Mandator.BeWoClientType)
|
||||
{
|
||||
@@ -661,6 +663,13 @@ namespace BeWo
|
||||
}
|
||||
}
|
||||
|
||||
private static bool getUserSetting(string key)
|
||||
{
|
||||
var val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, key);
|
||||
var allowed = val != null && val.Equals("1");
|
||||
return allowed;
|
||||
}
|
||||
|
||||
internal static Uri SiteOfOrigin
|
||||
{
|
||||
get
|
||||
|
||||
@@ -58,7 +58,11 @@ namespace BeWo
|
||||
Administration = 16,
|
||||
AiConversation = 17,
|
||||
AiConversationPopup = 18,
|
||||
ServiceRecord = 19
|
||||
// Nur für AI Conversation Zuweisung
|
||||
ServiceRecord = 19,
|
||||
CustomerSingle = 20,
|
||||
PersonSingle = 21,
|
||||
EmployeeSingle = 22,
|
||||
}
|
||||
|
||||
public partial class MainControl
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BeWo.ServiceProxy
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/CreateAiConversation", ReplyAction="http://tempuri.org/IOperationsEnhancedService/CreateAiConversationResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/CreateAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(int uicontext, long model, System.Collections.Generic.List<System.Tuple<long, long>> bewoobjects);
|
||||
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid);
|
||||
|
||||
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/SendNewMessage", ReplyAction="http://tempuri.org/IOperationsEnhancedService/SendNewMessageResponse")]
|
||||
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/SendNewMessageBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
|
||||
@@ -94,9 +94,9 @@ namespace BeWo.ServiceProxy
|
||||
return base.Channel.GetAiConversations(uicontext);
|
||||
}
|
||||
|
||||
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(int uicontext, long model, System.Collections.Generic.List<System.Tuple<long, long>> bewoobjects)
|
||||
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid)
|
||||
{
|
||||
return base.Channel.CreateAiConversation(uicontext, model, bewoobjects);
|
||||
return base.Channel.CreateAiConversation(conversation, modell_oid);
|
||||
}
|
||||
|
||||
public System.Collections.Generic.List<BS.Shared.DataContracts.AiConversationMessageDC> SendNewMessage(long conversation, string message)
|
||||
|
||||
@@ -231,4 +231,87 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- EndRegion -->
|
||||
|
||||
<!-- Region Weiße Buttons im MainNavigationView -->
|
||||
<Style
|
||||
x:Key="NavigationToolbarButtonStyle"
|
||||
BasedOn="{StaticResource HideDisabledButton}"
|
||||
TargetType="{x:Type Button}">
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="Storyboard1">
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
AccelerationRatio="1"
|
||||
BeginTime="00:00:00"
|
||||
Storyboard.TargetName="contentPresenter"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
|
||||
Duration="00:00:00.2">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1.2" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
AccelerationRatio="1"
|
||||
BeginTime="00:00:00"
|
||||
Storyboard.TargetName="contentPresenter"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
|
||||
Duration="00:00:00.2">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1.2" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="Storyboard2">
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00"
|
||||
DecelerationRatio="1"
|
||||
Storyboard.TargetName="contentPresenter"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
|
||||
Duration="00:00:00.2">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00"
|
||||
DecelerationRatio="1"
|
||||
Storyboard.TargetName="contentPresenter"
|
||||
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
|
||||
Duration="00:00:00.2">
|
||||
<SplineDoubleKeyFrame KeyTime="00:00:00.2" Value="1" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Width="Auto"
|
||||
Margin="3,0,3,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<ContentPresenter.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1" />
|
||||
<SkewTransform AngleX="0" AngleY="0" />
|
||||
<RotateTransform Angle="0" />
|
||||
<TranslateTransform X="0" Y="0" />
|
||||
</TransformGroup>
|
||||
</ContentPresenter.RenderTransform>
|
||||
</ContentPresenter>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard x:Name="Storyboard2_BeginStoryboard" Storyboard="{StaticResource Storyboard2}" />
|
||||
</Trigger.ExitActions>
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}" />
|
||||
</Trigger.EnterActions>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF" />
|
||||
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
</Style>
|
||||
<!-- EndRegion -->
|
||||
</ResourceDictionary>
|
||||
@@ -1,5 +1,6 @@
|
||||
using BeWo.Core;
|
||||
using BeWo.ServiceProxy;
|
||||
using BeWo.View.Windows;
|
||||
using BeWo.ViewModel;
|
||||
using BeWo.ViewModel.ListViewModel;
|
||||
using BS.Shared.DataContracts.GkvAbrechnung;
|
||||
|
||||
@@ -1,26 +1,39 @@
|
||||
<UserControl x:Class="BeWo.View.Controls.TextViewer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:BeWo.View.Controls"
|
||||
mc:Ignorable="d">
|
||||
<UserControl
|
||||
x:Class="BeWo.View.Controls.TextViewer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:BeWo.View.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Margin="3" Background="#eeeeee">
|
||||
<TextBox x:Name="txt" IsReadOnly="True" Text="test" Foreground="Black" Background="#f1f1f1" BorderThickness="1">
|
||||
|
||||
</TextBox>
|
||||
<ScrollViewer
|
||||
Margin="3"
|
||||
Background="#eeeeee"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<TextBox
|
||||
x:Name="txt"
|
||||
Background="#f1f1f1"
|
||||
BorderThickness="1"
|
||||
Foreground="Black"
|
||||
IsReadOnly="True"
|
||||
Text="test" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<Button Grid.Row="1" Content="Inhalt in Zwischenablage kopieren" Click="Button_Click" Margin="3"/>
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
Margin="3"
|
||||
Click="Button_Click"
|
||||
Content="Inhalt in Zwischenablage kopieren" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Windows.Threading;
|
||||
using BeWo.Core;
|
||||
using BeWo.ServiceProxy;
|
||||
using BeWo.View.Controls;
|
||||
using BeWo.View.Windows;
|
||||
using BeWo.ViewModel;
|
||||
using BeWo.ViewModel.ListViewModel;
|
||||
|
||||
|
||||
@@ -783,7 +783,7 @@
|
||||
FontSize="22"
|
||||
Foreground="#FFFFFFFF"
|
||||
Text="{Binding CustomerAlias}"
|
||||
TextDecorations="" />
|
||||
TextDecorations="None" />
|
||||
<TextBox
|
||||
Margin="0,0,0,0"
|
||||
Padding="0,0,0,0"
|
||||
|
||||
@@ -37,6 +37,7 @@ using DevExpress.Xpf.Editors;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Documents;
|
||||
using System.Collections.ObjectModel;
|
||||
using BeWo.View.Windows;
|
||||
|
||||
namespace BeWo.View.Detail
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
xmlns:localViewModel="clr-namespace:BeWo.ViewModel"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:security="clr-namespace:BeWo.Security"
|
||||
xmlns:shared="clr-namespace:BS.Shared;assembly=BS.Shared"
|
||||
xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
|
||||
xmlns:val="clr-namespace:BeWo.Validation"
|
||||
@@ -619,13 +620,15 @@
|
||||
<Button
|
||||
Margin="3"
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="Ai_Button_Click">
|
||||
Click="Ai_Button_Click"
|
||||
Visibility="{Binding Converter={StaticResource UserPermission2VisibleConverter}, ConverterParameter={x:Static shared:UserRightType.AiModuleView}}">
|
||||
AI Chat Window
|
||||
</Button>
|
||||
<Button
|
||||
Margin="3"
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="Ai_Button2_Click">
|
||||
Click="Ai_Button2_Click"
|
||||
Visibility="{Binding Converter={StaticResource UserPermission2VisibleConverter}, ConverterParameter={x:Static shared:UserRightType.AiModuleView2}}">
|
||||
AI Chat Popup
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
@@ -53,6 +53,7 @@ using DependencyObject = System.Windows.DependencyObject;
|
||||
using BeWo.AI.View;
|
||||
using BeWo.AI;
|
||||
using BeWo.View.Detail.AI;
|
||||
using BeWo.View.Windows;
|
||||
|
||||
namespace BeWo.View.Detail.Zeiterfassung
|
||||
{
|
||||
@@ -5077,12 +5078,7 @@ namespace BeWo.View.Detail.Zeiterfassung
|
||||
|
||||
var context = ViewModel.GetVisibleInformationReferences(records);
|
||||
|
||||
var control = new AiConversationChatView();
|
||||
|
||||
control.ViewModel.UIContext = (int)(UIContext.ServiceRecord);
|
||||
control.ViewModel.ContextBeWoObjects = context;
|
||||
|
||||
var window = BeWoWindowBuilder.GetAiConversationZeiterfassungWindow(context);
|
||||
var window = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationWindow(UIContext.ServiceRecord, context);
|
||||
|
||||
window.Show();
|
||||
}
|
||||
@@ -5092,10 +5088,7 @@ namespace BeWo.View.Detail.Zeiterfassung
|
||||
|
||||
var context = ViewModel.GetVisibleInformationReferences(records);
|
||||
|
||||
var control = new AiConversationChatModalPopup();
|
||||
|
||||
control.ViewModel.UIContext = (int)(UIContext.ServiceRecord);
|
||||
control.ViewModel.ContextBeWoObjects = context;
|
||||
var control = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationControl(UIContext.ServiceRecord, context);
|
||||
|
||||
MainControl.ShowControlAsModalPopup(control);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BeWo.ServiceProxy;
|
||||
using BeWo.View.Windows;
|
||||
using BeWo.ViewModel;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:localNavView="clr-namespace:BeWo.View.Navigation"
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
x:Name="root_view"
|
||||
Loaded="OnLoaded">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
|
||||
@@ -25,6 +25,11 @@ using BS.Shared.Translation;
|
||||
using Microsoft.Win32;
|
||||
using BeWo.AI;
|
||||
using BeWo.View.Document;
|
||||
using DevExpress.Mvvm;
|
||||
using BeWo.View.Detail.AI;
|
||||
using System;
|
||||
using BeWo.View.Windows;
|
||||
using System.Collections;
|
||||
|
||||
namespace BeWo.View.Navigation
|
||||
{
|
||||
@@ -44,7 +49,10 @@ namespace BeWo.View.Navigation
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
mainNavigationView.Sorter = new CustomerSorter();
|
||||
mainNavigationView.OpenAiWindowCommand = new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView), false);
|
||||
mainNavigationView.OpenAiPopupCommand = new DelegateCommand(OpenAiPopup, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2), false);
|
||||
|
||||
mainNavigationView.Sorter = new CustomerSorter();
|
||||
mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_AllowArchiving);
|
||||
mainNavigationView.ShowArchivedObjectsVisible = true;
|
||||
|
||||
@@ -169,7 +177,48 @@ namespace BeWo.View.Navigation
|
||||
UpdateCustomFilter();
|
||||
}
|
||||
|
||||
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
|
||||
public Dictionary<TableID, long[]> GetVisibleInformationReferences()
|
||||
{
|
||||
var visible = mainNavigationView.objectListBox.ItemsSource;
|
||||
|
||||
return GetVisibleInformationReferences(visible);
|
||||
}
|
||||
|
||||
private Dictionary<TableID, long[]> GetVisibleInformationReferences(IEnumerable selected_records)
|
||||
{
|
||||
foreach (var record in selected_records)
|
||||
{
|
||||
var t = record is CompactCustomerDC;
|
||||
|
||||
|
||||
if (record is CompactCustomerDC)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OpenAiWindow()
|
||||
{
|
||||
var context = GetVisibleInformationReferences();
|
||||
|
||||
var window = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationWindow(UIContext.Customer, context);
|
||||
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private void OpenAiPopup()
|
||||
{
|
||||
var context = GetVisibleInformationReferences();
|
||||
|
||||
var control = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationControl(UIContext.Customer, context);
|
||||
|
||||
MainControl.ShowControlAsModalPopup(control);
|
||||
}
|
||||
|
||||
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
|
||||
{
|
||||
BeWoApp.AppSettings.CustomerFilterSupportConcepts = ((CustomerFilterItem) supportConceptFilterComboBox.SelectedItem)?.CustomerFilter ?? CustomerFilterEnum.MyCustomer;
|
||||
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
<localView:BeWoView x:Class="BeWo.View.Navigation.CustomerTeamNavigationView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
xmlns:localNavView="clr-namespace:BeWo.View.Navigation"
|
||||
Loaded="OnLoaded"
|
||||
>
|
||||
<localView:BeWoView
|
||||
x:Class="BeWo.View.Navigation.CustomerTeamNavigationView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:localNavView="clr-namespace:BeWo.View.Navigation"
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
Loaded="OnLoaded">
|
||||
|
||||
<Grid>
|
||||
<localNavView:MainNavigationView x:Name="mainNavigationView"
|
||||
MainGroupHeader="Kliententeams"
|
||||
CreateNewObject="mainNavigationView_CreateNewObject"
|
||||
OpenObject="mainNavigationView_OpenObject"
|
||||
DeleteObject="mainNavigationView_DeleteObject"
|
||||
DeleteDemands="DeleteAll, CustomerTeam_Delete"
|
||||
CreateDemands="CreateAll, CustomerTeam_Create"
|
||||
ExcelExport="mainNavigationView_ExcelExport"
|
||||
ContentGroupStyle="{StaticResource CustomerTeamNavigationStyle}"
|
||||
MainListItemStyle="{StaticResource SearchDetailStyle}"
|
||||
HistoryListItemStyle="{StaticResource SearchSimpleStyle}"
|
||||
OnReloadData="MainNavigationView_OnReloadData"/>
|
||||
<localNavView:MainNavigationView
|
||||
x:Name="mainNavigationView"
|
||||
ContentGroupStyle="{StaticResource CustomerTeamNavigationStyle}"
|
||||
CreateDemands="CreateAll, CustomerTeam_Create"
|
||||
CreateNewObject="mainNavigationView_CreateNewObject"
|
||||
DeleteDemands="DeleteAll, CustomerTeam_Delete"
|
||||
DeleteObject="mainNavigationView_DeleteObject"
|
||||
ExcelExport="mainNavigationView_ExcelExport"
|
||||
HistoryListItemStyle="{StaticResource SearchSimpleStyle}"
|
||||
MainGroupHeader="Kliententeams"
|
||||
MainListItemStyle="{StaticResource SearchDetailStyle}"
|
||||
OnReloadData="MainNavigationView_OnReloadData"
|
||||
OpenObject="mainNavigationView_OpenObject" />
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -1,33 +1,45 @@
|
||||
<localView:BeWoView x:Class="BeWo.View.Navigation.EmployeeNavigationView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
xmlns:localNavView="clr-namespace:BeWo.View.Navigation"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
Loaded="OnLoaded">
|
||||
<Grid>
|
||||
<localNavView:MainNavigationView
|
||||
x:Name="mainNavigationView"
|
||||
MainGroupHeader="{markup:Translate MitarbeiterPlural}"
|
||||
CreateNewObject="MainNavigationView_CreateNewObject"
|
||||
OpenObject="MainNavigationView_OpenObject"
|
||||
DeleteObject="MainNavigationView_DeleteObject"
|
||||
ExcelExport="MainNavigationView_ExcelExport"
|
||||
Print="mainNavigationView_Print"
|
||||
DeleteDemands="DeleteAll, EmployeeView_Delete"
|
||||
CreateDemands="CreateAll, EmployeeView_Create"
|
||||
ArchiveObject="MainNavigationView_ArchiveObject"
|
||||
ContentGroupStyle="{StaticResource EmployeeNavigationStyle}"
|
||||
MainListItemStyle="{StaticResource EmployeeDetailStyle}"
|
||||
HistoryListItemStyle="{StaticResource SearchSimpleStyle}"
|
||||
OnReloadData="MainNavigationView_OnReloadData"/>
|
||||
<localView:BeWoView
|
||||
x:Class="BeWo.View.Navigation.EmployeeNavigationView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:localNavView="clr-namespace:BeWo.View.Navigation"
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
Loaded="OnLoaded">
|
||||
<Grid>
|
||||
<localNavView:MainNavigationView
|
||||
x:Name="mainNavigationView"
|
||||
ArchiveObject="MainNavigationView_ArchiveObject"
|
||||
ContentGroupStyle="{StaticResource EmployeeNavigationStyle}"
|
||||
CreateDemands="CreateAll, EmployeeView_Create"
|
||||
CreateNewObject="MainNavigationView_CreateNewObject"
|
||||
DeleteDemands="DeleteAll, EmployeeView_Delete"
|
||||
DeleteObject="MainNavigationView_DeleteObject"
|
||||
ExcelExport="MainNavigationView_ExcelExport"
|
||||
HistoryListItemStyle="{StaticResource SearchSimpleStyle}"
|
||||
MainGroupHeader="{markup:Translate MitarbeiterPlural}"
|
||||
MainListItemStyle="{StaticResource EmployeeDetailStyle}"
|
||||
OnReloadData="MainNavigationView_OnReloadData"
|
||||
OpenObject="MainNavigationView_OpenObject"
|
||||
Print="mainNavigationView_Print" />
|
||||
|
||||
<TextBlock Grid.Column="1" x:Name="textblock_link" VerticalAlignment="Bottom" Margin="0,0,25,15" HorizontalAlignment="Right" FontSize="16">
|
||||
<Hyperlink x:Name="linkNewLicense" TargetName="newWindow" Foreground="#FFFFFF" NavigateUri="http://www.bewoplaner.de" RequestNavigate="LinkNewLicense_OnRequestNavigate">
|
||||
<Run Text="{markup:Translate Neue Mitarbeiterlizenz bestellen}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
x:Name="textblock_link"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,25,15"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
FontSize="16">
|
||||
<Hyperlink
|
||||
x:Name="linkNewLicense"
|
||||
Foreground="#FFFFFF"
|
||||
NavigateUri="http://www.bewoplaner.de"
|
||||
RequestNavigate="LinkNewLicense_OnRequestNavigate"
|
||||
TargetName="newWindow">
|
||||
<Run Text="{markup:Translate Neue Mitarbeiterlizenz bestellen}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
<!-- MainListItemStyle="{StaticResource SearchDetailStyle}" -->
|
||||
<!-- MainListItemStyle="{StaticResource SearchDetailStyle}" -->
|
||||
</localView:BeWoView>
|
||||
@@ -274,6 +274,27 @@
|
||||
Content="KI"
|
||||
Style="{StaticResource NavigationToolbarButtonStyle}"
|
||||
Visibility="Collapsed" />
|
||||
<StackPanel Margin="0" Orientation="Horizontal">
|
||||
<StackPanel.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</StackPanel.Resources>
|
||||
<Button
|
||||
x:Name="btnOpenAi2"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding Path=OpenAiWindowCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}"
|
||||
Content="AI Chat Window"
|
||||
Style="{StaticResource NavigationToolbarButtonStyle}" />
|
||||
<Button
|
||||
x:Name="btnOpenAi3"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding Path=OpenAiPopupCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}"
|
||||
Content="AI Chat Popup"
|
||||
Style="{StaticResource NavigationToolbarButtonStyle}" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
x:Name="textblock_link"
|
||||
Margin="20,0,0,0"
|
||||
|
||||
@@ -21,6 +21,7 @@ using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Translation;
|
||||
using DevExpress.Mvvm;
|
||||
|
||||
namespace BeWo.View.Navigation
|
||||
{
|
||||
@@ -128,7 +129,10 @@ namespace BeWo.View.Navigation
|
||||
|
||||
public event CopyObjectDelegate CopyObject;
|
||||
|
||||
public bool ArchiveButtonVisible
|
||||
public DelegateCommand OpenAiWindowCommand { get; set; }
|
||||
public DelegateCommand OpenAiPopupCommand { get; set; }
|
||||
|
||||
public bool ArchiveButtonVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -618,6 +622,7 @@ namespace BeWo.View.Navigation
|
||||
}
|
||||
}
|
||||
|
||||
// Christian
|
||||
private void btnOpenAi_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (OpenAiChat != null)
|
||||
@@ -626,7 +631,27 @@ namespace BeWo.View.Navigation
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCopy_Click(object sender, RoutedEventArgs e)
|
||||
// Rene Window
|
||||
private void btnOpenAi2_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (OpenAiChat != null)
|
||||
{
|
||||
OpenAiChat();
|
||||
}
|
||||
}
|
||||
|
||||
// Rene ModalPopup
|
||||
private void btnOpenAi3_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (OpenAiChat != null)
|
||||
{
|
||||
OpenAiChat();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCopy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (CopyObject != null)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ using BeWo.Core.Service;
|
||||
using BeWo.MultiLanguage;
|
||||
using BS.Shared.Translation;
|
||||
using Microsoft.Win32;
|
||||
using BeWo.View.Windows;
|
||||
|
||||
namespace BeWo.View.Navigation
|
||||
{
|
||||
|
||||
48
BeWo/View/Windows/AiWindowBuilder.cs
Normal file
48
BeWo/View/Windows/AiWindowBuilder.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using BeWo.View.Detail.AI;
|
||||
using BS.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using static BeWo.View.Windows.BeWoWindowBuilder;
|
||||
|
||||
namespace BeWo.View.Windows
|
||||
{
|
||||
public class AiWindowBuilder
|
||||
{
|
||||
public Dictionary<UIContext, string> UIContext2Header { get; set; } = new Dictionary<UIContext, string>()
|
||||
{
|
||||
{UIContext.ServiceRecord, "Zeiterfassung KI Chat" },
|
||||
{UIContext.Customer, "Klienten Übersicht KI Chat" },
|
||||
};
|
||||
|
||||
public Window GetAiConversationWindow(UIContext uIContext, Dictionary<TableID, long[]> context, double height = 600, double width = 1200)
|
||||
{
|
||||
string title = null;
|
||||
|
||||
UIContext2Header.TryGetValue(uIContext, out title);
|
||||
|
||||
if (string.IsNullOrEmpty(title))
|
||||
title = "default";
|
||||
|
||||
var control = GetAiConversationControl(uIContext, context, height, width);
|
||||
|
||||
var window = GetAnimatedBeWoWindow(title, control, 400, height, 1000, 500, width, 1600);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
public UserControl GetAiConversationControl(UIContext uIContext, Dictionary<TableID, long[]> context, double height = 600, double width = 1200)
|
||||
{
|
||||
var control = new AiConversationChatView();
|
||||
|
||||
control.ViewModel.UIContext = (int)(UIContext.ServiceRecord);
|
||||
control.ViewModel.ContextBeWoObjects = context;
|
||||
|
||||
return control;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using BeWo.View.Controls;
|
||||
using BeWo.View.Detail;
|
||||
using BeWo.View.Detail.AI;
|
||||
using BeWo.View.Windows;
|
||||
using BeWo.ViewModel;
|
||||
using BS.Shared.Extensions;
|
||||
using System;
|
||||
@@ -12,22 +11,11 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace BeWo.View
|
||||
namespace BeWo.View.Windows
|
||||
{
|
||||
public static class BeWoWindowBuilder
|
||||
{
|
||||
public static Window GetAiConversationZeiterfassungWindow(List<Tuple<long, long>> context, double height = 600, double width = 1200)
|
||||
{
|
||||
var title = "Zeiterfassung KI Chat";
|
||||
var control = new AiConversationChatView();
|
||||
|
||||
control.ViewModel.UIContext = (int)(UIContext.ServiceRecord);
|
||||
control.ViewModel.ContextBeWoObjects = context;
|
||||
|
||||
var window = GetAnimatedBeWoWindow(title, control, 400, height, 1000, 500, width, 1600);
|
||||
|
||||
return window;
|
||||
}
|
||||
public static AiWindowBuilder AiWindowBuilder { get; } = new AiWindowBuilder();
|
||||
|
||||
public static BeWoWindow GetTextViewer(string title, string text, bool fixed_size = false, double height = 600, double width = 600)
|
||||
{
|
||||
@@ -98,7 +86,7 @@ namespace BeWo.View
|
||||
return beWoWindow;
|
||||
}
|
||||
|
||||
private static AnimatedBeWoWindow GetAnimatedBeWoWindow(string title, Control control, double min_height, double height, double max_height, double min_width, double width, double max_width)
|
||||
public static AnimatedBeWoWindow GetAnimatedBeWoWindow(string title, Control control, double min_height, double height, double max_height, double min_width, double width, double max_width)
|
||||
{
|
||||
var beWoWindow = new AnimatedBeWoWindow();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BeWo.ServiceProxy;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using BS.Shared.Extensions;
|
||||
@@ -107,11 +108,16 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
}
|
||||
|
||||
public int UIContext{ get; set; }
|
||||
public List<Tuple<long, long>> ContextBeWoObjects { get; set; }
|
||||
public Dictionary<TableID, long[]> ContextBeWoObjects { get; set; }
|
||||
|
||||
public void RequestNewConversation()
|
||||
{
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.CreateAiConversation(UIContext, Config.SelectedModel.Oid.Value, ContextBeWoObjects), dc => {
|
||||
var conv = new AiConversationDC();
|
||||
|
||||
conv.UIContext = UIContext;
|
||||
conv.ContextBeWoObjects = ContextBeWoObjects;
|
||||
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.CreateAiConversation(conv, Config.SelectedModel.Oid.Value), dc => {
|
||||
var vm = new AiConversationVM(dc);
|
||||
VMList.Insert(0, vm);
|
||||
SelectedVM = vm;
|
||||
|
||||
@@ -1918,7 +1918,7 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
return json;
|
||||
}
|
||||
|
||||
public List<Tuple<long, long>> GetVisibleInformationReferences(IEnumerable<ServiceRecordVM> selected_records)
|
||||
public Dictionary<TableID, long[]> GetVisibleInformationReferences(IEnumerable<ServiceRecordVM> selected_records)
|
||||
{
|
||||
var current = SelectedCustomerNode;
|
||||
var hello = current?.SupportConceptTreeNodeDC;
|
||||
@@ -1927,17 +1927,20 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
if (current is null)
|
||||
return null;
|
||||
|
||||
var rtn = new List<Tuple<long, long>>();
|
||||
|
||||
rtn.Add(new Tuple<long, long>(hello.Customer.CustomerOid, (long)TableID.Customer));
|
||||
rtn.Add(new Tuple<long, long>(hello.SupportConcept.SupportConceptOid, (long)TableID.SupportConcept));
|
||||
rtn.Add(new Tuple<long, long>(hello.CostBearer.CostBearerOid ?? -1, (long)TableID.CostBearer));
|
||||
|
||||
var oids = new List<long>();
|
||||
foreach (var record in selected_records)
|
||||
{
|
||||
rtn.Add(new Tuple<long, long>(record.DataContract.ServiceRecordOid ?? -1, (long)TableID.ServiceRecord));
|
||||
oids.Add(record.DataContract.ServiceRecordOid ?? -1);
|
||||
}
|
||||
|
||||
var rtn = new Dictionary<TableID, long[]>()
|
||||
{
|
||||
{TableID.Customer, new long[]{ hello.Customer.CustomerOid } },
|
||||
{TableID.SupportConcept, new long[]{ hello.SupportConcept.SupportConceptOid } },
|
||||
{TableID.CostBearer, new long[]{ hello.CostBearer.CostBearerOid ?? -1 } },
|
||||
{TableID.ServiceRecord, oids.ToArray() }
|
||||
};
|
||||
|
||||
return rtn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BS.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,6 +10,6 @@ namespace BeWo.Data.Entities
|
||||
public class BeWoEntityReference
|
||||
{
|
||||
public virtual long Oid { get; set; }
|
||||
public virtual long Tid { get; set; }
|
||||
public virtual TableID Tid { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</key>
|
||||
<composite-element class="BeWo.Data.Entities.BeWoEntityReference,BeWo.Data">
|
||||
<property name="Oid" column="BeWoObjectOid" type="long"/>
|
||||
<property name="Tid" column="BeWoObjectTid" type="long"/>
|
||||
<property name="Tid" column="BeWoObjectTid" type="BS.Shared.TableID, BS.Shared"/>
|
||||
</composite-element>
|
||||
</bag>
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ CONSTRAINT `FK_AICONVERSATION_OID` FOREIGN KEY (`AiConversationOid`) REFERENCES
|
||||
|
||||
CREATE Table `AiConversation2BeWoObject` (
|
||||
`AiConversationOid` bigint,
|
||||
`BeWoObjectTid` int,
|
||||
`BeWoObjectOid` bigint,
|
||||
`BeWoObjectTid` bigint,
|
||||
PRIMARY KEY (`AiConversationOid`, `BeWoObjectOid`, `BeWoObjectTid`),
|
||||
PRIMARY KEY (`AiConversationOid`, `BeWoObjectTid`, `BeWoObjectOid`),
|
||||
CONSTRAINT `FK_AICONVERSATION2_OID` FOREIGN KEY (`AiConversationOid`) REFERENCES `aiconversation` (`Oid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pDataContract.Created = pEntity.Created;
|
||||
pDataContract.Updated = pEntity.Updated;
|
||||
pDataContract.Context = pEntity.Context;
|
||||
pDataContract.ContextBeWoObjects = pEntity.ContextBeWoObjects?.Select(x => new Tuple<long, long>(x.Oid, x.Tid)).ToList();
|
||||
pDataContract.ContextBeWoObjects = Parse(pEntity.ContextBeWoObjects);
|
||||
pDataContract.UIContext = pEntity.UIContext;
|
||||
|
||||
if (pEntity.Messages is IList<AiConversationMessage> list && list.Any())
|
||||
@@ -37,6 +38,8 @@ namespace BeWo.Service.DCEntityMapper
|
||||
|
||||
public override AiConversation MergeWithEntity(AiConversationDC pDataContract, AiConversation pEntity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
ConcurrencyCheck(pDataContract.Version, pEntity);
|
||||
|
||||
//pEntity.Oid = pDataContract.Oid;
|
||||
@@ -46,8 +49,8 @@ namespace BeWo.Service.DCEntityMapper
|
||||
pEntity.Created = pDataContract.Created;
|
||||
pEntity.Updated = pDataContract.Updated;
|
||||
pEntity.Context = pDataContract.Context;
|
||||
pEntity.ContextBeWoObjects = pDataContract.ContextBeWoObjects?.Select(x => new BeWoEntityReference() { Oid = x.Item1, Tid = x.Item2}).ToList();
|
||||
pEntity.UIContext = pDataContract.UIContext;
|
||||
pEntity.ContextBeWoObjects = Parse(pDataContract.ContextBeWoObjects);
|
||||
|
||||
MapperFactory.AiConversationMessage.MergeWithEntitys(pDataContract.Messages, pEntity.Messages);
|
||||
|
||||
@@ -61,5 +64,43 @@ namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public Dictionary<TableID, long[]> Parse(IEnumerable<BeWoEntityReference> beWoEntities)
|
||||
{
|
||||
if (beWoEntities is null)
|
||||
return null;
|
||||
|
||||
var tables = beWoEntities.Select(x => x.Tid).Distinct();
|
||||
|
||||
var rtn = new Dictionary<TableID, List<long>>();
|
||||
foreach (var table in tables)
|
||||
{
|
||||
rtn.Add(table, new List<long>());
|
||||
}
|
||||
|
||||
beWoEntities.DoForEach(x => rtn[x.Tid].Add(x.Oid));
|
||||
|
||||
return rtn.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToArray());
|
||||
}
|
||||
|
||||
public IList<BeWoEntityReference> Parse(Dictionary<TableID, long[]> input)
|
||||
{
|
||||
if (input is null)
|
||||
return null;
|
||||
|
||||
var rtn = new List<BeWoEntityReference>();
|
||||
|
||||
foreach (var kvp in input)
|
||||
{
|
||||
var table = kvp.Key;
|
||||
for (var i = 0; i < kvp.Value.Length; i++)
|
||||
{
|
||||
var oid = kvp.Value[i];
|
||||
rtn.Add(new BeWoEntityReference() { Tid = table, Oid = oid });
|
||||
}
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BeWo.Data.Entities;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Attributes;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
@@ -37,7 +38,7 @@ namespace BeWo.Service.ServiceContracts
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(BS.Shared.UserRightType.AiModuleView)]
|
||||
AiConversationDC CreateAiConversation(int uicontext, long model, List<Tuple<long, long>> bewoobjects);
|
||||
AiConversationDC CreateAiConversation(AiConversationDC conversation, long modell_oid);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
|
||||
@@ -6,6 +6,7 @@ using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.ServiceContracts;
|
||||
using BeWo.Service.ServiceProxy;
|
||||
using BeWo.Service.ServiceUtils;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
using BS.Shared.DataContracts.MikePHPContracts;
|
||||
@@ -14,6 +15,7 @@ using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.ServiceModel;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -77,19 +79,19 @@ namespace BeWo.Service.ServiceImplementations
|
||||
return dcs;
|
||||
}
|
||||
|
||||
public AiConversationDC CreateAiConversation(int uicontext, long model, List<Tuple<long, long>> bewoobjects)
|
||||
public AiConversationDC CreateAiConversation(AiConversationDC conversation, long modell_oid)
|
||||
{
|
||||
var current_user = UserRightHelper.GetLoggedInUserWithOid();
|
||||
|
||||
var system = AiSystemBuilder.CreateSystemInstructions(uicontext, bewoobjects);
|
||||
var system = AiSystemBuilder.CreateSystemInstructions(conversation.UIContext, conversation.ContextBeWoObjects);
|
||||
|
||||
var conv = new AiConversation();
|
||||
conv.Created = DateTime.Now;
|
||||
conv.ContextBeWoObjects = bewoobjects?.Select(x => new BeWoEntityReference() { Oid = x.Item1, Tid = x.Item2}).ToList();
|
||||
conv.ContextBeWoObjects = MapperFactory.AiConversation.Parse(conversation.ContextBeWoObjects);
|
||||
conv.Displayname = "Displayname";
|
||||
conv.Messages = new List<AiConversationMessage>();
|
||||
conv.Modell = DAOFactory.GenericDAO.LoadByID<AiModel>(model);
|
||||
conv.UIContext = uicontext;
|
||||
conv.Modell = DAOFactory.GenericDAO.LoadByID<AiModel>(modell_oid);
|
||||
conv.UIContext = conversation.UIContext;
|
||||
conv.Updated = DateTime.Now;
|
||||
conv.ApplicationUserOid = current_user.Oid;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace BeWo.Service.ServiceUtils
|
||||
{
|
||||
public static class AiSystemBuilder
|
||||
{
|
||||
public static string CreateSystemInstructions(int uicontext, List<Tuple<long, long>> bewoobjects)
|
||||
public static string CreateSystemInstructions(int uicontext, Dictionary<TableID, long[]> bewoobjects)
|
||||
{
|
||||
var system_prompt = getSystemPrompt(2);
|
||||
|
||||
@@ -78,40 +78,38 @@ namespace BeWo.Service.ServiceUtils
|
||||
return escape;
|
||||
}
|
||||
|
||||
private static string createServiceRecordContext(List<Tuple<long, long>> bewoobjects)
|
||||
private static string createServiceRecordContext(Dictionary<TableID, long[]> bewoobjects)
|
||||
{
|
||||
if (bewoobjects is null || !bewoobjects.Any())
|
||||
return null;
|
||||
|
||||
// Sortiere Liste
|
||||
var sorted = getDictionary(bewoobjects);
|
||||
|
||||
var selected = new Dictionary<string, object>();
|
||||
if (tryGetSingleValue(sorted, TableID.Customer, out long coid))
|
||||
if (bewoobjects.TryGetValue(TableID.Customer, out long[] cvalues) && (cvalues?.Length ?? 0) > 0)
|
||||
{
|
||||
var customer = DAOFactory.GenericDAO.GetByID<Customer>(coid);
|
||||
var customer = DAOFactory.GenericDAO.GetByID<Customer>(cvalues[0]);
|
||||
var customer_dc = MapperFactory.CompactCustomerDC_Customer.MapToNewDC(customer);
|
||||
selected.Add("CustomerName", customer_dc.LastNameFirstName);
|
||||
}
|
||||
|
||||
if (tryGetSingleValue(sorted, TableID.CostBearer, out long cboid))
|
||||
if (bewoobjects.TryGetValue(TableID.CostBearer, out long[] cbvalues) && (cbvalues?.Length ?? 0) > 0)
|
||||
{
|
||||
var costbearer = DAOFactory.GenericDAO.GetByID<Organisation>(cboid);
|
||||
var costbearer = DAOFactory.GenericDAO.GetByID<Organisation>(cbvalues[0]);
|
||||
var costbearer_dc = MapperFactory.CompactOrganisationDC_Organisation.MapToNewDC(costbearer);
|
||||
selected.Add("CostBearerName", costbearer_dc.Name);
|
||||
}
|
||||
|
||||
if (tryGetSingleValue(sorted, TableID.SupportConcept, out long soid))
|
||||
if (bewoobjects.TryGetValue(TableID.SupportConcept, out long[] svalues) && (svalues?.Length ?? 0) > 0)
|
||||
{
|
||||
var supportconcept = DAOFactory.GenericDAO.GetByID<SupportConcept>(soid);
|
||||
var supportconcept = DAOFactory.GenericDAO.GetByID<SupportConcept>(svalues[0]);
|
||||
var supportconcept_dc = MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDC(supportconcept);
|
||||
selected.Add("SupportConceptDuration", $"{supportconcept_dc.StartDate?.Date} - {supportconcept_dc.EndDate?.Date}");
|
||||
}
|
||||
|
||||
var records = new List<Dictionary<string, object>>();
|
||||
if (tryGetMultipleValues(sorted, TableID.ServiceRecord, out List<long> oids))
|
||||
if (bewoobjects.TryGetValue(TableID.ServiceRecord, out long[] values) && (values?.Length ?? 0) > 0)
|
||||
{
|
||||
var service_records = DAOFactory.GenericDAO.GetByIDs<ServiceRecord>(oids);
|
||||
var service_records = DAOFactory.GenericDAO.GetByIDs<ServiceRecord>(values);
|
||||
var service_records_dc = MapperFactory.ServiceRecordDC_ServiceRecord.MapToNewDCs(service_records);
|
||||
|
||||
foreach (var service_record in service_records_dc)
|
||||
@@ -163,41 +161,41 @@ namespace BeWo.Service.ServiceUtils
|
||||
}
|
||||
}
|
||||
|
||||
private static Dictionary<long, List<long>> getDictionary(List<Tuple<long, long>> tuples)
|
||||
{
|
||||
var seperate = new Dictionary<long, List<long>>();
|
||||
foreach (var bewoobject in tuples)
|
||||
{
|
||||
var oid = bewoobject.Item1;
|
||||
var tid = bewoobject.Item2;
|
||||
//private static Dictionary<TableID, List<long>> getDictionary(List<Tuple<TableID, long>> tuples)
|
||||
//{
|
||||
// var seperate = new Dictionary<TableID, List<long>>();
|
||||
// foreach (var bewoobject in tuples)
|
||||
// {
|
||||
// var tid = bewoobject.Item1;
|
||||
// var oid = bewoobject.Item2;
|
||||
|
||||
if (seperate.TryGetValue(tid, out var list))
|
||||
{
|
||||
list.Add(oid);
|
||||
}
|
||||
else
|
||||
{
|
||||
seperate.Add(tid, new List<long>() { oid });
|
||||
}
|
||||
}
|
||||
return seperate;
|
||||
}
|
||||
// if (seperate.TryGetValue(tid, out var list))
|
||||
// {
|
||||
// list.Add(oid);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// seperate.Add(tid, new List<long>() { oid });
|
||||
// }
|
||||
// }
|
||||
// return seperate;
|
||||
//}
|
||||
|
||||
private static bool tryGetSingleValue(Dictionary<long, List<long>> sorted, TableID tid, out long oid)
|
||||
{
|
||||
oid = 0;
|
||||
//private static bool tryGetSingleValue(Dictionary<TableID, List<long>> sorted, TableID tid, out long oid)
|
||||
//{
|
||||
// oid = 0;
|
||||
|
||||
if (!tryGetMultipleValues(sorted, tid, out List<long> oids) || oids is null || oids.Count == 0)
|
||||
return false;
|
||||
// if (!tryGetMultipleValues(sorted, tid, out List<long> oids) || oids is null || oids.Count == 0)
|
||||
// return false;
|
||||
|
||||
oid = oids[0];
|
||||
// oid = oids[0];
|
||||
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
//}
|
||||
|
||||
private static bool tryGetMultipleValues(Dictionary<long, List<long>> sorted, TableID tid, out List<long> oids)
|
||||
{
|
||||
return sorted.TryGetValue((long)tid, out oids);
|
||||
}
|
||||
//private static bool tryGetMultipleValues(Dictionary<TableID, List<long>> sorted, TableID tid, out List<long> oids)
|
||||
//{
|
||||
// return sorted.TryGetValue(tid, out oids);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
{
|
||||
public static class SettingsKeys
|
||||
{
|
||||
public static string ShowExpiredSupportConcepts => "ShowExpiredSupportConcepts";
|
||||
// Modules
|
||||
public static string ModuleAiEnabled => "ModuleAiEnabled";
|
||||
|
||||
|
||||
public static string ShowExpiredSupportConcepts => "ShowExpiredSupportConcepts";
|
||||
public static string ShowOnlyMySupportConcepts => "ShowOnlyMySupportConcepts";
|
||||
public static string LastSelectedServiceRecordTimeInterval => "LastSelectedServiceRecordTimeInterval";
|
||||
public static string CustomerFilterInZeiterfassung => "CustomerFilterInZeiterfassung";
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace BS.Shared.DataContracts.Feature.AI
|
||||
[DataMember] public DateTime Updated { get; set; }
|
||||
[DataMember] public AiModelDC Modell { get; set; }
|
||||
[DataMember] public string Context { get; set; }
|
||||
[DataMember] public List<Tuple<long, long>> ContextBeWoObjects { get; set; }
|
||||
[DataMember] public Dictionary<TableID, long[]> ContextBeWoObjects { get; set; }
|
||||
[DataMember] public int UIContext { get; set; }
|
||||
[DataMember] public List<AiConversationMessageDC> Messages { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user