AGNT Templates implementiert

This commit is contained in:
Daniel Schick 2021-09-16 07:14:06 +00:00
parent a8df8cc417
commit 54a552f210
14 changed files with 548 additions and 98 deletions

View File

@ -1,4 +1,4 @@
 <src:DetailBaseControl xmlns:src="clr-namespace:ENI2"
<src:DetailBaseControl xmlns:src="clr-namespace:ENI2"
x:Class="ENI2.DetailViewControls.PortCallDetailControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -13,103 +13,141 @@
d:DesignHeight="600" d:DesignWidth="800">
<GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.textPortCall}">
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="300" />
<RowDefinition Height="250" />
</Grid.RowDefinitions>
<GroupBox Name="noaNodGroupBox" Header="{x:Static p:Resources.textArrivalDeparture}" Margin="5, 20, 5, 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textETAPortOfCall}" Name="label_ETAToPortOfCall" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textETDPortOfCall}" Name="label_ETDFromPortOfCall" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textETAKielCanal}" Name="label_ETAToKielCanal" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textETDKielCanal}" Name="label_ETDFromKielCanal" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textLastPort}" Name="label_LastPort" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textNextPort}" Name="label_NextPort" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="2" Content="{x:Static p:Resources.textETDLastPort}" Name="label_ETDFromLastport" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textETANextPort}" Name="label_ETAToNextPort" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textAnchored}" Name="label_IsAnchored" Margin="0,0,10,0" />
<xctk:DateTimePicker Grid.Column="1" Grid.Row="0" Value="{Binding ETAToPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToPortOfCall" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="0" Value="{Binding ETDFromPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromPortOfCall" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Column="1" Grid.Row="1" Value="{Binding ETAToKielCanal, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="1" Value="{Binding ETDFromKielCanal, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="2" Width="Auto" x:Name="locodeControl_LastPort" LocodeValue="{Binding LastPort, Mode=TwoWay}"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="2" Value="{Binding ETDFromLastPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromLastPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="3" Width="Auto" x:Name="locodeControl_NextPort" LocodeValue="{Binding NextPort, Mode=TwoWay}" LocodeSource="SSN" />
<xctk:DateTimePicker Grid.Column="3" Grid.Row="3" Value="{Binding ETAToNextPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToNextPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="300" />
<RowDefinition Height="250" />
</Grid.RowDefinitions>
<GroupBox Name="noaNodGroupBox" Header="{x:Static p:Resources.textArrivalDeparture}" Margin="5, 20, 5, 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textETAPortOfCall}" Name="label_ETAToPortOfCall" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textETDPortOfCall}" Name="label_ETDFromPortOfCall" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textETAKielCanal}" Name="label_ETAToKielCanal" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textETDKielCanal}" Name="label_ETDFromKielCanal" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textLastPort}" Name="label_LastPort" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textNextPort}" Name="label_NextPort" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="2" Content="{x:Static p:Resources.textETDLastPort}" Name="label_ETDFromLastport" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textETANextPort}" Name="label_ETAToNextPort" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textAnchored}" Name="label_IsAnchored" Margin="0,0,10,0" />
<xctk:DateTimePicker Grid.Column="1" Grid.Row="0" Value="{Binding ETAToPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToPortOfCall" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="0" Value="{Binding ETDFromPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromPortOfCall" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Column="1" Grid.Row="1" Value="{Binding ETAToKielCanal, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="1" Value="{Binding ETDFromKielCanal, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="2" Width="Auto" x:Name="locodeControl_LastPort" LocodeValue="{Binding LastPort, Mode=TwoWay}"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="2" Value="{Binding ETDFromLastPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromLastPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="3" Width="Auto" x:Name="locodeControl_NextPort" LocodeValue="{Binding NextPort, Mode=TwoWay}" LocodeSource="SSN" />
<xctk:DateTimePicker Grid.Column="3" Grid.Row="3" Value="{Binding ETAToNextPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToNextPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<CheckBox Grid.Column="1" Grid.Row="4" IsThreeState="True" VerticalContentAlignment="Center" Name="checkBox_IsAnchored" IsChecked="{Binding IsAnchored}"/>
<GroupBox Grid.Row="5" Grid.ColumnSpan="4" Name="groupBoxCallPurpose" Header="{x:Static p:Resources.textCallPurposes}" >
<enictrl:ENIDataGrid x:Name="dataGridCallPurposes" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
<GroupBox Grid.Row="5" Grid.ColumnSpan="4" Name="groupBoxCallPurpose" Header="{x:Static p:Resources.textCallPurposes}" >
<enictrl:ENIDataGrid x:Name="dataGridCallPurposes" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding CallPurposeCode, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding CallPurposeDescription, Mode=TwoWay}" IsReadOnly="True" Width="0.9*" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</GroupBox>
</Grid>
</GroupBox>
<GroupBox Name="agentGroupBox" Header="{x:Static p:Resources.textAgent}" Grid.Row="1" Margin="5, 20, 5, 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding CallPurposeCode, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding CallPurposeDescription, Mode=TwoWay}" IsReadOnly="True" Width="0.9*" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</GroupBox>
</Grid>
</GroupBox>
<GroupBox Name="agentGroupBox" Header="{x:Static p:Resources.textAgent}" Grid.Row="1" Margin="5, 20, 5, 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textCompanyName}" Name="label_AgentCompanyName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textStreetNumber}" Name="label_AgentStreetAndNumber" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPostalCode}" Name="label_AgentPostalCode" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textLastName}" Name="label_AgentLastName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textPhone}" Name="label_AgentPhone" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textEMail}" Name="label_AgentEMail" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="2" Content="{x:Static p:Resources.textCity}" Name="label_AgentCity" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="2" Content="{x:Static p:Resources.textFirstName}" Name="label_AgentFirstName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textFax}" Name="label_AgentFax" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textCountry}" Name="label_AgentCountry" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textCompanyName}" Name="label_AgentCompanyName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textStreetNumber}" Name="label_AgentStreetAndNumber" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPostalCode}" Name="label_AgentPostalCode" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textLastName}" Name="label_AgentLastName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textPhone}" Name="label_AgentPhone" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="7" Grid.Column="0" Content="{x:Static p:Resources.textEMail}" Name="label_AgentEMail" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textCity}" Name="label_AgentCity" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="2" Content="{x:Static p:Resources.textFirstName}" Name="label_AgentFirstName" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="7" Grid.Column="2" Content="{x:Static p:Resources.textFax}" Name="label_AgentFax" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textCountry}" Name="label_AgentCountry" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textAgentTemplate}" Name="labelAgentTemplate" Margin="0,0,10,0"/>
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textTitle}" Name="labelAgentTemplateTitle" Margin="0,0,10,0" Visibility="Hidden" />
<TextBox Grid.Row="0" Grid.Column="1" Name="textBox_AgentCompanyName" MaxLength="99" Margin="2" Text="{Binding AgentCompanyName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Name="textBox_AgentStreetAndNumber" MaxLength="99" Margin="2" Text="{Binding AgentStreetAndNumber}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Name="textBox_AgentPostalCode" MaxLength="99" Margin="2" Text="{Binding AgentPostalCode}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="3" Name="textBox_AgentCity" MaxLength="99" Margin="2" Text="{Binding AgentCity}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Name="textBox_AgentCountry" MaxLength="99" Margin="2" Text="{Binding AgentCountry}" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Name="textBox_AgentLastName" MaxLength="99" Margin="2" Text="{Binding AgentLastName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="5" Grid.Column="3" Name="textBox_AgentFirstName" MaxLength="99" Margin="2" Text="{Binding AgentFirstName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="99" Margin="2" Text="{Binding AgentPhone}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="3" Name="textBox_AgentFax" MaxLength="99" Margin="2" Text="{Binding AgentFax}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="99" Margin="2" Text="{Binding AgentEMail}" VerticalContentAlignment="Center"/>
</Grid>
</GroupBox>
</Grid>
<TextBox Grid.Row="0" Grid.Column="1" Name="textBox_AgentCompanyName" MaxLength="99" Margin="2" Text="{Binding AgentCompanyName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="1" Grid.Column="1" Name="textBox_AgentStreetAndNumber" MaxLength="99" Margin="2" Text="{Binding AgentStreetAndNumber}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="2" Grid.Column="1" Name="textBox_AgentPostalCode" MaxLength="99" Margin="2" Text="{Binding AgentPostalCode}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="3" Name="textBox_AgentCity" MaxLength="99" Margin="2" Text="{Binding AgentCity}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="3" Grid.Column="1" Name="textBox_AgentCountry" MaxLength="99" Margin="2" Text="{Binding AgentCountry}" VerticalContentAlignment="Center" />
<TextBox Grid.Row="5" Grid.Column="1" Name="textBox_AgentLastName" MaxLength="99" Margin="2" Text="{Binding AgentLastName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="3" Name="textBox_AgentFirstName" MaxLength="99" Margin="2" Text="{Binding AgentFirstName}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="99" Margin="2" Text="{Binding AgentPhone}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="3" Name="textBox_AgentFax" MaxLength="99" Margin="2" Text="{Binding AgentFax}" VerticalContentAlignment="Center"/>
<TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="99" Margin="2" Text="{Binding AgentEMail}" VerticalContentAlignment="Center"/>
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBox_AgentTemplate" Margin="2" SelectedValuePath="Id" DisplayMemberPath="AgentTitle" SelectionChanged="comboBox_AgentTemplate_SelectionChanged" />
<Grid Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26" />
</Grid.ColumnDefinitions>
<Button Name="buttonSetTemplate" Margin="2" Click="buttonSetTemplate_Click" BorderThickness="0" Background="Transparent"
ToolTip="Apply template" HorizontalContentAlignment="Right" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/check.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
</Grid>
<Grid Grid.Row="1" Grid.Column="3" Name="gridTemplateControls" Visibility="Visible">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <!-- Name -->
<ColumnDefinition Width="26"/> <!-- Save button -->
<ColumnDefinition Width="26"/> <!-- Delete button -->
<ColumnDefinition Width="52"/> <!-- Undo button -->
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Margin="2" Name="textBoxTemplateTitle" VerticalContentAlignment="Center"/>
<Button Name="buttonSaveTemplate" Grid.Column="1" Grid.Row="0" Margin="2" Click="buttonSaveTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Save template">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/floppy_disk_blue.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonDeleteTemplate" Grid.Column="2" Grid.Row="0" Margin="2" Click="buttonDeleteTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Delete template" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/delete.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonUndoTemplate" Grid.Column="3" Grid.Row="0" Margin="22,2,2,2" Click="buttonUndoTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Undo last overwrite" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/undo.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
</Grid>
</Grid>
</GroupBox>
</Grid>
</ScrollViewer>
</GroupBox>
</src:DetailBaseControl>

View File

@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Diagnostics;
using bsmd.database;
using ENI2.EditControls;
@ -19,8 +20,18 @@ namespace ENI2.DetailViewControls
/// </summary>
public partial class PortCallDetailControl : DetailBaseControl
{
#region Fields
private NOA_NOD _noa_nod;
private AGNT _agnt;
private AGNT _agnt;
private static List<AGNT_Template> _agntTemplates = null;
private AGNT_Template _currentTemplate;
private AGNT_Template _undoTemplate;
#endregion
#region Construction
public PortCallDetailControl()
{
@ -28,6 +39,10 @@ namespace ENI2.DetailViewControls
this.Loaded += PortCallDetailControl_Loaded;
}
#endregion
#region Loading / initialize
private void PortCallDetailControl_Loaded(object sender, RoutedEventArgs e)
{
// NOA_NOD
@ -106,8 +121,19 @@ namespace ENI2.DetailViewControls
this.dateTimePicker_ETDFromPortOfCall.DataContext = _noa_nod;
this.checkBox_IsAnchored.IsEnabled = this.Core.IsDK;
if(_agntTemplates == null)
{
_agntTemplates = DBManager.Instance.GetAGNTTemplates(); // inital full load
_agntTemplates.Sort();
Trace.WriteLine(string.Format("{0} agent templates loaded", _agntTemplates.Count));
}
this.comboBox_AgentTemplate.ItemsSource = _agntTemplates;
}
#endregion
#region datagrid call purposes
private void DataGridCallPurposes_DeleteRequested(DatabaseEntity obj)
@ -223,7 +249,139 @@ namespace ENI2.DetailViewControls
e.Handled = true;
}
#endregion
#endregion
#region AGNT templates combo
private void comboBox_AgentTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Trace.WriteLine("combo selection changed");
AGNT_Template at = this.comboBox_AgentTemplate.SelectedItem as AGNT_Template;
if(at != null)
{
this.textBoxTemplateTitle.Text = at.AgentTitle;
this.buttonDeleteTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = true;
this._currentTemplate = at;
}
}
private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e)
{
if (_currentTemplate != null)
{
if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
this.comboBox_AgentTemplate.SelectedItem = null;
this.comboBox_AgentTemplate.ItemsSource = null;
DBManager.Instance.Delete(_currentTemplate);
_agntTemplates.Remove(_currentTemplate);
this.textBoxTemplateTitle.Text = null;
this.buttonDeleteTemplate.IsEnabled = false;
this.comboBox_AgentTemplate.ItemsSource = _agntTemplates;
this.buttonSetTemplate.IsEnabled = false;
}
}
}
private void buttonSaveTemplate_Click(object sender, RoutedEventArgs e)
{
string title = this.textBoxTemplateTitle.Text.Trim();
if(title.IsNullOrEmpty())
{
MessageBox.Show("Title may not be empty", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
AGNT_Template existingTemplate = null;
foreach(AGNT_Template anExistingTemplate in _agntTemplates)
{
if(anExistingTemplate.AgentTitle.Equals(title,StringComparison.OrdinalIgnoreCase))
{
existingTemplate = anExistingTemplate;
break;
}
}
if(existingTemplate != null)
{
if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
return;
}
this._currentTemplate = createFromCurrentText(title, existingTemplate);
DBManager.Instance.Save(this._currentTemplate);
if(existingTemplate == null)
{
comboBox_AgentTemplate.ItemsSource = null;
_agntTemplates.Add(this._currentTemplate);
_agntTemplates.Sort();
comboBox_AgentTemplate.ItemsSource = _agntTemplates;
}
MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
}
private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
{
this.textBox_AgentCity.Text = this._undoTemplate.AgentCity;
this.textBox_AgentCompanyName.Text = this._undoTemplate.AgentCompanyName;
this.textBox_AgentCountry.Text = this._undoTemplate.AgentCountry;
this.textBox_AgentEMail.Text = this._undoTemplate.AgentEMail;
this.textBox_AgentFax.Text = this._undoTemplate.AgentFax;
this.textBox_AgentFirstName.Text = this._undoTemplate.AgentFirstName;
this.textBox_AgentLastName.Text = this._undoTemplate.AgentLastName;
this.textBox_AgentPhone.Text = this._undoTemplate.AgentPhone;
this.textBox_AgentPostalCode.Text = this._undoTemplate.AgentPostalCode;
this.textBox_AgentStreetAndNumber.Text = this._undoTemplate.AgentStreetAndNumber;
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
}
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
{
this._undoTemplate = createFromCurrentText(null, null);
this.textBox_AgentCity.Text = this._currentTemplate.AgentCity;
this.textBox_AgentCompanyName.Text = this._currentTemplate.AgentCompanyName;
this.textBox_AgentCountry.Text = this._currentTemplate.AgentCountry;
this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail;
this.textBox_AgentFax.Text = this._currentTemplate.AgentFax;
this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName;
this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName;
this.textBox_AgentPhone.Text = this._currentTemplate.AgentPhone;
this.textBox_AgentPostalCode.Text = this._currentTemplate.AgentPostalCode;
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.buttonUndoTemplate.IsEnabled = true;
}
private AGNT_Template createFromCurrentText(string title, AGNT_Template existingTemplate)
{
AGNT_Template at = new AGNT_Template();
if (existingTemplate != null)
at = existingTemplate;
at.AgentTitle = title;
at.AgentCity = this.textBox_AgentCity.Text;
at.AgentCompanyName = this.textBox_AgentCompanyName.Text;
at.AgentCountry = this.textBox_AgentCountry.Text;
at.AgentEMail = this.textBox_AgentEMail.Text;
at.AgentFax = this.textBox_AgentFax.Text;
at.AgentFirstName = this.textBox_AgentFirstName.Text;
at.AgentLastName = this.textBox_AgentLastName.Text;
at.AgentPhone = this.textBox_AgentPhone.Text;
at.AgentPostalCode = this.textBox_AgentPostalCode.Text;
at.AgentStreetAndNumber = textBox_AgentStreetAndNumber.Text;
return at;
}
#endregion
}
}

View File

@ -706,6 +706,7 @@
<Resource Include="Resources\clock_history.png" />
<Resource Include="Resources\clock_history.ico" />
<Resource Include="Resources\document_down.png" />
<Resource Include="Resources\undo.png" />
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -803,6 +803,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Template.
/// </summary>
public static string textAgentTemplate {
get {
return ResourceManager.GetString("textAgentTemplate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Declaration is already cancelled!.
/// </summary>
@ -4448,6 +4457,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Title.
/// </summary>
public static string textTitle {
get {
return ResourceManager.GetString("textTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show message core database fields (Detail).
/// </summary>
@ -4956,6 +4974,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap undo {
get {
object obj = ResourceManager.GetObject("undo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -1729,4 +1729,13 @@
<data name="textMessageStatus" xml:space="preserve">
<value>Message status</value>
</data>
<data name="textAgentTemplate" xml:space="preserve">
<value>Template</value>
</data>
<data name="textTitle" xml:space="preserve">
<value>Title</value>
</data>
<data name="undo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,33 @@
PRINT N'Creating [dbo].[AGNT_template]...';
GO
CREATE TABLE [dbo].[AGNT_template] (
[Id] UNIQUEIDENTIFIER NOT NULL,
[Title] NVARCHAR (50) NULL,
[AgentCompanyName] NVARCHAR (100) NULL,
[AgentStreetAndNumber] NVARCHAR (100) NULL,
[AgentPostalCode] NVARCHAR (25) NULL,
[AgentCity] NVARCHAR (100) NULL,
[AgentCountry] NVARCHAR (100) NULL,
[AgentLastName] NVARCHAR (100) NULL,
[AgentFirstName] NVARCHAR (100) NULL,
[AgentPhone] NVARCHAR (100) NULL,
[AgentFax] NVARCHAR (100) NULL,
[AgentEMail] NVARCHAR (100) NULL,
[Created] DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
[Changed] DATETIME NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO
CREATE TRIGGER AGNT_template_Trigger_Change_Log
ON
dbo.AGNT_TEMPLATE
FOR UPDATE
AS
SET NOCOUNT ON
IF NOT UPDATE([Changed])
UPDATE AGNT_TEMPLATE SET [Changed] = GETDATE() WHERE Id IN (SELECT Id FROM [inserted])
GO

View File

@ -51,7 +51,7 @@ namespace bsmd.database
[ShowReport]
[LookupName("AGNT.AgentPostalCode")]
[MaxLength(99)]
[MaxLength(24)]
[ENI2Validation]
[DataMember]
public string AgentPostalCode { get; set; }

View File

@ -0,0 +1,159 @@
// Copyright (c) 2020-present schick Informatik
// Description: Save location for AGNT templates (lookup / pre-filled)
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Runtime.Serialization;
namespace bsmd.database
{
public class AGNT_Template : DatabaseEntity, IComparable
{
#region Construction
public AGNT_Template()
{
this.tablename = "[dbo].[AGNT_template]";
}
#endregion
#region Properties
[MaxLength(49)]
public string AgentTitle { get; set; }
[MaxLength(99)]
public string AgentCompanyName { get; set; }
[MaxLength(99)]
public string AgentStreetAndNumber { get; set; }
[MaxLength(24)]
public string AgentPostalCode { get; set; }
[MaxLength(99)]
public string AgentCity { get; set; }
[MaxLength(99)]
public string AgentCountry { get; set; }
[MaxLength(99)]
public string AgentLastName { get; set; }
[MaxLength(99)]
public string AgentFirstName { get; set; }
[MaxLength(99)]
public string AgentPhone { get; set; }
[MaxLength(99)]
public string AgentFax { get; set; }
[MaxLength(99)]
public string AgentEMail { get; set; }
#endregion
#region DatabaseEntity implementation
public override void PrepareSave(System.Data.IDbCommand cmd)
{
SqlCommand scmd = cmd as SqlCommand;
if (this.AgentTitle != null) scmd.Parameters.AddWithValue("@P1", this.AgentTitle);
else scmd.Parameters.AddWithValue("@P1", DBNull.Value);
if (this.AgentCompanyName != null) scmd.Parameters.AddWithValue("@P2", this.AgentCompanyName);
else scmd.Parameters.AddWithValue("@P2", DBNull.Value);
if (this.AgentStreetAndNumber != null) scmd.Parameters.AddWithValue("@P3", this.AgentStreetAndNumber);
else scmd.Parameters.AddWithValue("@P3", DBNull.Value);
if (this.AgentPostalCode != null) scmd.Parameters.AddWithValue("@P4", this.AgentPostalCode);
else scmd.Parameters.AddWithValue("@P4", DBNull.Value);
if (this.AgentCity != null) scmd.Parameters.AddWithValue("@P5", this.AgentCity);
else scmd.Parameters.AddWithValue("@P5", DBNull.Value);
if (this.AgentCountry != null) scmd.Parameters.AddWithValue("@P6", this.AgentCountry);
else scmd.Parameters.AddWithValue("@P6", DBNull.Value);
if (this.AgentLastName != null) scmd.Parameters.AddWithValue("@P7", this.AgentLastName);
else scmd.Parameters.AddWithValue("@P7", DBNull.Value);
if (this.AgentFirstName != null) scmd.Parameters.AddWithValue("@P8", this.AgentFirstName);
else scmd.Parameters.AddWithValue("@P8", DBNull.Value);
if (this.AgentPhone != null) scmd.Parameters.AddWithValue("@P9", this.AgentPhone);
else scmd.Parameters.AddWithValue("@P9", DBNull.Value);
if (this.AgentFax != null) scmd.Parameters.AddWithValue("@P10", this.AgentFax);
else scmd.Parameters.AddWithValue("@P10", DBNull.Value);
if (this.AgentEMail != null) scmd.Parameters.AddWithValue("@P11", this.AgentEMail);
else scmd.Parameters.AddWithValue("@P11", DBNull.Value);
if (this.IsNew)
{
this.CreateId();
scmd.Parameters.AddWithValue("@ID", this.Id);
cmd.CommandText = string.Format("INSERT INTO {0} (Id, Title, AgentCompanyName, AgentStreetAndNumber, " +
"AgentPostalCode, AgentCity, AgentCountry, AgentLastName, AgentFirstName, AgentPhone, AgentFax, " +
"AgentEMail) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)", this.Tablename);
}
else
{
cmd.CommandText = string.Format("UPDATE {0} SET Title = @P1, AgentCompanyName = @P2, AgentStreetAndNumber = @P3, AgentPostalCode = @P4, AgentCity = @P5, " +
"AgentCountry = @P6, AgentLastName = @P7, AgentFirstName = @P8, AgentPhone = @P9, AgentFax = @P10, " +
"AgentEMail = @P11 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithValue("@ID", this.Id);
}
}
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, Title, AgentCompanyName, AgentStreetAndNumber, AgentPostalCode, AgentCity, AgentCountry, " +
"AgentLastName, AgentFirstName, AgentPhone, AgentFax, AgentEMail FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.ALL:
default:
break;
}
cmd.CommandText = query;
}
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
AGNT_Template agnt_t = new AGNT_Template();
agnt_t.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) agnt_t.AgentTitle = reader.GetString(1);
if (!reader.IsDBNull(2)) agnt_t.AgentCompanyName = reader.GetString(2);
if (!reader.IsDBNull(3)) agnt_t.AgentStreetAndNumber = reader.GetString(3);
if (!reader.IsDBNull(4)) agnt_t.AgentPostalCode = reader.GetString(4);
if (!reader.IsDBNull(5)) agnt_t.AgentCity = reader.GetString(5);
if (!reader.IsDBNull(6)) agnt_t.AgentCountry = reader.GetString(6);
if (!reader.IsDBNull(7)) agnt_t.AgentLastName = reader.GetString(7);
if (!reader.IsDBNull(8)) agnt_t.AgentFirstName = reader.GetString(8);
if (!reader.IsDBNull(9)) agnt_t.AgentPhone = reader.GetString(9);
if (!reader.IsDBNull(10)) agnt_t.AgentFax = reader.GetString(10);
if (!reader.IsDBNull(11)) agnt_t.AgentEMail = reader.GetString(11);
result.Add(agnt_t);
}
reader.Close();
return result;
}
public int CompareTo(object obj)
{
if (obj is AGNT_Template)
{
return AgentTitle.CompareTo(((AGNT_Template)obj).AgentTitle);
}
return 0;
}
#endregion
}
}

View File

@ -707,6 +707,29 @@ namespace bsmd.database
}
}
public List<AGNT_Template> GetAGNTTemplates()
{
List<AGNT_Template> result = new List<AGNT_Template>();
try
{
using (SqlCommand cmd = new SqlCommand())
{
AGNT_Template agnt_template = new AGNT_Template();
agnt_template.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
IDataReader reader = this.PerformCommand(cmd);
List<DatabaseEntity> a_list = agnt_template.LoadList(reader);
foreach (AGNT_Template aTemplate in a_list)
result.Add(aTemplate);
reader.Close();
}
}
catch(Exception ex)
{
_log.ErrorFormat("Error loading AGNT templates: {0}", ex.Message);
}
return result;
}
#endregion
#region internal/private funcs

View File

@ -65,6 +65,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AGNT.cs" />
<Compile Include="AGNT_Template.cs" />
<Compile Include="CallPurpose.cs" />
<Compile Include="Customer.cs" />
<Compile Include="Extensions.cs" />

View File

@ -5,8 +5,8 @@ ___
# Planung
ENI 6.5.0
ENI 6.5.0: Korrektur SEC / AGNT Vorlagen
ReportGenerator 6.5 (wartet auf Freigabe)
# Aktuell installiert bei BSMD