Added sheet / logic to part 3 Pre-Arrival
This commit is contained in:
parent
ee1c17bb4f
commit
51d6aeee74
@ -179,6 +179,8 @@ namespace ENI2
|
|||||||
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" });
|
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" });
|
||||||
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text1Voyage, MessageGroupControlType = typeof(VoyageControl), ImagePath = "Resources/ship2.png" });
|
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text1Voyage, MessageGroupControlType = typeof(VoyageControl), ImagePath = "Resources/ship2.png" });
|
||||||
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text2PortCall, MessageGroupControlType = typeof(PortControl), ImagePath = "Resources/anchor.png" });
|
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text2PortCall, MessageGroupControlType = typeof(PortControl), ImagePath = "Resources/anchor.png" });
|
||||||
|
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text3PreArrival, MessageGroupControlType = typeof(PreArrivalControl), ImagePath = "Resources/arrow_down_right_red.png" });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.listBoxMessages.ItemsSource = this._listBoxList;
|
this.listBoxMessages.ItemsSource = this._listBoxList;
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
private void copyItemToTOWA(object sender, RoutedEventArgs e)
|
private void copyItemToTOWA(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// aus dem aktuell selektierten TOWA Element ein neues TOWD Element machen
|
// aus dem aktuell selektierten TOWD Element ein neues TOWA Element machen
|
||||||
if (this.dataGridTowageOnDeparture.SelectedItems != null)
|
if (this.dataGridTowageOnDeparture.SelectedItems != null)
|
||||||
{
|
{
|
||||||
foreach (TOWD selectedTOWD in this.dataGridTowageOnDeparture.SelectedItems)
|
foreach (TOWD selectedTOWD in this.dataGridTowageOnDeparture.SelectedItems)
|
||||||
@ -166,8 +166,7 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
private void DataGridTowageOnDeparture_DeleteRequested(DatabaseEntity obj)
|
private void DataGridTowageOnDeparture_DeleteRequested(DatabaseEntity obj)
|
||||||
{
|
{
|
||||||
TOWD towd = obj as TOWD;
|
if (obj is TOWD towd)
|
||||||
if (towd != null)
|
|
||||||
{
|
{
|
||||||
// are you sure dialog is in base class
|
// are you sure dialog is in base class
|
||||||
this._towdMessage.Elements.Remove(towd);
|
this._towdMessage.Elements.Remove(towd);
|
||||||
@ -245,8 +244,7 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
private void DataGridTowageOnArrival_DeleteRequested(DatabaseEntity obj)
|
private void DataGridTowageOnArrival_DeleteRequested(DatabaseEntity obj)
|
||||||
{
|
{
|
||||||
TOWA towa = obj as TOWA;
|
if (obj is TOWA towa)
|
||||||
if (towa != null)
|
|
||||||
{
|
{
|
||||||
// are you sure dialog is in base class
|
// are you sure dialog is in base class
|
||||||
this._towaMessage.Elements.Remove(towa);
|
this._towaMessage.Elements.Remove(towa);
|
||||||
|
|||||||
@ -496,6 +496,9 @@
|
|||||||
<Compile Include="SheetDisplayControls\PortControl.xaml.cs">
|
<Compile Include="SheetDisplayControls\PortControl.xaml.cs">
|
||||||
<DependentUpon>PortControl.xaml</DependentUpon>
|
<DependentUpon>PortControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="SheetDisplayControls\PreArrivalControl.xaml.cs">
|
||||||
|
<DependentUpon>PreArrivalControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="SheetDisplayControls\VoyageControl.xaml.cs">
|
<Compile Include="SheetDisplayControls\VoyageControl.xaml.cs">
|
||||||
<DependentUpon>VoyageControl.xaml</DependentUpon>
|
<DependentUpon>VoyageControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -812,6 +815,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="SheetDisplayControls\PreArrivalControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="SheetDisplayControls\VoyageControl.xaml">
|
<Page Include="SheetDisplayControls\VoyageControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
72
ENI2/Properties/Resources.Designer.cs
generated
72
ENI2/Properties/Resources.Designer.cs
generated
@ -1028,6 +1028,60 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to 3.1 General.
|
||||||
|
/// </summary>
|
||||||
|
public static string text31General {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("text31General", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to 3.2 Persons on board on arrival.
|
||||||
|
/// </summary>
|
||||||
|
public static string text32PersonsOnBoard {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("text32PersonsOnBoard", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to 3.3 Bunker on arrival.
|
||||||
|
/// </summary>
|
||||||
|
public static string text33BunkerOnArrival {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("text33BunkerOnArrival", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to 3.4 Dangerous cargo on board on arrival.
|
||||||
|
/// </summary>
|
||||||
|
public static string text34DangerousCargo {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("text34DangerousCargo", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to 3.5 Tow (barge, pontoon, etc.) on arrival.
|
||||||
|
/// </summary>
|
||||||
|
public static string text36TowOnArrival {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("text36TowOnArrival", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to 3. Pre-arrival.
|
||||||
|
/// </summary>
|
||||||
|
public static string text3PreArrival {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("text3PreArrival", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to About ENI-2.
|
/// Looks up a localized string similar to About ENI-2.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1172,6 +1226,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Are any security-related matters to report?.
|
||||||
|
/// </summary>
|
||||||
|
public static string textAreMatterToReport {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textAreMatterToReport", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Are you sure?.
|
/// Looks up a localized string similar to Are you sure?.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -3512,6 +3575,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to if yes, description of matters to report.
|
||||||
|
/// </summary>
|
||||||
|
public static string textMatterToReport {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textMatterToReport", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Max acitivity.
|
/// Looks up a localized string similar to Max acitivity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2002,4 +2002,28 @@
|
|||||||
<data name="textOfficialUse" xml:space="preserve">
|
<data name="textOfficialUse" xml:space="preserve">
|
||||||
<value>Official use</value>
|
<value>Official use</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="text3PreArrival" xml:space="preserve">
|
||||||
|
<value>3. Pre-arrival</value>
|
||||||
|
</data>
|
||||||
|
<data name="text31General" xml:space="preserve">
|
||||||
|
<value>3.1 General</value>
|
||||||
|
</data>
|
||||||
|
<data name="text32PersonsOnBoard" xml:space="preserve">
|
||||||
|
<value>3.2 Persons on board on arrival</value>
|
||||||
|
</data>
|
||||||
|
<data name="text33BunkerOnArrival" xml:space="preserve">
|
||||||
|
<value>3.3 Bunker on arrival</value>
|
||||||
|
</data>
|
||||||
|
<data name="text34DangerousCargo" xml:space="preserve">
|
||||||
|
<value>3.4 Dangerous cargo on board on arrival</value>
|
||||||
|
</data>
|
||||||
|
<data name="text36TowOnArrival" xml:space="preserve">
|
||||||
|
<value>3.5 Tow (barge, pontoon, etc.) on arrival</value>
|
||||||
|
</data>
|
||||||
|
<data name="textAreMatterToReport" xml:space="preserve">
|
||||||
|
<value>Are any security-related matters to report?</value>
|
||||||
|
</data>
|
||||||
|
<data name="textMatterToReport" xml:space="preserve">
|
||||||
|
<value>if yes, description of matters to report</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@ -11,17 +11,9 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace ENI2.SheetDisplayControls
|
namespace ENI2.SheetDisplayControls
|
||||||
{
|
{
|
||||||
@ -88,7 +80,6 @@ namespace ENI2.SheetDisplayControls
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
foreach (Message aMessage in this.Messages)
|
foreach (Message aMessage in this.Messages)
|
||||||
{
|
{
|
||||||
if (aMessage.Elements.Count == 0) continue;
|
|
||||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.LADG) { this._ladgMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.LADG) { this._ladgMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.SERV) { this._servMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.SERV) { this._servMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) { this._noa_nod = aMessage.Elements[0] as NOA_NOD; this.ControlMessages.Add(aMessage); }
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) { this._noa_nod = aMessage.Elements[0] as NOA_NOD; this.ControlMessages.Add(aMessage); }
|
||||||
|
|||||||
124
ENI2/SheetDisplayControls/PreArrivalControl.xaml
Normal file
124
ENI2/SheetDisplayControls/PreArrivalControl.xaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<src:DetailBaseControl xmlns:src="clr-namespace:ENI2"
|
||||||
|
x:Class="ENI2.SheetDisplayControls.PreArrivalControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:p="clr-namespace:ENI2.Properties"
|
||||||
|
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||||
|
xmlns:util="clr-namespace:ENI2.Util"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
|
xmlns:local="clr-namespace:ENI2.SheetDisplayControls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="2450" d:DesignWidth="800">
|
||||||
|
<GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.text3PreArrival}">
|
||||||
|
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width=".35*"/>
|
||||||
|
<ColumnDefinition Width=".65*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="140" />
|
||||||
|
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="140" />
|
||||||
|
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text31General}" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"/>
|
||||||
|
<Label Grid.Row="1" Content="{x:Static p:Resources.textDraughtOnArrivalLabel}" Grid.Column="0" HorizontalContentAlignment="Right" Margin="0,0,10,0"/>
|
||||||
|
<xctk:DoubleUpDown Grid.Row="1" Grid.Column="1" Name="doubleUpDownDraught" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N1" Value="{Binding DraughtUponArrival_DMT, Mode=TwoWay}" TextAlignment="Left"/>
|
||||||
|
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textCurrentShipSecLevel}" Name="label_CurrentShipSecLevel" Margin="0,0,10,0"/>
|
||||||
|
<ComboBox Name="comboBoxCurrentShipSecurityLevel" Grid.Row="2" Grid.Column="1" SelectedValue="{Binding CurrentShipSecurityLevel}" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
|
||||||
|
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textAnchored}" Name="label_IsAnchored" Margin="0,0,10,0" />
|
||||||
|
<CheckBox Grid.Column="1" Grid.Row="3" IsThreeState="True" VerticalContentAlignment="Center" Name="checkBox_IsAnchored" IsChecked="{Binding IsAnchored}"/>
|
||||||
|
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textAreMatterToReport}" Name="label_AreMatterToReport" Margin="0,0,10,0"/>
|
||||||
|
<CheckBox Grid.Column="1" Grid.Row="4" IsThreeState="True" VerticalContentAlignment="Center" Name="checkBox_AreMatterToReport" IsChecked="{Binding IsAnchored}"/>
|
||||||
|
<Label HorizontalContentAlignment="Right" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textMatterToReport}" Name="label_MatterToReport" Margin="0,0,10,0"/>
|
||||||
|
<TextBox Name="textBoxMatterToReport" Grid.Row="5" Grid.Column="1" MaxLength="1024" Text="{Binding MatterToReport, Converter={util:TrimStringConverter}}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text32PersonsOnBoard}" Grid.Column="0" Grid.Row="6" Grid.ColumnSpan="2"/>
|
||||||
|
<Label Content="{x:Static p:Resources.textPersonsOnBoard}" Grid.Column="0" Grid.Row="7" HorizontalContentAlignment="Right" Margin="0,0,10,0"/>
|
||||||
|
<xctk:IntegerUpDown Value="{Binding TotalPersonsOnBoardUponArrival, Mode=TwoWay}" Grid.Row="7" Grid.Column="1" Name="integerUpDownPersonsOnBoard" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" TextAlignment="Left"/>
|
||||||
|
<Label Content="{x:Static p:Resources.textCrewMemberOnBoard}" Grid.Column="0" Grid.Row="8" HorizontalContentAlignment="Right" Margin="0,0,10,0"/>
|
||||||
|
<xctk:IntegerUpDown Value="{Binding TotalCrewMembersOnBoardUponArrival, Mode=TwoWay}" Grid.Row="8" Grid.Column="1" Name="integerUpDownCrewMemberOnBoard" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" TextAlignment="Left"/>
|
||||||
|
<Label Content="{x:Static p:Resources.textPassengersOnBoard}" Grid.Column="0" Grid.Row="9" HorizontalContentAlignment="Right" Margin="0,0,10,0"/>
|
||||||
|
<xctk:IntegerUpDown Value="{Binding TotalPassengersOnBoardUponArrival, Mode=TwoWay}" Grid.Row="9" Grid.Column="1" Name="integerUpDownPassengersOnBoard" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" TextAlignment="Left"/>
|
||||||
|
<Label Content="{x:Static p:Resources.textStowawaysOnBoard}" Grid.Column="0" Grid.Row="10" HorizontalContentAlignment="Right" Margin="0,0,10,0"/>
|
||||||
|
<xctk:IntegerUpDown Value="{Binding TotalStowawaysOnBoardUponArrival, Mode=TwoWay}" Grid.Row="10" Grid.Column="1" Name="integerUpDownStowawaysOnBoard" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" TextAlignment="Left"/>
|
||||||
|
|
||||||
|
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text33BunkerOnArrival}" Grid.Column="0" Grid.Row="11" Grid.ColumnSpan="2"/>
|
||||||
|
<enictrl:ENIDataGrid x:Name="dataGridBKRA" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Grid.Row="12" Grid.ColumnSpan="2"
|
||||||
|
AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerType}" Width="0.2*">
|
||||||
|
<DataGridTextColumn.Binding>
|
||||||
|
<Binding Path="BunkerFuelType" Mode="TwoWay">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<util:StringValidationRule MaxLength="25" />
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</DataGridTextColumn.Binding>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerQuantity}" IsReadOnly="False" Width="0.8*">
|
||||||
|
<DataGridTextColumn.Binding>
|
||||||
|
<Binding Path="BunkerFuelQuantity_TNE" Mode="TwoWay">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<util:NumberValidationRule MaxValue="10000"/>
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</DataGridTextColumn.Binding>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</enictrl:ENIDataGrid>
|
||||||
|
|
||||||
|
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text34DangerousCargo}" Grid.Column="0" Grid.Row="13" Grid.ColumnSpan="2"/>
|
||||||
|
<Label Content="{x:Static p:Resources.textDangerousGoodsOnBoard}" Grid.Column="0" Grid.Row="14" HorizontalContentAlignment="Right" Margin="0,0,10,0"/>
|
||||||
|
<CheckBox Name="checkBoxDangerousGoodsOnBoard" IsChecked="{Binding NoDPGOnBoardOnArrival, Converter={util:InverseBooleanConverter}}" Grid.Row="14" Grid.Column="1" VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text36TowOnArrival}" Grid.Column="0" Grid.Row="15" Grid.ColumnSpan="2"/>
|
||||||
|
<enictrl:ENIDataGrid Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridTowageOnArrival" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textName}" Binding="{Binding TowageOnArrivalName}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textPurposeOfCall}" Binding="{Binding TowageOnArrivalPurposeOfCall}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textFlag}" Binding="{Binding TowageOnArrivalFlag}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textDraughtInDecimetre}" Binding="{Binding TowageOnArrivalDraught_DMT, StringFormat={}{0:N1}}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textGrossTonnage}" Binding="{Binding TowageOnArrivalGrossTonnage}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textLengthOverAll}" Binding="{Binding TowageOnArrivalLengthOverall_MTR, StringFormat={}{0:N2}}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textBeamOverAll}" Binding="{Binding TowageOnArrivalBeam_MTR, StringFormat={}{0:N2}}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textRemarks}" Binding="{Binding TowageOnArrivalRemarks}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textCompanyName}" Binding="{Binding TowageOnArrivalOperatorCompanyName}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textStreetNumber}" Binding="{Binding TowageOnArrivalOperatorStreetNameAndNumber}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textPostalCode}" Binding="{Binding TowageOnArrivalOperatorPostalCode}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textCity}" Binding="{Binding TowageOnArrivalOperatorCity}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textCountry}" Binding="{Binding TowageOnArrivalOperatorCountry}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textEMail}" Binding="{Binding TowageOnArrivalOperatorEmail}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textPhone}" Binding="{Binding TowageOnArrivalOperatorPhone}" IsReadOnly="True" Width="Auto" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textFax}" Binding="{Binding TowageOnArrivalOperatorFax}" IsReadOnly="True" Width="Auto" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</enictrl:ENIDataGrid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
|
</GroupBox>
|
||||||
|
</src:DetailBaseControl>
|
||||||
381
ENI2/SheetDisplayControls/PreArrivalControl.xaml.cs
Normal file
381
ENI2/SheetDisplayControls/PreArrivalControl.xaml.cs
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
// Copyright (c) 2025 - schick Informatik
|
||||||
|
// Description: Display control of formsheet Tab 3. Pre-Arrival
|
||||||
|
//
|
||||||
|
|
||||||
|
using bsmd.database;
|
||||||
|
using ENI2.EditControls;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ENI2.SheetDisplayControls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for PreArrivalControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PreArrivalControl : DetailBaseControl
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private TIEFA _tiefa;
|
||||||
|
private SEC _sec;
|
||||||
|
private NOA_NOD _noa_nod;
|
||||||
|
private POBA _poba;
|
||||||
|
private Message _brkaMessage;
|
||||||
|
private Message _brkdMessage;
|
||||||
|
private HAZ _haz;
|
||||||
|
private Message _towaMessage;
|
||||||
|
private Message _towdMessage;
|
||||||
|
|
||||||
|
private bool _ctxInitialized = false;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Construction
|
||||||
|
|
||||||
|
public PreArrivalControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Loaded += PreArrivalControl_Loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public override
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
|
||||||
|
base.Initialize();
|
||||||
|
foreach (Message aMessage in this.Messages)
|
||||||
|
{
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.TIEFA) { this._tiefa = aMessage.Elements[0] as TIEFA; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) { this._sec = aMessage.Elements[0] as SEC; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) { this._noa_nod = aMessage.Elements[0] as NOA_NOD; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.POBA) { this._poba = aMessage.Elements[0] as POBA; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.BKRA) { this._brkaMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.BKRD) { this._brkdMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) { this._haz = aMessage.Elements[0] as HAZ; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.TOWA) { this._towaMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.TOWD) { this._towdMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.1
|
||||||
|
this.doubleUpDownDraught.DataContext = this._tiefa;
|
||||||
|
this.comboBoxCurrentShipSecurityLevel.ItemsSource = Util.GlobalStructures.ShipSecurityLevels;
|
||||||
|
this.comboBoxCurrentShipSecurityLevel.DataContext = this._sec;
|
||||||
|
this.checkBox_IsAnchored.DataContext = this._noa_nod;
|
||||||
|
this.checkBox_AreMatterToReport.DataContext = this._sec;
|
||||||
|
this.textBoxMatterToReport.DataContext = this._sec;
|
||||||
|
|
||||||
|
// 3.2
|
||||||
|
this.integerUpDownPersonsOnBoard.DataContext = this._poba;
|
||||||
|
this.integerUpDownCrewMemberOnBoard.DataContext = this._poba;
|
||||||
|
this.integerUpDownPassengersOnBoard.DataContext = this._poba;
|
||||||
|
this.integerUpDownStowawaysOnBoard.DataContext = this._poba;
|
||||||
|
|
||||||
|
// 3.3
|
||||||
|
this.dataGridBKRA.Initialize();
|
||||||
|
this.dataGridBKRA.ItemsSource = this._brkaMessage.Elements;
|
||||||
|
this.dataGridBKRA.AddingNewItem += DataGridBKRA_AddingNewItem;
|
||||||
|
this.dataGridBKRA.EditRequested += DataGridBKRA_EditRequested;
|
||||||
|
this.dataGridBKRA.DeleteRequested += DataGridBKRA_DeleteRequested;
|
||||||
|
this.dataGridBKRA.CreateRequested += DataGridBKRA_CreateRequested;
|
||||||
|
|
||||||
|
// 3.4
|
||||||
|
this.checkBoxDangerousGoodsOnBoard.DataContext = this._haz;
|
||||||
|
|
||||||
|
// 3.5
|
||||||
|
if (this._towaMessage == null)
|
||||||
|
{
|
||||||
|
this._towaMessage = this.Core.CreateMessage(Message.NotificationClass.TOWA);
|
||||||
|
this.Messages.Add(this._towaMessage);
|
||||||
|
}
|
||||||
|
this.dataGridTowageOnArrival.Initialize();
|
||||||
|
this.dataGridTowageOnArrival.ItemsSource = this._towaMessage.Elements;
|
||||||
|
this.dataGridTowageOnArrival.AddingNewItem += DataGridTowageOnArrival_AddingNewItem;
|
||||||
|
this.dataGridTowageOnArrival.EditRequested += DataGridTowageOnArrival_EditRequested;
|
||||||
|
this.dataGridTowageOnArrival.DeleteRequested += DataGridTowageOnArrival_DeleteRequested;
|
||||||
|
this.dataGridTowageOnArrival.CreateRequested += DataGridTowageOnArrival_CreateRequested;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void PreArrivalControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// 3.1
|
||||||
|
this.RegisterDoubleUpDownChange(this.doubleUpDownDraught, Message.NotificationClass.TIEFA);
|
||||||
|
this.RegisterComboboxIndexChange(this.comboBoxCurrentShipSecurityLevel, Message.NotificationClass.SEC);
|
||||||
|
this.RegisterCheckboxChange(this.checkBox_IsAnchored, Message.NotificationClass.NOA_NOD);
|
||||||
|
this.RegisterCheckboxChange(this.checkBox_AreMatterToReport, Message.NotificationClass.SEC);
|
||||||
|
this.RegisterTextboxChange(this.textBoxMatterToReport, Message.NotificationClass.SEC);
|
||||||
|
|
||||||
|
// 3.2
|
||||||
|
this.RegisterIntegerUpDownChange(this.integerUpDownCrewMemberOnBoard, Message.NotificationClass.POBA);
|
||||||
|
this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBA);
|
||||||
|
this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBA);
|
||||||
|
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBA);
|
||||||
|
|
||||||
|
// 3.3
|
||||||
|
this.dataGridBKRA.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.BKRA); };
|
||||||
|
|
||||||
|
// Extra Menüpunkt um alle Bunker Positionen nach BKRD zu kopieren
|
||||||
|
|
||||||
|
if (!_ctxInitialized)
|
||||||
|
{
|
||||||
|
this.dataGridBKRA.ContextMenu.Items.Add(new Separator());
|
||||||
|
MenuItem copyBKRItem = new MenuItem();
|
||||||
|
copyBKRItem.Header = Properties.Resources.textCopyToBKRD;
|
||||||
|
copyBKRItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
|
||||||
|
copyBKRItem.Click += this.copyBKR;
|
||||||
|
this.dataGridBKRA.ContextMenu.Items.Add(copyBKRItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3.4
|
||||||
|
this.RegisterCheckboxChange(this.checkBoxDangerousGoodsOnBoard, Message.NotificationClass.HAZA);
|
||||||
|
|
||||||
|
// 3.5
|
||||||
|
|
||||||
|
if (!_ctxInitialized)
|
||||||
|
{
|
||||||
|
|
||||||
|
this.dataGridTowageOnArrival.ContextMenu.Items.Add(new Separator());
|
||||||
|
MenuItem copyItem = new MenuItem();
|
||||||
|
copyItem.Header = string.Format(Properties.Resources.textCopyTo, "TOWD");
|
||||||
|
copyItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
|
||||||
|
copyItem.Click += new RoutedEventHandler(this.copyTOWAItem);
|
||||||
|
this.dataGridTowageOnArrival.ContextMenu.Items.Add(copyItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ctxInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyBKR(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.dataGridBKRA.SelectedItems != null)
|
||||||
|
{
|
||||||
|
foreach (BRKA brka in this.dataGridBKRA.SelectedItems)
|
||||||
|
{
|
||||||
|
BRKD copyBRKD = new BRKD();
|
||||||
|
copyBRKD.MessageHeader = this._brkdMessage;
|
||||||
|
copyBRKD.CopyFromBKRA(brka);
|
||||||
|
copyBRKD.Identifier = DatabaseEntity.GetNewIdentifier(this._brkdMessage.Elements);
|
||||||
|
this._brkdMessage.Elements.Add(copyBRKD);
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.BKRD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyTOWAItem(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
// aus dem aktuell selektierten TOWA Element ein neues TOWD Element machen
|
||||||
|
if (this.dataGridTowageOnArrival.SelectedItems != null)
|
||||||
|
{
|
||||||
|
foreach (TOWA selectedTOWA in this.dataGridTowageOnArrival.SelectedItems)
|
||||||
|
{
|
||||||
|
TOWD copyTOWD = new TOWD();
|
||||||
|
copyTOWD.MessageHeader = _towdMessage;
|
||||||
|
copyTOWD.CopyFromTOWA(selectedTOWA);
|
||||||
|
copyTOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
|
||||||
|
this._towdMessage.Elements.Add(copyTOWD);
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.TOWD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region BKRA grid events
|
||||||
|
|
||||||
|
private void DataGridBKRA_CreateRequested()
|
||||||
|
{
|
||||||
|
this.dataGridBKRA.CancelEdit();
|
||||||
|
this.dataGridBKRA.CancelEdit();
|
||||||
|
EditBKRDialog ebd = new EditBKRDialog();
|
||||||
|
ebd.BRKA = new BRKA();
|
||||||
|
ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._brkaMessage.Elements);
|
||||||
|
ebd.BRKA.MessageHeader = _brkaMessage;
|
||||||
|
ebd.IsDeparture = false;
|
||||||
|
|
||||||
|
ebd.AddClicked += () =>
|
||||||
|
{
|
||||||
|
ebd.CopyValuesToEntity();
|
||||||
|
if (!this._brkaMessage.Elements.Contains(ebd.BRKA))
|
||||||
|
this._brkaMessage.Elements.Add(ebd.BRKA);
|
||||||
|
this.dataGridBKRA.Items.Refresh();
|
||||||
|
|
||||||
|
ebd.BRKA = new BRKA();
|
||||||
|
ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._brkaMessage.Elements);
|
||||||
|
ebd.BRKA.MessageHeader = _brkaMessage;
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.BKRA);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ebd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
if (!_brkaMessage.Elements.Contains(ebd.BRKA))
|
||||||
|
_brkaMessage.Elements.Add(ebd.BRKA);
|
||||||
|
this.dataGridBKRA.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.BKRA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridBKRA_DeleteRequested(DatabaseEntity obj)
|
||||||
|
{
|
||||||
|
if (obj is BRKA brka)
|
||||||
|
{
|
||||||
|
this.dataGridBKRA.CancelEdit();
|
||||||
|
this.dataGridBKRA.CancelEdit();
|
||||||
|
// are you sure dialog is in base class
|
||||||
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brka);
|
||||||
|
this._brkaMessage.Elements.Remove(brka);
|
||||||
|
DatabaseEntity.ResetIdentifiers(this._brkaMessage.Elements);
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.BKRA);
|
||||||
|
this.dataGridBKRA.Items.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridBKRA_EditRequested(DatabaseEntity obj)
|
||||||
|
{
|
||||||
|
// I am not shitting you: this has to be called TWICE(!) in a row in order to work
|
||||||
|
// see: https://stackoverflow.com/questions/20204592/wpf-datagrid-refresh-is-not-allowed-during-an-addnew-or-edititem-transaction-m
|
||||||
|
this.dataGridBKRA.CancelEdit(DataGridEditingUnit.Row);
|
||||||
|
this.dataGridBKRA.CommitEdit(DataGridEditingUnit.Row, true);
|
||||||
|
|
||||||
|
EditBKRDialog eld = new EditBKRDialog();
|
||||||
|
eld.IsDeparture = false;
|
||||||
|
eld.BRKA = obj as BRKA;
|
||||||
|
|
||||||
|
eld.AddClicked += () =>
|
||||||
|
{
|
||||||
|
eld.CopyValuesToEntity();
|
||||||
|
if (!_brkaMessage.Elements.Contains(eld.BRKA))
|
||||||
|
_brkaMessage.Elements.Add(eld.BRKA);
|
||||||
|
this.dataGridBKRA.ItemsSource = null;
|
||||||
|
this.dataGridBKRA.ItemsSource = this._brkaMessage.Elements;
|
||||||
|
eld.BRKA = new BRKA();
|
||||||
|
eld.BRKA.Identifier = BRKA.GetNewIdentifier(this._brkaMessage.Elements);
|
||||||
|
eld.BRKA.MessageHeader = _brkaMessage;
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.BKRA);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (eld.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
if (!_brkaMessage.Elements.Contains(eld.BRKA))
|
||||||
|
_brkaMessage.Elements.Add(eld.BRKA);
|
||||||
|
this.dataGridBKRA.ItemsSource = null;
|
||||||
|
this.dataGridBKRA.ItemsSource = this._brkaMessage.Elements;
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.BKRA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridBKRA_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e)
|
||||||
|
{
|
||||||
|
this.DataGridBKRA_CreateRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region TOWA grid
|
||||||
|
|
||||||
|
private void DataGridTowageOnArrival_CreateRequested()
|
||||||
|
{
|
||||||
|
EditTOWDialog ebd = new EditTOWDialog();
|
||||||
|
ebd.IsDeparture = false;
|
||||||
|
ebd.TOWA = new TOWA();
|
||||||
|
ebd.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
|
||||||
|
ebd.TOWA.MessageHeader = this._towaMessage;
|
||||||
|
|
||||||
|
ebd.AddClicked += () =>
|
||||||
|
{
|
||||||
|
ebd.CopyValuesToEntity();
|
||||||
|
if (!this._towaMessage.Elements.Contains(ebd.TOWA))
|
||||||
|
this._towaMessage.Elements.Add(ebd.TOWA);
|
||||||
|
this.dataGridTowageOnArrival.Items.Refresh();
|
||||||
|
ebd.TOWA = new TOWA();
|
||||||
|
ebd.TOWA.MessageHeader = _towaMessage;
|
||||||
|
ebd.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.TOWA);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ebd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
if (!this._towaMessage.Elements.Contains(ebd.TOWA))
|
||||||
|
_towaMessage.Elements.Add(ebd.TOWA);
|
||||||
|
this.dataGridTowageOnArrival.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.TOWA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridTowageOnArrival_DeleteRequested(DatabaseEntity obj)
|
||||||
|
{
|
||||||
|
if (obj is TOWA towa)
|
||||||
|
{
|
||||||
|
// are you sure dialog is in base class
|
||||||
|
this._towaMessage.Elements.Remove(towa);
|
||||||
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(towa);
|
||||||
|
DatabaseEntity.ResetIdentifiers(this._towaMessage.Elements);
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.TOWA);
|
||||||
|
this.dataGridTowageOnArrival.Items.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridTowageOnArrival_EditRequested(DatabaseEntity obj)
|
||||||
|
{
|
||||||
|
EditTOWDialog eld = new EditTOWDialog();
|
||||||
|
eld.IsDeparture = false;
|
||||||
|
eld.TOWA = obj as TOWA;
|
||||||
|
|
||||||
|
eld.AddClicked += () =>
|
||||||
|
{
|
||||||
|
eld.CopyValuesToEntity();
|
||||||
|
if (!_towaMessage.Elements.Contains(eld.TOWA))
|
||||||
|
_towaMessage.Elements.Add(eld.TOWA);
|
||||||
|
this.dataGridTowageOnArrival.Items.Refresh();
|
||||||
|
|
||||||
|
eld.TOWA = new TOWA();
|
||||||
|
eld.TOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
|
||||||
|
eld.TOWA.MessageHeader = _towaMessage;
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.TOWA);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (eld.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
if (!this._towaMessage.Elements.Contains(eld.TOWA))
|
||||||
|
this._towaMessage.Elements.Add(eld.TOWA);
|
||||||
|
this.dataGridTowageOnArrival.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.TOWA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridTowageOnArrival_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e)
|
||||||
|
{
|
||||||
|
this.DataGridTowageOnArrival_CreateRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region mouse wheel
|
||||||
|
|
||||||
|
private void ScrollViewer_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
||||||
|
{
|
||||||
|
ScrollViewer scv = (ScrollViewer)sender;
|
||||||
|
scv.ScrollToVerticalOffset(scv.VerticalOffset - e.Delta);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user