Added sheet / logic to part 4 Pre-Departure
This commit is contained in:
parent
51d6aeee74
commit
ebbcd1ad97
@ -15,7 +15,6 @@ using ENI2.Util;
|
||||
|
||||
using ENI2.EditControls;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System.Linq;
|
||||
using ENI2.SheetDisplayControls;
|
||||
|
||||
@ -180,7 +179,7 @@ namespace ENI2
|
||||
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.text3PreArrival, MessageGroupControlType = typeof(PreArrivalControl), ImagePath = "Resources/arrow_down_right_red.png" });
|
||||
|
||||
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text4PreDeparture, MessageGroupControlType = typeof(PreDepartureControl), ImagePath = "Resources/arrow_up_right_green.png" });
|
||||
}
|
||||
|
||||
this.listBoxMessages.ItemsSource = this._listBoxList;
|
||||
|
||||
@ -499,6 +499,9 @@
|
||||
<Compile Include="SheetDisplayControls\PreArrivalControl.xaml.cs">
|
||||
<DependentUpon>PreArrivalControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SheetDisplayControls\PreDepartureControl.xaml.cs">
|
||||
<DependentUpon>PreDepartureControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SheetDisplayControls\VoyageControl.xaml.cs">
|
||||
<DependentUpon>VoyageControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -819,6 +822,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="SheetDisplayControls\PreDepartureControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="SheetDisplayControls\VoyageControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
54
ENI2/Properties/Resources.Designer.cs
generated
54
ENI2/Properties/Resources.Designer.cs
generated
@ -1082,6 +1082,60 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 4.1 General.
|
||||
/// </summary>
|
||||
public static string text41General {
|
||||
get {
|
||||
return ResourceManager.GetString("text41General", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 4.2 Persons on board on departure.
|
||||
/// </summary>
|
||||
public static string text42PersonsOnBoard {
|
||||
get {
|
||||
return ResourceManager.GetString("text42PersonsOnBoard", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 4.3 Bunker on departure.
|
||||
/// </summary>
|
||||
public static string text43BunkerOnDeparture {
|
||||
get {
|
||||
return ResourceManager.GetString("text43BunkerOnDeparture", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 4.4 Dangerous cargo on board on departure.
|
||||
/// </summary>
|
||||
public static string text44DangerousCargo {
|
||||
get {
|
||||
return ResourceManager.GetString("text44DangerousCargo", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 4.5 Tow (barge, pontoon etc.) on departure.
|
||||
/// </summary>
|
||||
public static string text45TowOnDeparture {
|
||||
get {
|
||||
return ResourceManager.GetString("text45TowOnDeparture", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 4. Pre-departure.
|
||||
/// </summary>
|
||||
public static string text4PreDeparture {
|
||||
get {
|
||||
return ResourceManager.GetString("text4PreDeparture", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to About ENI-2.
|
||||
/// </summary>
|
||||
|
||||
@ -2026,4 +2026,22 @@
|
||||
<data name="textMatterToReport" xml:space="preserve">
|
||||
<value>if yes, description of matters to report</value>
|
||||
</data>
|
||||
<data name="text4PreDeparture" xml:space="preserve">
|
||||
<value>4. Pre-departure</value>
|
||||
</data>
|
||||
<data name="text42PersonsOnBoard" xml:space="preserve">
|
||||
<value>4.2 Persons on board on departure</value>
|
||||
</data>
|
||||
<data name="text43BunkerOnDeparture" xml:space="preserve">
|
||||
<value>4.3 Bunker on departure</value>
|
||||
</data>
|
||||
<data name="text44DangerousCargo" xml:space="preserve">
|
||||
<value>4.4 Dangerous cargo on board on departure</value>
|
||||
</data>
|
||||
<data name="text45TowOnDeparture" xml:space="preserve">
|
||||
<value>4.5 Tow (barge, pontoon etc.) on departure</value>
|
||||
</data>
|
||||
<data name="text41General" xml:space="preserve">
|
||||
<value>4.1 General</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -10,7 +10,7 @@
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:local="clr-namespace:ENI2.SheetDisplayControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="2450" d:DesignWidth="800">
|
||||
d:DesignHeight="850" d:DesignWidth="800">
|
||||
<GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.text3PreArrival}">
|
||||
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<Grid>
|
||||
|
||||
@ -5,19 +5,9 @@
|
||||
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
|
||||
{
|
||||
|
||||
116
ENI2/SheetDisplayControls/PreDepartureControl.xaml
Normal file
116
ENI2/SheetDisplayControls/PreDepartureControl.xaml
Normal file
@ -0,0 +1,116 @@
|
||||
<src:DetailBaseControl xmlns:src="clr-namespace:ENI2"
|
||||
x:Class="ENI2.SheetDisplayControls.PreDepartureControl"
|
||||
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="850" d:DesignWidth="800">
|
||||
<GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.text4PreDeparture}">
|
||||
<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="1" />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="1" />
|
||||
<RowDefinition Height="1" />
|
||||
|
||||
<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.text41General}" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"/>
|
||||
<Label Grid.Row="1" Content="{x:Static p:Resources.textDraughtOnDepartureLabel}" 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 DraughtUponDeparture_DMT, Mode=TwoWay}" TextAlignment="Left"/>
|
||||
|
||||
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text42PersonsOnBoard}" 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 TotalPersonsOnBoardUponDeparture, 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 TotalCrewMembersOnBoardUponDeparture, 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 TotalPassengersOnBoardUponDeparture, 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 TotalStowawaysOnBoardUponDeparture, 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.text43BunkerOnDeparture}" Grid.Column="0" Grid.Row="11" Grid.ColumnSpan="2"/>
|
||||
<enictrl:ENIDataGrid x:Name="dataGridBKRD" 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.text44DangerousCargo}" 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.text45TowOnDeparture}" Grid.Column="0" Grid.Row="15" Grid.ColumnSpan="2"/>
|
||||
<enictrl:ENIDataGrid Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridTowageOnDeparture" 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>
|
||||
357
ENI2/SheetDisplayControls/PreDepartureControl.xaml.cs
Normal file
357
ENI2/SheetDisplayControls/PreDepartureControl.xaml.cs
Normal file
@ -0,0 +1,357 @@
|
||||
// Copyright (c) 2025 - schick Informatik
|
||||
// Description: Display control of formsheet Tab 4. Pre-Departure
|
||||
//
|
||||
|
||||
using bsmd.database;
|
||||
using ENI2.EditControls;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
|
||||
namespace ENI2.SheetDisplayControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PreDepartureControl.xaml
|
||||
/// </summary>
|
||||
public partial class PreDepartureControl : DetailBaseControl
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private TIEFD _tiefd;
|
||||
private POBD _pobd;
|
||||
private Message _brkaMessage;
|
||||
private Message _brkdMessage;
|
||||
private HAZ _haz;
|
||||
private Message _towaMessage;
|
||||
private Message _towdMessage;
|
||||
|
||||
private bool _ctxInitialized = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Construction
|
||||
|
||||
public PreDepartureControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += PreDepartureControl_Loaded;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public override
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
base.Initialize();
|
||||
foreach (Message aMessage in this.Messages)
|
||||
{
|
||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.TIEFD) { this._tiefd = aMessage.Elements[0] as TIEFD; this.ControlMessages.Add(aMessage); }
|
||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.POBD) { this._pobd = aMessage.Elements[0] as POBD; 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.HAZD) { 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); }
|
||||
}
|
||||
|
||||
// 4.1
|
||||
this.doubleUpDownDraught.DataContext = this._tiefd;
|
||||
|
||||
// 4.2
|
||||
this.integerUpDownPersonsOnBoard.DataContext = this._pobd;
|
||||
this.integerUpDownCrewMemberOnBoard.DataContext = this._pobd;
|
||||
this.integerUpDownPassengersOnBoard.DataContext = this._pobd;
|
||||
this.integerUpDownStowawaysOnBoard.DataContext = this._pobd;
|
||||
|
||||
// 4.3
|
||||
this.dataGridBKRD.Initialize();
|
||||
this.dataGridBKRD.ItemsSource = this._brkaMessage.Elements;
|
||||
this.dataGridBKRD.AddingNewItem += DataGridBKRD_AddingNewItem;
|
||||
this.dataGridBKRD.EditRequested += DataGridBKRD_EditRequested;
|
||||
this.dataGridBKRD.DeleteRequested += DataGridBKRD_DeleteRequested;
|
||||
this.dataGridBKRD.CreateRequested += DataGridBKRD_CreateRequested;
|
||||
|
||||
// 4.4
|
||||
this.checkBoxDangerousGoodsOnBoard.DataContext = this._haz;
|
||||
|
||||
// 4.5
|
||||
if (this._towdMessage == null)
|
||||
{
|
||||
this._towdMessage = this.Core.CreateMessage(Message.NotificationClass.TOWD);
|
||||
this.Messages.Add(this._towdMessage);
|
||||
}
|
||||
this.dataGridTowageOnDeparture.Initialize();
|
||||
this.dataGridTowageOnDeparture.ItemsSource = this._towdMessage.Elements;
|
||||
this.dataGridTowageOnDeparture.AddingNewItem += DataGridTowageOnDeparture_AddingNewItem;
|
||||
this.dataGridTowageOnDeparture.EditRequested += DataGridTowageOnDeparture_EditRequested;
|
||||
this.dataGridTowageOnDeparture.DeleteRequested += DataGridTowageOnDeparture_DeleteRequested;
|
||||
this.dataGridTowageOnDeparture.CreateRequested += DataGridTowageOnDeparture_CreateRequested;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void PreDepartureControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 4.1
|
||||
this.RegisterDoubleUpDownChange(this.doubleUpDownDraught, Message.NotificationClass.TIEFA);
|
||||
|
||||
// 4.2
|
||||
this.RegisterIntegerUpDownChange(this.integerUpDownCrewMemberOnBoard, Message.NotificationClass.POBD);
|
||||
this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBD);
|
||||
this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBD);
|
||||
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBD);
|
||||
|
||||
// 4.3
|
||||
this.dataGridBKRD.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.BKRD); };
|
||||
|
||||
// Extra Menüpunkt um alle Bunker Positionen nach BKRA zu kopieren
|
||||
|
||||
if (!_ctxInitialized)
|
||||
{
|
||||
this.dataGridBKRD.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.dataGridBKRD.ContextMenu.Items.Add(copyBKRItem);
|
||||
}
|
||||
|
||||
// 4.4
|
||||
this.RegisterCheckboxChange(this.checkBoxDangerousGoodsOnBoard, Message.NotificationClass.HAZD);
|
||||
|
||||
// 4.5
|
||||
|
||||
if (!_ctxInitialized)
|
||||
{
|
||||
|
||||
this.dataGridTowageOnDeparture.ContextMenu.Items.Add(new Separator());
|
||||
MenuItem copyItem = new MenuItem();
|
||||
copyItem.Header = string.Format(Properties.Resources.textCopyTo, "TOWA");
|
||||
copyItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
|
||||
copyItem.Click += new RoutedEventHandler(this.copyTOWAItem);
|
||||
this.dataGridTowageOnDeparture.ContextMenu.Items.Add(copyItem);
|
||||
}
|
||||
|
||||
_ctxInitialized = true;
|
||||
}
|
||||
|
||||
private void copyBKR(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.dataGridBKRD.SelectedItems != null)
|
||||
{
|
||||
foreach (BRKD brkd in this.dataGridBKRD.SelectedItems)
|
||||
{
|
||||
BRKA copyBRKA = new BRKA();
|
||||
copyBRKA.MessageHeader = this._brkdMessage;
|
||||
copyBRKA.CopyFromBKRD(brkd);
|
||||
copyBRKA.Identifier = DatabaseEntity.GetNewIdentifier(this._brkaMessage.Elements);
|
||||
this._brkaMessage.Elements.Add(copyBRKA);
|
||||
this.SublistElementChanged(Message.NotificationClass.BKRA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void copyTOWAItem(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// aus dem aktuell selektierten TOWD Element ein neues TOWA Element machen
|
||||
if (this.dataGridTowageOnDeparture.SelectedItems != null)
|
||||
{
|
||||
foreach (TOWD selectedTOWD in this.dataGridTowageOnDeparture.SelectedItems)
|
||||
{
|
||||
TOWA copyTOWA = new TOWA();
|
||||
copyTOWA.MessageHeader = _towaMessage;
|
||||
copyTOWA.CopyFromTOWD(selectedTOWD);
|
||||
copyTOWA.Identifier = TOWA.GetNewIdentifier(this._towaMessage.Elements);
|
||||
this._towaMessage.Elements.Add(copyTOWA);
|
||||
this.SublistElementChanged(Message.NotificationClass.TOWA);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region BKRD grid events
|
||||
|
||||
private void DataGridBKRD_CreateRequested()
|
||||
{
|
||||
this.dataGridBKRD.CancelEdit();
|
||||
this.dataGridBKRD.CancelEdit();
|
||||
EditBKRDialog ebd = new EditBKRDialog();
|
||||
ebd.BRKD = new BRKD();
|
||||
ebd.BRKD.Identifier = BRKD.GetNewIdentifier(this._brkdMessage.Elements);
|
||||
ebd.BRKD.MessageHeader = _brkdMessage;
|
||||
ebd.IsDeparture = true;
|
||||
|
||||
ebd.AddClicked += () =>
|
||||
{
|
||||
ebd.CopyValuesToEntity();
|
||||
if (!this._brkdMessage.Elements.Contains(ebd.BRKD))
|
||||
this._brkdMessage.Elements.Add(ebd.BRKD);
|
||||
this.dataGridBKRD.Items.Refresh();
|
||||
|
||||
ebd.BRKD = new BRKD();
|
||||
ebd.BRKD.Identifier = BRKD.GetNewIdentifier(this._brkdMessage.Elements);
|
||||
ebd.BRKD.MessageHeader = _brkdMessage;
|
||||
this.SublistElementChanged(Message.NotificationClass.BKRD);
|
||||
};
|
||||
|
||||
if (ebd.ShowDialog() ?? false)
|
||||
{
|
||||
if (!_brkdMessage.Elements.Contains(ebd.BRKD))
|
||||
_brkdMessage.Elements.Add(ebd.BRKD);
|
||||
this.dataGridBKRD.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.BKRD);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGridBKRD_DeleteRequested(DatabaseEntity obj)
|
||||
{
|
||||
if (obj is BRKD brkd)
|
||||
{
|
||||
this.dataGridBKRD.CancelEdit();
|
||||
this.dataGridBKRD.CancelEdit();
|
||||
// are you sure dialog is in base class
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brkd);
|
||||
this._brkdMessage.Elements.Remove(brkd);
|
||||
DatabaseEntity.ResetIdentifiers(this._brkdMessage.Elements);
|
||||
this.SublistElementChanged(Message.NotificationClass.BKRD);
|
||||
this.dataGridBKRD.Items.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGridBKRD_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.dataGridBKRD.CancelEdit(DataGridEditingUnit.Row);
|
||||
this.dataGridBKRD.CommitEdit(DataGridEditingUnit.Row, true);
|
||||
|
||||
EditBKRDialog eld = new EditBKRDialog();
|
||||
eld.IsDeparture = true;
|
||||
eld.BRKD = obj as BRKD;
|
||||
|
||||
eld.AddClicked += () =>
|
||||
{
|
||||
eld.CopyValuesToEntity();
|
||||
if (!_brkdMessage.Elements.Contains(eld.BRKD))
|
||||
_brkdMessage.Elements.Add(eld.BRKD);
|
||||
this.dataGridBKRD.ItemsSource = null;
|
||||
this.dataGridBKRD.ItemsSource = this._brkdMessage.Elements;
|
||||
eld.BRKD = new BRKD();
|
||||
eld.BRKD.Identifier = BRKD.GetNewIdentifier(this._brkdMessage.Elements);
|
||||
eld.BRKD.MessageHeader = _brkdMessage;
|
||||
this.SublistElementChanged(Message.NotificationClass.BKRD);
|
||||
};
|
||||
|
||||
if (eld.ShowDialog() ?? false)
|
||||
{
|
||||
if (!_brkdMessage.Elements.Contains(eld.BRKD))
|
||||
_brkdMessage.Elements.Add(eld.BRKD);
|
||||
this.dataGridBKRD.ItemsSource = null;
|
||||
this.dataGridBKRD.ItemsSource = this._brkaMessage.Elements;
|
||||
this.SublistElementChanged(Message.NotificationClass.BKRD);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGridBKRD_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e)
|
||||
{
|
||||
this.DataGridBKRD_CreateRequested();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TOWD grid
|
||||
|
||||
private void DataGridTowageOnDeparture_CreateRequested()
|
||||
{
|
||||
EditTOWDialog ebd = new EditTOWDialog();
|
||||
ebd.IsDeparture = true;
|
||||
ebd.TOWD = new TOWD();
|
||||
ebd.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
|
||||
ebd.TOWD.MessageHeader = this._towdMessage;
|
||||
|
||||
ebd.AddClicked += () =>
|
||||
{
|
||||
ebd.CopyValuesToEntity();
|
||||
if (!this._towdMessage.Elements.Contains(ebd.TOWD))
|
||||
this._towdMessage.Elements.Add(ebd.TOWD);
|
||||
this.dataGridTowageOnDeparture.Items.Refresh();
|
||||
ebd.TOWD = new TOWD();
|
||||
ebd.TOWD.MessageHeader = _towdMessage;
|
||||
ebd.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
|
||||
this.SublistElementChanged(Message.NotificationClass.TOWD);
|
||||
};
|
||||
|
||||
if (ebd.ShowDialog() ?? false)
|
||||
{
|
||||
if (!this._towdMessage.Elements.Contains(ebd.TOWD))
|
||||
_towdMessage.Elements.Add(ebd.TOWD);
|
||||
this.dataGridTowageOnDeparture.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.TOWD);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGridTowageOnDeparture_DeleteRequested(DatabaseEntity obj)
|
||||
{
|
||||
if (obj is TOWD towd)
|
||||
{
|
||||
// are you sure dialog is in base class
|
||||
this._towdMessage.Elements.Remove(towd);
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(towd);
|
||||
DatabaseEntity.ResetIdentifiers(this._towdMessage.Elements);
|
||||
this.SublistElementChanged(Message.NotificationClass.TOWD);
|
||||
this.dataGridTowageOnDeparture.Items.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGridTowageOnDeparture_EditRequested(DatabaseEntity obj)
|
||||
{
|
||||
EditTOWDialog eld = new EditTOWDialog();
|
||||
eld.IsDeparture = true;
|
||||
eld.TOWD = obj as TOWD;
|
||||
|
||||
eld.AddClicked += () =>
|
||||
{
|
||||
eld.CopyValuesToEntity();
|
||||
if (!_towdMessage.Elements.Contains(eld.TOWD))
|
||||
_towdMessage.Elements.Add(eld.TOWD);
|
||||
this.dataGridTowageOnDeparture.Items.Refresh();
|
||||
|
||||
eld.TOWD = new TOWD();
|
||||
eld.TOWD.Identifier = TOWD.GetNewIdentifier(this._towdMessage.Elements);
|
||||
eld.TOWD.MessageHeader = _towdMessage;
|
||||
this.SublistElementChanged(Message.NotificationClass.TOWD);
|
||||
};
|
||||
|
||||
if (eld.ShowDialog() ?? false)
|
||||
{
|
||||
if (!this._towdMessage.Elements.Contains(eld.TOWD))
|
||||
this._towdMessage.Elements.Add(eld.TOWD);
|
||||
this.dataGridTowageOnDeparture.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.TOWD);
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGridTowageOnDeparture_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e)
|
||||
{
|
||||
this.DataGridTowageOnDeparture_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