Merge branch 'release/eni_7.12'
This commit is contained in:
commit
8d3f82ee96
@ -82,6 +82,9 @@ namespace ENI2
|
|||||||
LADG.CargoCodesNST = LocalizedLookup.getCargoCodesNST();
|
LADG.CargoCodesNST = LocalizedLookup.getCargoCodesNST();
|
||||||
LADG.CargoCodesNST3 = LocalizedLookup.getCargoCodesNST3();
|
LADG.CargoCodesNST3 = LocalizedLookup.getCargoCodesNST3();
|
||||||
|
|
||||||
|
// Load import value mappings
|
||||||
|
ValueMapping.LoadDicts();
|
||||||
|
|
||||||
// Preload validation fields
|
// Preload validation fields
|
||||||
List<ValidationField> vFields = bsmd.database.ValidationRule.ValidationFields;
|
List<ValidationField> vFields = bsmd.database.ValidationRule.ValidationFields;
|
||||||
RuleEngine.RegisterLocodeChecker(Util.GlobalStructures.IsValidLocode);
|
RuleEngine.RegisterLocodeChecker(Util.GlobalStructures.IsValidLocode);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace ENI2.Controls
|
|||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly ObservableCollection<MaerskData> maerskDataList = new ObservableCollection<MaerskData>();
|
private readonly ObservableCollection<MaerskData> maerskDataList = new ObservableCollection<MaerskData>();
|
||||||
private readonly DatabaseEntityWatchdog _dbWatchDog;
|
private readonly DatabaseEntityWatchdog _dbWatchDog;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
68
ENI2/Controls/ValueMappingsControl.xaml
Normal file
68
ENI2/Controls/ValueMappingsControl.xaml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<UserControl x:Class="ENI2.Controls.ValueMappingsControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ENI2.Controls"
|
||||||
|
xmlns:p="clr-namespace:ENI2.Properties"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Grid.Row="0" Content="{x:Static p:Resources.textExcelValueMappings}" />
|
||||||
|
<GroupBox Name="groupBoxRP" Header="" Grid.Row="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="40" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="40" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="50" />
|
||||||
|
<ColumnDefinition Width="30" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Content="Type" Grid.Column="0" />
|
||||||
|
<ComboBox Margin="2" Grid.Column="1" x:Name="comboBoxType" SelectionChanged="comboBoxType_SelectionChanged" />
|
||||||
|
|
||||||
|
<local:BusyControl x:Name="busyControl" Grid.Column="2" />
|
||||||
|
<Button x:Name="buttonSave" Grid.Column="6" Margin="2" Content="Save all changes" Click="buttonSave_Click" />
|
||||||
|
<Button x:Name="buttonImport" Grid.Column="9" Margin="2" Content="Import" Click="buttonImport_Click" IsEnabled="False" />
|
||||||
|
<Button x:Name="buttonExport" Grid.Column="10" Margin="2" Content="Export" Click="buttonExport_Click" IsEnabled="False" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridValueMappings" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
|
SelectionMode="Extended" AutoGenerateColumns="False" CellEditEnding="dataGridValueMappings_CellEditEnding" CanUserAddRows="False"
|
||||||
|
MouseDoubleClick="dataGridValueMappings_MouseDoubleClick" BeginningEdit="dataGridValueMappings_BeginningEdit">
|
||||||
|
<local:ENIDataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Value}" Value="*">
|
||||||
|
<Setter Property="Background" Value="Pink"></Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</local:ENIDataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn x:Name="columnKey" Header="Key" Binding="{Binding Key, Mode=TwoWay}" IsReadOnly="False" />
|
||||||
|
<DataGridTextColumn x:Name="columnValue" Header="Value key" Binding="{Binding Value, Mode=TwoWay}" IsReadOnly="False" />
|
||||||
|
<DataGridTextColumn x:Name="columnValueText" Header="Value text" Binding="{Binding ValueText, Mode=TwoWay}" IsReadOnly="True" />
|
||||||
|
<DataGridTextColumn Header="Created" Binding="{Binding Created}" IsReadOnly="True" />
|
||||||
|
<DataGridTextColumn Header="Changed" Binding="{Binding Changed}" IsReadOnly="True" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</local:ENIDataGrid>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
212
ENI2/Controls/ValueMappingsControl.xaml.cs
Normal file
212
ENI2/Controls/ValueMappingsControl.xaml.cs
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
using bsmd.database;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
namespace ENI2.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ValueMappingsControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ValueMappingsControl : UserControl
|
||||||
|
{
|
||||||
|
private readonly ObservableCollection<ValueMapping> _mappings = new ObservableCollection<ValueMapping>();
|
||||||
|
private DataGridCellInfo activeCellAtEdit;
|
||||||
|
|
||||||
|
public ValueMappingsControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.comboBoxType.ItemsSource = Enum.GetValues(typeof(ValueMapping.MappingType)).Cast<ValueMapping.MappingType>();
|
||||||
|
this.dataGridValueMappings.ItemsSource = _mappings;
|
||||||
|
|
||||||
|
this.dataGridValueMappings.ContextMenu = new ContextMenu();
|
||||||
|
MenuItem addItem = new MenuItem
|
||||||
|
{
|
||||||
|
Header = Properties.Resources.textAdd,
|
||||||
|
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) }
|
||||||
|
};
|
||||||
|
|
||||||
|
addItem.Click += AddItem_Click;
|
||||||
|
this.dataGridValueMappings.ContextMenu.Items.Add(addItem);
|
||||||
|
|
||||||
|
MenuItem delItem = new MenuItem
|
||||||
|
{
|
||||||
|
Header = Properties.Resources.textDelete,
|
||||||
|
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) }
|
||||||
|
};
|
||||||
|
|
||||||
|
delItem.Click += DelItem_Click;
|
||||||
|
this.dataGridValueMappings.ContextMenu.Items.Add(delItem);
|
||||||
|
|
||||||
|
MenuItem invalidItem = new MenuItem
|
||||||
|
{
|
||||||
|
Header = "Set as invalid key",
|
||||||
|
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/sign_warning_radiation.png")) }
|
||||||
|
};
|
||||||
|
invalidItem.Click += InvalidItem_Click;
|
||||||
|
this.dataGridValueMappings.ContextMenu.Items.Add(invalidItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region context menu event handler
|
||||||
|
|
||||||
|
private void InvalidItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.dataGridValueMappings.SelectedItem is ValueMapping vm)
|
||||||
|
{
|
||||||
|
vm.Value = "*";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void DelItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.dataGridValueMappings.SelectedItem is ValueMapping vm)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show($"Are you sure to delete {vm.Key} -> {vm.Value}?", Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) ==
|
||||||
|
MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
int result = await DBManagerAsync.DeleteAsync(vm);
|
||||||
|
if (result == 1)
|
||||||
|
{
|
||||||
|
_mappings.Remove(vm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ValueMapping.MappingType? mappingType = (ValueMapping.MappingType?) this.comboBoxType.SelectedItem;
|
||||||
|
if (mappingType == null) return;
|
||||||
|
ValueMapping vm = ValueMapping.Create(mappingType.Value);
|
||||||
|
_mappings.Add(vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void dataGridValueMappings_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
|
{
|
||||||
|
// we need to check that there are no keys entered twice or changed into something that is already here
|
||||||
|
string newValue = ((TextBox)e.EditingElement).Text;
|
||||||
|
if (newValue == null) return;
|
||||||
|
|
||||||
|
if (e.Column == columnKey)
|
||||||
|
{
|
||||||
|
ValueMapping editedMapping = e.Row.Item as ValueMapping;
|
||||||
|
foreach(ValueMapping vm in _mappings)
|
||||||
|
{
|
||||||
|
if (vm == editedMapping) continue; // dont compare with myself
|
||||||
|
if (vm.Key == newValue)
|
||||||
|
{
|
||||||
|
((TextBox)e.EditingElement).Text = editedMapping.Key;
|
||||||
|
e.Cancel = true; // hopefully this avoids writing back to the model
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(e.Column == columnValue)
|
||||||
|
{
|
||||||
|
ValueMapping editedMapping = e.Row.Item as ValueMapping;
|
||||||
|
|
||||||
|
ValueMapping.MappingType? mappingType = (ValueMapping.MappingType)this.comboBoxType.SelectedItem;
|
||||||
|
if ((mappingType != null) && (newValue != null))
|
||||||
|
{
|
||||||
|
switch (mappingType)
|
||||||
|
{
|
||||||
|
case ValueMapping.MappingType.GENDER:
|
||||||
|
if (Util.GlobalStructures.GenderDict.ContainsKey(newValue))
|
||||||
|
editedMapping.ValueText = Util.GlobalStructures.GenderDict[newValue];
|
||||||
|
else
|
||||||
|
editedMapping.ValueText = "";
|
||||||
|
break;
|
||||||
|
case ValueMapping.MappingType.DOCUMENT_TYPE:
|
||||||
|
if (Util.GlobalStructures.IDDocTypeDict.ContainsKey(newValue))
|
||||||
|
editedMapping.ValueText = Util.GlobalStructures.IDDocTypeDict[newValue];
|
||||||
|
else
|
||||||
|
editedMapping.ValueText = "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
editedMapping.ValueText = newValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridValueMappings_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonImport_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonExport_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void comboBoxType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
this._mappings.Clear();
|
||||||
|
|
||||||
|
if(this.comboBoxType.SelectedItem != null)
|
||||||
|
{
|
||||||
|
ValueMapping.MappingType mappingType = (ValueMapping.MappingType)this.comboBoxType.SelectedItem;
|
||||||
|
List<ValueMapping> mappings = await DBManagerAsync.LoadValuesForType(mappingType);
|
||||||
|
foreach (ValueMapping vm in mappings)
|
||||||
|
{
|
||||||
|
// add "Klartext"
|
||||||
|
switch(mappingType)
|
||||||
|
{
|
||||||
|
case ValueMapping.MappingType.GENDER:
|
||||||
|
if (Util.GlobalStructures.GenderDict.ContainsKey(vm.Value))
|
||||||
|
vm.ValueText = Util.GlobalStructures.GenderDict[vm.Value];
|
||||||
|
break;
|
||||||
|
case ValueMapping.MappingType.DOCUMENT_TYPE:
|
||||||
|
if (Util.GlobalStructures.IDDocTypeDict.ContainsKey(vm.Value))
|
||||||
|
vm.ValueText = Util.GlobalStructures.IDDocTypeDict[vm.Value];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
vm.ValueText = vm.Value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_mappings.Add(vm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridValueMappings_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||||
|
{
|
||||||
|
this.activeCellAtEdit = this.dataGridValueMappings.CurrentCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void buttonSave_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
int totalSaves = 0;
|
||||||
|
foreach(ValueMapping vm in _mappings)
|
||||||
|
{
|
||||||
|
if (vm.Key.IsNullOrEmpty()) continue;
|
||||||
|
if (vm.IsNew || vm.IsDirty)
|
||||||
|
{
|
||||||
|
totalSaves += await DBManagerAsync.SaveAsync(vm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(totalSaves > 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{totalSaves} value mappings saved", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -302,7 +302,7 @@ namespace ENI2.DetailViewControls
|
|||||||
ewrd.AddClicked += () =>
|
ewrd.AddClicked += () =>
|
||||||
{
|
{
|
||||||
ewrd.CopyValuesToEntity();
|
ewrd.CopyValuesToEntity();
|
||||||
if (!this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
if ((ewrd.WasteReceived.WasteCode != null) && !this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
||||||
{
|
{
|
||||||
this._selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
this._selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
||||||
this.dataGridWasteReceived.Items.Refresh();
|
this.dataGridWasteReceived.Items.Refresh();
|
||||||
@ -315,7 +315,7 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
if (ewrd.ShowDialog() ?? false)
|
if (ewrd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
if (!this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
if ((ewrd.WasteReceived.WasteCode != null) && !this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
||||||
{
|
{
|
||||||
this._selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
this._selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
||||||
this.dataGridWasteReceived.Items.Refresh();
|
this.dataGridWasteReceived.Items.Refresh();
|
||||||
@ -333,7 +333,7 @@ namespace ENI2.DetailViewControls
|
|||||||
ewrd.AddClicked += () =>
|
ewrd.AddClicked += () =>
|
||||||
{
|
{
|
||||||
ewrd.CopyValuesToEntity();
|
ewrd.CopyValuesToEntity();
|
||||||
if (!this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
if ((ewrd.WasteReceived.WasteCode != null) && !this._selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
||||||
{
|
{
|
||||||
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
||||||
this.dataGridWasteReceived.Items.Refresh();
|
this.dataGridWasteReceived.Items.Refresh();
|
||||||
@ -346,9 +346,9 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
if (ewrd.ShowDialog() ?? false)
|
if (ewrd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
if (!_selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
if ((ewrd.WasteReceived.WasteCode != null) && !_selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode))
|
||||||
{
|
{
|
||||||
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
_selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived);
|
||||||
}
|
}
|
||||||
this.dataGridWasteReceived.Items.Refresh();
|
this.dataGridWasteReceived.Items.Refresh();
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
|
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
|
||||||
|
|||||||
@ -36,8 +36,8 @@
|
|||||||
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
|
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
|
||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>publish.html</WebPage>
|
<WebPage>publish.html</WebPage>
|
||||||
<ApplicationRevision>6</ApplicationRevision>
|
<ApplicationRevision>3</ApplicationRevision>
|
||||||
<ApplicationVersion>7.11.0.%2a</ApplicationVersion>
|
<ApplicationVersion>7.12.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@ -185,20 +185,20 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.Toolkit, Version=4.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.Toolkit, Version=4.5.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.3.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.4.5.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -234,6 +234,9 @@
|
|||||||
<Compile Include="Controls\MaerskOverviewControl.xaml.cs">
|
<Compile Include="Controls\MaerskOverviewControl.xaml.cs">
|
||||||
<DependentUpon>MaerskOverviewControl.xaml</DependentUpon>
|
<DependentUpon>MaerskOverviewControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\ValueMappingsControl.xaml.cs">
|
||||||
|
<DependentUpon>ValueMappingsControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="EditControls\CompareExcelDialog.xaml.cs">
|
<Compile Include="EditControls\CompareExcelDialog.xaml.cs">
|
||||||
<DependentUpon>CompareExcelDialog.xaml</DependentUpon>
|
<DependentUpon>CompareExcelDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -494,6 +497,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Controls\ValueMappingsControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="ControlTemplates.xaml">
|
<Page Include="ControlTemplates.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@ -15,17 +15,18 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ENI2.Excel
|
namespace ENI2.Excel
|
||||||
{
|
{
|
||||||
public static class ExcelUtil
|
public static class ExcelUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#region fields
|
||||||
|
|
||||||
private static readonly ILog _log = LogManager.GetLogger(typeof(ExcelUtil));
|
private static readonly ILog _log = LogManager.GetLogger(typeof(ExcelUtil));
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> _countryImportDict = new Dictionary<string, string>();
|
#endregion
|
||||||
private static readonly Dictionary<string, string> _genderImportDict = new Dictionary<string, string>();
|
|
||||||
private static readonly Dictionary<string, string> _documentTypeImportDict = new Dictionary<string, string>();
|
|
||||||
private static readonly Dictionary<string, string> _locodeImportDict = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
#region Process Sheet (normal BSMD sheet import)
|
#region Process Sheet (normal BSMD sheet import)
|
||||||
|
|
||||||
@ -56,6 +57,8 @@ namespace ENI2.Excel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValueMapping.LoadDicts(); // reload all messaging dicts (also removes "temporary" entries from last run)
|
||||||
|
|
||||||
// load messages if already present
|
// load messages if already present
|
||||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.ALL);
|
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.ALL);
|
||||||
|
|
||||||
@ -1340,8 +1343,7 @@ namespace ENI2.Excel
|
|||||||
wr.WasteCode.Equals("204") || wr.WasteCode.Equals("510") || wr.WasteCode.Equals("511"))
|
wr.WasteCode.Equals("204") || wr.WasteCode.Equals("510") || wr.WasteCode.Equals("511"))
|
||||||
wr.WasteDescription = "-";
|
wr.WasteDescription = "-";
|
||||||
}
|
}
|
||||||
wr.AmountWasteReceived_MTQ = reader.ReadNumber(wAmount);
|
wr.AmountWasteReceived_MTQ = reader.ReadNumber(wAmount) ?? (double?)0; // Default ist 0, nicht nix ;-)
|
||||||
if (!wr.AmountWasteReceived_MTQ.HasValue) wr.AmountWasteReceived_MTQ = 0; // Default ist 0, nicht nix ;-)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// only add message when an identification number was given
|
// only add message when an identification number was given
|
||||||
@ -2104,6 +2106,8 @@ namespace ENI2.Excel
|
|||||||
if (canceled) return true;
|
if (canceled) return true;
|
||||||
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 18));
|
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 18));
|
||||||
crew.CrewMemberCountryOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 18));
|
crew.CrewMemberCountryOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 18));
|
||||||
|
if ((crew.CrewMemberCountryOfBirth != null) && (crew.CrewMemberCountryOfBirth.Length > 2)) crew.CrewMemberCountryOfBirth = null;
|
||||||
|
|
||||||
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("J{0}", i + 18));
|
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("J{0}", i + 18));
|
||||||
|
|
||||||
crew.CrewMemberIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 18)), out canceled);
|
crew.CrewMemberIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 18)), out canceled);
|
||||||
@ -2214,6 +2218,7 @@ namespace ENI2.Excel
|
|||||||
if (canceled) return true;
|
if (canceled) return true;
|
||||||
crewd.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 18));
|
crewd.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 18));
|
||||||
crewd.CrewMemberCountryOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 18));
|
crewd.CrewMemberCountryOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 18));
|
||||||
|
if ((crewd.CrewMemberCountryOfBirth != null) && (crewd.CrewMemberCountryOfBirth.Length > 2)) crewd.CrewMemberCountryOfBirth = null;
|
||||||
crewd.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("J{0}", i + 18));
|
crewd.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("J{0}", i + 18));
|
||||||
|
|
||||||
|
|
||||||
@ -2226,9 +2231,7 @@ namespace ENI2.Excel
|
|||||||
if (canceled) return true;
|
if (canceled) return true;
|
||||||
if (crewd.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty())
|
if (crewd.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty())
|
||||||
crewd.CrewMemberIdentityDocumentIssuingState = "XX";
|
crewd.CrewMemberIdentityDocumentIssuingState = "XX";
|
||||||
crewd.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("N{0}", i + 18));
|
crewd.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("N{0}", i + 18)) ?? (DateTime?)new DateTime(2100, 12, 31);
|
||||||
if (!crewd.CrewMemberIdentityDocumentExpiryDate.HasValue)
|
|
||||||
crewd.CrewMemberIdentityDocumentExpiryDate = new DateTime(2100, 12, 31);
|
|
||||||
|
|
||||||
crewd.Effects = reader.ReadCellAsText("2. PORT", string.Format("C{0}", i + 142));
|
crewd.Effects = reader.ReadCellAsText("2. PORT", string.Format("C{0}", i + 142));
|
||||||
|
|
||||||
@ -2333,7 +2336,9 @@ namespace ENI2.Excel
|
|||||||
pas.PassengerInTransit = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", i + 17));
|
pas.PassengerInTransit = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", i + 17));
|
||||||
|
|
||||||
pas.PassengerPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 17));
|
pas.PassengerPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 17));
|
||||||
pas.PassengerCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 17)), out canceled);
|
pas.PassengerCountryOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 17));
|
||||||
|
if ((pas.PassengerCountryOfBirth != null) && (pas.PassengerCountryOfBirth.Length > 2)) pas.PassengerCountryOfBirth = null;
|
||||||
|
|
||||||
if (canceled) return true;
|
if (canceled) return true;
|
||||||
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("L{0}", i + 17));
|
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("L{0}", i + 17));
|
||||||
pas.PassengerDateOfBirth = dateOfBirth;
|
pas.PassengerDateOfBirth = dateOfBirth;
|
||||||
@ -2342,9 +2347,7 @@ namespace ENI2.Excel
|
|||||||
if (canceled) return true;
|
if (canceled) return true;
|
||||||
pas.PassengerIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("N{0}", i + 17));
|
pas.PassengerIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("N{0}", i + 17));
|
||||||
|
|
||||||
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("P{0}", i + 17));
|
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("P{0}", i + 17)) ?? (DateTime?)new DateTime(2100, 12, 31);
|
||||||
if (!pas.PassengerIdentityDocumentExpiryDate.HasValue)
|
|
||||||
pas.PassengerIdentityDocumentExpiryDate = new DateTime(2100, 12, 31);
|
|
||||||
|
|
||||||
pas.PassengerVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("Q{0}", i + 17));
|
pas.PassengerVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("Q{0}", i + 17));
|
||||||
pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 17));
|
pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 17));
|
||||||
@ -2474,9 +2477,7 @@ namespace ENI2.Excel
|
|||||||
pas.PassengerIdentityDocumentId = reader.ReadText(pasIdentDocId);
|
pas.PassengerIdentityDocumentId = reader.ReadText(pasIdentDocId);
|
||||||
pas.PassengerVisaNumber = reader.ReadText(pasVisaNo);
|
pas.PassengerVisaNumber = reader.ReadText(pasVisaNo);
|
||||||
pas.PassengerIdentityDocumentIssuingState = reader.ReadNationality(pasIssuing);
|
pas.PassengerIdentityDocumentIssuingState = reader.ReadNationality(pasIssuing);
|
||||||
pas.PassengerIdentityDocumentExpiryDate = reader.ReadDate(pasExpiryDate);
|
pas.PassengerIdentityDocumentExpiryDate = reader.ReadDate(pasExpiryDate) ?? (DateTime?)new DateTime(2100, 12, 31);
|
||||||
if (!pas.PassengerIdentityDocumentExpiryDate.HasValue)
|
|
||||||
pas.PassengerIdentityDocumentExpiryDate = new DateTime(2100, 12, 31);
|
|
||||||
pas.PassengerCountryOfBirth = reader.ReadNationality(pasCountryOfBirth);
|
pas.PassengerCountryOfBirth = reader.ReadNationality(pasCountryOfBirth);
|
||||||
pas.EmergencyCare = reader.ReadText(pasEmergencyCare);
|
pas.EmergencyCare = reader.ReadText(pasEmergencyCare);
|
||||||
pas.EmergencyContactNumber = reader.ReadText(pasEmergencyContact);
|
pas.EmergencyContactNumber = reader.ReadText(pasEmergencyContact);
|
||||||
@ -2589,8 +2590,6 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
#endregion LookupMessageCore
|
#endregion LookupMessageCore
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region GetMessageWithType
|
#region GetMessageWithType
|
||||||
|
|
||||||
private static Message GetMessageWithType(List<Message> messages, MessageCore core, Message.NotificationClass type)
|
private static Message GetMessageWithType(List<Message> messages, MessageCore core, Message.NotificationClass type)
|
||||||
@ -2622,9 +2621,9 @@ namespace ENI2.Excel
|
|||||||
if (!gender.IsNullOrEmpty() && !result.HasValue)
|
if (!gender.IsNullOrEmpty() && !result.HasValue)
|
||||||
{
|
{
|
||||||
// special treatment / callback
|
// special treatment / callback
|
||||||
if (_genderImportDict.ContainsKey(gender))
|
if (ValueMapping.Dicts[ValueMapping.MappingType.GENDER].ContainsKey(gender))
|
||||||
{
|
{
|
||||||
result = byte.Parse(_genderImportDict[gender]); // we have mapped this before
|
result = byte.Parse(ValueMapping.Dicts[ValueMapping.MappingType.GENDER][gender].Value); // we have mapped this before
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2636,8 +2635,23 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if (!fid.SelectedValue.IsNullOrEmpty())
|
if (!fid.SelectedValue.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
_genderImportDict[gender] = fid.SelectedValue;
|
if (!ValueMapping.InvalidKeys[ValueMapping.MappingType.GENDER].Contains(gender))
|
||||||
result = byte.Parse(_genderImportDict[gender]);
|
{
|
||||||
|
string selectedValue = fid.SelectedValue;
|
||||||
|
Task<bool> createResult = Task.Run(async () => await ValueMapping.Create(ValueMapping.MappingType.GENDER, gender, selectedValue));
|
||||||
|
if (!createResult.Result)
|
||||||
|
_log.WarnFormat("Error saving gender value mapping {0} -> {1}", gender, selectedValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add temporary
|
||||||
|
ValueMapping vm = ValueMapping.Create(ValueMapping.MappingType.GENDER);
|
||||||
|
vm.Key = gender;
|
||||||
|
vm.Value = fid.SelectedValue;
|
||||||
|
ValueMapping.Dicts[ValueMapping.MappingType.GENDER].Add(gender, vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = byte.Parse(fid.SelectedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2668,9 +2682,9 @@ namespace ENI2.Excel
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// special treatment / callback
|
// special treatment / callback
|
||||||
if (_documentTypeImportDict.ContainsKey(documentType))
|
if (ValueMapping.Dicts[ValueMapping.MappingType.DOCUMENT_TYPE].ContainsKey(documentType))
|
||||||
{
|
{
|
||||||
result = byte.Parse(_documentTypeImportDict[documentType]); // we have mapped this before
|
result = byte.Parse(ValueMapping.Dicts[ValueMapping.MappingType.DOCUMENT_TYPE][documentType].Value); // we have mapped this before
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2682,8 +2696,23 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if (!fid.SelectedValue.IsNullOrEmpty())
|
if (!fid.SelectedValue.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
_documentTypeImportDict[documentType] = fid.SelectedValue;
|
if(!ValueMapping.InvalidKeys[ValueMapping.MappingType.DOCUMENT_TYPE].Contains(documentType))
|
||||||
result = byte.Parse(_documentTypeImportDict[documentType]);
|
{
|
||||||
|
string selectedValue = fid.SelectedValue;
|
||||||
|
Task<bool> createResult = Task.Run<bool>(async () => await ValueMapping.Create(ValueMapping.MappingType.DOCUMENT_TYPE, documentType, selectedValue));
|
||||||
|
if (!createResult.Result)
|
||||||
|
_log.WarnFormat("Error saving document type value mapping {0} -> {1}", documentType, selectedValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add temporary
|
||||||
|
ValueMapping vm = ValueMapping.Create(ValueMapping.MappingType.DOCUMENT_TYPE);
|
||||||
|
vm.Key = documentType;
|
||||||
|
vm.Value = fid.SelectedValue;
|
||||||
|
ValueMapping.Dicts[ValueMapping.MappingType.DOCUMENT_TYPE].Add(documentType, vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
result = byte.Parse(fid.SelectedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2714,9 +2743,9 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
result = CREW.NationalityDict.FirstOrDefault(x => x.Value.Substring(3).Equals(nationality, StringComparison.OrdinalIgnoreCase)).Key;
|
result = CREW.NationalityDict.FirstOrDefault(x => x.Value.Substring(3).Equals(nationality, StringComparison.OrdinalIgnoreCase)).Key;
|
||||||
}
|
}
|
||||||
else if (_countryImportDict.ContainsKey(nationality))
|
else if (ValueMapping.Dicts[ValueMapping.MappingType.COUNTRY].ContainsKey(nationality))
|
||||||
{
|
{
|
||||||
result = _countryImportDict[nationality];
|
result = ValueMapping.Dicts[ValueMapping.MappingType.COUNTRY][nationality].Value;
|
||||||
}
|
}
|
||||||
else // we cannot find whatever this is..
|
else // we cannot find whatever this is..
|
||||||
{
|
{
|
||||||
@ -2728,7 +2757,21 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if (!fid.SelectedValue.IsNullOrEmpty())
|
if (!fid.SelectedValue.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
_countryImportDict[nationality] = fid.SelectedValue;
|
if(!ValueMapping.InvalidKeys[ValueMapping.MappingType.COUNTRY].Contains(nationality))
|
||||||
|
{
|
||||||
|
string selectedValue = fid.SelectedValue;
|
||||||
|
Task<bool> createResult = Task.Run(async () => await ValueMapping.Create(ValueMapping.MappingType.COUNTRY, nationality, selectedValue));
|
||||||
|
if(!createResult.Result)
|
||||||
|
_log.WarnFormat("Error saving nationality value mapping {0} -> {1}", nationality, selectedValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add temporary
|
||||||
|
ValueMapping vm = ValueMapping.Create(ValueMapping.MappingType.COUNTRY);
|
||||||
|
vm.Key = nationality;
|
||||||
|
vm.Value = fid.SelectedValue;
|
||||||
|
ValueMapping.Dicts[ValueMapping.MappingType.COUNTRY].Add(nationality, vm);
|
||||||
|
}
|
||||||
result = fid.SelectedValue.Substring(0, 2); // attention manual entry
|
result = fid.SelectedValue.Substring(0, 2); // attention manual entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2761,7 +2804,7 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
if (possibleLocodes.Count > 1)
|
if (possibleLocodes.Count > 1)
|
||||||
{
|
{
|
||||||
if (!_locodeImportDict.ContainsKey(val))
|
if (!ValueMapping.Dicts[ValueMapping.MappingType.LOCODE].ContainsKey(val))
|
||||||
{
|
{
|
||||||
FixImportDialog fid = new FixImportDialog();
|
FixImportDialog fid = new FixImportDialog();
|
||||||
fid.Value = val;
|
fid.Value = val;
|
||||||
@ -2772,15 +2815,28 @@ namespace ENI2.Excel
|
|||||||
fid.SelectionValues = ld;
|
fid.SelectionValues = ld;
|
||||||
if (fid.ShowDialog() ?? false)
|
if (fid.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
_locodeImportDict[val] = fid.SelectedValue;
|
string selectedValue = fid.SelectedValue;
|
||||||
|
if (!ValueMapping.InvalidKeys[ValueMapping.MappingType.LOCODE].Contains(selectedValue)) {
|
||||||
|
Task<bool> createResult = Task.Run<bool>(async () => await ValueMapping.Create(ValueMapping.MappingType.LOCODE, val, selectedValue));
|
||||||
|
if (!createResult.Result)
|
||||||
|
_log.WarnFormat("Error saving locode value mapping {0} -> {1}", val, selectedValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add temporary
|
||||||
|
ValueMapping vm = ValueMapping.Create(ValueMapping.MappingType.LOCODE);
|
||||||
|
vm.Key = val;
|
||||||
|
vm.Value = fid.SelectedValue;
|
||||||
|
ValueMapping.Dicts[ValueMapping.MappingType.LOCODE].Add(val, vm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
canceled = true;
|
canceled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_locodeImportDict.ContainsKey(val))
|
if (ValueMapping.Dicts[ValueMapping.MappingType.LOCODE].ContainsKey(val))
|
||||||
result = _locodeImportDict[val];
|
result = ValueMapping.Dicts[ValueMapping.MappingType.LOCODE][val].Value;
|
||||||
}
|
}
|
||||||
else if (possibleLocodes.Count == 1)
|
else if (possibleLocodes.Count == 1)
|
||||||
{
|
{
|
||||||
@ -2788,7 +2844,7 @@ namespace ENI2.Excel
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!_locodeImportDict.ContainsKey(val))
|
if (!ValueMapping.Dicts[ValueMapping.MappingType.LOCODE].ContainsKey(val))
|
||||||
{
|
{
|
||||||
// nothing found, let the user pick a locode by himself
|
// nothing found, let the user pick a locode by himself
|
||||||
FixImportDialog fid = new FixImportDialog();
|
FixImportDialog fid = new FixImportDialog();
|
||||||
@ -2797,11 +2853,25 @@ namespace ENI2.Excel
|
|||||||
fid.LocodeMode = true;
|
fid.LocodeMode = true;
|
||||||
if (fid.ShowDialog() ?? false)
|
if (fid.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
_locodeImportDict[val] = fid.SelectedValue;
|
if (!ValueMapping.InvalidKeys[ValueMapping.MappingType.LOCODE].Contains(fid.SelectedValue))
|
||||||
|
{
|
||||||
|
string selectedValue = fid.SelectedValue;
|
||||||
|
Task<bool> createResult = Task.Run(async () => await ValueMapping.Create(ValueMapping.MappingType.LOCODE, val, selectedValue));
|
||||||
|
if (!createResult.Result)
|
||||||
|
_log.WarnFormat("Error saving locode value mapping {0} -> {1}", val, selectedValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// add temporary
|
||||||
|
ValueMapping vm = ValueMapping.Create(ValueMapping.MappingType.LOCODE);
|
||||||
|
vm.Key = val;
|
||||||
|
vm.Value = fid.SelectedValue;
|
||||||
|
ValueMapping.Dicts[ValueMapping.MappingType.LOCODE].Add(val, vm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_locodeImportDict.ContainsKey(val))
|
if (ValueMapping.Dicts[ValueMapping.MappingType.LOCODE].ContainsKey(val))
|
||||||
result = _locodeImportDict[val];
|
result = ValueMapping.Dicts[ValueMapping.MappingType.LOCODE][val].Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -82,10 +82,10 @@ namespace ENI2.Excel
|
|||||||
//case Message.NotificationClass.CREWD: // XXX-TODO
|
//case Message.NotificationClass.CREWD: // XXX-TODO
|
||||||
// this.WriteCREW(message, false, isRefSheet);
|
// this.WriteCREW(message, false, isRefSheet);
|
||||||
// break;
|
// break;
|
||||||
case Message.NotificationClass.HAZA:
|
case Message.NotificationClass.HAZA:
|
||||||
this.WriteHAZ(message, true);
|
this.WriteHAZ(message, true);
|
||||||
break;
|
break;
|
||||||
case Message.NotificationClass.HAZD:
|
case Message.NotificationClass.HAZD:
|
||||||
this.WriteHAZ(message, false);
|
this.WriteHAZ(message, false);
|
||||||
break;
|
break;
|
||||||
case Message.NotificationClass.INFO:
|
case Message.NotificationClass.INFO:
|
||||||
@ -141,13 +141,13 @@ namespace ENI2.Excel
|
|||||||
if (message.Elements[0] is STAT stat)
|
if (message.Elements[0] is STAT stat)
|
||||||
{
|
{
|
||||||
this.WriteMessage(stat);
|
this.WriteMessage(stat);
|
||||||
this.WriteSTAT(stat, isRefSheet);
|
this.WriteSTAT(stat, isRefSheet);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Message.NotificationClass.STO:
|
case Message.NotificationClass.STO:
|
||||||
this.WriteSTO(message);
|
this.WriteSTO(message);
|
||||||
break;
|
break;
|
||||||
case Message.NotificationClass.TIEFA:
|
case Message.NotificationClass.TIEFA:
|
||||||
if (message.Elements[0] is TIEFA tiefa)
|
if (message.Elements[0] is TIEFA tiefa)
|
||||||
{
|
{
|
||||||
// Ref-Sheet: dm, neues Formblatt: m
|
// Ref-Sheet: dm, neues Formblatt: m
|
||||||
@ -180,7 +180,7 @@ namespace ENI2.Excel
|
|||||||
_log.InfoFormat("skip writing message class {0}", message.MessageNotificationClassDisplay);
|
_log.InfoFormat("skip writing message class {0}", message.MessageNotificationClassDisplay);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -306,7 +306,7 @@ namespace ENI2.Excel
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ReportDocument.cargoCodesNST.TryGetValue(ladg.CargoCodeNST, out string cargoCode))
|
if (ReportDocument.cargoCodesNST.TryGetValue(ladg.CargoCodeNST, out string cargoCode))
|
||||||
WriteText(lnType, cargoCode.Substring(3)); // description w/o code
|
WriteText(lnType, cargoCode.Substring(3)); // description w/o code
|
||||||
}
|
}
|
||||||
WriteText(lnZusatz, ladg.CargoCodeNST_3);
|
WriteText(lnZusatz, ladg.CargoCodeNST_3);
|
||||||
WriteNumber(lnCNOI, ladg.CargoNumberOfItems);
|
WriteNumber(lnCNOI, ladg.CargoNumberOfItems);
|
||||||
@ -423,10 +423,10 @@ namespace ENI2.Excel
|
|||||||
if (isRefSheet)
|
if (isRefSheet)
|
||||||
{
|
{
|
||||||
WriteText(crewIssuingState, crew.CrewMemberIdentityDocumentIssuingState);
|
WriteText(crewIssuingState, crew.CrewMemberIdentityDocumentIssuingState);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!crew.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty() && !crew.CrewMemberIdentityDocumentIssuingState.Equals("XX"))
|
if(!crew.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty() && !crew.CrewMemberIdentityDocumentIssuingState.Equals("XX"))
|
||||||
WriteText(crewIssuingState, crew.CrewMemberIdentityDocumentIssuingState);
|
WriteText(crewIssuingState, crew.CrewMemberIdentityDocumentIssuingState);
|
||||||
}
|
}
|
||||||
if(isRefSheet)
|
if(isRefSheet)
|
||||||
@ -438,7 +438,7 @@ namespace ENI2.Excel
|
|||||||
if(crew.CrewMemberIdentityDocumentExpiryDate != new DateTime(2100, 12, 31))
|
if(crew.CrewMemberIdentityDocumentExpiryDate != new DateTime(2100, 12, 31))
|
||||||
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
|
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteText(crewCountry, crew.CrewMemberCountryOfBirth);
|
WriteText(crewCountry, crew.CrewMemberCountryOfBirth);
|
||||||
if (isArrival)
|
if (isArrival)
|
||||||
WriteText(effects, crew.Effects);
|
WriteText(effects, crew.Effects);
|
||||||
@ -564,7 +564,7 @@ namespace ENI2.Excel
|
|||||||
WriteNumber(ibc_quantity, ibcPosition.Quantity_KGM.Value);
|
WriteNumber(ibc_quantity, ibcPosition.Quantity_KGM.Value);
|
||||||
WriteText(ibc_stowagePosition, ibcPosition.StowagePosition);
|
WriteText(ibc_stowagePosition, ibcPosition.StowagePosition);
|
||||||
WriteText(ibc_portOfLoading, ibcPosition.PortOfLoading);
|
WriteText(ibc_portOfLoading, ibcPosition.PortOfLoading);
|
||||||
WriteText(ibc_portOfDischarge, ibcPosition.PortOfDischarge);
|
WriteText(ibc_portOfDischarge, ibcPosition.PortOfDischarge);
|
||||||
WriteText(ibc_hazards, ibcPosition.HazardsDisplay);
|
WriteText(ibc_hazards, ibcPosition.HazardsDisplay);
|
||||||
WriteBoolean(ibc_specref, ibcPosition.SpecRef15_19 ?? false);
|
WriteBoolean(ibc_specref, ibcPosition.SpecRef15_19 ?? false);
|
||||||
WriteText(ibc_remarks, ibcPosition.Remarks);
|
WriteText(ibc_remarks, ibcPosition.Remarks);
|
||||||
@ -886,7 +886,7 @@ namespace ENI2.Excel
|
|||||||
WriteText("SEC.CurrentShipSecurityLevel", sec.CurrentShipSecurityLevel.Value.ToString());
|
WriteText("SEC.CurrentShipSecurityLevel", sec.CurrentShipSecurityLevel.Value.ToString());
|
||||||
|
|
||||||
WriteText("SEC.ISSCIssuerType", sec.ISSCIssuerTypeDisplay);
|
WriteText("SEC.ISSCIssuerType", sec.ISSCIssuerTypeDisplay);
|
||||||
|
|
||||||
if(sec.GeneralDescriptionOfCargo.HasValue)
|
if(sec.GeneralDescriptionOfCargo.HasValue)
|
||||||
{
|
{
|
||||||
switch(sec.GeneralDescriptionOfCargo.Value)
|
switch(sec.GeneralDescriptionOfCargo.Value)
|
||||||
@ -1041,7 +1041,7 @@ namespace ENI2.Excel
|
|||||||
if(CREW.NationalityDict.TryGetValue(towa.TowageOnArrivalFlag, out string country))
|
if(CREW.NationalityDict.TryGetValue(towa.TowageOnArrivalFlag, out string country))
|
||||||
WriteText(tFlag, country.Substring(3));
|
WriteText(tFlag, country.Substring(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteText(tPoC, towa.TowageOnArrivalPurposeOfCall);
|
WriteText(tPoC, towa.TowageOnArrivalPurposeOfCall);
|
||||||
if (towa.TowageOnArrivalDraught_DMT.HasValue)
|
if (towa.TowageOnArrivalDraught_DMT.HasValue)
|
||||||
WriteNumber(tDraft, towa.TowageOnArrivalDraught_DMT.Value);
|
WriteNumber(tDraft, towa.TowageOnArrivalDraught_DMT.Value);
|
||||||
@ -1091,7 +1091,7 @@ namespace ENI2.Excel
|
|||||||
WriteNumber(tBeam, towd.TowageOnDepartureBeam_MTR.Value);
|
WriteNumber(tBeam, towd.TowageOnDepartureBeam_MTR.Value);
|
||||||
WriteText(tOp, towd.TowageOnDepartureOperatorCompanyName);
|
WriteText(tOp, towd.TowageOnDepartureOperatorCompanyName);
|
||||||
// WriteText(tPoc, towd.Tow)
|
// WriteText(tPoc, towd.Tow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -1103,17 +1103,6 @@ namespace ENI2.Excel
|
|||||||
if (wasMessage.Elements.Count == 0) return;
|
if (wasMessage.Elements.Count == 0) return;
|
||||||
WAS was = wasMessage.Elements[0] as WAS;
|
WAS was = wasMessage.Elements[0] as WAS;
|
||||||
|
|
||||||
if (was.WasteDisposalDelivery.HasValue) // TODO: CH schreibt für DK erforderlich -> nachfragen
|
|
||||||
{
|
|
||||||
switch (was.WasteDisposalDelivery)
|
|
||||||
{
|
|
||||||
case 0: WriteText("WAS.WasteDisposalDelivery", "ALL"); break;
|
|
||||||
case 1: WriteText("WAS.WasteDisposalDelivery", "SOME"); break;
|
|
||||||
case 2: WriteText("WAS.WasteDisposalDelivery", "NONE"); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteText("WAS.LastWasteDisposalPort", isRefSheet ? was.LastWasteDisposalPort : Locode.LocodeDB.LocationNameFromLocode(was.LastWasteDisposalPort));
|
WriteText("WAS.LastWasteDisposalPort", isRefSheet ? was.LastWasteDisposalPort : Locode.LocodeDB.LocationNameFromLocode(was.LastWasteDisposalPort));
|
||||||
WriteText("WAS.WasteDisposalServiceProviderName", was.WasteDisposalServiceProviderText);
|
WriteText("WAS.WasteDisposalServiceProviderName", was.WasteDisposalServiceProviderText);
|
||||||
WriteText("WAS.NextWasteDisposalPort", isRefSheet? was.NextWasteDisposalPort : Locode.LocodeDB.LocationNameFromLocode(was.NextWasteDisposalPort));
|
WriteText("WAS.NextWasteDisposalPort", isRefSheet? was.NextWasteDisposalPort : Locode.LocodeDB.LocationNameFromLocode(was.NextWasteDisposalPort));
|
||||||
@ -1124,7 +1113,7 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
int? wasteType = (int?)ReadNumber(string.Format("WAS.WasteCode_{0}", i + 1));
|
int? wasteType = (int?)ReadNumber(string.Format("WAS.WasteCode_{0}", i + 1));
|
||||||
if (!wasteType.HasValue) continue;
|
if (!wasteType.HasValue) continue;
|
||||||
|
|
||||||
string wasteDescription = string.Format("WAS.WasteDescription_{0}", i + 1);
|
string wasteDescription = string.Format("WAS.WasteDescription_{0}", i + 1);
|
||||||
string wasteAmount = string.Format("WAS.WasteDisposalAmount_MTQ_{0}", i + 1);
|
string wasteAmount = string.Format("WAS.WasteDisposalAmount_MTQ_{0}", i + 1);
|
||||||
string wasteCapacity = string.Format("WAS.WasteCapacity_MTQ_{0}", i + 1);
|
string wasteCapacity = string.Format("WAS.WasteCapacity_MTQ_{0}", i + 1);
|
||||||
@ -1133,7 +1122,7 @@ namespace ENI2.Excel
|
|||||||
string amountGen = string.Format("WAS.WasteAmountGeneratedTillNextPort_MTQ_{0}", i + 1);
|
string amountGen = string.Format("WAS.WasteAmountGeneratedTillNextPort_MTQ_{0}", i + 1);
|
||||||
|
|
||||||
Waste waste = was.GetWasteForType(wasteType.Value);
|
Waste waste = was.GetWasteForType(wasteType.Value);
|
||||||
|
|
||||||
WriteText(wasteDescription, waste.WasteDescription);
|
WriteText(wasteDescription, waste.WasteDescription);
|
||||||
if (waste.WasteDisposalAmount_MTQ.HasValue)
|
if (waste.WasteDisposalAmount_MTQ.HasValue)
|
||||||
WriteNumber(wasteAmount, waste.WasteDisposalAmount_MTQ.Value);
|
WriteNumber(wasteAmount, waste.WasteDisposalAmount_MTQ.Value);
|
||||||
@ -1143,7 +1132,7 @@ namespace ENI2.Excel
|
|||||||
WriteNumber(wasteRetained, waste.WasteAmountRetained_MTQ.Value);
|
WriteNumber(wasteRetained, waste.WasteAmountRetained_MTQ.Value);
|
||||||
WriteText(wastePort, isRefSheet ? waste.WasteDisposalPort : Locode.LocodeDB.LocationNameFromLocode(waste.WasteDisposalPort));
|
WriteText(wastePort, isRefSheet ? waste.WasteDisposalPort : Locode.LocodeDB.LocationNameFromLocode(waste.WasteDisposalPort));
|
||||||
if (waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue)
|
if (waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue)
|
||||||
WriteNumber(amountGen, waste.WasteAmountGeneratedTillNextPort_MTQ.Value);
|
WriteNumber(amountGen, waste.WasteAmountGeneratedTillNextPort_MTQ.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1216,8 +1205,8 @@ namespace ENI2.Excel
|
|||||||
WriteText("INFO.PortArea", info.PortArea);
|
WriteText("INFO.PortArea", info.PortArea);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteText("INFO.PortArea", LocalizedLookup.GetPortAreaFromCode(info.PortArea));
|
WriteText("INFO.PortArea", LocalizedLookup.GetPortAreaFromCode(info.PortArea));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1244,7 +1233,7 @@ namespace ENI2.Excel
|
|||||||
if(isRefSheet)
|
if(isRefSheet)
|
||||||
{
|
{
|
||||||
WriteText("STAT.ShipType", stat.ShipType);
|
WriteText("STAT.ShipType", stat.ShipType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (LocalizedLookup.getVesselTypes().TryGetValue(stat.ShipType, out string shipType))
|
if (LocalizedLookup.getVesselTypes().TryGetValue(stat.ShipType, out string shipType))
|
||||||
@ -1345,7 +1334,7 @@ namespace ENI2.Excel
|
|||||||
}
|
}
|
||||||
catch(Exception)
|
catch(Exception)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName));
|
System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -1370,10 +1359,10 @@ namespace ENI2.Excel
|
|||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if(v != null)
|
if(v != null)
|
||||||
{
|
{
|
||||||
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate();
|
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -92,6 +92,7 @@
|
|||||||
<MenuItem x:Name="menuItemStatus" Header="{x:Static p:Resources.textServerStatus}" Click="radioButton_Click" />
|
<MenuItem x:Name="menuItemStatus" Header="{x:Static p:Resources.textServerStatus}" Click="radioButton_Click" />
|
||||||
<MenuItem x:Name="menuItemUserAdministration" Header="{x:Static p:Resources.textUserAdministration}" Click="radioButton_Click" Visibility="Hidden"/>
|
<MenuItem x:Name="menuItemUserAdministration" Header="{x:Static p:Resources.textUserAdministration}" Click="radioButton_Click" Visibility="Hidden"/>
|
||||||
<MenuItem x:Name="menuItemMaersk" Header="{x:Static p:Resources.textPOLists}" Click="radioButton_Click" Visibility="Hidden" />
|
<MenuItem x:Name="menuItemMaersk" Header="{x:Static p:Resources.textPOLists}" Click="radioButton_Click" Visibility="Hidden" />
|
||||||
|
<MenuItem x:Name="menuItemValueMappings" Header="{x:Static p:Resources.textExcelValueMappings}" Click="radioButton_Click" Visibility="Hidden" />
|
||||||
<MenuItem x:Name="labelStatusId" />
|
<MenuItem x:Name="labelStatusId" />
|
||||||
<MenuItem Header="Help" HorizontalAlignment="Right">
|
<MenuItem Header="Help" HorizontalAlignment="Right">
|
||||||
<MenuItem Header="About" Click="buttonAbout_Click">
|
<MenuItem Header="About" Click="buttonAbout_Click">
|
||||||
|
|||||||
@ -35,6 +35,7 @@ namespace ENI2
|
|||||||
|
|
||||||
private ReportingPartyControl rpControl;
|
private ReportingPartyControl rpControl;
|
||||||
private MaerskOverviewControl moControl;
|
private MaerskOverviewControl moControl;
|
||||||
|
private ValueMappingsControl vmControl;
|
||||||
private ServerStatusControl statusControl;
|
private ServerStatusControl statusControl;
|
||||||
private readonly SucheControl sucheControl;
|
private readonly SucheControl sucheControl;
|
||||||
private CompareExcelDialog compareExcelDialog;
|
private CompareExcelDialog compareExcelDialog;
|
||||||
@ -304,6 +305,14 @@ namespace ENI2
|
|||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(this.statusControl);
|
this.rootContainer.Children.Add(this.statusControl);
|
||||||
}
|
}
|
||||||
|
else if(sender == this.menuItemValueMappings)
|
||||||
|
{
|
||||||
|
if(this.vmControl == null)
|
||||||
|
{
|
||||||
|
this.vmControl = new ValueMappingsControl();
|
||||||
|
}
|
||||||
|
this.rootContainer.Children.Add(this.vmControl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCompareSheets_Click(object sender, RoutedEventArgs ev)
|
private void buttonCompareSheets_Click(object sender, RoutedEventArgs ev)
|
||||||
@ -663,7 +672,7 @@ namespace ENI2
|
|||||||
App.UserId = this.userEntity.Id;
|
App.UserId = this.userEntity.Id;
|
||||||
ReportingParty.CurrentReportingParty = this.userEntity;
|
ReportingParty.CurrentReportingParty = this.userEntity;
|
||||||
this.menuItemMaersk.Visibility = Visibility.Visible;
|
this.menuItemMaersk.Visibility = Visibility.Visible;
|
||||||
|
this.menuItemValueMappings.Visibility = Visibility.Visible;
|
||||||
if (this.userEntity.IsAdmin)
|
if (this.userEntity.IsAdmin)
|
||||||
{
|
{
|
||||||
this.menuItemUserAdministration.Visibility = Visibility.Visible;
|
this.menuItemUserAdministration.Visibility = Visibility.Visible;
|
||||||
|
|||||||
9
ENI2/Properties/Resources.Designer.cs
generated
9
ENI2/Properties/Resources.Designer.cs
generated
@ -2297,6 +2297,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Excel import value mappings.
|
||||||
|
/// </summary>
|
||||||
|
public static string textExcelValueMappings {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textExcelValueMappings", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Excepted quantities.
|
/// Looks up a localized string similar to Excepted quantities.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1879,4 +1879,7 @@
|
|||||||
<data name="textCopyIMO" xml:space="preserve">
|
<data name="textCopyIMO" xml:space="preserve">
|
||||||
<value>Copy IMO to clipboard</value>
|
<value>Copy IMO to clipboard</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textExcelValueMappings" xml:space="preserve">
|
||||||
|
<value>Excel import value mappings</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@ -117,7 +117,7 @@ namespace ENI2.LockingServiceReference {
|
|||||||
return this.CORRUPTFilesField;
|
return this.CORRUPTFilesField;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if ((object.ReferenceEquals(this.CORRUPTFilesField, value) != true)) {
|
if ((ReferenceEquals(this.CORRUPTFilesField, value) != true)) {
|
||||||
this.CORRUPTFilesField = value;
|
this.CORRUPTFilesField = value;
|
||||||
this.RaisePropertyChanged("CORRUPTFiles");
|
this.RaisePropertyChanged("CORRUPTFiles");
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ namespace ENI2.LockingServiceReference {
|
|||||||
return this.IMPFilesField;
|
return this.IMPFilesField;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if ((object.ReferenceEquals(this.IMPFilesField, value) != true)) {
|
if ((ReferenceEquals(this.IMPFilesField, value) != true)) {
|
||||||
this.IMPFilesField = value;
|
this.IMPFilesField = value;
|
||||||
this.RaisePropertyChanged("IMPFiles");
|
this.RaisePropertyChanged("IMPFiles");
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ namespace ENI2.LockingServiceReference {
|
|||||||
return this.READYFilesField;
|
return this.READYFilesField;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if ((object.ReferenceEquals(this.READYFilesField, value) != true)) {
|
if ((ReferenceEquals(this.READYFilesField, value) != true)) {
|
||||||
this.READYFilesField = value;
|
this.READYFilesField = value;
|
||||||
this.RaisePropertyChanged("READYFiles");
|
this.RaisePropertyChanged("READYFiles");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ Sample license text.
|
|||||||
-->
|
-->
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ExcelDataReader" version="3.6.0" targetFramework="net452" />
|
<package id="ExcelDataReader" version="3.6.0" targetFramework="net452" />
|
||||||
<package id="Extended.Wpf.Toolkit" version="4.3.0" targetFramework="net48" />
|
<package id="Extended.Wpf.Toolkit" version="4.5.0" targetFramework="net48" />
|
||||||
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
<package id="log4net" version="2.0.15" targetFramework="net48" />
|
||||||
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net48" />
|
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net48" />
|
||||||
<package id="PDFsharp-MigraDoc-gdi" version="1.50.5147" targetFramework="net452" />
|
<package id="PDFsharp-MigraDoc-gdi" version="1.50.5147" targetFramework="net452" />
|
||||||
|
|||||||
42
SQL/table.ValueMapping.eni.7.12.sql
Normal file
42
SQL/table.ValueMapping.eni.7.12.sql
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
/****** Object: Table [dbo].[ValueMapping] Script Date: 09.05.2023 13:21:12 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[ValueMapping](
|
||||||
|
[Id] [uniqueidentifier] ROWGUIDCOL NOT NULL,
|
||||||
|
[EntryType] [tinyint] NULL,
|
||||||
|
[MappingKey] [nvarchar](64) NULL,
|
||||||
|
[MappingValue] [nvarchar](128) NULL,
|
||||||
|
[Created] [datetime] NOT NULL,
|
||||||
|
[Changed] [datetime] NULL,
|
||||||
|
CONSTRAINT [PK_ValueMapping] PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[Id] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[ValueMapping] ADD CONSTRAINT [DF_ValueMapping_Id] DEFAULT (newid()) FOR [Id]
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[ValueMapping] ADD CONSTRAINT [DF_ValueMapping_Created] DEFAULT (getdate()) FOR [Created]
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
CREATE trigger [dbo].[ValueMapping_Trigger_Change_Log]
|
||||||
|
ON [dbo].[ValueMapping]
|
||||||
|
FOR UPDATE
|
||||||
|
AS
|
||||||
|
SET NOCOUNT ON
|
||||||
|
IF NOT UPDATE([Changed])
|
||||||
|
UPDATE ValueMapping SET [Changed] = GETDATE() WHERE Id IN (SELECT Id FROM [inserted])
|
||||||
|
GO
|
||||||
|
ALTER TABLE [dbo].[ValueMapping] ENABLE TRIGGER [ValueMapping_Trigger_Change_Log]
|
||||||
|
GO
|
||||||
@ -24,7 +24,7 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
messageCore = Util.LookupMessageCore(reader, out readMessage);
|
messageCore = Util.LookupMessageCore(reader, out readMessage);
|
||||||
|
|
||||||
if (messageCore == null) return false; // cannot work with this sheet or create one
|
if (messageCore == null) return false; // cannot work with this sheet or create one
|
||||||
|
|
||||||
// load messages if already present
|
// load messages if already present
|
||||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.ALL);
|
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.ALL);
|
||||||
@ -113,7 +113,7 @@ namespace bsmd.ExcelReadService
|
|||||||
ScanCREW(messages, messageCore, reader);
|
ScanCREW(messages, messageCore, reader);
|
||||||
|
|
||||||
ScanPAS(messages, messageCore, reader);
|
ScanPAS(messages, messageCore, reader);
|
||||||
|
|
||||||
ScanBPOL(messages, messageCore, reader);
|
ScanBPOL(messages, messageCore, reader);
|
||||||
|
|
||||||
ScanTOWA(messages, messageCore, reader);
|
ScanTOWA(messages, messageCore, reader);
|
||||||
@ -139,7 +139,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if ((message.MessageNotificationClass == Message.NotificationClass.CREWD) || (message.MessageNotificationClass == Message.NotificationClass.CREWD) ||
|
if ((message.MessageNotificationClass == Message.NotificationClass.CREWD) || (message.MessageNotificationClass == Message.NotificationClass.CREWD) ||
|
||||||
(message.MessageNotificationClass == Message.NotificationClass.STO))
|
(message.MessageNotificationClass == Message.NotificationClass.STO))
|
||||||
message.InternalStatus = Message.BSMDStatus.PREPARE;
|
message.InternalStatus = Message.BSMDStatus.PREPARE;
|
||||||
else
|
else
|
||||||
message.InternalStatus = Message.BSMDStatus.EXCEL;
|
message.InternalStatus = Message.BSMDStatus.EXCEL;
|
||||||
message.UnsentMessageWarningShown = false;
|
message.UnsentMessageWarningShown = false;
|
||||||
DBManager.Instance.Save(message);
|
DBManager.Instance.Save(message);
|
||||||
@ -147,7 +147,7 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ATA
|
#region ATA
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
if (!ata.ATAPortOfCall.HasValue && ataMessage.IsNew)
|
if (!ata.ATAPortOfCall.HasValue && ataMessage.IsNew)
|
||||||
messages.Remove(ataMessage);
|
messages.Remove(ataMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
private static void ScanBPOL(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
private static void ScanBPOL(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
{
|
{
|
||||||
// Die Verarbeitung dieser Nachricht aktuell nur für
|
// Die Verarbeitung dieser Nachricht aktuell nur für
|
||||||
Message bpolMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BPOL);
|
Message bpolMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BPOL);
|
||||||
if (bpolMessage.Elements.Count == 0)
|
if (bpolMessage.Elements.Count == 0)
|
||||||
{
|
{
|
||||||
@ -311,8 +311,8 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
poi.PortOfItineraryName = bpolNameValue;
|
poi.PortOfItineraryName = bpolNameValue;
|
||||||
reader.Conf.ConfirmText(bpolName, bpolNameValue, ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(bpolName, bpolNameValue, ExcelReader.ReadState.OK);
|
||||||
poi.PortOfItineraryLocode = bpolLocodeValue;
|
poi.PortOfItineraryLocode = bpolLocodeValue;
|
||||||
// falls nur Locode angegeben wurde, Portname aus Locode ermitteln
|
// falls nur Locode angegeben wurde, Portname aus Locode ermitteln
|
||||||
if(poi.PortOfItineraryName.IsNullOrEmpty() && !poi.PortOfItineraryLocode.IsNullOrEmpty() && (poi.PortOfItineraryLocode.Length == 5))
|
if(poi.PortOfItineraryName.IsNullOrEmpty() && !poi.PortOfItineraryLocode.IsNullOrEmpty() && (poi.PortOfItineraryLocode.Length == 5))
|
||||||
{
|
{
|
||||||
poi.PortOfItineraryName = LocodeDB.PortNameFromLocode(poi.PortOfItineraryLocode);
|
poi.PortOfItineraryName = LocodeDB.PortNameFromLocode(poi.PortOfItineraryLocode);
|
||||||
@ -342,8 +342,8 @@ namespace bsmd.ExcelReadService
|
|||||||
if (((poba.TotalPersonsOnBoardUponArrival ?? 0) == 0) && poba.IsNew)
|
if (((poba.TotalPersonsOnBoardUponArrival ?? 0) == 0) && poba.IsNew)
|
||||||
messages.Remove(pobaMessage);
|
messages.Remove(pobaMessage);
|
||||||
|
|
||||||
reader.Conf.ConfirmNumber("POBA.TotalCrewMembersOnBoardUponArrival_DK", poba.TotalCrewMembersOnBoardUponArrival,
|
reader.Conf.ConfirmNumber("POBA.TotalCrewMembersOnBoardUponArrival_DK", poba.TotalCrewMembersOnBoardUponArrival,
|
||||||
(poba.TotalCrewMembersOnBoardUponArrival.HasValue && poba.TotalCrewMembersOnBoardUponArrival > 0) ?
|
(poba.TotalCrewMembersOnBoardUponArrival.HasValue && poba.TotalCrewMembersOnBoardUponArrival > 0) ?
|
||||||
ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
||||||
|
|
||||||
reader.Conf.ConfirmNumber("POBA.TotalPassengersOnBoardUponArrival_DK", poba.TotalPassengersOnBoardUponArrival,
|
reader.Conf.ConfirmNumber("POBA.TotalPassengersOnBoardUponArrival_DK", poba.TotalPassengersOnBoardUponArrival,
|
||||||
@ -406,7 +406,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if(shipClass.IsNullOrEmpty())
|
if(shipClass.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
reader.Conf.ConfirmText("HAZA.INFShipClass", null, ExcelReader.ReadState.FAIL);
|
reader.Conf.ConfirmText("HAZA.INFShipClass", null, ExcelReader.ReadState.FAIL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (shipClass.Contains('1')) haza.INFShipClass = 0;
|
if (shipClass.Contains('1')) haza.INFShipClass = 0;
|
||||||
@ -416,7 +416,7 @@ namespace bsmd.ExcelReadService
|
|||||||
reader.Conf.ConfirmText("HAZA.INFShipClass", shipClass, haza.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
reader.Conf.ConfirmText("HAZA.INFShipClass", shipClass, haza.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMDG
|
// IMDG
|
||||||
#region IMDG
|
#region IMDG
|
||||||
|
|
||||||
for (int i = 1; i <= 10; i++)
|
for (int i = 1; i <= 10; i++)
|
||||||
@ -707,13 +707,13 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
if(haza.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
if(haza.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
||||||
{
|
{
|
||||||
haza.NoDPGOnBoardOnArrival = false;
|
haza.NoDPGOnBoardOnArrival = false;
|
||||||
// haza.DPGManifestOnBoardOnArrival = true;
|
// haza.DPGManifestOnBoardOnArrival = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,7 +755,7 @@ namespace bsmd.ExcelReadService
|
|||||||
reader.Conf.ConfirmText("HAZD.INFShipClass", shipClass, hazd.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
reader.Conf.ConfirmText("HAZD.INFShipClass", shipClass, hazd.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMDG
|
// IMDG
|
||||||
#region IMDG
|
#region IMDG
|
||||||
|
|
||||||
for (int i = 1; i <= 10; i++)
|
for (int i = 1; i <= 10; i++)
|
||||||
@ -1045,7 +1045,7 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (hazd.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
if (hazd.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
||||||
{
|
{
|
||||||
@ -1053,7 +1053,7 @@ namespace bsmd.ExcelReadService
|
|||||||
// hazd.DPGManifestOnBoardOnArrival = true;
|
// hazd.DPGManifestOnBoardOnArrival = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,7 +1099,7 @@ namespace bsmd.ExcelReadService
|
|||||||
stat.PortOfRegistry = reader.ReadLoCode("STAT.PortOfRegistry");
|
stat.PortOfRegistry = reader.ReadLoCode("STAT.PortOfRegistry");
|
||||||
stat.Flag = reader.ReadNationality("STAT.Flag");
|
stat.Flag = reader.ReadNationality("STAT.Flag");
|
||||||
|
|
||||||
stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber");
|
stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber");
|
||||||
reader.Conf.ConfirmText("STAT.MMSINumber", stat.MMSINumber, (stat.MMSINumber.IsNullOrEmpty() || (stat.MMSINumber.Length != 9)) ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText("STAT.MMSINumber", stat.MMSINumber, (stat.MMSINumber.IsNullOrEmpty() || (stat.MMSINumber.Length != 9)) ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
stat.CallSign = reader.ReadTextNoWhitespace("STAT.CallSign");
|
stat.CallSign = reader.ReadTextNoWhitespace("STAT.CallSign");
|
||||||
@ -1134,7 +1134,7 @@ namespace bsmd.ExcelReadService
|
|||||||
reader.Conf.ConfirmText("ShipMail", messageCore.HerbergEmailContactReportingVessel, messageCore.HerbergEmailContactReportingVessel.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText("ShipMail", messageCore.HerbergEmailContactReportingVessel, messageCore.HerbergEmailContactReportingVessel.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
// wird nicht wieder entfernt (core ist auch da!)
|
// wird nicht wieder entfernt (core ist auch da!)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -1195,7 +1195,7 @@ namespace bsmd.ExcelReadService
|
|||||||
callPurpose.CallPurposeDescription = callPurposeDescription;
|
callPurpose.CallPurposeDescription = callPurposeDescription;
|
||||||
ExcelReader.ReadState aReadState = ExcelReader.ReadState.OK;
|
ExcelReader.ReadState aReadState = ExcelReader.ReadState.OK;
|
||||||
if (callPurposeDescription.IsNullOrEmpty()) aReadState = ExcelReader.ReadState.WARN;
|
if (callPurposeDescription.IsNullOrEmpty()) aReadState = ExcelReader.ReadState.WARN;
|
||||||
else if (callPurposeDescription.Length > 90) aReadState = ExcelReader.ReadState.FAIL;
|
else if (callPurposeDescription.Length > 90) aReadState = ExcelReader.ReadState.FAIL;
|
||||||
reader.Conf.ConfirmText(callPurposeDescriptionKey, callPurposeDescription, aReadState);
|
reader.Conf.ConfirmText(callPurposeDescriptionKey, callPurposeDescription, aReadState);
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
reader.Conf.ConfirmText("NOA_NOD.CallPuposeDescription_1_DK", callPurposeDescription, callPurposeDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText("NOA_NOD.CallPuposeDescription_1_DK", callPurposeDescription, callPurposeDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
||||||
@ -1203,7 +1203,7 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string lastPort = reader.ReadText("NOA_NOD.LastPort")?.Trim().ToUpper();
|
string lastPort = reader.ReadText("NOA_NOD.LastPort")?.Trim().ToUpper();
|
||||||
|
|
||||||
if (lastPort != null)
|
if (lastPort != null)
|
||||||
{
|
{
|
||||||
@ -1226,7 +1226,7 @@ namespace bsmd.ExcelReadService
|
|||||||
string nextPort = reader.ReadText("NOA_NOD.NextPort")?.Trim().ToUpper();
|
string nextPort = reader.ReadText("NOA_NOD.NextPort")?.Trim().ToUpper();
|
||||||
bool isValidSSNPort = false;
|
bool isValidSSNPort = false;
|
||||||
if (!nextPort.IsNullOrEmpty())
|
if (!nextPort.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
if (nextPort.Length > 5)
|
if (nextPort.Length > 5)
|
||||||
nextPort = nextPort.Substring(0, 5); //trunc
|
nextPort = nextPort.Substring(0, 5); //trunc
|
||||||
else
|
else
|
||||||
@ -1255,7 +1255,7 @@ namespace bsmd.ExcelReadService
|
|||||||
else
|
else
|
||||||
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", null, ExcelReader.ReadState.FAIL);
|
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", null, ExcelReader.ReadState.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
noa_nod.ETDFromLastPort = reader.ReadDateTime("NOA_NOD.ETDDateFromLastPort", "NOA_NOD.ETDTimeFromLastPort");
|
noa_nod.ETDFromLastPort = reader.ReadDateTime("NOA_NOD.ETDDateFromLastPort", "NOA_NOD.ETDTimeFromLastPort");
|
||||||
noa_nod.ETAToNextPort = reader.ReadDateTime("NOA_NOD.ETADateToNextPort", "NOA_NOD.ETATimeToNextPort");
|
noa_nod.ETAToNextPort = reader.ReadDateTime("NOA_NOD.ETADateToNextPort", "NOA_NOD.ETATimeToNextPort");
|
||||||
// DK
|
// DK
|
||||||
@ -1303,7 +1303,7 @@ namespace bsmd.ExcelReadService
|
|||||||
Util.ScanMessage(was, reader);
|
Util.ScanMessage(was, reader);
|
||||||
|
|
||||||
was.WasteDisposalDelivery = reader.ReadDelivery("WAS.WasteDisposalDelivery");
|
was.WasteDisposalDelivery = reader.ReadDelivery("WAS.WasteDisposalDelivery");
|
||||||
was.LastWasteDisposalPort = reader.ReadLoCode("WAS.LastWasteDisposalPort");
|
was.LastWasteDisposalPort = reader.ReadLoCode("WAS.LastWasteDisposalPort");
|
||||||
|
|
||||||
string wastedispServProvName = reader.ReadText("WAS.WasteDisposalServiceProviderName");
|
string wastedispServProvName = reader.ReadText("WAS.WasteDisposalServiceProviderName");
|
||||||
if (wastedispServProvName != null)
|
if (wastedispServProvName != null)
|
||||||
@ -1324,7 +1324,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if (wastedispServProvName.Length > 90) readState = ExcelReader.ReadState.FAIL;
|
if (wastedispServProvName.Length > 90) readState = ExcelReader.ReadState.FAIL;
|
||||||
else readState = ExcelReader.ReadState.OK;
|
else readState = ExcelReader.ReadState.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Conf.ConfirmText("WAS.WasteDisposalServiceProviderName", wastedispServProvName, readState);
|
reader.Conf.ConfirmText("WAS.WasteDisposalServiceProviderName", wastedispServProvName, readState);
|
||||||
|
|
||||||
// Waste 1 - 15
|
// Waste 1 - 15
|
||||||
@ -1332,7 +1332,7 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
string wastetype = string.Format("WAS.WasteType_{0}", i);
|
string wastetype = string.Format("WAS.WasteType_{0}", i);
|
||||||
string wasteCode = string.Format("WAS.WasteCode_{0}", i);
|
string wasteCode = string.Format("WAS.WasteCode_{0}", i);
|
||||||
string wasteDescription = string.Format("WAS.WasteDescription_{0}", i);
|
string wasteDescription = string.Format("WAS.WasteDescription_{0}", i);
|
||||||
string wasteAmount = string.Format("WAS.WasteDisposalAmount_MTQ_{0}", i);
|
string wasteAmount = string.Format("WAS.WasteDisposalAmount_MTQ_{0}", i);
|
||||||
string wasteCapacity = string.Format("WAS.WasteCapacity_MTQ_{0}", i);
|
string wasteCapacity = string.Format("WAS.WasteCapacity_MTQ_{0}", i);
|
||||||
string wasteRetained = string.Format("WAS.WasteAmountRetained_MTQ_{0}", i);
|
string wasteRetained = string.Format("WAS.WasteAmountRetained_MTQ_{0}", i);
|
||||||
@ -1348,13 +1348,13 @@ namespace bsmd.ExcelReadService
|
|||||||
was.Waste.Add(waste);
|
was.Waste.Add(waste);
|
||||||
}
|
}
|
||||||
|
|
||||||
waste.WasteType = (int?) reader.ReadNumber(wasteCode);
|
waste.WasteType = (int?) reader.ReadNumber(wasteCode);
|
||||||
|
|
||||||
if (waste.WasteType.HasValue && (waste.WasteType == 2313))
|
if (waste.WasteType.HasValue && (waste.WasteType == 2313))
|
||||||
waste.WasteType = 2600;
|
waste.WasteType = 2600;
|
||||||
|
|
||||||
if (reader.Mode == ExcelReader.CountryMode.DE)
|
if (reader.Mode == ExcelReader.CountryMode.DE)
|
||||||
{
|
{
|
||||||
reader.Conf.ConfirmText(wastetype, waste.WasteTypeDisplay, ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(wastetype, waste.WasteTypeDisplay, ExcelReader.ReadState.OK);
|
||||||
reader.Conf.ConfirmNumber(wasteCode, waste.WasteType, ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmNumber(wasteCode, waste.WasteType, ExcelReader.ReadState.OK);
|
||||||
}
|
}
|
||||||
@ -1364,7 +1364,7 @@ namespace bsmd.ExcelReadService
|
|||||||
reader.Conf.ConfirmNumber(wasteCode, WAS.DKWasteCodes[i - 1], ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmNumber(wasteCode, WAS.DKWasteCodes[i - 1], ExcelReader.ReadState.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Waste description Spezialfälle für DK
|
// Waste description Spezialfälle für DK
|
||||||
waste.WasteDescription = reader.ReadText(wasteDescription);
|
waste.WasteDescription = reader.ReadText(wasteDescription);
|
||||||
if (waste.WasteDescription.IsNullOrEmpty())
|
if (waste.WasteDescription.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
@ -1394,14 +1394,14 @@ namespace bsmd.ExcelReadService
|
|||||||
if((reader.Mode == ExcelReader.CountryMode.DK) && (i==9))
|
if((reader.Mode == ExcelReader.CountryMode.DK) && (i==9))
|
||||||
{
|
{
|
||||||
_log.DebugFormat("DK: Changing Waste code {0} to 2300 for line {1}", waste.WasteType, i);
|
_log.DebugFormat("DK: Changing Waste code {0} to 2300 for line {1}", waste.WasteType, i);
|
||||||
waste.WasteType = 2300;
|
waste.WasteType = 2300;
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Conf.ConfirmText(wasteDescription, waste.WasteDescription, waste.WasteDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(wasteDescription, waste.WasteDescription, waste.WasteDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
||||||
waste.WasteDisposalAmount_MTQ = reader.ReadNumberDefaultZero(wasteAmount);
|
waste.WasteDisposalAmount_MTQ = reader.ReadNumberDefaultZero(wasteAmount);
|
||||||
waste.WasteCapacity_MTQ = reader.ReadNumberDefaultZero(wasteCapacity);
|
waste.WasteCapacity_MTQ = reader.ReadNumberDefaultZero(wasteCapacity);
|
||||||
waste.WasteAmountRetained_MTQ = reader.ReadNumberDefaultZero(wasteRetained);
|
waste.WasteAmountRetained_MTQ = reader.ReadNumberDefaultZero(wasteRetained);
|
||||||
|
|
||||||
waste.WasteDisposalPort = reader.ReadLoCode(wastePort);
|
waste.WasteDisposalPort = reader.ReadLoCode(wastePort);
|
||||||
bool isLocode;
|
bool isLocode;
|
||||||
ExcelReader.ReadState rs;
|
ExcelReader.ReadState rs;
|
||||||
@ -1414,11 +1414,11 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
isLocode = (LocodeDB.PortNameFromLocode(waste.WasteDisposalPort) != null);
|
isLocode = (LocodeDB.PortNameFromLocode(waste.WasteDisposalPort) != null);
|
||||||
rs = isLocode ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL;
|
rs = isLocode ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL;
|
||||||
}
|
}
|
||||||
reader.Conf.ConfirmText(wastePort, waste.WasteDisposalPort, rs);
|
reader.Conf.ConfirmText(wastePort, waste.WasteDisposalPort, rs);
|
||||||
|
|
||||||
waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumberDefaultZero(amountGen);
|
waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumberDefaultZero(amountGen);
|
||||||
waste.WasteDisposedAtLastPort_MTQ = reader.ReadNumberDefaultZero(wasteDis);
|
// waste.WasteDisposedAtLastPort_MTQ = reader.ReadNumberDefaultZero(wasteDis);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ((reader.Mode == ExcelReader.CountryMode.DE) &&
|
if ((reader.Mode == ExcelReader.CountryMode.DE) &&
|
||||||
@ -1447,7 +1447,7 @@ namespace bsmd.ExcelReadService
|
|||||||
highlightRow15 &= (waste.WasteAmountRetained_MTQ > 0);
|
highlightRow15 &= (waste.WasteAmountRetained_MTQ > 0);
|
||||||
highlightRow15 &= (waste.WasteDisposalPort != "ZZUKN");
|
highlightRow15 &= (waste.WasteDisposalPort != "ZZUKN");
|
||||||
highlightRow15 &= (waste.WasteAmountGeneratedTillNextPort_MTQ > 0);
|
highlightRow15 &= (waste.WasteAmountGeneratedTillNextPort_MTQ > 0);
|
||||||
highlightRow15 &= (waste.WasteDisposedAtLastPort_MTQ > 0);
|
// highlightRow15 &= (waste.WasteDisposedAtLastPort_MTQ > 0);
|
||||||
|
|
||||||
if(highlightRow15)
|
if(highlightRow15)
|
||||||
{
|
{
|
||||||
@ -1465,7 +1465,7 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
if (!waste.WasteType.HasValue)
|
if (!waste.WasteType.HasValue)
|
||||||
{
|
{
|
||||||
was.Waste.Remove(waste);
|
was.Waste.Remove(waste);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1493,7 +1493,7 @@ namespace bsmd.ExcelReadService
|
|||||||
mdh.MDHSimplification = false;
|
mdh.MDHSimplification = false;
|
||||||
mdh.PortOfCallWhereCompleteMDHNotified = "";
|
mdh.PortOfCallWhereCompleteMDHNotified = "";
|
||||||
|
|
||||||
|
|
||||||
string kuerzelErsteZelle = reader.ReadText("MDH.PortOfCallLast30DaysLocode_1");
|
string kuerzelErsteZelle = reader.ReadText("MDH.PortOfCallLast30DaysLocode_1");
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -1565,7 +1565,7 @@ namespace bsmd.ExcelReadService
|
|||||||
poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
|
poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
|
||||||
|
|
||||||
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
|
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
|
||||||
{
|
{
|
||||||
// try different separators
|
// try different separators
|
||||||
string[] crew = crewNameString.Split(';');
|
string[] crew = crewNameString.Split(';');
|
||||||
if (crew.Length == 1)
|
if (crew.Length == 1)
|
||||||
@ -1585,7 +1585,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if (crew[j].Length > 90)
|
if (crew[j].Length > 90)
|
||||||
readState = ExcelReader.ReadState.FAIL;
|
readState = ExcelReader.ReadState.FAIL;
|
||||||
}
|
}
|
||||||
reader.Conf.ConfirmText(crewName, crewNameString, readState);
|
reader.Conf.ConfirmText(crewName, crewNameString, readState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// falls Häkchen gesetzt aber Namensfeld leer: Fehler markieren
|
// falls Häkchen gesetzt aber Namensfeld leer: Fehler markieren
|
||||||
@ -1729,7 +1729,7 @@ namespace bsmd.ExcelReadService
|
|||||||
newSEC.MessageHeader = secMessage;
|
newSEC.MessageHeader = secMessage;
|
||||||
secMessage.Elements.Add(newSEC);
|
secMessage.Elements.Add(newSEC);
|
||||||
}
|
}
|
||||||
SEC sec = secMessage.Elements[0] as SEC;
|
SEC sec = secMessage.Elements[0] as SEC;
|
||||||
Util.ScanMessage(sec, reader);
|
Util.ScanMessage(sec, reader);
|
||||||
|
|
||||||
reader.ReadBoolean("SEC.AreMatterToReport"); // das berücksichtigen wir derzeit nicht in der DB (implizit)
|
reader.ReadBoolean("SEC.AreMatterToReport"); // das berücksichtigen wir derzeit nicht in der DB (implizit)
|
||||||
@ -1756,7 +1756,7 @@ namespace bsmd.ExcelReadService
|
|||||||
reader.Conf.ConfirmText("SEC.CurrentShipSecurityLevel", shipsecLevel, sec.CurrentShipSecurityLevel.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
reader.Conf.ConfirmText("SEC.CurrentShipSecurityLevel", shipsecLevel, sec.CurrentShipSecurityLevel.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Conf.ConfirmText("SEC.ISSCType", isscType, sec.ISSCType.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
|
reader.Conf.ConfirmText("SEC.ISSCType", isscType, sec.ISSCType.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
|
||||||
|
|
||||||
string isscIssuerType = reader.ReadText("SEC.ISSCIssuerType");
|
string isscIssuerType = reader.ReadText("SEC.ISSCIssuerType");
|
||||||
if(isscIssuerType != null)
|
if(isscIssuerType != null)
|
||||||
@ -1768,8 +1768,8 @@ namespace bsmd.ExcelReadService
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.Conf.ConfirmText("SEC.ISSCIssuerType", isscIssuerType, sec.ISSCIssuerType.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
|
reader.Conf.ConfirmText("SEC.ISSCIssuerType", isscIssuerType, sec.ISSCIssuerType.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
|
||||||
sec.GeneralDescriptionOfCargo = reader.ReadGeneralDescriptionOfCargo("SEC.GeneralDescriptionOfCargo");
|
sec.GeneralDescriptionOfCargo = reader.ReadGeneralDescriptionOfCargo("SEC.GeneralDescriptionOfCargo");
|
||||||
|
|
||||||
bool? secKielArrival = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Arrival");
|
bool? secKielArrival = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Arrival");
|
||||||
bool? secKielDeparture = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Departure");
|
bool? secKielDeparture = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Departure");
|
||||||
|
|
||||||
@ -1800,7 +1800,7 @@ namespace bsmd.ExcelReadService
|
|||||||
string portDateOfArrival = string.Format("SEC.PortFacilityDateOfArrival_{0}", i);
|
string portDateOfArrival = string.Format("SEC.PortFacilityDateOfArrival_{0}", i);
|
||||||
string portDateOfDeparture = string.Format("SEC.PortFacilityDateOfDeparture_{0}", i);
|
string portDateOfDeparture = string.Format("SEC.PortFacilityDateOfDeparture_{0}", i);
|
||||||
string portShipSecLevel = string.Format("SEC.PortFacilityShipSecurityLevel_{0}", i);
|
string portShipSecLevel = string.Format("SEC.PortFacilityShipSecurityLevel_{0}", i);
|
||||||
string portGISISCode = string.Format("SEC.PortFacilityGISISCode_{0}", i);
|
string portGISISCode = string.Format("SEC.PortFacilityGISISCode_{0}", i);
|
||||||
string portSecMatters = string.Format("SEC.PortFacilitySecurityMattersToReport_{0}", i);
|
string portSecMatters = string.Format("SEC.PortFacilitySecurityMattersToReport_{0}", i);
|
||||||
|
|
||||||
if (!(sec.GetPortFacilityWithIdentifier(i.ToString()) is LastTenPortFacilitiesCalled l10fc))
|
if (!(sec.GetPortFacilityWithIdentifier(i.ToString()) is LastTenPortFacilitiesCalled l10fc))
|
||||||
@ -1831,7 +1831,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
|
if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
|
||||||
reader.Conf.ConfirmText(portShipSecLevel, sLevel, l10fc.PortFacilityShipSecurityLevel.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
reader.Conf.ConfirmText(portShipSecLevel, sLevel, l10fc.PortFacilityShipSecurityLevel.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
l10fc.PortFacilityGISISCode = reader.ReadTextNoWhitespace(portGISISCode);
|
l10fc.PortFacilityGISISCode = reader.ReadTextNoWhitespace(portGISISCode);
|
||||||
|
|
||||||
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
|
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
|
||||||
@ -1929,7 +1929,7 @@ namespace bsmd.ExcelReadService
|
|||||||
bkra.BunkerFuelQuantity_TNE = reader.ReadNumber(lnQuantity);
|
bkra.BunkerFuelQuantity_TNE = reader.ReadNumber(lnQuantity);
|
||||||
bkra.BunkerFuelType = reader.ReadText(lnType);
|
bkra.BunkerFuelType = reader.ReadText(lnType);
|
||||||
reader.Conf.ConfirmText(lnType, bkra.BunkerFuelType, ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(lnType, bkra.BunkerFuelType, ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
// "OK" Quantity falls Type nicht angegeben
|
// "OK" Quantity falls Type nicht angegeben
|
||||||
if (bkra.BunkerFuelType.IsNullOrEmpty() && !bkra.BunkerFuelQuantity_TNE.HasValue)
|
if (bkra.BunkerFuelType.IsNullOrEmpty() && !bkra.BunkerFuelQuantity_TNE.HasValue)
|
||||||
reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK);
|
||||||
@ -1938,11 +1938,11 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
|
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
|
||||||
reader.Conf.ConfirmNumber(lnQuantity, bkra.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN);
|
reader.Conf.ConfirmNumber(lnQuantity, bkra.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dont save empty element
|
// dont save empty element
|
||||||
if(bkra.IsNew && !bkra.BunkerFuelQuantity_TNE.HasValue && bkra.BunkerFuelType.IsNullOrEmpty())
|
if(bkra.IsNew && !bkra.BunkerFuelQuantity_TNE.HasValue && bkra.BunkerFuelType.IsNullOrEmpty())
|
||||||
bkraMessage.Elements.Remove(bkra);
|
bkraMessage.Elements.Remove(bkra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1982,7 +1982,7 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
// dont save empty element
|
// dont save empty element
|
||||||
if (bkrd.IsNew && !bkrd.BunkerFuelQuantity_TNE.HasValue && bkrd.BunkerFuelType.IsNullOrEmpty())
|
if (bkrd.IsNew && !bkrd.BunkerFuelQuantity_TNE.HasValue && bkrd.BunkerFuelType.IsNullOrEmpty())
|
||||||
bkrdMessage.Elements.Remove(bkrd);
|
bkrdMessage.Elements.Remove(bkrd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1991,7 +1991,7 @@ namespace bsmd.ExcelReadService
|
|||||||
#region TOWA
|
#region TOWA
|
||||||
|
|
||||||
private static void ScanTOWA(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
private static void ScanTOWA(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
{
|
{
|
||||||
Message towaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWA);
|
Message towaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWA);
|
||||||
|
|
||||||
// 24.4.21: TOWA beim Excel import
|
// 24.4.21: TOWA beim Excel import
|
||||||
@ -2051,7 +2051,7 @@ namespace bsmd.ExcelReadService
|
|||||||
#region TOWD
|
#region TOWD
|
||||||
|
|
||||||
private static void ScanTOWD(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
private static void ScanTOWD(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
{
|
{
|
||||||
Message towdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWD);
|
Message towdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWD);
|
||||||
|
|
||||||
// 24.4.21: TOWD beim Excel import
|
// 24.4.21: TOWD beim Excel import
|
||||||
@ -2099,7 +2099,7 @@ namespace bsmd.ExcelReadService
|
|||||||
towd.TowageOnDepartureBeam_MTR = reader.ReadNumber(tBeam);
|
towd.TowageOnDepartureBeam_MTR = reader.ReadNumber(tBeam);
|
||||||
towd.TowageOnDepartureOperatorCompanyName = reader.ReadText(tOp);
|
towd.TowageOnDepartureOperatorCompanyName = reader.ReadText(tOp);
|
||||||
reader.Conf.ConfirmText(tOp, towd.TowageOnDepartureOperatorCompanyName, towd.TowageOnDepartureOperatorCompanyName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(tOp, towd.TowageOnDepartureOperatorCompanyName, towd.TowageOnDepartureOperatorCompanyName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2131,7 +2131,7 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
private static void ScanSERV(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
private static void ScanSERV(List<Message> messages, MessageCore messageCore, ExcelReader reader)
|
||||||
{
|
{
|
||||||
Message servMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SERV);
|
Message servMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SERV);
|
||||||
if(servMessage.Elements.Count == 0)
|
if(servMessage.Elements.Count == 0)
|
||||||
{
|
{
|
||||||
SERV newSERV = new SERV();
|
SERV newSERV = new SERV();
|
||||||
@ -2218,7 +2218,7 @@ namespace bsmd.ExcelReadService
|
|||||||
ladgMessage.Elements.Add(ladg);
|
ladgMessage.Elements.Add(ladg);
|
||||||
}
|
}
|
||||||
|
|
||||||
ladg.CargoHandlingType = reader.ReadCargoHandlingType(lnCHT);
|
ladg.CargoHandlingType = reader.ReadCargoHandlingType(lnCHT);
|
||||||
|
|
||||||
// Transit-Ladung für DE nicht übernehmen!
|
// Transit-Ladung für DE nicht übernehmen!
|
||||||
if ((reader.Mode == ExcelReader.CountryMode.DE) && ((ladg.CargoHandlingType ?? 0) == 2))
|
if ((reader.Mode == ExcelReader.CountryMode.DE) && ((ladg.CargoHandlingType ?? 0) == 2))
|
||||||
@ -2257,18 +2257,18 @@ namespace bsmd.ExcelReadService
|
|||||||
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.WARN);
|
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.WARN);
|
||||||
ladg.CargoCodeNST = null;
|
ladg.CargoCodeNST = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ladg.CargoCodeNST = null;
|
ladg.CargoCodeNST = null;
|
||||||
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
|
reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ladg.CargoLACode = reader.ReadCargoLACode(lnLACode);
|
ladg.CargoLACode = reader.ReadCargoLACode(lnLACode);
|
||||||
|
|
||||||
ladg.CargoCodeNST_3 = reader.ReadText(lnZusatz);
|
ladg.CargoCodeNST_3 = reader.ReadText(lnZusatz);
|
||||||
if (!ladg.CargoCodeNST_3.IsNullOrEmpty())
|
if (!ladg.CargoCodeNST_3.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
if (ladg.CargoCodeNST_3.Length == 1)
|
if (ladg.CargoCodeNST_3.Length == 1)
|
||||||
@ -2290,8 +2290,8 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
ladg.CargoNumberOfItems = (int?) reader.ReadNumber(lnCNOI);
|
ladg.CargoNumberOfItems = (int?) reader.ReadNumber(lnCNOI);
|
||||||
ladg.CargoGrossQuantity_TNE = reader.ReadNumber(lnCGQ);
|
ladg.CargoGrossQuantity_TNE = reader.ReadNumber(lnCGQ);
|
||||||
ladg.PortOfLoading = reader.ReadLoCode(lnLoad);
|
ladg.PortOfLoading = reader.ReadLoCode(lnLoad);
|
||||||
ladg.PortOfDischarge = reader.ReadLoCode(lnDis);
|
ladg.PortOfDischarge = reader.ReadLoCode(lnDis);
|
||||||
|
|
||||||
// dont save empty element
|
// dont save empty element
|
||||||
if (ladg.IsNew && !ladg.CargoHandlingType.HasValue)
|
if (ladg.IsNew && !ladg.CargoHandlingType.HasValue)
|
||||||
@ -2342,11 +2342,11 @@ namespace bsmd.ExcelReadService
|
|||||||
crew.CrewMemberDuty = reader.ReadText(crewDuty);
|
crew.CrewMemberDuty = reader.ReadText(crewDuty);
|
||||||
reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
|
crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
|
||||||
crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
|
crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
|
||||||
reader.Conf.ConfirmText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth, crew.CrewMemberPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth, crew.CrewMemberPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
crew.CrewMemberDateOfBirth = reader.ReadBirthDate(crewDateOfBirth);
|
crew.CrewMemberDateOfBirth = reader.ReadBirthDate(crewDateOfBirth);
|
||||||
|
|
||||||
crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType);
|
crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType);
|
||||||
crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId);
|
crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId);
|
||||||
@ -2393,7 +2393,7 @@ namespace bsmd.ExcelReadService
|
|||||||
crew.CrewMemberDuty = reader.ReadText(crewDuty);
|
crew.CrewMemberDuty = reader.ReadText(crewDuty);
|
||||||
reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
|
crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
|
||||||
crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
|
crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
|
||||||
reader.Conf.ConfirmText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth, crew.CrewMemberPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth, crew.CrewMemberPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
|
|
||||||
@ -2452,7 +2452,7 @@ namespace bsmd.ExcelReadService
|
|||||||
pas.PassengerFirstName = firstName;
|
pas.PassengerFirstName = firstName;
|
||||||
reader.Conf.ConfirmText(pasFirstName, pas.PassengerFirstName, pas.PassengerFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(pasFirstName, pas.PassengerFirstName, pas.PassengerFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
pas.PassengerGender = reader.ReadGender(pasGender);
|
pas.PassengerGender = reader.ReadGender(pasGender);
|
||||||
pas.PassengerNationality = reader.ReadNationality(pasNationality);
|
pas.PassengerNationality = reader.ReadNationality(pasNationality);
|
||||||
// TODO: Nicht klar ob hier LOCODEs kommen oder nicht
|
// TODO: Nicht klar ob hier LOCODEs kommen oder nicht
|
||||||
pas.PassengerPortOfEmbarkation = reader.ReadLoCode(pasEmbarkation);
|
pas.PassengerPortOfEmbarkation = reader.ReadLoCode(pasEmbarkation);
|
||||||
reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, pas.PassengerPortOfEmbarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, pas.PassengerPortOfEmbarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
@ -2505,7 +2505,7 @@ namespace bsmd.ExcelReadService
|
|||||||
pas.PassengerFirstName = reader.ReadText(pasFirstName);
|
pas.PassengerFirstName = reader.ReadText(pasFirstName);
|
||||||
reader.Conf.ConfirmText(pasFirstName, pas.PassengerFirstName, pas.PassengerFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(pasFirstName, pas.PassengerFirstName, pas.PassengerFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
pas.PassengerGender = reader.ReadGender(pasGender);
|
pas.PassengerGender = reader.ReadGender(pasGender);
|
||||||
pas.PassengerNationality = reader.ReadNationality(pasNationality);
|
pas.PassengerNationality = reader.ReadNationality(pasNationality);
|
||||||
// TODO: Nicht klar ob hier LOCODEs kommen oder nicht
|
// TODO: Nicht klar ob hier LOCODEs kommen oder nicht
|
||||||
pas.PassengerPortOfEmbarkation = reader.ReadTextNoWhitespace(pasEmbarkation);
|
pas.PassengerPortOfEmbarkation = reader.ReadTextNoWhitespace(pasEmbarkation);
|
||||||
reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, pas.PassengerPortOfEmbarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, pas.PassengerPortOfEmbarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
@ -2541,7 +2541,7 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
object propValue = property.GetValue(dbEntity, null);
|
object propValue = property.GetValue(dbEntity, null);
|
||||||
string value = (propValue == null) ? string.Empty : propValue.ToString();
|
string value = (propValue == null) ? string.Empty : propValue.ToString();
|
||||||
LookupNameAttribute lookupNameAttribute = Attribute.GetCustomAttribute(property, typeof(LookupNameAttribute)) as LookupNameAttribute;
|
LookupNameAttribute lookupNameAttribute = Attribute.GetCustomAttribute(property, typeof(LookupNameAttribute)) as LookupNameAttribute;
|
||||||
|
|
||||||
if (property.PropertyType == typeof(DateTime?))
|
if (property.PropertyType == typeof(DateTime?))
|
||||||
{
|
{
|
||||||
@ -2587,7 +2587,7 @@ namespace bsmd.ExcelReadService
|
|||||||
readState = ExcelReader.ReadState.FAIL;
|
readState = ExcelReader.ReadState.FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Conf.ConfirmText(lookupNameAttribute.LookupName, sheetValue, readState);
|
reader.Conf.ConfirmText(lookupNameAttribute.LookupName, sheetValue, readState);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2626,9 +2626,9 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
bool? sheetValue = reader.ReadBoolean(lookupNameAttribute.LookupName);
|
bool? sheetValue = reader.ReadBoolean(lookupNameAttribute.LookupName);
|
||||||
string boolStringValue = reader.ReadText(lookupNameAttribute.LookupName);
|
string boolStringValue = reader.ReadText(lookupNameAttribute.LookupName);
|
||||||
if (sheetValue.HasValue) {
|
if (sheetValue.HasValue) {
|
||||||
property.SetValue(dbEntity, sheetValue);
|
property.SetValue(dbEntity, sheetValue);
|
||||||
reader.Conf.ConfirmText(lookupNameAttribute.LookupName, sheetValue.Value ? "Y" : "N",
|
reader.Conf.ConfirmText(lookupNameAttribute.LookupName, sheetValue.Value ? "Y" : "N",
|
||||||
ExcelReader.ReadState.OK);
|
ExcelReader.ReadState.OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2640,7 +2640,7 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
_log.DebugFormat("unhandled property type: {0}", property.PropertyType);
|
_log.DebugFormat("unhandled property type: {0}", property.PropertyType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2651,10 +2651,10 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check with cell values if this message core is already in our DB
|
/// Check with cell values if this message core is already in our DB
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static MessageCore LookupMessageCore(ExcelReader reader, out string message)
|
private static MessageCore LookupMessageCore(ExcelReader reader, out string message)
|
||||||
{
|
{
|
||||||
// lookup using field values
|
// lookup using field values
|
||||||
MessageCore result = null;
|
MessageCore result = null;
|
||||||
DateTime? eta = null;
|
DateTime? eta = null;
|
||||||
string poc;
|
string poc;
|
||||||
@ -2670,7 +2670,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if (bsmd.database.Util.IsVisitId(visitTransitId))
|
if (bsmd.database.Util.IsVisitId(visitTransitId))
|
||||||
{
|
{
|
||||||
result = DBManager.Instance.GetMessageCoreByVisitId(visitTransitId);
|
result = DBManager.Instance.GetMessageCoreByVisitId(visitTransitId);
|
||||||
}
|
}
|
||||||
else if (bsmd.database.Util.IsTransitId(visitTransitId))
|
else if (bsmd.database.Util.IsTransitId(visitTransitId))
|
||||||
{
|
{
|
||||||
result = DBManager.Instance.GetMessageCoreByTransitId(visitTransitId);
|
result = DBManager.Instance.GetMessageCoreByTransitId(visitTransitId);
|
||||||
@ -2688,7 +2688,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if (result.PoC.Substring(0, 2) == "DK")
|
if (result.PoC.Substring(0, 2) == "DK")
|
||||||
reader.SetConfirmation(Properties.Settings.Default.ConfirmationDK);
|
reader.SetConfirmation(Properties.Settings.Default.ConfirmationDK);
|
||||||
else
|
else
|
||||||
reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE);
|
reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE);
|
||||||
|
|
||||||
// copy poc/imo/eta to return sheet
|
// copy poc/imo/eta to return sheet
|
||||||
poc = reader.ReadText("Visit.PortOfCall");
|
poc = reader.ReadText("Visit.PortOfCall");
|
||||||
@ -2701,12 +2701,12 @@ namespace bsmd.ExcelReadService
|
|||||||
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// lookup poc, imo, eta
|
// lookup poc, imo, eta
|
||||||
poc = reader.ReadText("Visit.PortOfCall");
|
poc = reader.ReadText("Visit.PortOfCall");
|
||||||
|
|
||||||
if (poc != null)
|
if (poc != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Prüfen auf Transit
|
// Prüfen auf Transit
|
||||||
if (poc.IndexOf("CANAL", StringComparison.OrdinalIgnoreCase) >= 0 || poc.Equals("ZZNOK", StringComparison.OrdinalIgnoreCase))
|
if (poc.IndexOf("CANAL", StringComparison.OrdinalIgnoreCase) >= 0 || poc.Equals("ZZNOK", StringComparison.OrdinalIgnoreCase))
|
||||||
@ -2771,7 +2771,7 @@ namespace bsmd.ExcelReadService
|
|||||||
message = "invalid PoC";
|
message = "invalid PoC";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
imo = reader.ReadText("Visit.IMONumber");
|
imo = reader.ReadText("Visit.IMONumber");
|
||||||
reader.Conf.ConfirmText("Visit.IMONumber", imo, imo.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
reader.Conf.ConfirmText("Visit.IMONumber", imo, imo.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
|
||||||
@ -2784,7 +2784,7 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
if ((imo != null) && (eta.HasValue) && (poc != null))
|
if ((imo != null) && (eta.HasValue) && (poc != null))
|
||||||
{
|
{
|
||||||
result = DBManager.Instance.GetMessageCoreByShipInfos(imo, eta.Value, poc);
|
result = DBManager.Instance.GetMessageCoreByShipInfos(imo, eta.Value, poc);
|
||||||
if(result != null)
|
if(result != null)
|
||||||
{
|
{
|
||||||
_log.InfoFormat("Core [{3}] found for IMO {0}, ETA {1}, Poc {2}", imo, eta, poc, result.Id);
|
_log.InfoFormat("Core [{3}] found for IMO {0}, ETA {1}, Poc {2}", imo, eta, poc, result.Id);
|
||||||
@ -2856,7 +2856,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if (result.IsTransit)
|
if (result.IsTransit)
|
||||||
result.ETAKielCanal = eta;
|
result.ETAKielCanal = eta;
|
||||||
else
|
else
|
||||||
result.ETA = eta;
|
result.ETA = eta;
|
||||||
|
|
||||||
if (result.IMO.Length > 7)
|
if (result.IMO.Length > 7)
|
||||||
{
|
{
|
||||||
@ -2886,15 +2886,15 @@ namespace bsmd.ExcelReadService
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region GetMessageWithType
|
#region GetMessageWithType
|
||||||
|
|
||||||
private static Message GetMessageWithType(List<Message> messages, MessageCore core, Message.NotificationClass type)
|
private static Message GetMessageWithType(List<Message> messages, MessageCore core, Message.NotificationClass type)
|
||||||
{
|
{
|
||||||
foreach(Message message in messages)
|
foreach(Message message in messages)
|
||||||
if (message.MessageNotificationClass == type) return message;
|
if (message.MessageNotificationClass == type) return message;
|
||||||
|
|
||||||
Message newMessage = DBManager.Instance.GetMessage(core, type);
|
Message newMessage = DBManager.Instance.GetMessage(core, type);
|
||||||
if (newMessage == null)
|
if (newMessage == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace bsmd.Tool
|
namespace bsmd.Tool
|
||||||
{
|
{
|
||||||
@ -81,13 +82,18 @@ namespace bsmd.Tool
|
|||||||
insertCmd.Parameters.AddRange(new[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18 });
|
insertCmd.Parameters.AddRange(new[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18 });
|
||||||
updateCmd.Parameters.AddRange(new[] { p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, idParam });
|
updateCmd.Parameters.AddRange(new[] { p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, idParam });
|
||||||
|
|
||||||
|
SQLiteCommand delCmd = new SQLiteCommand(connection);
|
||||||
|
delCmd.CommandText = "DELETE FROM locodes WHERE id = @ID";
|
||||||
|
SQLiteParameter delIdParam = new SQLiteParameter("@ID", DbType.Int32);
|
||||||
|
delCmd.Parameters.Add(delIdParam);
|
||||||
|
|
||||||
string[] csvLines = File.ReadAllLines(csvFilePath);
|
string[] csvLines = File.ReadAllLines(csvFilePath);
|
||||||
int updateCnt = 0, insertCnt = 0;
|
int updateCnt = 0, insertCnt = 0;
|
||||||
|
|
||||||
for (int i = 0; i < csvLines.Length; i++)
|
for (int i = 0; i < csvLines.Length; i++)
|
||||||
{
|
{
|
||||||
string line = csvLines[i];
|
string line = csvLines[i];
|
||||||
string[] elems = line.Split(',');
|
string[] elems = Regex.Split(line, ",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))");
|
||||||
if (elems.Length < 12) continue;
|
if (elems.Length < 12) continue;
|
||||||
string country = elems[1].Trim().Replace("\"", "");
|
string country = elems[1].Trim().Replace("\"", "");
|
||||||
if (country.Length < 2) continue;
|
if (country.Length < 2) continue;
|
||||||
@ -100,12 +106,30 @@ namespace bsmd.Tool
|
|||||||
lcode.Value = code;
|
lcode.Value = code;
|
||||||
|
|
||||||
// Eingabeformat: https://service.unece.org/trade/locode/Service/LocodeColumn.htm
|
// Eingabeformat: https://service.unece.org/trade/locode/Service/LocodeColumn.htm
|
||||||
|
int? lid = null;
|
||||||
object lookupResult = lookupCmd.ExecuteScalar();
|
using (SQLiteDataReader lookupReader = lookupCmd.ExecuteReader())
|
||||||
if ((lookupResult != null) && (lookupResult != DBNull.Value))
|
{
|
||||||
|
while (lookupReader.Read())
|
||||||
|
{
|
||||||
|
if (!lookupReader.IsDBNull(0))
|
||||||
|
{
|
||||||
|
int tmp_id = lookupReader.GetInt32(0);
|
||||||
|
if (!lid.HasValue) { lid = tmp_id; }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Dublette, die löschen wir gleich hier:
|
||||||
|
delIdParam.Value = tmp_id;
|
||||||
|
if(delCmd.ExecuteNonQuery() == 0)
|
||||||
|
{
|
||||||
|
_log.WarnFormat("Delete of {0} affected no rows.", tmp_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lid.HasValue && lid > 0)
|
||||||
{
|
{
|
||||||
int lid = Convert.ToInt32(lookupResult);
|
|
||||||
|
|
||||||
p3.Value = elems[3].Trim().Replace("\"", "");
|
p3.Value = elems[3].Trim().Replace("\"", "");
|
||||||
p4.Value = elems[4].Trim().Replace("\"", "");
|
p4.Value = elems[4].Trim().Replace("\"", "");
|
||||||
p5.Value = elems[5].Trim().Replace("\"", "");
|
p5.Value = elems[5].Trim().Replace("\"", "");
|
||||||
@ -181,13 +205,11 @@ namespace bsmd.Tool
|
|||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine($"deleting {deleteIds.Count} obsolete entries");
|
Console.WriteLine($"deleting {deleteIds.Count} obsolete entries");
|
||||||
|
|
||||||
SQLiteCommand delCmd = new SQLiteCommand(connection);
|
|
||||||
delCmd.CommandText = "DELETE FROM locodes where id = @DELID";
|
|
||||||
// diejenigen löschen, die nicht mehr in der Quell CSV Datei auftauchen
|
// diejenigen löschen, die nicht mehr in der Quell CSV Datei auftauchen
|
||||||
foreach (int deleteId in deleteIds)
|
foreach (int deleteId in deleteIds)
|
||||||
{
|
{
|
||||||
delCmd.Parameters.AddWithValue("@DELID", deleteId);
|
delIdParam.Value = deleteId;
|
||||||
if (delCmd.ExecuteNonQuery() != 1)
|
if (delCmd.ExecuteNonQuery() != 1)
|
||||||
_log.WarnFormat("{0} affected no rows", deleteId);
|
_log.WarnFormat("{0} affected no rows", deleteId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -739,9 +739,7 @@ namespace bsmd.dakosy
|
|||||||
vList.Visit[0].WAS.WasteDisposalServiceProviderName[i].ServiceProviderName = ((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName;
|
vList.Visit[0].WAS.WasteDisposalServiceProviderName[i].ServiceProviderName = ((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vList.Visit[0].WAS.WasteDisposalDeliverySpecified = was.WasteDisposalDelivery.HasValue;
|
|
||||||
byte wdd = was.WasteDisposalDelivery ?? 0;
|
|
||||||
vList.Visit[0].WAS.WasteDisposalDelivery = WDDTypeFromNSWEnumeration(wdd);
|
|
||||||
if (was.Waste.Count > 0)
|
if (was.Waste.Count > 0)
|
||||||
{
|
{
|
||||||
vList.Visit[0].WAS.Waste = new Waste[was.Waste.Count];
|
vList.Visit[0].WAS.Waste = new Waste[was.Waste.Count];
|
||||||
|
|||||||
@ -91,9 +91,7 @@ namespace bsmd.database
|
|||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
@ -113,6 +111,8 @@ namespace bsmd.database
|
|||||||
result.Add(bkra);
|
result.Add(bkra);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,5 +141,15 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((BRKA)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +111,7 @@ namespace bsmd.database
|
|||||||
result.Add(bkrd);
|
result.Add(bkrd);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,5 +140,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((BRKD)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -231,8 +231,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,6 +265,7 @@ namespace bsmd.database
|
|||||||
result.Add(crew);
|
result.Add(crew);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,6 +305,9 @@ namespace bsmd.database
|
|||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((this.CrewMemberDateOfBirth.HasValue) && (this.CrewMemberDateOfBirth.Value > DateTime.Today))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -378,6 +380,20 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
if (!(obj is CREW)) return 1;
|
||||||
|
if (Int32.TryParse(((CREW)obj).Identifier, out int i1) && Int32.TryParse(this.Identifier, out int i2))
|
||||||
|
return i2.CompareTo(i1);
|
||||||
|
return this.Identifier.CompareTo(((CREW)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region CREWD
|
#region CREWD
|
||||||
@ -406,8 +422,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,6 +456,7 @@ namespace bsmd.database
|
|||||||
result.Add(crew);
|
result.Add(crew);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +114,7 @@ namespace bsmd.database
|
|||||||
result.Add(cp);
|
result.Add(cp);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,5 +129,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((CallPurpose)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
// Copyright (c) 2020-present schick Informatik
|
// Copyright (c) 2023-present schick Informatik
|
||||||
// Description: The new and mighty DB manager that uses async methods and
|
// Description: Variant of DBManager that uses async calls
|
||||||
// connection pooling.. will try it out in Maersk/PO numbers and expand over the whole
|
|
||||||
// app later
|
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using System;
|
using System;
|
||||||
@ -33,7 +31,22 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
SqlCommand cmd = new SqlCommand();
|
SqlCommand cmd = new SqlCommand();
|
||||||
entity.PrepareSave(cmd);
|
entity.PrepareSave(cmd);
|
||||||
return await PerformNonQueryAsync(cmd);
|
int result = await PerformNonQueryAsync(cmd);
|
||||||
|
if (result == 1) entity.IsDirty = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<int> DeleteAsync(DatabaseEntity entity)
|
||||||
|
{
|
||||||
|
if (!entity.IsNew)
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand())
|
||||||
|
{
|
||||||
|
entity.PrepareDelete(cmd);
|
||||||
|
return await PerformNonQueryAsync(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region convenience loading functions
|
#region convenience loading functions
|
||||||
@ -70,7 +83,7 @@ namespace bsmd.database
|
|||||||
MaerskData md = new MaerskData();
|
MaerskData md = new MaerskData();
|
||||||
md.PrepareLoadCommand(cmd, Message.LoadFilter.BY_CORE, messageCoreId);
|
md.PrepareLoadCommand(cmd, Message.LoadFilter.BY_CORE, messageCoreId);
|
||||||
SqlDataReader reader = await PerformCommandAsync(cmd);
|
SqlDataReader reader = await PerformCommandAsync(cmd);
|
||||||
List<MaerskData> resultList = await md.LoadListAsync(reader);
|
List<MaerskData> resultList = (await md.LoadListAsync(reader)).ConvertAll(x => (MaerskData) x);
|
||||||
MaerskData result = null;
|
MaerskData result = null;
|
||||||
if(resultList.Count > 0)
|
if(resultList.Count > 0)
|
||||||
{
|
{
|
||||||
@ -81,6 +94,14 @@ namespace bsmd.database
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<List<ValueMapping>> LoadValuesForType(ValueMapping.MappingType mappingType)
|
||||||
|
{
|
||||||
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
ValueMapping vm = new ValueMapping();
|
||||||
|
vm.PrepareLoadCommand(cmd, Message.LoadFilter.BY_TYPE, mappingType);
|
||||||
|
SqlDataReader reader = await PerformCommandAsync(cmd);
|
||||||
|
return (await vm.LoadListAsync(reader)).ConvertAll(x => (ValueMapping)x);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
44
bsmd.database/DatabaseEntityAsync.cs
Normal file
44
bsmd.database/DatabaseEntityAsync.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) 2023-present schick Informatik
|
||||||
|
// Description: Async variant of DatabaseEntity
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
public abstract class DatabaseEntityAsync : DatabaseEntity
|
||||||
|
{
|
||||||
|
protected abstract DatabaseEntityAsync ReadRowFromReader(IDataReader reader);
|
||||||
|
|
||||||
|
public async Task<List<DatabaseEntityAsync>> LoadListAsync(SqlDataReader reader)
|
||||||
|
{
|
||||||
|
List<DatabaseEntityAsync> result = new List<DatabaseEntityAsync>();
|
||||||
|
if (reader != null)
|
||||||
|
{
|
||||||
|
while (await reader.ReadAsync())
|
||||||
|
{
|
||||||
|
result.Add(ReadRowFromReader(reader));
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
||||||
|
{
|
||||||
|
List<DatabaseEntity> result = new List<DatabaseEntity>();
|
||||||
|
if (reader != null)
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
result.Add(ReadRowFromReader(reader));
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -229,8 +229,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY Identifier";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,6 +256,7 @@ namespace bsmd.database
|
|||||||
result.Add(ibc);
|
result.Add(ibc);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,5 +310,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((IBCPosition)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,8 +148,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY Identifier";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,6 +172,7 @@ namespace bsmd.database
|
|||||||
result.Add(igc);
|
result.Add(igc);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,5 +210,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((IGCPosition)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,8 +30,8 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region static Regex
|
#region static Regex
|
||||||
|
|
||||||
private static Regex imoClassRegex = new Regex(@"^[1-9]{1}(\.[1-9]{1}([A-Z]{1})?)?$");
|
private static readonly Regex imoClassRegex = new Regex(@"^[1-9]{1}(\.[1-9]{1}([A-Z]{1})?)?$");
|
||||||
private static Regex unNumberRegex = new Regex(@"^[0-9]{4}$");
|
private static readonly Regex unNumberRegex = new Regex(@"^[0-9]{4}$");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -375,8 +375,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY Identifier";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,6 +425,7 @@ namespace bsmd.database
|
|||||||
result.Add(imdg);
|
result.Add(imdg);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -624,5 +623,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((IMDGPosition)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,8 +179,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY Identifier";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +205,7 @@ namespace bsmd.database
|
|||||||
result.Add(imsbc);
|
result.Add(imsbc);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,5 +258,15 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((IMSBCPosition)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
@ -34,7 +35,7 @@ namespace bsmd.database
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dieses Interface kennzeichnet die Merkmale eines Sublisten-Elements
|
/// Dieses Interface kennzeichnet die Merkmale eines Sublisten-Elements
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ISublistElement
|
public interface ISublistElement : IComparable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mit diesem Schlüssel kann bei einem Report die richtige Beschriftung aus der SQLite Tabelle geholt werden
|
/// Mit diesem Schlüssel kann bei einem Report die richtige Beschriftung aus der SQLite Tabelle geholt werden
|
||||||
|
|||||||
@ -67,6 +67,7 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,9 +87,7 @@ namespace bsmd.database
|
|||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
@ -119,5 +118,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((InfectedArea)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,8 +182,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +206,7 @@ namespace bsmd.database
|
|||||||
result.Add(ladg);
|
result.Add(ladg);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,5 +238,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((LADG)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,6 +197,17 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((LastTenPortFacilitiesCalled)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -153,8 +153,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY Identifier";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -180,6 +178,7 @@ namespace bsmd.database
|
|||||||
result.Add(map);
|
result.Add(map);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,5 +223,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((MARPOL_Annex_I_Position)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace bsmd.database
|
|||||||
/// we use a generic storage class called "XtraData" that hopefully might be useful in another
|
/// we use a generic storage class called "XtraData" that hopefully might be useful in another
|
||||||
/// future scenario as well
|
/// future scenario as well
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MaerskData : DatabaseEntity, IEquatable<MaerskData>, IComparable<MaerskData>
|
public class MaerskData : DatabaseEntityAsync, IEquatable<MaerskData>, IComparable<MaerskData>
|
||||||
{
|
{
|
||||||
|
|
||||||
#region Construction
|
#region Construction
|
||||||
@ -124,7 +124,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region abstract DatabaseEntity method implementation
|
#region abstract DatabaseEntityAsync method implementation
|
||||||
|
|
||||||
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
||||||
{
|
{
|
||||||
@ -138,23 +138,9 @@ namespace bsmd.database
|
|||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<MaerskData>> LoadListAsync(SqlDataReader reader)
|
protected override DatabaseEntityAsync ReadRowFromReader(IDataReader reader)
|
||||||
{
|
|
||||||
List<MaerskData> result = new List<MaerskData>();
|
|
||||||
if (reader != null)
|
|
||||||
{
|
|
||||||
while (await reader.ReadAsync())
|
|
||||||
{
|
|
||||||
result.Add(ReadRowFromReader(reader));
|
|
||||||
}
|
|
||||||
reader.Close();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MaerskData ReadRowFromReader(IDataReader reader)
|
|
||||||
{
|
{
|
||||||
MaerskData md = null;
|
MaerskData md = null;
|
||||||
if (reader != null)
|
if (reader != null)
|
||||||
@ -247,9 +233,9 @@ namespace bsmd.database
|
|||||||
public bool Equals(MaerskData other)
|
public bool Equals(MaerskData other)
|
||||||
{
|
{
|
||||||
if (other == null) return false;
|
if (other == null) return false;
|
||||||
if (this.ColG == null) return (other.ColG == null);
|
if (this.ColG == null) return other.ColG == null;
|
||||||
if (this.ColH == null) return (other.ColH == null);
|
if (this.ColH == null) return other.ColH == null;
|
||||||
if (this.ColF == null) return (other.ColF == null);
|
if (this.ColF == null) return other.ColF == null;
|
||||||
return this.ColF.Equals(other.ColF) && this.ColG.Equals(other.ColG) && this.ColH.Equals(other.ColH);
|
return this.ColF.Equals(other.ColF) && this.ColG.Equals(other.ColG) && this.ColH.Equals(other.ColH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -143,7 +143,8 @@ namespace bsmd.database
|
|||||||
BY_CORE_AND_CLASS,
|
BY_CORE_AND_CLASS,
|
||||||
BY_AGE,
|
BY_AGE,
|
||||||
WASRCPT_ID,
|
WASRCPT_ID,
|
||||||
BY_FILE_SEQ_NUM
|
BY_FILE_SEQ_NUM,
|
||||||
|
BY_TYPE
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -234,7 +234,7 @@ namespace bsmd.database
|
|||||||
"PassengerIdentityDocumentId, PassengerVisaNumber, PassengerPortOfEmbarkation, PassengerPortOfDisembarkation," +
|
"PassengerIdentityDocumentId, PassengerVisaNumber, PassengerPortOfEmbarkation, PassengerPortOfDisembarkation," +
|
||||||
"PassengerInTransit, Identifier, IsDeparture, PassengerIdentityDocumentIssuingState, PassengerIdentityDocumentExpiryDate, " +
|
"PassengerInTransit, Identifier, IsDeparture, PassengerIdentityDocumentIssuingState, PassengerIdentityDocumentExpiryDate, " +
|
||||||
"NotificationSchengen, NotificationPAX, EmergencyCare, EmergencyContactNumber, PassengerCountryOfBirth) " +
|
"NotificationSchengen, NotificationPAX, EmergencyCare, EmergencyContactNumber, PassengerCountryOfBirth) " +
|
||||||
"VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, @P18, @P19, @P20, @P21, @P22 )",
|
"VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, @P18, @P19, @P20, @P21, @P22 )",
|
||||||
this.Tablename);
|
this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -256,7 +256,7 @@ namespace bsmd.database
|
|||||||
"PassengerDateOfBirth, PassengerGender, PassengerNationality, PassengerIdentityDocumentType, PassengerIdentityDocumentId, " +
|
"PassengerDateOfBirth, PassengerGender, PassengerNationality, PassengerIdentityDocumentType, PassengerIdentityDocumentId, " +
|
||||||
"PassengerVisaNumber, PassengerPortOfEmbarkation, PassengerPortOfDisembarkation, PassengerInTransit, Identifier, " +
|
"PassengerVisaNumber, PassengerPortOfEmbarkation, PassengerPortOfDisembarkation, PassengerInTransit, Identifier, " +
|
||||||
"IsDeparture, PassengerIdentityDocumentIssuingState, PassengerIdentityDocumentExpiryDate, NotificationSchengen, " +
|
"IsDeparture, PassengerIdentityDocumentIssuingState, PassengerIdentityDocumentExpiryDate, NotificationSchengen, " +
|
||||||
"NotificationPAX, EmergencyCare, EmergencyContactNumber, PassengerCountryOfBirth FROM {0}",
|
"NotificationPAX, EmergencyCare, EmergencyContactNumber, PassengerCountryOfBirth FROM {0}",
|
||||||
this.Tablename);
|
this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
@ -271,8 +271,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,6 +307,7 @@ namespace bsmd.database
|
|||||||
result.Add(pas);
|
result.Add(pas);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,6 +362,9 @@ namespace bsmd.database
|
|||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((this.PassengerDateOfBirth.HasValue) && (this.PassengerDateOfBirth.Value > DateTime.Today))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -433,6 +435,20 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
if (!(obj is PAS)) return 1;
|
||||||
|
if (Int32.TryParse(((PAS)obj).Identifier, out int i1) && Int32.TryParse(this.Identifier, out int i2))
|
||||||
|
return i2.CompareTo(i1);
|
||||||
|
return this.Identifier.CompareTo(((PAS)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region class PASD
|
#region class PASD
|
||||||
@ -460,8 +476,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,6 +512,7 @@ namespace bsmd.database
|
|||||||
result.Add(pas);
|
result.Add(pas);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -177,8 +177,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +196,7 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,5 +296,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((PortOfCallLast30Days)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,8 +88,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY TRY_CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +105,8 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -117,5 +115,16 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
return ValidationBlock.BLOCK2;
|
return ValidationBlock.BLOCK2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((PortOfCallLast30DaysCrewJoinedShip)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,8 +100,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,11 +119,23 @@ namespace bsmd.database
|
|||||||
result.Add(poi);
|
result.Add(poi);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((PortOfItinerary)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
[assembly: AssemblyCompany("schick Informatik")]
|
[assembly: AssemblyCompany("schick Informatik")]
|
||||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||||
[assembly: AssemblyInformationalVersion("7.11.0")]
|
[assembly: AssemblyInformationalVersion("7.12.0")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2023 schick Informatik")]
|
[assembly: AssemblyCopyright("Copyright © 2014-2023 schick Informatik")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("7.11.0.*")]
|
[assembly: AssemblyVersion("7.12.0.*")]
|
||||||
|
|
||||||
|
|||||||
@ -121,10 +121,21 @@ namespace bsmd.database
|
|||||||
result.Add(serv);
|
result.Add(serv);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((SERV)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,6 +90,7 @@ namespace bsmd.database
|
|||||||
result.Add(sto);
|
result.Add(sto);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +111,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,5 +143,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((STO)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,9 +101,7 @@ namespace bsmd.database
|
|||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
@ -124,6 +122,7 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +137,17 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((SanitaryMeasuresDetail)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region class SanitaryMeasuresDetailConverter
|
#region class SanitaryMeasuresDetailConverter
|
||||||
|
|||||||
@ -230,6 +230,17 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -88,8 +88,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,11 +105,21 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((StowawaysJoiningLocation)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,8 +81,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,10 +98,22 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((SubsidiaryRisks)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,8 +193,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +226,7 @@ namespace bsmd.database
|
|||||||
result.Add(towa);
|
result.Add(towa);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,6 +267,17 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((TOWA)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -178,8 +178,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +209,7 @@ namespace bsmd.database
|
|||||||
result.Add(towd);
|
result.Add(towd);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,6 +250,17 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((TOWD)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,8 +77,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,10 +94,22 @@ namespace bsmd.database
|
|||||||
result.Add(tfp);
|
result.Add(tfp);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((TreatmentFacilityProvider)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
271
bsmd.database/ValueMapping.cs
Normal file
271
bsmd.database/ValueMapping.cs
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
// Copyright (c) 2023-present schick Informatik
|
||||||
|
// Description: Container class for self-learning, volatile information that
|
||||||
|
// is added by parsing Excel sheets. Here common wrong/misspelled data fields
|
||||||
|
// are mapped to valid ones.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
public class ValueMapping : DatabaseEntityAsync, INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Construction
|
||||||
|
public ValueMapping()
|
||||||
|
{
|
||||||
|
this.tablename = "[dbo].[ValueMapping]";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region enums
|
||||||
|
|
||||||
|
public enum MappingType
|
||||||
|
{
|
||||||
|
COUNTRY,
|
||||||
|
GENDER,
|
||||||
|
DOCUMENT_TYPE,
|
||||||
|
LOCODE
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private static Dictionary<MappingType, Dictionary<string, ValueMapping>> _dicts;
|
||||||
|
private static Dictionary<MappingType, List<string>> _invalidKeys;
|
||||||
|
|
||||||
|
private string _key, _value, _valueText;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
public static Dictionary<MappingType, Dictionary<string, ValueMapping>> Dicts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_dicts == null)
|
||||||
|
{
|
||||||
|
_dicts = new Dictionary<MappingType, Dictionary<string, ValueMapping>>();
|
||||||
|
foreach (MappingType type in Enum.GetValues(typeof(MappingType)))
|
||||||
|
_dicts[type] = new Dictionary<string, ValueMapping>();
|
||||||
|
}
|
||||||
|
return _dicts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dictionary<MappingType, List<string>> InvalidKeys
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_invalidKeys == null)
|
||||||
|
{
|
||||||
|
_invalidKeys = new Dictionary<MappingType, List<string>>();
|
||||||
|
// get the keys initialized that cannot be assigned
|
||||||
|
foreach (MappingType type in Enum.GetValues(typeof(MappingType)))
|
||||||
|
_invalidKeys[type] = new List<string>();
|
||||||
|
}
|
||||||
|
return _invalidKeys;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MappingType EntryType { get; private set; }
|
||||||
|
|
||||||
|
public string Key
|
||||||
|
{
|
||||||
|
get { return _key; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!value.Equals(_key)) this.IsDirty = true;
|
||||||
|
this._key = value;
|
||||||
|
this.OnPropertyChanged("Key");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!value.Equals(_value)) this.IsDirty = true;
|
||||||
|
_value = value;
|
||||||
|
OnPropertyChanged("Value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ValueText
|
||||||
|
{
|
||||||
|
get { return _valueText; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this._valueText = value;
|
||||||
|
this.OnPropertyChanged("ValueText");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime? Created { get; private set; }
|
||||||
|
|
||||||
|
public DateTime? Changed { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public funcs
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// creates and saves a new entry and adds it to the internal dictionaries
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true if entry was actually created, false if already present</returns>
|
||||||
|
public static async Task<bool> Create(MappingType type, string key, string value)
|
||||||
|
{
|
||||||
|
if (!Dicts[type].ContainsKey(key))
|
||||||
|
{
|
||||||
|
ValueMapping vm = new ValueMapping()
|
||||||
|
{
|
||||||
|
EntryType = type,
|
||||||
|
Key = key,
|
||||||
|
Value = value
|
||||||
|
};
|
||||||
|
|
||||||
|
if (value.Equals("*"))
|
||||||
|
InvalidKeys[type].Add(key);
|
||||||
|
else
|
||||||
|
Dicts[type][key] = vm;
|
||||||
|
return await DBManagerAsync.SaveAsync(vm) == 1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create through manual editing in global scope
|
||||||
|
/// </summary>
|
||||||
|
public static ValueMapping Create(MappingType type)
|
||||||
|
{
|
||||||
|
ValueMapping vm = new ValueMapping()
|
||||||
|
{
|
||||||
|
EntryType = type
|
||||||
|
};
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// deletes an entry and removes it from the database
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true if successful, false if value was not found</returns>
|
||||||
|
public static async Task<bool> Delete(MappingType type, string key)
|
||||||
|
{
|
||||||
|
if (!Dicts.ContainsKey(type)) return false;
|
||||||
|
if (!Dicts[type].ContainsKey(key)) return false;
|
||||||
|
ValueMapping vm = Dicts[type][key];
|
||||||
|
Dicts[type].Remove(key);
|
||||||
|
return await DBManagerAsync.DeleteAsync(vm) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// updates an existing value and saves it
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true if successful</returns>
|
||||||
|
public async Task<bool> Update(string newValue)
|
||||||
|
{
|
||||||
|
this.Value = newValue;
|
||||||
|
return await DBManagerAsync.SaveAsync(this) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// (re-)loads all value mapping dictionaries
|
||||||
|
/// </summary>
|
||||||
|
public static async void LoadDicts()
|
||||||
|
{
|
||||||
|
foreach(MappingType type in Enum.GetValues(typeof(MappingType)))
|
||||||
|
{
|
||||||
|
Dicts[type].Clear();
|
||||||
|
List<ValueMapping> mappings = await DBManagerAsync.LoadValuesForType(type);
|
||||||
|
foreach (ValueMapping mapping in mappings)
|
||||||
|
{
|
||||||
|
if (mapping.Value.Equals("*"))
|
||||||
|
InvalidKeys[type].Add(mapping.Key);
|
||||||
|
else
|
||||||
|
Dicts[type][mapping.Key] = mapping;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DatabaseEntity implementation
|
||||||
|
|
||||||
|
public override void PrepareSave(System.Data.IDbCommand cmd)
|
||||||
|
{
|
||||||
|
SqlCommand scmd = cmd as SqlCommand;
|
||||||
|
|
||||||
|
scmd.Parameters.AddWithValue("@TYPE", this.EntryType);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@KEY", this.Key);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@VALUE", this.Value);
|
||||||
|
|
||||||
|
if(this.IsNew)
|
||||||
|
{
|
||||||
|
this.CreateId();
|
||||||
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
|
scmd.CommandText = $"INSERT INTO {Tablename} (Id, EntryType, MappingKey, MappingValue) VALUES (@ID, @TYPE, @KEY, @VALUE)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
|
scmd.CommandText = $"UPDATE {Tablename} SET EntryType = @TYPE, MappingKey = @KEY, MappingValue = @VALUE WHERE Id = @ID";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
|
{
|
||||||
|
string query = $"SELECT Id, EntryType, MappingKey, MappingValue, Created, Changed FROM {Tablename}";
|
||||||
|
switch (filter)
|
||||||
|
{
|
||||||
|
case Message.LoadFilter.BY_TYPE:
|
||||||
|
query += " WHERE EntryType = @TYPE";
|
||||||
|
((SqlCommand)cmd).Parameters.AddWithValue("@TYPE", criteria[0]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
query += " ORDER BY MappingKey";
|
||||||
|
cmd.CommandText = query;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DatabaseEntityAsync ReadRowFromReader(System.Data.IDataReader reader)
|
||||||
|
{
|
||||||
|
ValueMapping vm = null;
|
||||||
|
if (reader != null)
|
||||||
|
{
|
||||||
|
vm = new ValueMapping();
|
||||||
|
|
||||||
|
vm.id = reader.GetGuid(0);
|
||||||
|
|
||||||
|
if (!reader.IsDBNull(1)) vm.EntryType = (ValueMapping.MappingType)reader.GetByte(1);
|
||||||
|
if (!reader.IsDBNull(2)) vm._key = reader.GetString(2);
|
||||||
|
if (!reader.IsDBNull(3)) vm._value = reader.GetString(3);
|
||||||
|
if (!reader.IsDBNull(4)) vm.Created = reader.GetDateTime(4);
|
||||||
|
if (!reader.IsDBNull(5)) vm.Changed = reader.GetDateTime(5);
|
||||||
|
|
||||||
|
}
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region protected methods
|
||||||
|
|
||||||
|
protected void OnPropertyChanged(string name = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -129,12 +129,7 @@ namespace bsmd.database
|
|||||||
[LookupName("WAS.LastWasteDisposalDate")]
|
[LookupName("WAS.LastWasteDisposalDate")]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
[DateOnly]
|
[DateOnly]
|
||||||
public DateTime? LastWasteDisposalDate { get; set; }
|
public DateTime? LastWasteDisposalDate { get; set; }
|
||||||
|
|
||||||
[Obsolete]
|
|
||||||
[ShowReport]
|
|
||||||
[ENI2Validation]
|
|
||||||
public byte? WasteDisposalDelivery { get; set; }
|
|
||||||
|
|
||||||
[LookupName("WAS.ConfirmationOfSufficiency")]
|
[LookupName("WAS.ConfirmationOfSufficiency")]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
@ -232,8 +227,7 @@ namespace bsmd.database
|
|||||||
scmd.Parameters.AddWithNullableValue("@P2", this.WasteDisposalValidExemption);
|
scmd.Parameters.AddWithNullableValue("@P2", this.WasteDisposalValidExemption);
|
||||||
scmd.Parameters.AddWithNullableValue("@P3", this.LastWasteDisposalPort);
|
scmd.Parameters.AddWithNullableValue("@P3", this.LastWasteDisposalPort);
|
||||||
scmd.Parameters.AddWithNullableValue("@P4", this.ConfirmationOfCorrectness);
|
scmd.Parameters.AddWithNullableValue("@P4", this.ConfirmationOfCorrectness);
|
||||||
scmd.Parameters.AddWithNullableValue("@P5", this.LastWasteDisposalDate);
|
scmd.Parameters.AddWithNullableValue("@P5", this.LastWasteDisposalDate);
|
||||||
scmd.Parameters.AddWithNullableValue("@P6", this.WasteDisposalDelivery);
|
|
||||||
scmd.Parameters.AddWithNullableValue("@P7", this.ConfirmationOfSufficiency);
|
scmd.Parameters.AddWithNullableValue("@P7", this.ConfirmationOfSufficiency);
|
||||||
scmd.Parameters.AddWithNullableValue("@P8", this.NextWasteDisposalPort);
|
scmd.Parameters.AddWithNullableValue("@P8", this.NextWasteDisposalPort);
|
||||||
|
|
||||||
@ -242,14 +236,14 @@ namespace bsmd.database
|
|||||||
this.CreateId();
|
this.CreateId();
|
||||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, WasteDisposalValidExemption, " +
|
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, WasteDisposalValidExemption, " +
|
||||||
"LastWasteDisposalPort, ConfirmationOfCorrectness, LastWasteDisposalDate, WasteDisposalDelivery, " +
|
"LastWasteDisposalPort, ConfirmationOfCorrectness, LastWasteDisposalDate, " +
|
||||||
"ConfirmationOfSufficiency, NextWasteDisposalPort) VALUES ( @ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8 )", this.Tablename);
|
"ConfirmationOfSufficiency, NextWasteDisposalPort) VALUES ( @ID, @P1, @P2, @P3, @P4, @P5, @P7, @P8 )", this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scmd.Parameters.AddWithValue("ID", this.Id);
|
scmd.Parameters.AddWithValue("ID", this.Id);
|
||||||
scmd.CommandText = string.Format("UPDATE {0} SET WasteDisposalValidExemption = @P2, LastWasteDisposalPort = @P3, " +
|
scmd.CommandText = string.Format("UPDATE {0} SET WasteDisposalValidExemption = @P2, LastWasteDisposalPort = @P3, " +
|
||||||
"ConfirmationOfCorrectness = @P4, LastWasteDisposalDate = @P5, WasteDisposalDelivery = @P6, ConfirmationOfSufficiency = @P7, " +
|
"ConfirmationOfCorrectness = @P4, LastWasteDisposalDate = @P5, ConfirmationOfSufficiency = @P7, " +
|
||||||
"NextWasteDisposalPort = @P8 WHERE Id = @ID", this.Tablename);
|
"NextWasteDisposalPort = @P8 WHERE Id = @ID", this.Tablename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -257,7 +251,7 @@ namespace bsmd.database
|
|||||||
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
{
|
{
|
||||||
string query = string.Format("SELECT Id, WasteDisposalValidExemption, LastWasteDisposalPort, ConfirmationOfCorrectness, " +
|
string query = string.Format("SELECT Id, WasteDisposalValidExemption, LastWasteDisposalPort, ConfirmationOfCorrectness, " +
|
||||||
"LastWasteDisposalDate, WasteDisposalDelivery, ConfirmationOfSufficiency, NextWasteDisposalPort " +
|
"LastWasteDisposalDate, ConfirmationOfSufficiency, NextWasteDisposalPort " +
|
||||||
"FROM {0} ", this.Tablename);
|
"FROM {0} ", this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
@ -289,10 +283,9 @@ namespace bsmd.database
|
|||||||
if (!reader.IsDBNull(1)) was.WasteDisposalValidExemption = reader.GetBoolean(1);
|
if (!reader.IsDBNull(1)) was.WasteDisposalValidExemption = reader.GetBoolean(1);
|
||||||
if (!reader.IsDBNull(2)) was.LastWasteDisposalPort = reader.GetString(2);
|
if (!reader.IsDBNull(2)) was.LastWasteDisposalPort = reader.GetString(2);
|
||||||
if (!reader.IsDBNull(3)) was.ConfirmationOfCorrectness = reader.GetBoolean(3);
|
if (!reader.IsDBNull(3)) was.ConfirmationOfCorrectness = reader.GetBoolean(3);
|
||||||
if (!reader.IsDBNull(4)) was.LastWasteDisposalDate = reader.GetDateTime(4);
|
if (!reader.IsDBNull(4)) was.LastWasteDisposalDate = reader.GetDateTime(4);
|
||||||
if (!reader.IsDBNull(5)) was.WasteDisposalDelivery = reader.GetByte(5);
|
if (!reader.IsDBNull(5)) was.ConfirmationOfSufficiency = reader.GetBoolean(5);
|
||||||
if (!reader.IsDBNull(6)) was.ConfirmationOfSufficiency = reader.GetBoolean(6);
|
if (!reader.IsDBNull(6)) was.NextWasteDisposalPort = reader.GetString(6);
|
||||||
if (!reader.IsDBNull(7)) was.NextWasteDisposalPort = reader.GetString(7);
|
|
||||||
result.Add(was);
|
result.Add(was);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
|||||||
@ -300,6 +300,7 @@ namespace bsmd.database
|
|||||||
result.Add(was_rcpt);
|
result.Add(was_rcpt);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,5 +417,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((WAS_RCPT)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,11 +114,7 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public double? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
|
public double? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
|
||||||
|
|
||||||
[Obsolete]
|
|
||||||
[ENI2Validation]
|
|
||||||
public double? WasteDisposedAtLastPort_MTQ { get; set; }
|
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|
||||||
@ -179,9 +175,8 @@ namespace bsmd.database
|
|||||||
scmd.Parameters.AddWithNullableValue("@P5", this.WasteCapacity_MTQ);
|
scmd.Parameters.AddWithNullableValue("@P5", this.WasteCapacity_MTQ);
|
||||||
scmd.Parameters.AddWithNullableValue("@P6", this.WasteAmountRetained_MTQ);
|
scmd.Parameters.AddWithNullableValue("@P6", this.WasteAmountRetained_MTQ);
|
||||||
scmd.Parameters.AddWithNullableValue("@P7", this.WasteDisposalPort);
|
scmd.Parameters.AddWithNullableValue("@P7", this.WasteDisposalPort);
|
||||||
scmd.Parameters.AddWithNullableValue("@P8", this.WasteAmountGeneratedTillNextPort_MTQ);
|
scmd.Parameters.AddWithNullableValue("@P8", this.WasteAmountGeneratedTillNextPort_MTQ);
|
||||||
scmd.Parameters.AddWithNullableValue("@P9", this.WasteDisposedAtLastPort_MTQ);
|
scmd.Parameters.AddWithNullableValue("@P9", this.Identifier);
|
||||||
scmd.Parameters.AddWithNullableValue("@P10", this.Identifier);
|
|
||||||
|
|
||||||
if (this.IsNew)
|
if (this.IsNew)
|
||||||
{
|
{
|
||||||
@ -189,16 +184,16 @@ namespace bsmd.database
|
|||||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
scmd.CommandText = string.Format("INSERT INTO {0} (Id, WASId, WasteType, WasteDescription, " +
|
scmd.CommandText = string.Format("INSERT INTO {0} (Id, WASId, WasteType, WasteDescription, " +
|
||||||
"WasteDisposalAmount_MTQ, WasteCapacity_MTQ, WasteAmountRetained_MTQ, WasteDisposalPort, " +
|
"WasteDisposalAmount_MTQ, WasteCapacity_MTQ, WasteAmountRetained_MTQ, WasteDisposalPort, " +
|
||||||
"WasteAmountGeneratedTillNextPort_MTQ, WasteDisposedAtLastPort_MTQ, Identifier) " +
|
"WasteAmountGeneratedTillNextPort_MTQ, Identifier) " +
|
||||||
" VALUES ( @ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10 )", this.Tablename);
|
" VALUES ( @ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9 )", this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
scmd.CommandText = string.Format("UPDATE {0} SET WasteType = @P2, WasteDescription = @P3, " +
|
scmd.CommandText = string.Format("UPDATE {0} SET WasteType = @P2, WasteDescription = @P3, " +
|
||||||
"WasteDisposalAmount_MTQ = @P4, WasteCapacity_MTQ = @P5, WasteAmountRetained_MTQ = @P6," +
|
"WasteDisposalAmount_MTQ = @P4, WasteCapacity_MTQ = @P5, WasteAmountRetained_MTQ = @P6," +
|
||||||
"WasteDisposalPort = @P7, WasteAmountGeneratedTillNextPort_MTQ = @P8, WasteDisposedAtLastPort_MTQ = @P9, " +
|
"WasteDisposalPort = @P7, WasteAmountGeneratedTillNextPort_MTQ = @P8, " +
|
||||||
"Identifier = @P10 WHERE Id = @ID", this.Tablename);
|
"Identifier = @P9 WHERE Id = @ID", this.Tablename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +201,7 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
string query = string.Format("SELECT Id, WasteType, WasteDescription, WasteDisposalAmount_MTQ, " +
|
string query = string.Format("SELECT Id, WasteType, WasteDescription, WasteDisposalAmount_MTQ, " +
|
||||||
"WasteCapacity_MTQ, WasteAmountRetained_MTQ, WasteDisposalPort, WasteAmountGeneratedTillNextPort_MTQ, " +
|
"WasteCapacity_MTQ, WasteAmountRetained_MTQ, WasteDisposalPort, WasteAmountGeneratedTillNextPort_MTQ, " +
|
||||||
"WasteDisposedAtLastPort_MTQ, Identifier FROM {0} ", this.Tablename);
|
"Identifier FROM {0} ", this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
{
|
{
|
||||||
@ -219,7 +214,6 @@ namespace bsmd.database
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
@ -239,12 +233,12 @@ namespace bsmd.database
|
|||||||
if (!reader.IsDBNull(4)) waste.WasteCapacity_MTQ = (float) reader.GetDouble(4);
|
if (!reader.IsDBNull(4)) waste.WasteCapacity_MTQ = (float) reader.GetDouble(4);
|
||||||
if (!reader.IsDBNull(5)) waste.WasteAmountRetained_MTQ = (float) reader.GetDouble(5);
|
if (!reader.IsDBNull(5)) waste.WasteAmountRetained_MTQ = (float) reader.GetDouble(5);
|
||||||
if (!reader.IsDBNull(6)) waste.WasteDisposalPort = reader.GetString(6);
|
if (!reader.IsDBNull(6)) waste.WasteDisposalPort = reader.GetString(6);
|
||||||
if (!reader.IsDBNull(7)) waste.WasteAmountGeneratedTillNextPort_MTQ = (float) reader.GetDouble(7);
|
if (!reader.IsDBNull(7)) waste.WasteAmountGeneratedTillNextPort_MTQ = (float) reader.GetDouble(7);
|
||||||
if (!reader.IsDBNull(8)) waste.WasteDisposedAtLastPort_MTQ = (float)reader.GetDouble(8);
|
if (!reader.IsDBNull(8)) waste.Identifier = reader.GetString(8);
|
||||||
if (!reader.IsDBNull(9)) waste.Identifier = reader.GetString(9);
|
|
||||||
result.Add(waste);
|
result.Add(waste);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,5 +275,16 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((Waste)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,11 +32,7 @@ namespace bsmd.database
|
|||||||
[MaxLength(99)]
|
[MaxLength(99)]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
[Validation(ValidationCode.STRING_MAXLEN, 99)]
|
[Validation(ValidationCode.STRING_MAXLEN, 99)]
|
||||||
public string WasteDisposalServiceProviderName { get; set; }
|
public string WasteDisposalServiceProviderName { get; set; }
|
||||||
|
|
||||||
[Obsolete]
|
|
||||||
[JsonIgnore]
|
|
||||||
public byte? WasteDisposalDelivery { get; set; }
|
|
||||||
|
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|
||||||
@ -53,28 +49,27 @@ namespace bsmd.database
|
|||||||
SqlCommand scmd = cmd as SqlCommand;
|
SqlCommand scmd = cmd as SqlCommand;
|
||||||
|
|
||||||
scmd.Parameters.AddWithValue("@P1", this.WAS.Id);
|
scmd.Parameters.AddWithValue("@P1", this.WAS.Id);
|
||||||
scmd.Parameters.AddWithNullableValue("@P2", this.WasteDisposalServiceProviderName);
|
scmd.Parameters.AddWithNullableValue("@P2", this.WasteDisposalServiceProviderName);
|
||||||
scmd.Parameters.AddWithNullableValue("@P3", this.WasteDisposalDelivery);
|
|
||||||
scmd.Parameters.AddWithNullableValue("@P4", this.Identifier);
|
scmd.Parameters.AddWithNullableValue("@P4", this.Identifier);
|
||||||
|
|
||||||
if (this.IsNew)
|
if (this.IsNew)
|
||||||
{
|
{
|
||||||
this.CreateId();
|
this.CreateId();
|
||||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
scmd.CommandText = string.Format("INSERT INTO {0} (Id, WASId, WasteDisposalServiceProviderName, WasteDisposalDelivery, Identifier) " +
|
scmd.CommandText = string.Format("INSERT INTO {0} (Id, WASId, WasteDisposalServiceProviderName, Identifier) " +
|
||||||
"VALUES ( @ID, @P1, @P2, @P3, @P4 )", this.Tablename);
|
"VALUES ( @ID, @P1, @P2, @P4 )", this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scmd.Parameters.AddWithValue("ID", this.Id);
|
scmd.Parameters.AddWithValue("ID", this.Id);
|
||||||
scmd.CommandText = string.Format("UPDATE {0} SET WasteDisposalServiceProviderName = @P2, WasteDisposalDelivery = @P3 " +
|
scmd.CommandText = string.Format("UPDATE {0} SET WasteDisposalServiceProviderName = @P2 " +
|
||||||
"WHERE Id = @ID", this.Tablename);
|
"WHERE Id = @ID", this.Tablename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
{
|
{
|
||||||
string query = string.Format("SELECT Id, WasteDisposalServiceProviderName, WasteDisposalDelivery, Identifier FROM {0}", this.Tablename);
|
string query = string.Format("SELECT Id, WasteDisposalServiceProviderName, Identifier FROM {0}", this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
{
|
{
|
||||||
@ -88,8 +83,6 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,16 +95,27 @@ namespace bsmd.database
|
|||||||
WasteDisposalServiceProvider wdsp = new WasteDisposalServiceProvider();
|
WasteDisposalServiceProvider wdsp = new WasteDisposalServiceProvider();
|
||||||
|
|
||||||
wdsp.id = reader.GetGuid(0);
|
wdsp.id = reader.GetGuid(0);
|
||||||
if (!reader.IsDBNull(1)) wdsp.WasteDisposalServiceProviderName = reader.GetString(1);
|
if (!reader.IsDBNull(1)) wdsp.WasteDisposalServiceProviderName = reader.GetString(1);
|
||||||
if (!reader.IsDBNull(2)) wdsp.WasteDisposalDelivery = reader.GetByte(2);
|
if (!reader.IsDBNull(2)) wdsp.Identifier = reader.GetString(2);
|
||||||
if (!reader.IsDBNull(3)) wdsp.Identifier = reader.GetString(3);
|
|
||||||
result.Add(wdsp);
|
result.Add(wdsp);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((WasteDisposalServiceProvider)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,6 +81,7 @@ namespace bsmd.database
|
|||||||
result.Add(wasteReceived);
|
result.Add(wasteReceived);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
result.Sort();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +100,6 @@ namespace bsmd.database
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
query += " ORDER BY CAST(Identifier AS INT)";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
cmd.CommandText = query;
|
||||||
}
|
}
|
||||||
@ -141,5 +141,16 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null)
|
||||||
|
return 1;
|
||||||
|
return this.Identifier.CompareTo(((WasteReceived)obj).Identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,6 +111,7 @@
|
|||||||
<Compile Include="AGNT_Template.cs" />
|
<Compile Include="AGNT_Template.cs" />
|
||||||
<Compile Include="CallPurpose.cs" />
|
<Compile Include="CallPurpose.cs" />
|
||||||
<Compile Include="Customer.cs" />
|
<Compile Include="Customer.cs" />
|
||||||
|
<Compile Include="DatabaseEntityAsync.cs" />
|
||||||
<Compile Include="DBManagerAsync.cs" />
|
<Compile Include="DBManagerAsync.cs" />
|
||||||
<Compile Include="Extensions.cs" />
|
<Compile Include="Extensions.cs" />
|
||||||
<Compile Include="HAZ.cs" />
|
<Compile Include="HAZ.cs" />
|
||||||
@ -182,6 +183,7 @@
|
|||||||
<Compile Include="ValidationAttribute.cs" />
|
<Compile Include="ValidationAttribute.cs" />
|
||||||
<Compile Include="ValidationCondition.cs" />
|
<Compile Include="ValidationCondition.cs" />
|
||||||
<Compile Include="ValidationRule.cs" />
|
<Compile Include="ValidationRule.cs" />
|
||||||
|
<Compile Include="ValueMapping.cs" />
|
||||||
<Compile Include="WAS.cs" />
|
<Compile Include="WAS.cs" />
|
||||||
<Compile Include="Waste.cs" />
|
<Compile Include="Waste.cs" />
|
||||||
<Compile Include="WasteDisposalServiceProvider.cs" />
|
<Compile Include="WasteDisposalServiceProvider.cs" />
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
extensions: designer.cs generated.cs
|
extensions: designer.cs generated.cs
|
||||||
extensions: .cs .cpp .h
|
extensions: .cs .cpp .h
|
||||||
// Copyright (c) 2020-present schick Informatik
|
// Copyright (c) 2023-present schick Informatik
|
||||||
// Description:
|
// Description:
|
||||||
|
|
||||||
extensions: .aspx .ascx
|
extensions: .aspx .ascx
|
||||||
<%--
|
<%--
|
||||||
Copyright (c) 2020-present schick Informatik
|
Copyright (c) 2023-present schick Informatik
|
||||||
--%>
|
--%>
|
||||||
extensions: .vb
|
extensions: .vb
|
||||||
'Sample license text.
|
'Sample license text.
|
||||||
|
|||||||
@ -15,7 +15,7 @@ using bsmd.database;
|
|||||||
using bsmd.dbh.DBHWebReference;
|
using bsmd.dbh.DBHWebReference;
|
||||||
|
|
||||||
namespace bsmd.dbh
|
namespace bsmd.dbh
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class implements the "oldschool" approach of sending classes via the SOAP interface.
|
/// This class implements the "oldschool" approach of sending classes via the SOAP interface.
|
||||||
@ -118,7 +118,7 @@ namespace bsmd.dbh
|
|||||||
{
|
{
|
||||||
if (message == null) return false;
|
if (message == null) return false;
|
||||||
|
|
||||||
RootType rootType = message.Reset ? RootType.RESET : RootType.DATA;
|
RootType rootType = message.Reset ? RootType.RESET : RootType.DATA;
|
||||||
|
|
||||||
if (message.ReportingParty == null)
|
if (message.ReportingParty == null)
|
||||||
{
|
{
|
||||||
@ -190,7 +190,7 @@ namespace bsmd.dbh
|
|||||||
rootVisit.ETAPortOfCall = message.MessageCore.ETA.Value.ToDBHDateString();
|
rootVisit.ETAPortOfCall = message.MessageCore.ETA.Value.ToDBHDateString();
|
||||||
else
|
else
|
||||||
rootVisit.ETAPortOfCall = null;
|
rootVisit.ETAPortOfCall = null;
|
||||||
|
|
||||||
item = rootVisit;
|
item = rootVisit;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -353,7 +353,7 @@ namespace bsmd.dbh
|
|||||||
SEC sec = message.Elements[0] as SEC;
|
SEC sec = message.Elements[0] as SEC;
|
||||||
|
|
||||||
List<object> secItems = new List<object>();
|
List<object> secItems = new List<object>();
|
||||||
List<ItemsChoiceType1> choiceType1s = new List<ItemsChoiceType1>();
|
List<ItemsChoiceType1> choiceType1s = new List<ItemsChoiceType1>();
|
||||||
|
|
||||||
if(!message.MessageCore.IsTransit)
|
if(!message.MessageCore.IsTransit)
|
||||||
{
|
{
|
||||||
@ -417,7 +417,7 @@ namespace bsmd.dbh
|
|||||||
choiceType1s.Add(ItemsChoiceType1.GeneralDescriptionOfCargo);
|
choiceType1s.Add(ItemsChoiceType1.GeneralDescriptionOfCargo);
|
||||||
secItems.Add((CargoDescription)sec.GeneralDescriptionOfCargo.Value);
|
secItems.Add((CargoDescription)sec.GeneralDescriptionOfCargo.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i < sec.LastTenPortFacilitesCalled.Count; i++)
|
for (int i=0; i < sec.LastTenPortFacilitesCalled.Count; i++)
|
||||||
{
|
{
|
||||||
choiceType1s.Add(ItemsChoiceType1.LastTenPortFacilitiesCalled);
|
choiceType1s.Add(ItemsChoiceType1.LastTenPortFacilitiesCalled);
|
||||||
@ -458,7 +458,7 @@ namespace bsmd.dbh
|
|||||||
if (shipToShip.ShipToShipActivityDateTo.HasValue)
|
if (shipToShip.ShipToShipActivityDateTo.HasValue)
|
||||||
s2s.ShipToShipActivityDateTo = shipToShip.ShipToShipActivityDateTo.Value;
|
s2s.ShipToShipActivityDateTo = shipToShip.ShipToShipActivityDateTo.Value;
|
||||||
|
|
||||||
//int activityType;
|
//int activityType;
|
||||||
//if (!Int32.TryParse(shipToShip.ShipToShipActivityType, out activityType))
|
//if (!Int32.TryParse(shipToShip.ShipToShipActivityType, out activityType))
|
||||||
//activityType = NOA_NOD.getCallPurposeCodeFromDescription(shipToShip.ShipToShipActivityType) ?? 0;
|
//activityType = NOA_NOD.getCallPurposeCodeFromDescription(shipToShip.ShipToShipActivityType) ?? 0;
|
||||||
//s2s.ShipToShipActivityType = activityType;
|
//s2s.ShipToShipActivityType = activityType;
|
||||||
@ -537,8 +537,8 @@ namespace bsmd.dbh
|
|||||||
if(crew.CrewMemberIdentityDocumentIssuingState.Trim().Length == 2)
|
if(crew.CrewMemberIdentityDocumentIssuingState.Trim().Length == 2)
|
||||||
rootCREW.CrewMember[i].CrewMemberIdentityDocumentIssuingState = crew.CrewMemberIdentityDocumentIssuingState;
|
rootCREW.CrewMember[i].CrewMemberIdentityDocumentIssuingState = crew.CrewMemberIdentityDocumentIssuingState;
|
||||||
rootCREW.CrewMember[i].CrewMemberIdentityDocumentExpiryDateSpecified = crew.CrewMemberIdentityDocumentExpiryDate.HasValue;
|
rootCREW.CrewMember[i].CrewMemberIdentityDocumentExpiryDateSpecified = crew.CrewMemberIdentityDocumentExpiryDate.HasValue;
|
||||||
if (crew.CrewMemberIdentityDocumentExpiryDate.HasValue)
|
if (crew.CrewMemberIdentityDocumentExpiryDate.HasValue)
|
||||||
rootCREW.CrewMember[i].CrewMemberIdentityDocumentExpiryDate = crew.CrewMemberIdentityDocumentExpiryDate.Value;
|
rootCREW.CrewMember[i].CrewMemberIdentityDocumentExpiryDate = crew.CrewMemberIdentityDocumentExpiryDate.Value;
|
||||||
}
|
}
|
||||||
item = rootCREW;
|
item = rootCREW;
|
||||||
|
|
||||||
@ -706,7 +706,7 @@ namespace bsmd.dbh
|
|||||||
rootStat.TransportMode = RootSTATTransportMode.Item1; // default is maritime transport!
|
rootStat.TransportMode = RootSTATTransportMode.Item1; // default is maritime transport!
|
||||||
if (!stat.TransportMode.IsNullOrEmpty() && stat.TransportMode.Equals("8"))
|
if (!stat.TransportMode.IsNullOrEmpty() && stat.TransportMode.Equals("8"))
|
||||||
rootStat.TransportMode = RootSTATTransportMode.Item8;
|
rootStat.TransportMode = RootSTATTransportMode.Item8;
|
||||||
|
|
||||||
if (!stat.ISMCompanyName.IsNullOrEmpty())
|
if (!stat.ISMCompanyName.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
rootStat.ISMCompany = new RootSTATISMCompany();
|
rootStat.ISMCompany = new RootSTATISMCompany();
|
||||||
@ -726,7 +726,7 @@ namespace bsmd.dbh
|
|||||||
case Message.NotificationClass.LADG:
|
case Message.NotificationClass.LADG:
|
||||||
{
|
{
|
||||||
RootLADG rootLADG = new RootLADG();
|
RootLADG rootLADG = new RootLADG();
|
||||||
List<RootLADGCargo> cargoList = new List<RootLADGCargo>();
|
List<RootLADGCargo> cargoList = new List<RootLADGCargo>();
|
||||||
for (int i = 0; i < message.Elements.Count; i++ )
|
for (int i = 0; i < message.Elements.Count; i++ )
|
||||||
{
|
{
|
||||||
LADG ladg = message.Elements[i] as LADG;
|
LADG ladg = message.Elements[i] as LADG;
|
||||||
@ -764,7 +764,7 @@ namespace bsmd.dbh
|
|||||||
if (ladg.PortOfLoading.IsNullOrEmpty())
|
if (ladg.PortOfLoading.IsNullOrEmpty())
|
||||||
cargo.CargoPortOfLoading = "ZZUKN";
|
cargo.CargoPortOfLoading = "ZZUKN";
|
||||||
else
|
else
|
||||||
cargo.CargoPortOfLoading = ladg.PortOfLoading;
|
cargo.CargoPortOfLoading = ladg.PortOfLoading;
|
||||||
|
|
||||||
if (ladg.PortOfDischarge.IsNullOrEmpty())
|
if (ladg.PortOfDischarge.IsNullOrEmpty())
|
||||||
cargo.CargoPortOfDischarge = "ZZUKN";
|
cargo.CargoPortOfDischarge = "ZZUKN";
|
||||||
@ -850,7 +850,7 @@ namespace bsmd.dbh
|
|||||||
if (sendVolume)
|
if (sendVolume)
|
||||||
rootPre.TankerDetails.VolumeOfCargo_TNE = Decimal.Round((decimal)(pre72h.VolumeOfCargo.Value), 3);
|
rootPre.TankerDetails.VolumeOfCargo_TNE = Decimal.Round((decimal)(pre72h.VolumeOfCargo.Value), 3);
|
||||||
|
|
||||||
}
|
}
|
||||||
rootPre.PlannedOperations = pre72h.PlannedOperations;
|
rootPre.PlannedOperations = pre72h.PlannedOperations;
|
||||||
rootPre.PlannedWorks = pre72h.PlannedWorks;
|
rootPre.PlannedWorks = pre72h.PlannedWorks;
|
||||||
rootPre.DateOfLastExpandedInspectionSpecified = pre72h.DateOfLastExpandedInspection.HasValue;
|
rootPre.DateOfLastExpandedInspectionSpecified = pre72h.DateOfLastExpandedInspection.HasValue;
|
||||||
@ -924,7 +924,7 @@ namespace bsmd.dbh
|
|||||||
|
|
||||||
choiceTypes2.Add(ItemsChoiceType2.SanitaryMeasuresApplied);
|
choiceTypes2.Add(ItemsChoiceType2.SanitaryMeasuresApplied);
|
||||||
mdhItems.Add(mdh.SanitaryMeasuresApplied ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
|
mdhItems.Add(mdh.SanitaryMeasuresApplied ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
|
||||||
|
|
||||||
if (mdh.SanitaryMeasuresApplied ?? false)
|
if (mdh.SanitaryMeasuresApplied ?? false)
|
||||||
{
|
{
|
||||||
foreach (SanitaryMeasuresDetail smd in mdh.SanitaryMeasuresDetails)
|
foreach (SanitaryMeasuresDetail smd in mdh.SanitaryMeasuresDetails)
|
||||||
@ -938,7 +938,7 @@ namespace bsmd.dbh
|
|||||||
mdhItems.Add(smDet);
|
mdhItems.Add(smDet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
choiceTypes2.Add(ItemsChoiceType2.StowawaysDetected);
|
choiceTypes2.Add(ItemsChoiceType2.StowawaysDetected);
|
||||||
mdhItems.Add(mdh.StowawaysDetected ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
|
mdhItems.Add(mdh.StowawaysDetected ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
|
||||||
|
|
||||||
@ -947,7 +947,7 @@ namespace bsmd.dbh
|
|||||||
foreach (StowawaysJoiningLocation sjl in mdh.StowawaysJoiningLocations)
|
foreach (StowawaysJoiningLocation sjl in mdh.StowawaysJoiningLocations)
|
||||||
{
|
{
|
||||||
if(!sjl.StowawayJoiningLocation.IsNullOrEmpty())
|
if(!sjl.StowawayJoiningLocation.IsNullOrEmpty())
|
||||||
concatLocations = string.Format("{0} {1}", concatLocations, sjl.StowawayJoiningLocation);
|
concatLocations = string.Format("{0} {1}", concatLocations, sjl.StowawayJoiningLocation);
|
||||||
}
|
}
|
||||||
mdhItems.Add(concatLocations);
|
mdhItems.Add(concatLocations);
|
||||||
|
|
||||||
@ -983,7 +983,7 @@ namespace bsmd.dbh
|
|||||||
infected.InfectedAreaDate = ia.InfectedAreaDate.Value;
|
infected.InfectedAreaDate = ia.InfectedAreaDate.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mdh.PortOfCallLast30Days.Count > 0)
|
if (mdh.PortOfCallLast30Days.Count > 0)
|
||||||
{
|
{
|
||||||
choiceTypes2.Add(ItemsChoiceType2.PortsOfCallLast30Days);
|
choiceTypes2.Add(ItemsChoiceType2.PortsOfCallLast30Days);
|
||||||
@ -1063,27 +1063,27 @@ namespace bsmd.dbh
|
|||||||
{
|
{
|
||||||
choiceType3s.Add(ItemsChoiceType3.WasteDisposalDelivery);
|
choiceType3s.Add(ItemsChoiceType3.WasteDisposalDelivery);
|
||||||
wasteItems.Add((DisposalType)was.WasteDisposalDelivery.Value);
|
wasteItems.Add((DisposalType)was.WasteDisposalDelivery.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
{"Wert von 'ItemsElementName' stimmt nicht mit dem Typ von 'bsmd.dbh.DBHWebReference.RootWASWaste' überein.
|
{"Wert von 'ItemsElementName' stimmt nicht mit dem Typ von 'bsmd.dbh.DBHWebReference.RootWASWaste' überein.
|
||||||
* Sie müssen ihn auf 'bsmd.dbh.DBHWebReference.ItemsChoiceType3.@Waste' festlegen."}
|
* Sie müssen ihn auf 'bsmd.dbh.DBHWebReference.ItemsChoiceType3.@Waste' festlegen."}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (int j = 0; j < was.Waste.Count; j++)
|
for (int j = 0; j < was.Waste.Count; j++)
|
||||||
{
|
{
|
||||||
choiceType3s.Add(ItemsChoiceType3.Waste);
|
choiceType3s.Add(ItemsChoiceType3.Waste);
|
||||||
RootWASWaste rww = new RootWASWaste();
|
RootWASWaste rww = new RootWASWaste();
|
||||||
Waste waste = was.Waste[j] as Waste;
|
Waste waste = was.Waste[j] as Waste;
|
||||||
if ((waste.WasteType ?? 0) == 0) continue; // not a valid waste type
|
if ((waste.WasteType ?? 0) == 0) continue; // not a valid waste type
|
||||||
rww.WasteType = new RootWASWasteWasteType();
|
rww.WasteType = new RootWASWasteWasteType();
|
||||||
rww.WasteType.WasteCode = waste.WasteType ?? 0;
|
rww.WasteType.WasteCode = waste.WasteType ?? 0;
|
||||||
if (rww.WasteType.WasteCode == 2313) rww.WasteType.WasteCode = 2600; // Christin, 22.3.17
|
if (rww.WasteType.WasteCode == 2313) rww.WasteType.WasteCode = 2600; // Christin, 22.3.17
|
||||||
rww.WasteType.WasteDescription = waste.WasteDescription;
|
rww.WasteType.WasteDescription = waste.WasteDescription;
|
||||||
|
|
||||||
rww.WasteDisposedAtLastPort_MTQ = decimal.Round((decimal) (waste.WasteDisposedAtLastPort_MTQ ?? 0), 3);
|
// rww.WasteDisposedAtLastPort_MTQ = decimal.Round((decimal) (waste.WasteDisposedAtLastPort_MTQ ?? 0), 3);
|
||||||
rww.WasteDisposalAmount_MTQ = decimal.Round((decimal)(waste.WasteDisposalAmount_MTQ ?? 0), 3);
|
rww.WasteDisposalAmount_MTQ = decimal.Round((decimal)(waste.WasteDisposalAmount_MTQ ?? 0), 3);
|
||||||
|
|
||||||
rww.WasteDetails = new RootWASWasteWasteDetails();
|
rww.WasteDetails = new RootWASWasteWasteDetails();
|
||||||
rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal)(waste.WasteCapacity_MTQ ?? 0), 3);
|
rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal)(waste.WasteCapacity_MTQ ?? 0), 3);
|
||||||
rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal)(waste.WasteAmountRetained_MTQ ?? 0), 3);
|
rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal)(waste.WasteAmountRetained_MTQ ?? 0), 3);
|
||||||
@ -1137,7 +1137,7 @@ namespace bsmd.dbh
|
|||||||
rootTowa.TowageOnArrival[i].TowageOnArrivalRemarks = towa.TowageOnArrivalRemarks;
|
rootTowa.TowageOnArrival[i].TowageOnArrivalRemarks = towa.TowageOnArrivalRemarks;
|
||||||
}
|
}
|
||||||
item = rootTowa;
|
item = rootTowa;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -1176,7 +1176,7 @@ namespace bsmd.dbh
|
|||||||
|
|
||||||
#region HAZA
|
#region HAZA
|
||||||
//Felderreihenfolge wegen einfacher Test/Impl. entspricht genau dem XLS Sheet
|
//Felderreihenfolge wegen einfacher Test/Impl. entspricht genau dem XLS Sheet
|
||||||
case Message.NotificationClass.HAZA:
|
case Message.NotificationClass.HAZA:
|
||||||
{
|
{
|
||||||
RootHAZA rootHAZA = new RootHAZA();
|
RootHAZA rootHAZA = new RootHAZA();
|
||||||
HAZ haz = message.Elements[0] as HAZ;
|
HAZ haz = message.Elements[0] as HAZ;
|
||||||
@ -1284,7 +1284,7 @@ namespace bsmd.dbh
|
|||||||
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
|
rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
|
||||||
if(!imdgPos.VehicleLicenseNumber.IsNullOrEmpty())
|
if(!imdgPos.VehicleLicenseNumber.IsNullOrEmpty())
|
||||||
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
|
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
|
||||||
|
|
||||||
if (imdgPos.StowagePosition.IsNullOrEmpty())
|
if (imdgPos.StowagePosition.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
rootIMDG.Items = new string[3];
|
rootIMDG.Items = new string[3];
|
||||||
@ -1304,7 +1304,7 @@ namespace bsmd.dbh
|
|||||||
rootIMDG.Items = new string[1] { imdgPos.StowagePosition };
|
rootIMDG.Items = new string[1] { imdgPos.StowagePosition };
|
||||||
rootIMDG.ItemsElementName = new ItemsChoiceType4[1] { ItemsChoiceType4.StowagePosition };
|
rootIMDG.ItemsElementName = new ItemsChoiceType4[1] { ItemsChoiceType4.StowagePosition };
|
||||||
}
|
}
|
||||||
|
|
||||||
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
|
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
|
||||||
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
|
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
|
||||||
if(!imdgPos.Remarks.IsNullOrEmpty())
|
if(!imdgPos.Remarks.IsNullOrEmpty())
|
||||||
@ -1434,9 +1434,9 @@ namespace bsmd.dbh
|
|||||||
rootHAZA.Items[3] = dpgOnArrival;
|
rootHAZA.Items[3] = dpgOnArrival;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item = rootHAZA;
|
item = rootHAZA;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1448,7 +1448,7 @@ namespace bsmd.dbh
|
|||||||
{
|
{
|
||||||
RootHAZD rootHAZD = new RootHAZD();
|
RootHAZD rootHAZD = new RootHAZD();
|
||||||
HAZ haz = message.Elements[0] as HAZ;
|
HAZ haz = message.Elements[0] as HAZ;
|
||||||
|
|
||||||
if (haz.NoDPGOnBoardOnArrival ?? false)
|
if (haz.NoDPGOnBoardOnArrival ?? false)
|
||||||
{
|
{
|
||||||
rootHAZD.ItemsElementName = new ItemsChoiceType6[1];
|
rootHAZD.ItemsElementName = new ItemsChoiceType6[1];
|
||||||
@ -1702,9 +1702,9 @@ namespace bsmd.dbh
|
|||||||
rootHAZD.Items[3] = dpgOnDeparture;
|
rootHAZD.Items[3] = dpgOnDeparture;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
item = rootHAZD;
|
item = rootHAZD;
|
||||||
}
|
}
|
||||||
@ -1721,7 +1721,7 @@ namespace bsmd.dbh
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
// send object
|
// send object
|
||||||
|
|
||||||
bool returnval = true;
|
bool returnval = true;
|
||||||
try
|
try
|
||||||
@ -1766,9 +1766,9 @@ namespace bsmd.dbh
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_log.ErrorFormat("Exception on dbh message send: {0}", ex.Message);
|
_log.ErrorFormat("Exception on dbh message send: {0}", ex.Message);
|
||||||
if (ex.InnerException != null)
|
if (ex.InnerException != null)
|
||||||
_log.ErrorFormat("Inner exception: {0}", ex.InnerException.Message);
|
_log.ErrorFormat("Inner exception: {0}", ex.InnerException.Message);
|
||||||
|
|
||||||
returnval = false;
|
returnval = false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
BIN
misc/db.sqlite
BIN
misc/db.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user