Personen + Mitarbeiter AI Chat

This commit is contained in:
2025-04-14 15:06:00 +02:00
parent b122048ea1
commit fe1590de42
23 changed files with 1583 additions and 1036 deletions

View File

@@ -1,18 +1,30 @@
<localView:BeWoView x:Class="BeWo.View.Detail.GroupOfPeopleView"
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:localSearchView="clr-namespace:BeWo.View.Search"
xmlns:val="clr-namespace:BeWo.Validation"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
Height="Auto"
Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True">
<localView:BeWoView
x:Class="BeWo.View.Detail.GroupOfPeopleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
xmlns:localView="clr-namespace:BeWo.View"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:val="clr-namespace:BeWo.Validation"
Width="Auto"
Height="Auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Focusable="True">
<Grid>
<GroupBox Style="{StaticResource PopUpWindowStyle}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0">
<Image Source="..\..\Ressources\Icons\UserGroupBusinessDisabled.png" RenderTransformOrigin="0.5,0.5" Width="Auto" Height="28" Margin="0,0,0,0">
<StackPanel
Margin="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Image
Width="Auto"
Height="28"
Margin="0,0,0,0"
RenderTransformOrigin="0.5,0.5"
Source="..\..\Ressources\Icons\UserGroupBusinessDisabled.png">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
@@ -22,7 +34,14 @@
</TransformGroup>
</Image.RenderTransform>
</Image>
<TextBlock Text="Gruppe bearbeiten" Margin="10,4,0,0" Background="{x:Null}" Foreground="#FFFFFFFF" FontSize="20" VerticalAlignment="Stretch" Padding="0,0,0,0" />
<TextBlock
Margin="10,4,0,0"
Padding="0,0,0,0"
VerticalAlignment="Stretch"
Background="{x:Null}"
FontSize="20"
Foreground="#FFFFFFFF"
Text="Gruppe bearbeiten" />
</StackPanel>
</GroupBox.Header>
<Grid Margin="0,0,0,0" Background="{DynamicResource ObjectEditBackgroundBrush}">
@@ -31,8 +50,11 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Fill="{DynamicResource TeamContentBrush}" Height="6" />
<Grid Grid.Row="1" Name="grid_root" Margin="10,10,10,0">
<Rectangle Height="6" Fill="{DynamicResource TeamContentBrush}" />
<Grid
Name="grid_root"
Grid.Row="1"
Margin="10,10,10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -41,8 +63,11 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<GroupBox Width="180" Header="Alle Gruppen" Style="{StaticResource ObjectEditGroupBox}">
<Grid >
<GroupBox
Width="180"
Header="Alle Gruppen"
Style="{StaticResource ObjectEditGroupBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
@@ -51,41 +76,106 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button x:Name="btnAddGroup" HorizontalAlignment="Right" Click="btnAddGroup_Click" Height="21" Margin="0,0,0,3" ToolTip="Neue Gruppe hinzufügen">
<Button
x:Name="btnAddGroup"
Height="21"
Margin="0,0,0,3"
HorizontalAlignment="Right"
Click="btnAddGroup_Click"
ToolTip="Neue Gruppe hinzufügen">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Width="18" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,-2,0,0">
<Line X1="4" X2="12" Y1="8" Y2="8" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Line X1="8" X2="8" Y1="4" Y2="12" Fill="{x:Null}" Stroke="#FFFFFFFF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" />
<Grid
Width="18"
Margin="0,-2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Line
Width="16"
Height="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{x:Null}"
Stroke="#FFFFFFFF"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="2"
X1="4"
X2="12"
Y1="8"
Y2="8" />
<Line
Width="16"
Height="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{x:Null}"
Stroke="#FFFFFFFF"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="2"
X1="8"
X2="8"
Y1="4"
Y2="12" />
</Grid>
<TextBlock Grid.Column="1" Text="Neue Gruppe"></TextBlock>
<TextBlock Grid.Column="1" Text="Neue Gruppe" />
</Grid>
</Button>
</StackPanel>
<ListBox Grid.Row="1" ItemsSource="{Binding VMList}" SelectedItem="{Binding EditVM}">
<ListBox
Grid.Row="1"
ItemsSource="{Binding VMList}"
SelectedItem="{Binding EditVM}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource {x:Type Button}}" HorizontalAlignment="Center" VerticalAlignment="Center" Height="18" Padding="0" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}" Margin="3 0 0 0" Click="button_removegroup_Click" Tag="{Binding}" ToolTip="Entfernen">
<Button
Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"
Height="18"
Margin="3,0,0,0"
Padding="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Click="button_removegroup_Click"
Style="{StaticResource {x:Type Button}}"
Tag="{Binding}"
ToolTip="Entfernen">
<Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path Stroke="White" StrokeThickness="1.5" Data="M -3,-3 L 3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Path Stroke="White" StrokeThickness="1.5" Data="M 3,-3 L -3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Path
Data="M -3,-3 L 3, 3"
Stroke="White"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="1.5" />
<Path
Data="M 3,-3 L -3, 3"
Stroke="White"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="1.5" />
</Canvas>
</Button>
<Label Margin="3 0 0 3" Padding="0" Content="{Binding Path=Name}" />
<Label
Margin="3,0,0,3"
Padding="0"
Content="{Binding Path=Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</GroupBox>
<Grid Margin="10,0,0,0" Grid.Column="1" DataContext="{Binding EditVM}" >
<Grid
Grid.Column="1"
Margin="10,0,0,0"
DataContext="{Binding EditVM}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="250" />
@@ -100,11 +190,22 @@
<RowDefinition Height="0" />
</Grid.RowDefinitions>
<Label IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" >Name der Gruppe</Label>
<Label IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}">Name der Gruppe</Label>
<TextBox Grid.Column="1" Height="23" Margin="3,0,3,0" Text="{val:ValidationBinding Path=Name, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" />
<TextBox
Grid.Column="1"
Height="23"
Margin="3,0,3,0"
IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}"
Text="{val:ValidationBinding Path=Name,
UpdateSourceTrigger=PropertyChanged}" />
<GroupBox Grid.Row="3" Grid.ColumnSpan="4" Header="Mitglieder hinzufügen" Margin="3,15,0,0" Style="{DynamicResource ObjectEditGroupBox}" >
<GroupBox
Grid.Row="3"
Grid.ColumnSpan="4"
Margin="3,15,0,0"
Header="Mitglieder hinzufügen"
Style="{DynamicResource ObjectEditGroupBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220" />
@@ -116,32 +217,97 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label VerticalAlignment="Bottom" IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" Content="{markup:Translate Zugeordnete Hilfepläne}" />
<Label
VerticalAlignment="Bottom"
Content="{markup:Translate Zugeordnete Hilfepläne}"
IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" />
<ListBox Name="listbox_teamMember" Grid.Row="1" ItemsSource="{Binding Path=SupportConceptList}" IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" >
<ListBox
Name="listbox_teamMember"
Grid.Row="1"
IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}"
ItemsSource="{Binding Path=SupportConceptList}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource {x:Type Button}}" HorizontalAlignment="Center" VerticalAlignment="Center" Height="18" Padding="0" Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}" Margin="3 0 0 0" Click="button_remove_Click" Tag="{Binding}" ToolTip="Entfernen">
<Button
Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"
Height="18"
Margin="3,0,0,0"
Padding="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Click="button_remove_Click"
Style="{StaticResource {x:Type Button}}"
Tag="{Binding}"
ToolTip="Entfernen">
<Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path Stroke="White" StrokeThickness="1.5" Data="M -3,-3 L 3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Path Stroke="White" StrokeThickness="1.5" Data="M 3,-3 L -3, 3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" />
<Path
Data="M -3,-3 L 3, 3"
Stroke="White"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="1.5" />
<Path
Data="M 3,-3 L -3, 3"
Stroke="White"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="1.5" />
</Canvas>
</Button>
<Label Margin="3 0 0 3" Padding="0" Content="{Binding Path=LastName}" />
<Label Margin="0" Padding="0" Content=", " />
<Label Margin="0" Padding="0" Content="{Binding Path=FirstName}" />
<Label Margin="0" Padding="0" Content=", " />
<Label Margin="0" Padding="0" Content="{Binding Path=FirstCostBearerDetailString}" />
<Label
Margin="3,0,0,3"
Padding="0"
Content="{Binding Path=LastName}" />
<Label
Margin="0"
Padding="0"
Content=", " />
<Label
Margin="0"
Padding="0"
Content="{Binding Path=FirstName}" />
<Label
Margin="0"
Padding="0"
Content=", " />
<Label
Margin="0"
Padding="0"
Content="{Binding Path=FirstCostBearerDetailString}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Name="button_add" Grid.Row="2" Content="&lt;" FontWeight="Bold" Width="25" Grid.Column="1" VerticalAlignment="Center" Height="25" MinWidth="30" Margin="3" ToolTip="Neues Gruppenmitglied hinzufügen" Click="button_add_Click" IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" />
<Button
Name="button_add"
Grid.Row="2"
Grid.Column="1"
Width="25"
Height="25"
MinWidth="30"
Margin="3"
VerticalAlignment="Center"
Click="button_add_Click"
Content="&lt;"
FontWeight="Bold"
IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}"
ToolTip="Neues Gruppenmitglied hinzufügen" />
<Label VerticalAlignment="Bottom" Grid.Column="2" IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" Content="{markup:Translate Verfügbare Hilfepläne}"/>
<localSearchView:SupportConceptSearchView x:Name="SupportConceptSearchView" IsMultiSelect="True" Grid.Column="2" Grid.Row="1" SearchMode="ActiveCostbearer2SupportConcepts" ShowFilterPanel="True"/>
<Label
Grid.Column="2"
VerticalAlignment="Bottom"
Content="{markup:Translate Verfügbare Hilfepläne}"
IsEnabled="{Binding Converter={StaticResource ObjectBoolConverter}}" />
<localSearchView:SupportConceptSearchView
x:Name="SupportConceptSearchView"
Grid.Row="1"
Grid.Column="2"
IsMultiSelect="True"
SearchMode="ActiveCostbearer2SupportConcepts"
ShowFilterPanel="True" />
</Grid>
</GroupBox>
@@ -149,18 +315,41 @@
</Grid>
</Grid>
<Border Grid.Row="2" Grid.ColumnSpan="3" Height="40" Margin="0,10,0,0" VerticalAlignment="Stretch" Background="#FF000000">
<Border
Grid.Row="2"
Grid.ColumnSpan="3"
Height="40"
Margin="0,10,0,0"
VerticalAlignment="Stretch"
Background="#FF000000">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#19000000" Offset="0" />
<GradientStop Color="#33FFFFFF" Offset="1" />
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="#19000000" />
<GradientStop Offset="1" Color="#33FFFFFF" />
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<StackPanel Grid.ColumnSpan="3" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Height="Auto" Margin="5,10,0,0" HorizontalAlignment="Right">
<Button x:Name="btnSave" Content="Speichern und schließen" Margin="0,0,2,0" Command="ApplicationCommands.Save" Height="25" />
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,3,0" Command="ApplicationCommands.Close" Height="25" />
<StackPanel
Grid.Row="2"
Grid.ColumnSpan="3"
Height="Auto"
Margin="5,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnSave"
Height="25"
Margin="0,0,2,0"
Command="ApplicationCommands.Save"
Content="Speichern und schließen" />
<Button
x:Name="btnClose"
Height="25"
Margin="0,0,3,0"
Command="ApplicationCommands.Close"
Content="Schließen" />
</StackPanel>
</Grid>
</GroupBox>

View File

@@ -1,250 +1,545 @@
<localView:BeWoView x:Class="BeWo.View.Detail.UserView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup" xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localView="clr-namespace:BeWo.View" xmlns:localSearchView="clr-namespace:BeWo.View.Search" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True">
<Grid>
<uc:ShadowChrome>
<GroupBox Style="{StaticResource MainContentGroupBoxStyle}">
<GroupBox.Header>
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<Image Source="..\..\Ressources\Icons\UserBusinessMaleDisabled.png" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" Width="32">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform X="0" Y="5" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<TextBox Text="{Binding Path=Employee, Mode=OneWay}" Margin="10,0,0,0" Background="{x:Null}" Foreground="#FFFFFFFF" FontSize="22" BorderBrush="{x:Null}" VerticalAlignment="Bottom" Padding="0,0,0,0" />
</StackPanel>
</GroupBox.Header>
<Grid Margin="0,3,0,0" Background="{DynamicResource ObjectEditBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Fill="{DynamicResource UserContentBrush}" Height="6" />
<TabControl x:Name="root" Grid.Row="1" Style="{StaticResource ObjectEditTabControl}" BorderThickness="0,0,0,0" Padding="4,4,4,4">
<TabItem Header="Details" IsSelected="True">
<localView:BeWoView
x:Class="BeWo.View.Detail.UserView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
xmlns:localView="clr-namespace:BeWo.View"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
Width="Auto"
Height="Auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Focusable="True">
<Grid>
<uc:ShadowChrome>
<GroupBox Style="{StaticResource MainContentGroupBoxStyle}">
<GroupBox.Header>
<StackPanel VerticalAlignment="Bottom" Orientation="Horizontal">
<Image
Width="32"
RenderTransformOrigin="0.5,0.5"
Source="..\..\Ressources\Icons\UserBusinessMaleDisabled.png"
Stretch="Uniform">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform AngleX="0" AngleY="0" />
<RotateTransform Angle="0" />
<TranslateTransform X="0" Y="5" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<TextBox
Margin="10,0,0,0"
Padding="0,0,0,0"
VerticalAlignment="Bottom"
Background="{x:Null}"
BorderBrush="{x:Null}"
FontSize="22"
Foreground="#FFFFFFFF"
Text="{Binding Path=Employee, Mode=OneWay}" />
</StackPanel>
</GroupBox.Header>
<Grid Margin="0,3,0,0" Background="{DynamicResource ObjectEditBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle Height="6" Fill="{DynamicResource UserContentBrush}" />
<TabControl
x:Name="root"
Grid.Row="1"
Padding="4,4,4,4"
BorderThickness="0,0,0,0"
Style="{StaticResource ObjectEditTabControl}">
<TabItem Header="Details" IsSelected="True">
<Grid Name="grid_root" Grid.IsSharedSizeScope="True" Width="Auto">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="450" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid
Name="grid_root"
Width="Auto"
Grid.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="450" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="{t:Translate MitarbeiterSingular}" Grid.Row="0" />
<uc:PopUpEdit IsReadOnly="True" Grid.Row="0" Grid.Column="1"
DeleteButtonVisibility="Visible" Name="popupedit_employee"
PopUpClick="popupedit_employee_PopUpClick" DeleteClick="popupedit_employee_DeleteClick"
Text="{Binding Path=EmployeeString, Mode=OneWay}" Height="23" Margin="3" Cursor="Arrow"
HorizontalAlignment="Stretch" Width="Auto"
PreviewMouseDoubleClick="Popupedit_employee_OnPreviewMouseDoubleClick"/>
<Label Grid.Row="0" Content="{t:Translate MitarbeiterSingular}" />
<uc:PopUpEdit
Name="popupedit_employee"
Grid.Row="0"
Grid.Column="1"
Width="Auto"
Height="23"
Margin="3"
HorizontalAlignment="Stretch"
Cursor="Arrow"
DeleteButtonVisibility="Visible"
DeleteClick="popupedit_employee_DeleteClick"
IsReadOnly="True"
PopUpClick="popupedit_employee_PopUpClick"
PreviewMouseDoubleClick="Popupedit_employee_OnPreviewMouseDoubleClick"
Text="{Binding Path=EmployeeString, Mode=OneWay}" />
<Label x:Name="label_LicenseTypes" Content="{t:Translate Lizenztyp}" Grid.Row="1" />
<ComboBox x:Name="comboBox_LicenseTypes" Grid.Row="1" Grid.Column="1" Margin="3" Width="200" Height="23" HorizontalAlignment="Left" ItemsSource="{Binding Path=AllLicenseTypes}" SelectedValue="{Binding Path=LicenseType, Mode=TwoWay}" />
<Label
x:Name="label_LicenseTypes"
Grid.Row="1"
Content="{t:Translate Lizenztyp}" />
<ComboBox
x:Name="comboBox_LicenseTypes"
Grid.Row="1"
Grid.Column="1"
Width="200"
Height="23"
Margin="3"
HorizontalAlignment="Left"
ItemsSource="{Binding Path=AllLicenseTypes}"
SelectedValue="{Binding Path=LicenseType, Mode=TwoWay}" />
</Grid>
<GroupBox Grid.Row="1" Header="Zugangsdaten" Padding="5" Width="Auto" Style="{DynamicResource ObjectEditGroupBox}" Margin="0,15,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox
Grid.Row="1"
Width="Auto"
Margin="0,15,0,0"
Padding="5"
Header="Zugangsdaten"
Style="{DynamicResource ObjectEditGroupBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Content="Login Name" />
<TextBox VerticalAlignment="Top" Grid.Column="1" Height="23" Margin="3" Text="{Binding Path=LoginName, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Content="Login Name" />
<TextBox
Grid.Column="1"
Height="23"
Margin="3"
VerticalAlignment="Top"
Text="{Binding Path=LoginName, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<Grid Name="grid_passworNewUser" Grid.Column="1" Visibility="{Binding Path=IsNew, Converter={StaticResource BoolVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Passwort" />
<PasswordBox Name="passwordbox_password" Grid.Column="1" Height="23" Margin="3" />
<Label Grid.Row="1" Content="Passwort wiederholen" />
<PasswordBox Name="passwordbox_passwordRepeat" Grid.Column="1" Grid.Row="1" Height="23" Margin="3" />
</Grid>
<Grid
Name="grid_passworNewUser"
Grid.Column="1"
Visibility="{Binding Path=IsNew, Converter={StaticResource BoolVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Passwort" />
<PasswordBox
Name="passwordbox_password"
Grid.Column="1"
Height="23"
Margin="3" />
<Label Grid.Row="1" Content="Passwort wiederholen" />
<PasswordBox
Name="passwordbox_passwordRepeat"
Grid.Row="1"
Grid.Column="1"
Height="23"
Margin="3" />
</Grid>
<Grid Grid.Column="1" Name="grid_passwordExistingUser" Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="Passwort" IsEnabled="False" />
<PasswordBox Grid.Column="1" Height="23" Margin="3" IsEnabled="False" Password="xxxxxxxxxx" />
<Button Name="button_changePassword" Grid.Column="2" Height="23" HorizontalAlignment="Right" Margin="3" Content="Passwort ändern" Click="button_changePassword_Click" />
</Grid>
<Grid
Name="grid_passwordExistingUser"
Grid.Column="1"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Label Content="Passwort" IsEnabled="False" />
<PasswordBox
Grid.Column="1"
Height="23"
Margin="3"
IsEnabled="False"
Password="xxxxxxxxxx" />
<Button
Name="button_changePassword"
Grid.Column="2"
Height="23"
Margin="3"
HorizontalAlignment="Right"
Click="button_changePassword_Click"
Content="Passwort ändern" />
</Grid>
</Grid>
</GroupBox>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Grid.ColumnSpan="2" Header="{markup:Translate Benutzergruppen}" Padding="5" Style="{DynamicResource ObjectEditGroupBox}" Margin="0,15,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label HorizontalAlignment="Center" Content="gewählte Gruppen" />
<Label HorizontalAlignment="Center" Grid.Column="3" Content="mögliche Gruppen" />
<ListBox Name="listbox_groups" Grid.RowSpan="2" Grid.Row="1" ItemsSource="{Binding Path=UserGroups}" IsSynchronizedWithCurrentItem="True" MinHeight="100">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label VerticalAlignment="Center" Margin="3 0" Padding="0" IsHitTestVisible="False" Content="{Binding Path=Name}" />
<ToggleButton Grid.Column="1" HorizontalAlignment="Right" Width="14" Height="14" Background="White" Template="{StaticResource ExpanderToggleButton}" IsChecked="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Mode=OneWayToSource}" VerticalAlignment="Center" Visibility="{Binding Path=Description, Converter={StaticResource ObjectVisibilityConverter} }" />
<TextBox HorizontalAlignment="Left" Visibility="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BoolVisibilityConverter}}" Grid.Row="1" Grid.ColumnSpan="2" IsHitTestVisible="False" IsReadOnly="True" Cursor="Arrow" TextWrapping="WrapWithOverflow" Margin="10 3" Text="{Binding Path=Description}" BorderThickness="0" Background="Transparent" FontSize="10" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemContainerStyle>
<Style>
<Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<Button Name="button_addGroup" Grid.Column="1" VerticalAlignment="Bottom" Content="&lt;" FontWeight="Bold" Width="25" Grid.Row="1" Margin="3" Click="button_addGroup_Click" IsEnabled="{Binding Path=SelectedIndex, ElementName=listbox_possibleGroups, Converter={StaticResource IndexBoolConverter}}" Height="25" />
<Button Name="button_removeGroup" Grid.Column="1" Grid.Row="2" VerticalAlignment="Top" Content="&gt;" FontWeight="Bold" Width="25" Margin="3" Click="button_removeGroup_Click" IsEnabled="{Binding Path=SelectedIndex, ElementName=listbox_groups, Converter={StaticResource IndexBoolConverter}}" Height="25" />
<ListBox Name="listbox_possibleGroups" Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" ItemsSource="{Binding Path=PossibleGroups}" IsSynchronizedWithCurrentItem="True" MinHeight="100">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Stretch" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label VerticalAlignment="Center" Margin="3 0" Padding="0" IsHitTestVisible="False" Content="{Binding Path=Name}" />
<ToggleButton Grid.Column="1" HorizontalAlignment="Right" Width="14" Height="14" Background="White" Template="{StaticResource ExpanderToggleButton}" IsChecked="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Mode=OneWayToSource}" VerticalAlignment="Center" Visibility="{Binding Path=Description, Converter={StaticResource ObjectVisibilityConverter} }" />
<TextBox HorizontalAlignment="Left" Visibility="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BoolVisibilityConverter}}" Grid.Row="1" Grid.ColumnSpan="2" IsHitTestVisible="False" IsReadOnly="True" Cursor="Arrow" TextWrapping="WrapWithOverflow" Margin="10 3" Text="{Binding Path=Description}" BorderThickness="0" Background="Transparent" FontSize="10" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemContainerStyle>
<Style>
<Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Grid>
</GroupBox>
<GroupBox
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="0,15,0,0"
Padding="5"
Header="{markup:Translate Benutzergruppen}"
Style="{DynamicResource ObjectEditGroupBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label HorizontalAlignment="Center" Content="gewählte Gruppen" />
<Label
Grid.Column="3"
HorizontalAlignment="Center"
Content="mögliche Gruppen" />
<ListBox
Name="listbox_groups"
Grid.Row="1"
Grid.RowSpan="2"
MinHeight="100"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding Path=UserGroups}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="3" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label
Margin="3,0"
Padding="0"
VerticalAlignment="Center"
Content="{Binding Path=Name}"
IsHitTestVisible="False" />
<ToggleButton
Grid.Column="1"
Width="14"
Height="14"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="White"
IsChecked="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Mode=OneWayToSource}"
Template="{StaticResource ExpanderToggleButton}"
Visibility="{Binding Path=Description, Converter={StaticResource ObjectVisibilityConverter}}" />
<TextBox
Grid.Row="1"
Grid.ColumnSpan="2"
Margin="10,3"
HorizontalAlignment="Left"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
FontSize="10"
IsHitTestVisible="False"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="WrapWithOverflow"
Visibility="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BoolVisibilityConverter}}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemContainerStyle>
<Style>
<Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<Button
Name="button_addGroup"
Grid.Row="1"
Grid.Column="1"
Width="25"
Height="25"
Margin="3"
VerticalAlignment="Bottom"
Click="button_addGroup_Click"
Content="&lt;"
FontWeight="Bold"
IsEnabled="{Binding Path=SelectedIndex, ElementName=listbox_possibleGroups, Converter={StaticResource IndexBoolConverter}}" />
<Button
Name="button_removeGroup"
Grid.Row="2"
Grid.Column="1"
Width="25"
Height="25"
Margin="3"
VerticalAlignment="Top"
Click="button_removeGroup_Click"
Content="&gt;"
FontWeight="Bold"
IsEnabled="{Binding Path=SelectedIndex, ElementName=listbox_groups, Converter={StaticResource IndexBoolConverter}}" />
<ListBox
Name="listbox_possibleGroups"
Grid.Row="1"
Grid.RowSpan="2"
Grid.Column="2"
MinHeight="100"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding Path=PossibleGroups}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="3" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label
Margin="3,0"
Padding="0"
VerticalAlignment="Center"
Content="{Binding Path=Name}"
IsHitTestVisible="False" />
<ToggleButton
Grid.Column="1"
Width="14"
Height="14"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="White"
IsChecked="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Mode=OneWayToSource}"
Template="{StaticResource ExpanderToggleButton}"
Visibility="{Binding Path=Description, Converter={StaticResource ObjectVisibilityConverter}}" />
<TextBox
Grid.Row="1"
Grid.ColumnSpan="2"
Margin="10,3"
HorizontalAlignment="Left"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
FontSize="10"
IsHitTestVisible="False"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="WrapWithOverflow"
Visibility="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}, Converter={StaticResource BoolVisibilityConverter}}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemContainerStyle>
<Style>
<Setter Property="Control.HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Grid>
</GroupBox>
<Popup FocusManager.IsFocusScope="True" Grid.Row="3" Margin="10" Grid.ColumnSpan="2" Name="popup_employee" StaysOpen="False" Placement="MousePoint" Width="370" Height="250" Closed="popup_Closed" Opened="popup_Opened">
<localSearchView:EmployeeSearchView ItemSelected="EmployeeSearchView_EmployeeSelected" x:Name="employeeSearchView" />
</Popup>
<Popup
Name="popup_employee"
Grid.Row="3"
Grid.ColumnSpan="2"
Width="370"
Height="250"
Margin="10"
Closed="popup_Closed"
FocusManager.IsFocusScope="True"
Opened="popup_Opened"
Placement="MousePoint"
StaysOpen="False">
<localSearchView:EmployeeSearchView x:Name="employeeSearchView" ItemSelected="EmployeeSearchView_EmployeeSelected" />
</Popup>
<Popup FocusManager.IsFocusScope="True" Grid.Row="3" Margin="10" Grid.ColumnSpan="2" Name="popup_changePassword" StaysOpen="False" Placement="MousePoint" Closed="popup_Closed" Opened="popup_Opened">
<Border Background="{StaticResource ObjectEditBackgroundBrush}" BorderBrush="Black" BorderThickness="1">
<Grid Name="grid_passworEditExistingUser" Grid.Column="1" Margin="20 3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Popup
Name="popup_changePassword"
Grid.Row="3"
Grid.ColumnSpan="2"
Margin="10"
Closed="popup_Closed"
FocusManager.IsFocusScope="True"
Opened="popup_Opened"
Placement="MousePoint"
StaysOpen="False">
<Border
Background="{StaticResource ObjectEditBackgroundBrush}"
BorderBrush="Black"
BorderThickness="1">
<Grid
Name="grid_passworEditExistingUser"
Grid.Column="1"
Margin="20,3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Name="textblock_editFailures" Grid.ColumnSpan="2" Foreground="Red" FontSize="12" TextWrapping="Wrap" Margin="3 3 3 10" />
<TextBlock
Name="textblock_editFailures"
Grid.ColumnSpan="2"
Margin="3,3,3,10"
FontSize="12"
Foreground="Red"
TextWrapping="Wrap" />
<Label Name="lblOldPassword" Content="Altes Passwort" Grid.Row="1" />
<PasswordBox Name="passwordbox_editOldPassword" Grid.Column="1" Grid.Row="1" Height="23" Margin="3" MinWidth="180" />
<Label
Name="lblOldPassword"
Grid.Row="1"
Content="Altes Passwort" />
<PasswordBox
Name="passwordbox_editOldPassword"
Grid.Row="1"
Grid.Column="1"
Height="23"
MinWidth="180"
Margin="3" />
<Label Content="Neues Passwort" Grid.Row="2" Margin="0 10 0 0" />
<PasswordBox Name="passwordbox_editPassword" Grid.Column="1" Grid.Row="2" Height="23" Margin="3 10 3 3" PasswordChanged="Passwordbox_editPassword_OnPasswordChanged"/>
<Label Grid.Row="3" Content="Passwort wiederholen" />
<PasswordBox Name="passwordbox_editPasswordRepeat" Grid.Column="1" Grid.Row="3" Height="23" Margin="3" />
<!-- Hier Anzeige Für passwortStärke -->
<Label Name="passwordbox_StaerkeAnzeige" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Left" Visibility="Hidden"/>
<Grid Grid.IsSharedSizeScope="True" Grid.ColumnSpan="2" Grid.Row="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="but" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" SharedSizeGroup="but" />
</Grid.ColumnDefinitions>
<Button Name="button_saveEditPassword" Margin="3 20 3 10" Height="23" HorizontalAlignment="Stretch" Click="button_saveEditPassword_Click" Content="Änderung speichern" Padding="3 0" />
<Button Name="button_cancelEditPassword" Margin="3 20 3 10" Height="23" Grid.Column="2" HorizontalAlignment="Stretch" Click="button_cancelEditPassword_Click" Content="Abbrechen" Padding="3 0" />
</Grid>
</Grid>
</Border>
</Popup>
<Label
Grid.Row="2"
Margin="0,10,0,0"
Content="Neues Passwort" />
<PasswordBox
Name="passwordbox_editPassword"
Grid.Row="2"
Grid.Column="1"
Height="23"
Margin="3,10,3,3"
PasswordChanged="Passwordbox_editPassword_OnPasswordChanged" />
<Label Grid.Row="3" Content="Passwort wiederholen" />
<PasswordBox
Name="passwordbox_editPasswordRepeat"
Grid.Row="3"
Grid.Column="1"
Height="23"
Margin="3" />
</Grid>
</TabItem>
<TabItem Header="Dokumente" Name="tabitem_documents" Selector.Selected="tabitem_documents_Selected" />
<!-- Hier Anzeige Für passwortStärke -->
<Label
Name="passwordbox_StaerkeAnzeige"
Grid.Row="4"
Grid.Column="0"
Grid.ColumnSpan="2"
HorizontalAlignment="Left"
Visibility="Hidden" />
</TabControl>
<Border Grid.Row="2" Grid.ColumnSpan="3" Height="40" Margin="0,10,0,0" VerticalAlignment="Stretch" Background="#FF000000">
<Border.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#19000000" Offset="0" />
<GradientStop Color="#33FFFFFF" Offset="1" />
</LinearGradientBrush>
</Border.OpacityMask>
<Grid
Grid.Row="5"
Grid.ColumnSpan="2"
Grid.IsSharedSizeScope="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="but" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" SharedSizeGroup="but" />
</Grid.ColumnDefinitions>
<Button
Name="button_saveEditPassword"
Height="23"
Margin="3,20,3,10"
Padding="3,0"
HorizontalAlignment="Stretch"
Click="button_saveEditPassword_Click"
Content="Änderung speichern" />
<Button
Name="button_cancelEditPassword"
Grid.Column="2"
Height="23"
Margin="3,20,3,10"
Padding="3,0"
HorizontalAlignment="Stretch"
Click="button_cancelEditPassword_Click"
Content="Abbrechen" />
</Grid>
</Grid>
</Border>
</Popup>
</Border>
<StackPanel Grid.ColumnSpan="3" Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Height="Auto" Margin="5,10,0,0" HorizontalAlignment="Right">
<Button x:Name="btnSave" Content="Speichern" Margin="0,0,2,0" Command="ApplicationCommands.Save" Height="25" />
<Button x:Name="btnClose" Content="Schließen" Margin="0,0,3,0" Command="ApplicationCommands.Close" Height="25" />
</StackPanel>
</Grid>
</GroupBox>
</uc:ShadowChrome>
</Grid>
</Grid>
</TabItem>
<TabItem
Name="tabitem_documents"
Header="Dokumente"
Selector.Selected="tabitem_documents_Selected" />
</TabControl>
<Border
Grid.Row="2"
Grid.ColumnSpan="3"
Height="40"
Margin="0,10,0,0"
VerticalAlignment="Stretch"
Background="#FF000000">
<Border.OpacityMask>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0" Color="#19000000" />
<GradientStop Offset="1" Color="#33FFFFFF" />
</LinearGradientBrush>
</Border.OpacityMask>
</Border>
<StackPanel
Grid.Row="2"
Grid.ColumnSpan="3"
Height="Auto"
Margin="5,10,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnSave"
Height="25"
Margin="0,0,2,0"
Command="ApplicationCommands.Save"
Content="Speichern" />
<Button
x:Name="btnClose"
Height="25"
Margin="0,0,3,0"
Command="ApplicationCommands.Close"
Content="Schließen" />
</StackPanel>
</Grid>
</GroupBox>
</uc:ShadowChrome>
</Grid>
</localView:BeWoView>

View File

@@ -30,6 +30,7 @@ using BeWo.View.Detail.AI;
using System;
using BeWo.View.Windows;
using System.Collections;
using System.Windows.Input;
namespace BeWo.View.Navigation
{
@@ -49,8 +50,8 @@ namespace BeWo.View.Navigation
{
InitializeComponent();
mainNavigationView.OpenAiWindowCommand = new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView), false);
mainNavigationView.OpenAiPopupCommand = new DelegateCommand(OpenAiPopup, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2), false);
mainNavigationView.OpenAiWindowCommand = new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView));
mainNavigationView.OpenAiPopupCommand = new DelegateCommand(OpenAiPopup, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2));
mainNavigationView.Sorter = new CustomerSorter();
mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.Customer_AllowArchiving);
@@ -239,7 +240,9 @@ namespace BeWo.View.Navigation
ServiceFacade.DoCustomerServiceAsync(s => s.ConvertToNewSubstitutionType(), n => this.Dispatch(delegate
{
ReloadData(false);
}));
}));
CommandManager.InvalidateRequerySuggested();
}
private void UpdateCustomFilter()

View File

@@ -1,15 +1,18 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Navigation;
using BeWo.Core;
using BeWo.ServiceProxy;
using BeWo.View.Detail;
using BeWo.View.Navigation.Sorter;
using BeWo.View.Windows;
using BeWo.ViewModel;
using BS.Shared;
@@ -18,7 +21,7 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.Shared.Translation;
using DevExpress.Mvvm;
using Microsoft.Win32;
namespace BeWo.View.Navigation
@@ -33,16 +36,19 @@ namespace BeWo.View.Navigation
{
InitializeComponent();
//if (BeWoApp.UserName == "BSAdmin" && BeWoApp.UserPassword.IndexOf("P!d") > 0)
//{
// this.mainNavigationView.EditButtonsVisible = true;
//}
//else
//{
// this.mainNavigationView.EditButtonsVisible = false;
//}
mainNavigationView.OpenAiWindowCommand = new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView));
mainNavigationView.OpenAiPopupCommand = new DelegateCommand(OpenAiPopup, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2));
mainNavigationView.Sorter = new EmployeeSorter();
//if (BeWoApp.UserName == "BSAdmin" && BeWoApp.UserPassword.IndexOf("P!d") > 0)
//{
// this.mainNavigationView.EditButtonsVisible = true;
//}
//else
//{
// this.mainNavigationView.EditButtonsVisible = false;
//}
mainNavigationView.Sorter = new EmployeeSorter();
//this.linkNewLicense.NavigateUri = new Uri("http://www.bewoplaner.de/bewoplaner_mitarbeiter.html?ClientOID=" + BeWoApp.Tenant);
//if (BeWoApp.LoggedOnUser.HasRight(UserRightType.EmployeeView_Edit))
// textblock_link.Visibility = Visibility.Visible;
@@ -74,10 +80,53 @@ namespace BeWo.View.Navigation
private void OnLoaded(object sender, RoutedEventArgs e)
{
ReloadData(false);
}
ReloadData(false);
CommandManager.InvalidateRequerySuggested();
}
private bool MainNavigationView_ArchiveObject(IFilterableDC obj)
public Dictionary<TableID, long[]> GetVisibleInformationReferences()
{
var visible = mainNavigationView.objectListBox.ItemsSource;
return GetVisibleInformationReferences(visible);
}
private Dictionary<TableID, long[]> GetVisibleInformationReferences(IEnumerable visible_employees)
{
var oids = new List<long>();
foreach (var c in visible_employees)
{
var employee = c as CompactEmployeeDC;
oids.Add(employee.EmployeeOid);
}
var dict = new Dictionary<TableID, long[]>() {
{ TableID.Employee, oids.ToArray()}
};
return dict;
}
private void OpenAiWindow()
{
var context = GetVisibleInformationReferences();
var window = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationWindow(UIContext.Employee, context);
window.Show();
}
private void OpenAiPopup()
{
var context = GetVisibleInformationReferences();
var control = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationControl(UIContext.Employee, context);
MainControl.ShowControlAsModalPopup(control);
}
private bool MainNavigationView_ArchiveObject(IFilterableDC obj)
{
if (obj is CompactEmployeeDC dc)
{

View File

@@ -283,17 +283,17 @@
</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}" />
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}" />
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"

View File

@@ -85,6 +85,9 @@ namespace BeWo.View.Navigation
OpenSelectedObject();
}
};
OpenAiPopupCommand = new DelegateCommand(null, () => false);
OpenAiWindowCommand = new DelegateCommand(null, () => false);
}
public delegate bool ArchiveObjectDelegate(IFilterableDC obj);

View File

@@ -1,22 +1,28 @@
<localView:BeWoView x:Class="BeWo.View.Navigation.PersonNavigationView" 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">
<Grid Grid.IsSharedSizeScope="True" >
<localNavView:MainNavigationView
x:Name="mainNavigationView"
OpenMailMergeWindow="MainNavigationView_OnOpenMailMergeWindow"
MainGroupHeader="Personen"
CreateNewObject="mainNavigationView_CreateNewObject"
OpenObject="mainNavigationView_OpenObject"
DeleteObject="mainNavigationView_DeleteObject"
ArchiveObject="mainNavigationView_ArchiveObject"
DeleteDemands="DeleteAll, PersonView_Delete"
CreateDemands="CreateAll, PersonView_Create"
ExcelExport="mainNavigationView_ExcelExport"
Print="mainNavigationView_Print"
ContentGroupStyle="{StaticResource PersonNavigationStyle}"
MainListItemStyle="{StaticResource PersonDetailStyle}"
HistoryListItemStyle="{StaticResource SearchSimpleStyle}"
OnReloadData="MainNavigationView_OnReloadData"/>
<localView:BeWoView
x:Class="BeWo.View.Navigation.PersonNavigationView"
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 Grid.IsSharedSizeScope="True">
<localNavView:MainNavigationView
x:Name="mainNavigationView"
ArchiveObject="mainNavigationView_ArchiveObject"
ContentGroupStyle="{StaticResource PersonNavigationStyle}"
CreateDemands="CreateAll, PersonView_Create"
CreateNewObject="mainNavigationView_CreateNewObject"
DeleteDemands="DeleteAll, PersonView_Delete"
DeleteObject="mainNavigationView_DeleteObject"
ExcelExport="mainNavigationView_ExcelExport"
HistoryListItemStyle="{StaticResource SearchSimpleStyle}"
MainGroupHeader="Personen"
MainListItemStyle="{StaticResource PersonDetailStyle}"
OnReloadData="MainNavigationView_OnReloadData"
OpenMailMergeWindow="MainNavigationView_OnOpenMailMergeWindow"
OpenObject="mainNavigationView_OpenObject"
Print="mainNavigationView_Print" />
</Grid>
</Grid>
</localView:BeWoView>

View File

@@ -15,232 +15,283 @@ using BeWo.View.Navigation.Filter;
using BeWo.View.Navigation.Sorter;
using BeWo.ViewModel;
using Microsoft.Win32;
using DevExpress.Mvvm;
using BeWo.View.Windows;
using System.Collections;
using System.Windows.Input;
namespace BeWo.View.Navigation
{
/// <summary>
/// Interaktionslogik für PersonNavigationView.xaml
/// </summary>
public partial class PersonNavigationView
{
private readonly ComboBox filterComboBox;
/// <summary>
/// Interaktionslogik für PersonNavigationView.xaml
/// </summary>
public partial class PersonNavigationView
{
private readonly ComboBox filterComboBox;
private IEnumerable<IFilterableDC> objectList;
private IEnumerable<IFilterableDC> recentList;
private IEnumerable<IFilterableDC> objectList;
private IEnumerable<IFilterableDC> recentList;
public PersonNavigationView()
{
InitializeComponent();
public PersonNavigationView()
{
InitializeComponent();
mainNavigationView.Sorter = new PersonSorter();
mainNavigationView.OpenAiWindowCommand = new DelegateCommand(OpenAiWindow, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView));
mainNavigationView.OpenAiPopupCommand = new DelegateCommand(OpenAiPopup, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleView2));
mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.Person_AllowArchiving);
mainNavigationView.ShowArchivedObjectsVisible = true;
mainNavigationView.Sorter = new PersonSorter();
filterComboBox = new ComboBox();
mainNavigationView.ArchiveButtonVisible = BeWoApp.LoggedOnUser.HasRight(UserRightType.Person_AllowArchiving);
mainNavigationView.ShowArchivedObjectsVisible = true;
filterComboBox.FontSize = 12;
filterComboBox.Margin = new Thickness(10, 0, 0, 0);
filterComboBox.MinWidth = 100;
filterComboBox.Style = FindResource("SortComboBox") as Style;
filterComboBox = new ComboBox();
var lbl = new TextBlock
{
Text = "Filter:",
FontSize = 12,
Margin = new Thickness(8, 2, -3, 0)
};
filterComboBox.FontSize = 12;
filterComboBox.Margin = new Thickness(10, 0, 0, 0);
filterComboBox.MinWidth = 100;
filterComboBox.Style = FindResource("SortComboBox") as Style;
PersonFilterItem selectedItem = null;
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.Person_FamilyView))
{
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.All));
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.ContactPersons));
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.Family));
selectedItem = new PersonFilterItem(PersonFilterEnum.All); ;
}
else
{
filterComboBox.Visibility = Visibility.Collapsed;
lbl.Visibility = Visibility.Collapsed;
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.ContactPersons));
selectedItem = new PersonFilterItem(PersonFilterEnum.ContactPersons); ;
}
filterComboBox.SelectedItem = selectedItem;
filterComboBox.SelectionChanged += SupportConceptFilterComboBoxOnSelectionChanged;
var lbl = new TextBlock
{
Text = "Filter:",
FontSize = 12,
Margin = new Thickness(8, 2, -3, 0)
};
PersonFilterItem selectedItem = null;
if (BeWoApp.LoggedOnUser.HasRight(UserRightType.Person_FamilyView))
{
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.All));
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.ContactPersons));
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.Family));
selectedItem = new PersonFilterItem(PersonFilterEnum.All); ;
}
else
{
filterComboBox.Visibility = Visibility.Collapsed;
lbl.Visibility = Visibility.Collapsed;
filterComboBox.Items.Add(new PersonFilterItem(PersonFilterEnum.ContactPersons));
selectedItem = new PersonFilterItem(PersonFilterEnum.ContactPersons); ;
}
mainNavigationView.sortPanel.Children.Insert(3, lbl);
mainNavigationView.sortPanel.Children.Insert(4, filterComboBox);
UpdateCustomFilter();
}
filterComboBox.SelectedItem = selectedItem;
filterComboBox.SelectionChanged += SupportConceptFilterComboBoxOnSelectionChanged;
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{
//BeWoApp.AppSettings.CustomerFilterSupportConcepts = ((PersonFilterItem)filterComboBox.SelectedItem)?.CustomerFilter ?? CustomerFilterEnum.MyCustomer;
//BeWoApp.SaveAppSettings();
UpdateCustomFilter();
}
mainNavigationView.sortPanel.Children.Insert(3, lbl);
mainNavigationView.sortPanel.Children.Insert(4, filterComboBox);
private void UpdateCustomFilter()
{
mainNavigationView.CustomFilter = CreateNewPersonFilter();
}
UpdateCustomFilter();
}
private PersonNavigationFilter CreateNewPersonFilter()
{
var filter = new PersonNavigationFilter { PersonFilter = ((PersonFilterItem)filterComboBox.SelectedItem)?.Filter ?? PersonFilterEnum.ContactPersons };
public Dictionary<TableID, long[]> GetVisibleInformationReferences()
{
var visible = mainNavigationView.objectListBox.ItemsSource;
return filter;
}
return GetVisibleInformationReferences(visible);
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
ReloadData(false);
}
private Dictionary<TableID, long[]> GetVisibleInformationReferences(IEnumerable visible_persons)
{
var oids = new List<long>();
foreach (var p in visible_persons)
{
var person = p as CompactPersonDC;
oids.Add(person.PersonOid);
}
private bool mainNavigationView_ArchiveObject(IFilterableDC obj)
{
var dc = obj as CompactPersonDC;
if (dc != null)
{
if (
MessageBox.Show(
"Wollen Sie die Person '" + dc.FirstName + " " + dc.LastName + "' wirklich archivieren?",
"Archivieren", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
{
ServiceFacade.DoCustomerServiceAsync(
s =>
{
s.ArchivePerson(dc.PersonOid, dc.PersonVersion);
return dc;
},
cb => cb.PersonVersion++);
var dict = new Dictionary<TableID, long[]>() {
{
TableID.Person, oids.ToArray()}
};
return true;
}
}
return dict;
}
return false;
}
private void OpenAiWindow()
{
var context = GetVisibleInformationReferences();
private void mainNavigationView_CreateNewObject()
{
VMFactory.CreatePersonVMAsync(cb => this.Dispatch(() => MainControl.NavigateTo(new PersonView(cb) {ParentView = this})));
}
var window = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationWindow(UIContext.Person, context);
private bool mainNavigationView_DeleteObject(IFilterableDC obj)
{
var dc = obj as CompactPersonDC;
if (dc != null)
{
if (
MessageBox.Show(
"Wollen Sie die Person '" + dc.FirstName + " " + dc.LastName + "' wirklich löschen?", "Löschen",
MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
{
ServiceFacade.DoCustomerServiceAsync(s => s.DeactivatePerson(dc.PersonOid, dc.PersonVersion));
return true;
}
}
window.Show();
}
return false;
}
private void OpenAiPopup()
{
var context = GetVisibleInformationReferences();
private void mainNavigationView_ExcelExport(object sender, EventArgs<IEnumerable<IFilterableDC>> e)
{
var control = BeWoWindowBuilder.AiWindowBuilder.GetAiConversationControl(UIContext.Person, context);
MainControl.ShowControlAsModalPopup(control);
}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{
//BeWoApp.AppSettings.CustomerFilterSupportConcepts = ((PersonFilterItem)filterComboBox.SelectedItem)?.CustomerFilter ?? CustomerFilterEnum.MyCustomer;
//BeWoApp.SaveAppSettings();
UpdateCustomFilter();
}
private void UpdateCustomFilter()
{
mainNavigationView.CustomFilter = CreateNewPersonFilter();
}
private PersonNavigationFilter CreateNewPersonFilter()
{
var filter = new PersonNavigationFilter { PersonFilter = ((PersonFilterItem)filterComboBox.SelectedItem)?.Filter ?? PersonFilterEnum.ContactPersons };
return filter;
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
ReloadData(false);
CommandManager.InvalidateRequerySuggested();
}
private bool mainNavigationView_ArchiveObject(IFilterableDC obj)
{
var dc = obj as CompactPersonDC;
if (dc != null)
{
if (
MessageBox.Show(
"Wollen Sie die Person '" + dc.FirstName + " " + dc.LastName + "' wirklich archivieren?",
"Archivieren", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
{
ServiceFacade.DoCustomerServiceAsync(
s =>
{
s.ArchivePerson(dc.PersonOid, dc.PersonVersion);
return dc;
},
cb => cb.PersonVersion++);
return true;
}
}
return false;
}
private void mainNavigationView_CreateNewObject()
{
VMFactory.CreatePersonVMAsync(cb => this.Dispatch(() => MainControl.NavigateTo(new PersonView(cb) { ParentView = this })));
}
private bool mainNavigationView_DeleteObject(IFilterableDC obj)
{
var dc = obj as CompactPersonDC;
if (dc != null)
{
if (
MessageBox.Show(
"Wollen Sie die Person '" + dc.FirstName + " " + dc.LastName + "' wirklich löschen?", "Löschen",
MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
{
ServiceFacade.DoCustomerServiceAsync(s => s.DeactivatePerson(dc.PersonOid, dc.PersonVersion));
return true;
}
}
return false;
}
private void mainNavigationView_ExcelExport(object sender, EventArgs<IEnumerable<IFilterableDC>> e)
{
// string path = BeWoApp.LoginControl.GetAndCreateTempDataPath() + "\\Personen.xls";
var path = BeWoApp.GetAndCreateUserAppDataPath() + "\\Personen.xls";
var sf = new SaveFileDialog
{
FileName = Path.GetFileName(path),
Filter = "Microsoft Excel 97-2003-Arbeitsblatt|*.xls|Alle Dateien|*.*"
};
if (sf.ShowDialog() != true)
return;
var sf = new SaveFileDialog
{
FileName = Path.GetFileName(path),
Filter = "Microsoft Excel 97-2003-Arbeitsblatt|*.xls|Alle Dateien|*.*"
};
if (sf.ShowDialog() != true)
return;
ServiceFacade.DoDownloadServiceSync(
s =>
BeWoUtils.WriteExcelFile(
s.PrepareExcelFilePersonExport(mainNavigationView.DownloadLinkEngine.ExcelFileId,
e.Data.Cast<CompactPersonDC>().Select(c => c.PersonOid).ToList()),
sf.FileName));
}
private void mainNavigationView_Print(object sender, EventArgs<IEnumerable<IFilterableDC>> e)
{
var oids = e.Data.Cast<CompactPersonDC>().Select(c => c.PersonOid).ToList();
ServiceFacade.DoDownloadServiceSync(
s =>
BeWoUtils.WriteExcelFile(
s.PrepareExcelFilePersonExport(mainNavigationView.DownloadLinkEngine.ExcelFileId,
e.Data.Cast<CompactPersonDC>().Select(c => c.PersonOid).ToList()),
sf.FileName));
}
private void mainNavigationView_Print(object sender, EventArgs<IEnumerable<IFilterableDC>> e)
{
var oids = e.Data.Cast<CompactPersonDC>().Select(c => c.PersonOid).ToList();
ServiceFacade.DoReportServiceAsync(s => s.CreatePersonListReport(oids), r =>
{
this.Dispatch(() =>
{
BeWoUtils.ShowReportWindow(r, "Personen");
});
});
}
private void mainNavigationView_OpenObject(IFilterableDC obj)
{
var dc = obj as CompactPersonDC;
if (dc != null)
{
VMFactory.CreatePersonVMAsync(dc.PersonOid, cb => this.Dispatch(() => MainControl.NavigateTo(new PersonView(cb) {ParentView = this})));
}
}
ServiceFacade.DoReportServiceAsync(s => s.CreatePersonListReport(oids), r =>
{
this.Dispatch(() =>
{
BeWoUtils.ShowReportWindow(r, "Personen");
});
});
}
private void mainNavigationView_OpenObject(IFilterableDC obj)
{
var dc = obj as CompactPersonDC;
if (dc != null)
{
VMFactory.CreatePersonVMAsync(dc.PersonOid, cb => this.Dispatch(() => MainControl.NavigateTo(new PersonView(cb) { ParentView = this })));
}
}
public override void ChildViewClosed()
{
recentList = null;
objectList = null;
}
public override void ChildViewClosed()
{
recentList = null;
objectList = null;
}
private void MainNavigationView_OnReloadData()
{
ReloadData(true);
}
private void MainNavigationView_OnReloadData()
{
ReloadData(true);
}
private void ReloadData(bool refresh)
{
if (refresh || recentList == null)
{
ServiceFacade.DoCustomerServiceAsync(
s => s.GetAllPersonsByTypeCompact(PersonType.Others), r => this.Dispatch(delegate
{
objectList = r;
mainNavigationView.ShowSearchResult(objectList);
}));
ServiceFacade.DoCustomerServiceAsync(s => s.GetLastOpenedPersons(), r => this.Dispatch(delegate
{
recentList = r;
mainNavigationView.ShowHistory(recentList);
}));
}
else
{
mainNavigationView.ShowSearchResult(objectList);
mainNavigationView.ShowHistory(recentList);
}
}
private void ReloadData(bool refresh)
{
if (refresh || recentList == null)
{
ServiceFacade.DoCustomerServiceAsync(
s => s.GetAllPersonsByTypeCompact(PersonType.Others), r => this.Dispatch(delegate
{
objectList = r;
mainNavigationView.ShowSearchResult(objectList);
}));
ServiceFacade.DoCustomerServiceAsync(s => s.GetLastOpenedPersons(), r => this.Dispatch(delegate
{
recentList = r;
mainNavigationView.ShowHistory(recentList);
}));
}
else
{
mainNavigationView.ShowSearchResult(objectList);
mainNavigationView.ShowHistory(recentList);
}
}
private void MainNavigationView_OnOpenMailMergeWindow(List<IFilterableDC> allPersons, IFilterableDC selectedPerson)
{
var mmw = new MailMergeWindow(this, typeof(PersonDC), objectList.ToList(), selectedPerson)
{
Sorter = new PersonSorter()
};
mmw.Show();
}
private void MainNavigationView_OnOpenMailMergeWindow(List<IFilterableDC> allPersons, IFilterableDC selectedPerson)
{
var mmw = new MailMergeWindow(this, typeof(PersonDC), objectList.ToList(), selectedPerson)
{
Sorter = new PersonSorter()
};
mmw.Show();
}
public void ReactivatePerson(CompactPersonDC person)
{
public void ReactivatePerson(CompactPersonDC person)
{
if (MessageBox.Show("Wollen Sie die Person '" + person.FirstName + " " + person.LastName + "' wirklich reaktivieren?", "Löschen", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.No)
{
return;
@@ -256,29 +307,29 @@ namespace BeWo.View.Navigation
var context = mainNavigationView.objectListBox.DataContext;
mainNavigationView.objectListBox.DataContext = null;
mainNavigationView.objectListBox.DataContext = context;
}
}
public void DeleteForGood(CompactPersonDC person)
{
var dialog = new MessageDialog(() =>
{
this.Dispatch(() =>
{
ServiceFacade.DoOperationsServiceAsync(s =>
{
s.DeletePersonForGood(person.PersonOid);
}, () => { ReloadData(true); });
});
});
public void DeleteForGood(CompactPersonDC person)
{
var dialog = new MessageDialog(() =>
{
this.Dispatch(() =>
{
ServiceFacade.DoOperationsServiceAsync(s =>
{
s.DeletePersonForGood(person.PersonOid);
}, () => { ReloadData(true); });
});
});
ServiceFacade.DoOperationsServiceAsync(s => s.GetMessageFromServer(TableID.Person, person.PersonOid, MessageType.DeleteForGood), xaml =>
{
this.Dispatch(() =>
{
dialog.SetXaml(xaml);
dialog.ShowDialog();
});
});
}
}
ServiceFacade.DoOperationsServiceAsync(s => s.GetMessageFromServer(TableID.Person, person.PersonOid, MessageType.DeleteForGood), xaml =>
{
this.Dispatch(() =>
{
dialog.SetXaml(xaml);
dialog.ShowDialog();
});
});
}
}
}

View File

@@ -1,148 +1,181 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Entities;
using BeWo.Service.Core;
using BS.Shared;
using BS.Shared.Extensions;
namespace BeWo.Service.DCEntityMapper
{
public abstract class AbstractIDCEntityMapper<TEntity, TDC> : IDCEntityMapper<TEntity, TDC>
where TDC : new() where TEntity : BeWoEntityBase, new()
{
public bool ConcurrencyCheck(long? pDataContractVersion, BeWoEntityBase pEntity)
{
return ServiceLogic.ConcurrencyCheck(pDataContractVersion, pEntity);
}
public virtual List<TDC> MapToNewDCs(IEnumerable<TEntity> pEntitys)
{
List<TDC> lResult = new List<TDC>();
if (pEntitys != null)
{
foreach (TEntity iEntity in pEntitys)
{
lResult.Add(this.MergeWithDC(iEntity, CreateNewDC()));
}
}
return lResult;
}
public virtual TDC MapToNewDC(TEntity pEntity, bool ignoreNullEntity)
public abstract class AbstractIDCEntityMapper<TEntity, TDC> : IDCEntityMapper<TEntity, TDC>
where TDC : new() where TEntity : BeWoEntityBase, new()
{
public bool ConcurrencyCheck(long? pDataContractVersion, BeWoEntityBase pEntity)
{
if (ignoreNullEntity || pEntity is object)
return MapToNewDC(pEntity);
return CreateNewDC();
}
public virtual TDC MapToNewDC(TEntity pEntity)
{
return MergeWithDC(pEntity, CreateNewDC());
}
public virtual TDC CreateNewDC()
{
return new TDC();
}
public virtual List<TEntity> MapToNewEntities(IEnumerable<TDC> pDataContracts)
{
List<TEntity> lResult = new List<TEntity>();
if (pDataContracts != null)
{
foreach (TDC iDataContract in pDataContracts)
{
lResult.Add(this.MergeWithEntity(iDataContract, new TEntity()));
}
}
return lResult;
}
public virtual TEntity MapToNewEntity(TDC pDataContract, bool ignoreNullDC)
{
if (ignoreNullDC || pDataContract is object)
return MergeWithEntity(pDataContract, new TEntity());
return CreateNewEntity();
}
public virtual TEntity MapToNewEntity(TDC pDataContract)
{
return MergeWithEntity(pDataContract, new TEntity());
}
public virtual TEntity CreateNewEntity()
{
return new TEntity();
}
public abstract TDC MergeWithDC(TEntity pEntity, TDC pDataContract);
public virtual void MergeWithEntitys(IList<TDC> pDataContractList, IList<TEntity> pEntityList)
{
if (pEntityList.Count == 0 && pDataContractList != null && pDataContractList.Count > 0)
{
pEntityList.AddRange(pDataContractList.Select(dc => this.MapToNewEntity(dc)));
return;
}
if (pDataContractList == null || pDataContractList.Count == 0)
{
pEntityList.Clear();
return;
}
// remove deleted
pEntityList.RemoveRange(entity => pDataContractList.Count(dc => this.AreDCAndEntityEqual(dc, entity)) == 0);
// merge same
var lToMerge = pEntityList.Select(entity => new { Entity = entity, DataContract = pDataContractList.Single(dc => this.AreDCAndEntityEqual(dc, entity)) });
foreach (var iToMerge in lToMerge)
{
MergeWithEntity(iToMerge.DataContract, iToMerge.Entity);
}
// add new
List<TDC> newList = new List<TDC>();
foreach (TDC dc in pDataContractList)
{
bool isnew = true;
foreach (TEntity entity in pEntityList)
{
if (isnew && AreDCAndEntityEqual(dc, entity))
{
isnew = false;
}
}
if (isnew)
newList.Add(dc);
}
foreach (TDC newDC in newList)
{
pEntityList.Add(MapToNewEntity(newDC));
}
//pEntityList.AddRange(
// pDataContractList
// .Where(dc => pEntityList
// .Count(entity => AreDCAndEntityEqual(dc, entity)) == 0)
// .Select(dc => MapToNewEntity(dc)));
}
public virtual TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity, bool ignoreNullDC)
{
if (ignoreNullDC || pDataContract is object)
{
if (pEntity is null)
pEntity = CreateNewEntity();
return MergeWithEntity(pDataContract, pEntity);
}
return null;
return ServiceLogic.ConcurrencyCheck(pDataContractVersion, pEntity);
}
public abstract TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity);
protected abstract bool AreDCAndEntityEqual(TDC pDC, TEntity pEntity);
}
public virtual List<TDC> MapToNewDCs(IEnumerable<TEntity> pEntitys)
{
List<TDC> lResult = new List<TDC>();
if (pEntitys != null)
{
foreach (TEntity iEntity in pEntitys)
{
lResult.Add(this.MergeWithDC(iEntity, CreateNewDC()));
}
}
return lResult;
}
public virtual TDC MapToNewDC(TEntity pEntity, bool ignoreNullEntity)
{
if (ignoreNullEntity || pEntity is object)
return MapToNewDC(pEntity);
return CreateNewDC();
}
public virtual TDC MapToNewDC(TEntity pEntity)
{
return MergeWithDC(pEntity, CreateNewDC());
}
public virtual TDC CreateNewDC()
{
return new TDC();
}
public virtual List<TEntity> MapToNewEntities(IEnumerable<TDC> pDataContracts)
{
List<TEntity> lResult = new List<TEntity>();
if (pDataContracts != null)
{
foreach (TDC iDataContract in pDataContracts)
{
lResult.Add(this.MergeWithEntity(iDataContract, new TEntity()));
}
}
return lResult;
}
public virtual TEntity MapToNewEntity(TDC pDataContract, bool ignoreNullDC)
{
if (ignoreNullDC || pDataContract is object)
return MergeWithEntity(pDataContract, new TEntity());
return CreateNewEntity();
}
public virtual TEntity MapToNewEntity(TDC pDataContract)
{
return MergeWithEntity(pDataContract, new TEntity());
}
public virtual TEntity CreateNewEntity()
{
return new TEntity();
}
public abstract TDC MergeWithDC(TEntity pEntity, TDC pDataContract);
public virtual void MergeWithEntitys(IList<TDC> pDataContractList, IList<TEntity> pEntityList)
{
if (pEntityList.Count == 0 && pDataContractList != null && pDataContractList.Count > 0)
{
pEntityList.AddRange(pDataContractList.Select(dc => this.MapToNewEntity(dc)));
return;
}
if (pDataContractList == null || pDataContractList.Count == 0)
{
pEntityList.Clear();
return;
}
// remove deleted
pEntityList.RemoveRange(entity => pDataContractList.Count(dc => this.AreDCAndEntityEqual(dc, entity)) == 0);
// merge same
var lToMerge = pEntityList.Select(entity => new { Entity = entity, DataContract = pDataContractList.Single(dc => this.AreDCAndEntityEqual(dc, entity)) });
foreach (var iToMerge in lToMerge)
{
MergeWithEntity(iToMerge.DataContract, iToMerge.Entity);
}
// add new
List<TDC> newList = new List<TDC>();
foreach (TDC dc in pDataContractList)
{
bool isnew = true;
foreach (TEntity entity in pEntityList)
{
if (isnew && AreDCAndEntityEqual(dc, entity))
{
isnew = false;
}
}
if (isnew)
newList.Add(dc);
}
foreach (TDC newDC in newList)
{
pEntityList.Add(MapToNewEntity(newDC));
}
//pEntityList.AddRange(
// pDataContractList
// .Where(dc => pEntityList
// .Count(entity => AreDCAndEntityEqual(dc, entity)) == 0)
// .Select(dc => MapToNewEntity(dc)));
}
public virtual TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity, bool ignoreNullDC)
{
if (ignoreNullDC || pDataContract is object)
{
if (pEntity is null)
pEntity = CreateNewEntity();
return MergeWithEntity(pDataContract, pEntity);
}
return null;
}
public abstract TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity);
protected abstract bool AreDCAndEntityEqual(TDC pDC, TEntity pEntity);
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 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>>();
if (pDCs == null)
return dicts;
foreach (var dc in pDCs)
dicts.Add(ToJsonDictionary(dc));
return dicts;
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Access;
using BeWo.Data.Entities;
@@ -67,5 +68,21 @@ namespace BeWo.Service.DCEntityMapper
{
return pDC.CustomerOid == pEntity.Oid;
}
}
public override Dictionary<string, object> ToJsonDictionary(CompactCustomerDC customer)
{
var record_dict = new Dictionary<string, object>
{
{"Address", customer.AddressString},
{"Alias", customer.CustomerAlias},
{"CustomerOid", customer.CustomerOid},
{"DateOfBirth", customer.DateOfBirthString},
{"EqutyContribution", customer.EquityContribution},
{"Fullname", customer.FullName},
{"InvoiceAddress", customer.InvoiceAddressString}
};
return record_dict;
}
}
}

View File

@@ -2,37 +2,49 @@
using BeWo.Data.Entities;
using System.Linq;
using BS.Shared.DataContracts.Compact;
using System.Collections.Generic;
namespace BeWo.Service.DCEntityMapper
{
public class CompactEmployeeDC_Employee : AbstractIDCEntityMapper<Employee, CompactEmployeeDC>
{
public override CompactEmployeeDC MergeWithDC(Employee pEntity, CompactEmployeeDC pDataContract)
{
pDataContract.EmployeeOid = pEntity.Oid.Value;
pDataContract.PersonOid = pEntity.Person.Oid.Value;
pDataContract.EmployeeVersion = pEntity.Version.Value;
pDataContract.FirstName = pEntity.Person.FirstName;
pDataContract.LastName = pEntity.Person.LastName;
pDataContract.PersonnelNumber = pEntity.PersonnelNumber;
//pDataContract.FLSPerWeek = pEntity.WeeklyFLS;
pDataContract.ActivationType = pEntity.IsActive;
pDataContract.ValueListEntries = pEntity.ValueList.ToDictionary(i => i.Entry.Oid.Value, i => i.Entry.Type);
pDataContract.EmployeeColor = pEntity.EmployeeColor;
pDataContract.RelatedCustomerOIDList = pEntity.Employee2CustomerList.Where(w => w.CustomerOid.HasValue).Select(s => s.CustomerOid.Value).ToList();
public class CompactEmployeeDC_Employee : AbstractIDCEntityMapper<Employee, CompactEmployeeDC>
{
public override CompactEmployeeDC MergeWithDC(Employee pEntity, CompactEmployeeDC pDataContract)
{
pDataContract.EmployeeOid = pEntity.Oid.Value;
pDataContract.PersonOid = pEntity.Person.Oid.Value;
pDataContract.EmployeeVersion = pEntity.Version.Value;
pDataContract.FirstName = pEntity.Person.FirstName;
pDataContract.LastName = pEntity.Person.LastName;
pDataContract.PersonnelNumber = pEntity.PersonnelNumber;
//pDataContract.FLSPerWeek = pEntity.WeeklyFLS;
pDataContract.ActivationType = pEntity.IsActive;
pDataContract.ValueListEntries = pEntity.ValueList.ToDictionary(i => i.Entry.Oid.Value, i => i.Entry.Type);
pDataContract.EmployeeColor = pEntity.EmployeeColor;
pDataContract.RelatedCustomerOIDList = pEntity.Employee2CustomerList.Where(w => w.CustomerOid.HasValue).Select(s => s.CustomerOid.Value).ToList();
return pDataContract;
}
return pDataContract;
}
// COMPACT EMPLOYEES ARE NOT EDITABLE
public override Employee MergeWithEntity(CompactEmployeeDC pDataContract, Employee pEntity)
{
return DAOFactory.GenericDAO.LoadByID<Employee>(pDataContract.EmployeeOid);
}
// COMPACT EMPLOYEES ARE NOT EDITABLE
public override Employee MergeWithEntity(CompactEmployeeDC pDataContract, Employee pEntity)
{
return DAOFactory.GenericDAO.LoadByID<Employee>(pDataContract.EmployeeOid);
}
protected override bool AreDCAndEntityEqual(CompactEmployeeDC pDC, Employee pEntity)
{
return pDC.EmployeeOid == pEntity.Oid;
}
}
protected override bool AreDCAndEntityEqual(CompactEmployeeDC pDC, Employee pEntity)
{
return pDC.EmployeeOid == pEntity.Oid;
}
public override Dictionary<string, object> ToJsonDictionary(CompactEmployeeDC pDC)
{
var dict = new Dictionary<string, object>()
{
{"PersonellNumber", pDC.PersonnelNumber },
{"FullName", pDC.FirstNameLastName },
};
return dict;
}
}
}

View File

@@ -1,63 +1,80 @@
using BeWo.Data.Entities;
using BS.Shared.DataContracts.Compact;
using System.Collections.Generic;
namespace BeWo.Service.DCEntityMapper
{
public class CompactPersonDC_Person : AbstractIDCEntityMapper<Person, CompactPersonDC>
{
public override CompactPersonDC MergeWithDC(Person pEntity, CompactPersonDC pDataContract)
{
pDataContract.DateOfBirth = pEntity.DateOfBirth;
pDataContract.FirstName = pEntity.FirstName;
pDataContract.LastName = pEntity.LastName;
pDataContract.PersonOid = pEntity.Oid.Value;
pDataContract.PersonVersion = pEntity.Version.Value;
pDataContract.ActivationType = pEntity.IsActive;
pDataContract.PersonType = pEntity.Type;
pDataContract.FamilyStatus = pEntity.FamilyStatus;
pDataContract.Geschlecht = pEntity.Sex;
public class CompactPersonDC_Person : AbstractIDCEntityMapper<Person, CompactPersonDC>
{
public override CompactPersonDC MergeWithDC(Person pEntity, CompactPersonDC pDataContract)
{
pDataContract.DateOfBirth = pEntity.DateOfBirth;
pDataContract.FirstName = pEntity.FirstName;
pDataContract.LastName = pEntity.LastName;
pDataContract.PersonOid = pEntity.Oid.Value;
pDataContract.PersonVersion = pEntity.Version.Value;
pDataContract.ActivationType = pEntity.IsActive;
pDataContract.PersonType = pEntity.Type;
pDataContract.FamilyStatus = pEntity.FamilyStatus;
pDataContract.Geschlecht = pEntity.Sex;
if (pEntity.Title != null)
{
pDataContract.Title = pEntity.Title.Value;
}
if (pEntity.Title != null)
{
pDataContract.Title = pEntity.Title.Value;
}
if (pEntity.Function != null)
{
pDataContract.Function = pEntity.Function.Value;
}
if (pEntity.Function != null)
{
pDataContract.Function = pEntity.Function.Value;
}
if (pEntity.Address != null)
{
pDataContract.Street = pEntity.Address.Street;
pDataContract.PostalCode = pEntity.Address.PostalCode;
pDataContract.Town = pEntity.Address.Town;
}
if (pEntity.Address != null)
{
pDataContract.Street = pEntity.Address.Street;
pDataContract.PostalCode = pEntity.Address.PostalCode;
pDataContract.Town = pEntity.Address.Town;
}
pDataContract.OrganisationRelations = MapperFactory.Organisation2PersonDC_Organisation2Person.MapToNewDCs(pEntity.Organisation2Persons);
pDataContract.OrganisationRelations = MapperFactory.Organisation2PersonDC_Organisation2Person.MapToNewDCs(pEntity.Organisation2Persons);
return pDataContract;
}
return pDataContract;
}
public override Person MergeWithEntity(CompactPersonDC pDataContract, Person pEntity)
{
this.ConcurrencyCheck(pDataContract.PersonVersion, pEntity);
public override Person MergeWithEntity(CompactPersonDC pDataContract, Person pEntity)
{
this.ConcurrencyCheck(pDataContract.PersonVersion, pEntity);
pEntity.Oid = pDataContract.PersonOid;
pEntity.DateOfBirth = pDataContract.DateOfBirth;
pEntity.FirstName = pDataContract.FirstName;
pEntity.LastName = pDataContract.LastName;
pEntity.IsActive = pDataContract.ActivationType;
pEntity.Oid = pDataContract.PersonOid;
pEntity.DateOfBirth = pDataContract.DateOfBirth;
pEntity.FirstName = pDataContract.FirstName;
pEntity.LastName = pDataContract.LastName;
pEntity.IsActive = pDataContract.ActivationType;
MapperFactory.Organisation2PersonDC_Organisation2Person.MergeWithEntitys(pDataContract.OrganisationRelations, pEntity.Organisation2Persons);
MapperFactory.Organisation2PersonDC_Organisation2Person.MergeWithEntitys(pDataContract.OrganisationRelations, pEntity.Organisation2Persons);
return pEntity;
}
return pEntity;
}
protected override bool AreDCAndEntityEqual(CompactPersonDC pDC, Person pEntity)
{
return pDC.PersonOid == pEntity.Oid;
}
}
protected override bool AreDCAndEntityEqual(CompactPersonDC pDC, Person pEntity)
{
return pDC.PersonOid == pEntity.Oid;
}
public override Dictionary<string, object> ToJsonDictionary(CompactPersonDC pDC)
{
var jsonObject = new Dictionary<string, object>()
{
{"Address", pDC.AddressString },
{"DateOfBirth", pDC.Birthday },
{"CustomerOid", pDC.CustomerOid },
{"EmployeeOid", pDC.EmployeeOid },
{ "FullName", pDC.FullName },
{"Gender", pDC.Geschlecht.ToString() },
{"Function", pDC.Function },
};
return jsonObject;
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using BeWo.Data.Entities;
@@ -18,5 +19,10 @@ namespace BeWo.Service.DCEntityMapper
TDC MergeWithDC(TEntity pEntity, TDC pDataContract);
TEntity MergeWithEntity(TDC pDataContract, TEntity pEntity);
}
Dictionary<string, object> ToJsonDictionary(TDC pDC);
Dictionary<string, object> ToJsonDictionary(TEntity pEntity);
IList<Dictionary<string, object>> ToJsonDictionary(IList<TEntity> pEntities);
IList<Dictionary<string, object>> ToJsonDictionary(IList<TDC> pDCs);
}
}

View File

@@ -266,5 +266,29 @@ namespace BeWo.Service.DCEntityMapper
return pDC.ServiceRecordOid == pEntity.Oid;
}
}
public override Dictionary<string, object> ToJsonDictionary(ServiceRecordDC service_record)
{
var record_dict = new Dictionary<string, object>
{
{ "StartDate", service_record.Start },
{ "EndDate", service_record.End },
{ "Duration (Std)", service_record.DurationInStunden },
{ "ServiceCategory", service_record.ServiceDescription.Category.Name },
{ "ServiceDescription", service_record.ServiceDescription.Name },
{ "Documentation", service_record.Notice
+ "\n" + service_record.Notice2
+ "\n" + service_record.Notice3
+ "\n" + service_record.Notice4
+ "\n" + service_record.Notice5},
{ "Distance (Meter)", service_record.DistanceInMeter ?? 0 },
{ "InsertedOn", service_record.InsertedOn },
{ "Betrag", service_record.Betrag },
{ "InsertUser", service_record.InsUser },
{ "Employee", service_record.Employee }
};
return record_dict;
}
}
}

View File

@@ -227,11 +227,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AI\Core\AiMapperFactory.cs" />
<Compile Include="AI\Core\BaseAiMapping.cs" />
<Compile Include="AI\Mappings\CompactCustomerAiMapping.cs" />
<Compile Include="AI\Mappings\CustomerAiMapping.cs" />
<Compile Include="AI\Mappings\ServiceRecordAiMapping.cs" />
<Compile Include="Core\DiamantExporter.cs" />
<Compile Include="Core\ExcelDownload.cs" />
<Compile Include="Core\FileAttachmentUtils.cs" />

View File

@@ -26,7 +26,6 @@ namespace BeWo.Service.ServiceImplementations
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class AiEnhancedServiceImp : IAiEnhancedService
{
#region Ai
public AiConfigDC GetAiConfig()
{
var configs = DAOFactory.GenericDAO.GetAllActive<AiConfig>();
@@ -83,7 +82,7 @@ namespace BeWo.Service.ServiceImplementations
{
var current_user = UserRightHelper.GetLoggedInUserWithOid();
var system = AiSystemBuilder.CreateSystemInstructions(conversation.UIContext, conversation.ContextBeWoObjects);
var system_prompt = AiSystemBuilder.CreateSystemInstructions(conversation.UIContext, conversation.ContextBeWoObjects);
var conv = new AiConversation();
conv.Created = DateTime.Now;
@@ -96,7 +95,7 @@ namespace BeWo.Service.ServiceImplementations
conv.ApplicationUserOid = current_user.Oid;
var msg = new AiConversationMessage();
msg.Message = system;
msg.Message = system_prompt;
msg.AiConversation = conv;
msg.Role = BS.Shared.AiConversationMessageRole.System;
msg.Created = DateTime.Now;
@@ -169,7 +168,6 @@ namespace BeWo.Service.ServiceImplementations
return config;
}
private AiModel getDefaultAiModel()
{
var models = getAiModels();
@@ -179,7 +177,6 @@ namespace BeWo.Service.ServiceImplementations
return models.First();
}
private IEnumerable<AiModel> getAiModels()
{
var old_models = DAOFactory.GenericDAO.GetAll<AiModel>();
@@ -218,6 +215,5 @@ namespace BeWo.Service.ServiceImplementations
return models;
}
#endregion
}
}

View File

@@ -24,55 +24,7 @@ namespace BeWo.Service.ServiceUtils
{
var system_prompt = getSystemPrompt(2);
Dictionary<string, object> data = null;
switch (uicontext)
{
case 0:
break;
case 1:
data = createCustomerNavigationContext(bewoobjects);
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
case 12:
break;
case 13:
break;
case 14:
break;
case 15:
break;
case 16:
break;
case 17:
break;
case 18:
break;
// Service Record
case 19:
data = createServiceRecordContext(bewoobjects);
break;
default:
throw new NotImplementedException("UI Context unknown");
}
var data = getContextData(uicontext, bewoobjects);
var text = JsonConvert.SerializeObject(data);
@@ -81,117 +33,167 @@ namespace BeWo.Service.ServiceUtils
return result;
}
/// <summary>
/// SupportConcept = 0,
/// Customer = 1,
/// Person = 2,
/// Employee = 3,
/// Organisation = 4,
/// Team = 5,
/// Dokumente = 6,
/// User = 7,
/// UserGroup = 8,
/// Report = 9,
/// Scheduler = 10,
/// Wohnheim = 11,
/// Vertretungen = 12,
/// CustomerTeam = 13,
/// Scheduling = 14,
/// Finance = 15,
/// Administration = 16,
/// AiConversation = 17,
/// AiConversationPopup = 18,
/// // Nur für AI Conversation Zuweisung
/// ServiceRecord = 19,
/// CustomerSingle = 20,
/// PersonSingle = 21,
/// EmployeeSingle = 22,
/// </summary>
/// <param name="uicontext"></param>
/// <param name="bewoobjects"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
private static Dictionary<string, object> getContextData(int uicontext, Dictionary<TableID, long[]> bewoobjects)
{
switch (uicontext)
{
case 0: break;
case 1: return createCustomerNavigationContext(bewoobjects);
case 2: return createPersonNavigationContext(bewoobjects);
case 3: return createEmployeeNavigationContext(bewoobjects);
case 4: break;
case 5: break;
case 6: break;
case 7: break;
case 8: break;
case 9: break;
case 10: break;
case 11: break;
case 12: break;
case 13: break;
case 14: break;
case 15: break;
case 16: break;
case 17: break;
case 18: break;
case 19: return createServiceRecordContext(bewoobjects);
}
throw new NotImplementedException("UI Context unknown");
}
private static Dictionary<string, object> createCustomerNavigationContext(Dictionary<TableID, long[]> bewoobjects)
{
if (bewoobjects is null || !bewoobjects.Any())
return null;
var customers = new List<Dictionary<string,object>>();
if (bewoobjects.TryGetValue(TableID.Customer, out long[] cvalues) && (cvalues?.Length ?? 0) > 0)
{
var customers_e = DAOFactory.GenericDAO.GetByIDs<Customer>(cvalues);
var customers_dc = MapperFactory.CompactCustomerDC_Customer.MapToNewDCs(customers_e);
customers = customers_dc.Select(getCustomer).ToList();
}
var klienten = LoadEntities(bewoobjects, TableID.Customer, MapperFactory.CompactCustomerDC_Customer);
var dict = new Dictionary<string, object>
{
{ "Aktuelle Ansicht", "Klienten Navigation" },
{ "Klienten", customers }
{ "Aktueller Ansichtsfilter", "Funktion noch nicht verfügbar" },
{ "Klientenliste", (object)klienten ?? "keine Klienten sichtbar" }
};
return dict;
}
private static Dictionary<string, object> createPersonNavigationContext(Dictionary<TableID, long[]> bewoobjects)
{
var personen = LoadEntities(bewoobjects, TableID.Person, MapperFactory.CompactPersonDC_Person);
var dict = new Dictionary<string, object>
{
{ "Aktuelle Ansicht", "Personen Navigation" },
{ "Aktueller Ansichtsfilter", "Funktion noch nicht verfügbar" },
{ "Personenliste", (object)personen ?? "keine Klienten sichtbar" }
};
return dict;
}
private static Dictionary<string, object> createEmployeeNavigationContext(Dictionary<TableID, long[]> bewoobjects)
{
var mitarbeiter = LoadEntities(bewoobjects, TableID.Employee, MapperFactory.CompactEmployeeDC_Employee);
var dict = new Dictionary<string, object>
{
{ "Aktuelle Ansicht", "Mitarbeiter Navigation" },
{ "Aktueller Ansichtsfilter", "Funktion noch nicht verfügbar" },
{ "Mitarbeiterliste", (object)mitarbeiter ?? "keine Klienten sichtbar" }
};
return dict;
}
private static Dictionary<string, object> createServiceRecordContext(Dictionary<TableID, long[]> bewoobjects)
{
if (bewoobjects is null || !bewoobjects.Any())
return null;
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 selected = new Dictionary<string, object>();
if (bewoobjects.TryGetValue(TableID.Customer, out long[] cvalues) && (cvalues?.Length ?? 0) > 0)
var sub_dict = new Dictionary<string, object>()
{
var customer = DAOFactory.GenericDAO.GetByID<Customer>(cvalues[0]);
var customer_dc = MapperFactory.CompactCustomerDC_Customer.MapToNewDC(customer);
selected.Add("CustomerName", customer_dc.LastNameFirstName);
}
if (bewoobjects.TryGetValue(TableID.CostBearer, out long[] cbvalues) && (cbvalues?.Length ?? 0) > 0)
{
var costbearer = DAOFactory.GenericDAO.GetByID<Organisation>(cbvalues[0]);
var costbearer_dc = MapperFactory.CompactOrganisationDC_Organisation.MapToNewDC(costbearer);
selected.Add("CostBearerName", costbearer_dc.Name);
}
if (bewoobjects.TryGetValue(TableID.SupportConcept, out long[] svalues) && (svalues?.Length ?? 0) > 0)
{
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 (bewoobjects.TryGetValue(TableID.ServiceRecord, out long[] values) && (values?.Length ?? 0) > 0)
{
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)
{
records.Add(getServiceRecord(service_record));
}
}
{ "CustomerName Ansicht", customer },
{ "CostBearerName", costbearer },
{ "SupportConceptDuration", supportconcept }
};
var dict = new Dictionary<string, object>
{
{ "Aktuelle Ansicht", "Zeiterfassung" },
{ "Selected", selected },
{ "Aktueller Ansichtsfilter", "Funktion noch nicht verfügbar" },
{ "Selected", sub_dict},
{ "Zeiterfassungen", records }
};
return dict;
}
private static Dictionary<string, object> getServiceRecord(ServiceRecordDC service_record)
private static object LoadProperty<TEntity, TDC>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, IDCEntityMapper<TEntity, TDC> mapper, Func<TDC, object> getPropertyFunc)
where TDC : new() where TEntity : BeWoEntityBase, new()
{
var record_dict = new Dictionary<string, object>
{
{ "StartDate", service_record.Start },
{ "EndDate", service_record.End },
{ "Duration (Std)", service_record.DurationInStunden },
{ "ServiceCategory", service_record.ServiceDescription.Category.Name },
{ "ServiceDescription", service_record.ServiceDescription.Name },
{ "Documentation", service_record.Notice
+ "\n" + service_record.Notice2
+ "\n" + service_record.Notice3
+ "\n" + service_record.Notice4
+ "\n" + service_record.Notice5},
{ "Distance (Meter)", service_record.DistanceInMeter ?? 0 },
{ "InsertedOn", service_record.InsertedOn },
{ "Betrag", service_record.Betrag },
{ "InsertUser", service_record.InsUser },
{ "Employee", service_record.Employee }
};
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
return record_dict;
}
private static Dictionary<string, object> getCustomer(CompactCustomerDC customer)
{
var record_dict = new Dictionary<string, object>
{
{"Address", customer.AddressString},
{"Alias", customer.CustomerAlias},
{"CustomerOid", customer.CustomerOid},
{"DateOfBirth", customer.DateOfBirthString},
{"EqutyContribution", customer.EquityContribution},
{"Fullname", customer.FullName},
{"InvoiceAddress", customer.InvoiceAddressString}
};
var entity = DAOFactory.GenericDAO.GetByID<TEntity>(oids[0]);
var dc = mapper.MapToNewDC(entity);
var property = getPropertyFunc(dc);
return record_dict;
return property;
}
private static Dictionary<string, object> getEmployee(CompactEmployeeDC compactEmployee)
private static Dictionary<string, object> LoadEntity<TEntity, TDC>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, IDCEntityMapper<TEntity, TDC> mapper)
where TDC : new() where TEntity : BeWoEntityBase, new()
{
return null;
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
var entity = DAOFactory.GenericDAO.GetByID<TEntity>(oids[0]);
var dict = mapper.ToJsonDictionary(entity);
return dict;
}
private static IList<Dictionary<string, object>> LoadEntities<TEntity, TDC>
(Dictionary<TableID, long[]> bewoobjects, TableID tid, IDCEntityMapper<TEntity, TDC> mapper)
where TDC : new() where TEntity : BeWoEntityBase, new()
{
if (!bewoobjects.TryGetValue(tid, out long[] oids) || (oids?.Length ?? 0) == 0)
return null;
var entities = DAOFactory.GenericDAO.GetByIDs<TEntity>(oids);
var dict = mapper.ToJsonDictionary(entities);
return dict;
}
private static string getSystemPrompt(int i)
@@ -206,42 +208,5 @@ namespace BeWo.Service.ServiceUtils
return result;
}
}
//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;
//}
//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;
// oid = oids[0];
// return true;
//}
//private static bool tryGetMultipleValues(Dictionary<TableID, List<long>> sorted, TableID tid, out List<long> oids)
//{
// return sorted.TryGetValue(tid, out oids);
//}
}
}

View File

@@ -1,36 +0,0 @@
using BeWo.Data.Entities;
using BeWo.Service.AI.Mappings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.AI.Core
{
internal class AiMapperFactory
{
private readonly Dictionary<Type, object> _Mappers;
public AiMapperFactory()
{
_Mappers = new Dictionary<Type, object>()
{
{typeof(CompactCustomerAiMapping), new Lazy<CompactCustomerAiMapping>(() => new CompactCustomerAiMapping()) },
{typeof(CustomerAiMapping), new Lazy<CustomerAiMapping>(() => new CustomerAiMapping()) },
{typeof(ServiceRecordAiMapping), new Lazy<ServiceRecordAiMapping>(() => new ServiceRecordAiMapping()) },
};
}
public T GetMapper<T>() where T : class
{
if (_Mappers.TryGetValue(typeof(T), out var lazy))
{
return (lazy as Lazy<T>)?.Value;
}
throw new InvalidOperationException($"No mapper registered for type {typeof(T).Name}");
}
}
}

View File

@@ -1,24 +0,0 @@
using BS.Shared.DataContracts;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.AI.Core
{
internal abstract class BaseAiMapping<TDataContract> where TDataContract : IDataContract
{
public string ToJson(TDataContract dataContract)
{
var json_dict = ToJsonDictionary(dataContract);
var json = JsonConvert.SerializeObject(json_dict);
return json;
}
public abstract Dictionary<string, object> ToJsonDictionary(TDataContract dataContract);
}
}

View File

@@ -1,18 +0,0 @@
using BeWo.Service.AI.Core;
using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.AI.Mappings
{
internal class CompactCustomerAiMapping : BaseAiMapping<CustomerDC>
{
public override Dictionary<string, object> ToJsonDictionary(CustomerDC customer)
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,18 +0,0 @@
using BeWo.Service.AI.Core;
using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.AI.Mappings
{
internal class CustomerAiMapping : BaseAiMapping<CustomerDC>
{
public override Dictionary<string, object> ToJsonDictionary(CustomerDC customer)
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,18 +0,0 @@
using BeWo.Service.AI.Core;
using BS.Shared.DataContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.AI.Mappings
{
internal class ServiceRecordAiMapping : BaseAiMapping<ServiceRecordDC>
{
public override Dictionary<string, object> ToJsonDictionary(ServiceRecordDC dataContract)
{
throw new NotImplementedException();
}
}
}

View File

@@ -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 Dictionary<TableID, long[]> ContextBeWoObjects { get; set; }
[DataMember] public Dictionary<TableID, long[]> ContextBeWoObjects { get; set; } = new Dictionary<TableID, long[]>();
[DataMember] public int UIContext { get; set; }
[DataMember] public List<AiConversationMessageDC> Messages { get; set; }
}