Compare commits
36 Commits
1bbf82b5d1
...
c6c48d25da
| Author | SHA1 | Date | |
|---|---|---|---|
| c6c48d25da | |||
| 5f90e51691 | |||
| 7938e5ab6e | |||
| 3ec18b8356 | |||
| 9aaeb4d288 | |||
| 4257fdbea0 | |||
| a3d6ed337a | |||
| 6375639387 | |||
| 9b45b902c7 | |||
| 4174ea9e65 | |||
| b1b01532ca | |||
| 5eb181de91 | |||
| 6076b2529e | |||
| 5ee7cf2f2a | |||
| be78399def | |||
| 3735735ef7 | |||
| 8bbf7e9cc9 | |||
| 83edca21de | |||
| 933a283a4b | |||
| b6c1de3817 | |||
| bdc7131a1e | |||
| 46ca051331 | |||
| 1d44b156f4 | |||
| eae9b42266 | |||
| 284d669dc7 | |||
| 731a7eff9c | |||
| 4b49c78166 | |||
| d649c4ac16 | |||
| e3b12ae531 | |||
| a0b72f63a8 | |||
| 310819a527 | |||
| 012cbc4d6d | |||
| fa460ec8e4 | |||
| ec81631bd8 | |||
| e7ca08c65d | |||
| 680ebcdf84 |
@ -12,7 +12,7 @@
|
|||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
|
||||||
</startup>
|
</startup>
|
||||||
<applicationSettings>
|
<applicationSettings>
|
||||||
<ENI2.Properties.Settings>
|
<ENI2.Properties.Settings>
|
||||||
@ -85,7 +85,7 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.8" newVersion="9.0.0.8" />
|
<bindingRedirect oldVersion="0.0.0.0-9.0.0.9" newVersion="9.0.0.9" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
@ -121,7 +121,23 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Security.Cryptography.Pkcs" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Security.Cryptography.Pkcs" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.8" newVersion="9.0.0.8" />
|
<bindingRedirect oldVersion="0.0.0.0-9.0.0.9" newVersion="9.0.0.9" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.6.0" newVersion="4.1.6.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="DocumentFormat.OpenXml.Framework" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Bcl.HashCode" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@ -11,13 +11,10 @@ using log4net;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Net;
|
|
||||||
using ENI2.LockingServiceReference;
|
using ENI2.LockingServiceReference;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Office.Interop.Excel;
|
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
|
|
||||||
namespace ENI2
|
namespace ENI2
|
||||||
{
|
{
|
||||||
|
|||||||
113
ENI2/Controls/EasyPeasyControl.xaml
Normal file
113
ENI2/Controls/EasyPeasyControl.xaml
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<UserControl x:Class="ENI2.Controls.EasyPeasyControl"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="650" d:DesignWidth="1024" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded">
|
||||||
|
|
||||||
|
|
||||||
|
<DockPanel>
|
||||||
|
<!-- Header with logo -->
|
||||||
|
<Border DockPanel.Dock="Top" Padding="10" Background="#FFFDF6">
|
||||||
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
|
||||||
|
<!-- Embed SVG via Image (optional): place your SVG as a DrawingImage in resources, or replace with PNG -->
|
||||||
|
<TextBlock Text="🍋 easy-peasy" FontSize="20" FontWeight="Bold" Margin="0,0,16,0"/>
|
||||||
|
<TextBlock Text="Edit • Paste • Export XML" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
|
<StackPanel Margin="12" Orientation="Vertical" >
|
||||||
|
<!-- Top-level fields -->
|
||||||
|
<UniformGrid Columns="4" Rows="3" Margin="0,0,0,12" Height="84">
|
||||||
|
<TextBlock Text="Art der Identification (Vertreter)" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
|
||||||
|
<TextBox Text="{Binding DelegateIdentificationType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="Art der Identifikation (Kunde)" VerticalAlignment="Center" Margin="0,0,4,0" TextAlignment="Right" />
|
||||||
|
<TextBox Text="{Binding TraderIdentificationType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Text="LRN" TextAlignment="Right" Margin="0,0,4,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBox Text="{Binding LRN, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="Identifikationsnummer (Kunde)" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right" />
|
||||||
|
<TextBox Text="{Binding TraderIdentificationNumber, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Text="Land" TextAlignment="Right" Margin="0,0,4,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBox Text="{Binding Country, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="Identifikationsnummer (Vertreter)" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
|
||||||
|
<TextBox Text="{Binding DelegateIdentificationNumber, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
<!-- ProofInformation -->
|
||||||
|
<GroupBox Header="Kennung des Antrags auf Nachweis TZ2L(F)">
|
||||||
|
<StackPanel Margin="8">
|
||||||
|
<UniformGrid Columns="4" Rows="4" Margin="0,0,0,12" >
|
||||||
|
<TextBlock Text="Zuständige Zollstelle" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.CompetentCustomsOffice, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="Art der Anmeldung" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.DeclarationType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="Datum Anmeldung
|
||||||
|
(yyyy-MM-ddTHH:mm:ss)" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.DeclarationDate, StringFormat={}{0:yyyy-MM-ddTHH:mm:ss}, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center" />
|
||||||
|
<TextBlock Text="Gesamtrohmasse (kg)" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox x:Name="textBoxTotalGrossMass" Text="{Binding ProofInformationT2LT2LF.TotalGrossMassKg, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="Antrag auf Gültigkeitsdauer des Nachweises (in Tagen)" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="Art des Antrags" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.RequestType, UpdateSourceTrigger=PropertyChanged}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
</UniformGrid>
|
||||||
|
|
||||||
|
<GroupBox Header="Warenort">
|
||||||
|
<UniformGrid Columns="6" Margin="8" Height="28">
|
||||||
|
<TextBlock Text="Art des Ortes" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.LocationOfGoods.TypeOfLocation}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="Art der Ortsbestimmung" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.LocationOfGoods.QualifierOfIdentification}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="UNLocode" TextAlignment="Right" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.LocationOfGoods.UNLocode}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
</UniformGrid>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
|
<CheckBox Content="In Containern beförderte Waren" Margin="8"
|
||||||
|
IsChecked="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.ContainerIndication}"/>
|
||||||
|
|
||||||
|
<!-- Goods Items grid (paste target) -->
|
||||||
|
<TextBlock Text="Warenpositionen (Paste tab/CSV with columns: HS, Item#, Description, Gross, Net, Pkgs, Type, Marks)" Margin="4,12,0,4"/>
|
||||||
|
<DataGrid ItemsSource="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF}"
|
||||||
|
AutoGenerateColumns="False" SelectionMode="Extended" x:Name="dataGridGoodsItems" CanUserAddRows="False"
|
||||||
|
PreviewKeyDown="DataGrid_PreviewKeyDown" Focusable="True" MinHeight="80" IsTabStop="True" MaxHeight="320">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="HS Code" Binding="{Binding Commodity.HarmonizedSystemSubHeadingCode}"/>
|
||||||
|
<DataGridTextColumn Header="Item #" Binding="{Binding GoodsItemNumber}"/>
|
||||||
|
<DataGridTextColumn Header="Description" Binding="{Binding DescriptionOfGoods}" Width="2*"/>
|
||||||
|
<DataGridTextColumn Header="Gross" Binding="{Binding GoodsMeasure.GrossMass}"/>
|
||||||
|
<DataGridTextColumn Header="Net" Binding="{Binding GoodsMeasure.NetMass}"/>
|
||||||
|
<DataGridTextColumn Header="Pkgs" Binding="{Binding Packaging.NumberOfPackages}"/>
|
||||||
|
<DataGridTextColumn Header="Type" Binding="{Binding Packaging.TypeOfPackages}"/>
|
||||||
|
<DataGridTextColumn Header="Marks" Binding="{Binding Packaging.ShippingMarks}" Width="*"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<GroupBox Header="Dokumente" Margin="0,12,0,0">
|
||||||
|
<UniformGrid Columns="4" Margin="8" Height="28">
|
||||||
|
<TextBlock Text="Art des Dokuments" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.TransportDocuments.Type}" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBlock Text="Referenznummer" Margin="0,0,4,0" VerticalAlignment="Center" TextAlignment="Right"/>
|
||||||
|
<TextBox Text="{Binding ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.TransportDocuments.ReferenceNumber}" Margin="2" VerticalContentAlignment="Center" />
|
||||||
|
</UniformGrid>
|
||||||
|
</GroupBox>
|
||||||
|
</StackPanel>
|
||||||
|
</GroupBox>
|
||||||
|
|
||||||
|
<!-- Actions -->
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
|
||||||
|
<Button x:Name="buttonImport" Content="Import" Width="100" Margin="0,0,8,0" Click="buttonImport_Click" />
|
||||||
|
<Button x:Name="buttonClear" Content="Clear" Width="100" Margin="0,0,8,0" Click="buttonClear_Click"/>
|
||||||
|
<Button x:Name="buttonExport" Content="Export" Width="120" Click="buttonExport_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
506
ENI2/Controls/EasyPeasyControl.xaml.cs
Normal file
506
ENI2/Controls/EasyPeasyControl.xaml.cs
Normal file
@ -0,0 +1,506 @@
|
|||||||
|
// Copyright (c) 2017- schick Informatik
|
||||||
|
// Description: Display dialog for customs XML data upload app
|
||||||
|
//
|
||||||
|
|
||||||
|
using bsmd.database.EasyPeasy;
|
||||||
|
using ENI2.Util;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace ENI2.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for EasyPeasyControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EasyPeasyControl : UserControl
|
||||||
|
{
|
||||||
|
|
||||||
|
private ProofRequest _vm;
|
||||||
|
|
||||||
|
#region Construction
|
||||||
|
|
||||||
|
public EasyPeasyControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.dataGridGoodsItems.ContextMenu = new ContextMenu();
|
||||||
|
|
||||||
|
MenuItem addItem = new MenuItem();
|
||||||
|
addItem.Header = Properties.Resources.textAdd;
|
||||||
|
addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) };
|
||||||
|
addItem.Click += AddItem_Click;
|
||||||
|
this.dataGridGoodsItems.ContextMenu.Items.Add(addItem);
|
||||||
|
|
||||||
|
MenuItem deleteItem = new MenuItem();
|
||||||
|
deleteItem.Header = Properties.Resources.textDelete;
|
||||||
|
deleteItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) };
|
||||||
|
deleteItem.Click += DeleteItem_Click;
|
||||||
|
this.dataGridGoodsItems.ContextMenu.Items.Add(deleteItem);
|
||||||
|
|
||||||
|
// Add separator and paste option
|
||||||
|
this.dataGridGoodsItems.ContextMenu.Items.Add(new Separator());
|
||||||
|
|
||||||
|
MenuItem pasteItem = new MenuItem();
|
||||||
|
pasteItem.Header = "Paste";
|
||||||
|
pasteItem.Click += (s, e) => HandlePasteOperation();
|
||||||
|
this.dataGridGoodsItems.ContextMenu.Items.Add(pasteItem);
|
||||||
|
|
||||||
|
// Add command bindings for proper keyboard handling
|
||||||
|
this.dataGridGoodsItems.CommandBindings.Add(new CommandBinding(
|
||||||
|
ApplicationCommands.Paste,
|
||||||
|
(s, e) => HandlePasteOperation(),
|
||||||
|
(s, e) => e.CanExecute = Clipboard.ContainsText()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void SaveState()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EasyPeasyState.Save(_vm);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
#region context menu event handler
|
||||||
|
|
||||||
|
private void AddItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null) return;
|
||||||
|
var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
|
||||||
|
int nextItemNo = list.Any() ? list.Max(x => x.GoodsItemNumber) + 1 : 1;
|
||||||
|
var item = new GoodsItemForT2LT2LF
|
||||||
|
{
|
||||||
|
GoodsItemNumber = nextItemNo
|
||||||
|
};
|
||||||
|
list.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeleteItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
foreach(GoodsItemForT2LT2LF item in this.dataGridGoodsItems.SelectedItems.Cast<GoodsItemForT2LT2LF>().ToArray())
|
||||||
|
{
|
||||||
|
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null) return;
|
||||||
|
var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
|
||||||
|
list.Remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region button event handler
|
||||||
|
|
||||||
|
private void buttonClear_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CleanupAutoCalculation();
|
||||||
|
|
||||||
|
this._vm = EasyPeasyState.CreateDefault();
|
||||||
|
if (_vm.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null)
|
||||||
|
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF = new ObservableCollection<GoodsItemForT2LT2LF>();
|
||||||
|
|
||||||
|
_vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
|
||||||
|
_vm.ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays = 90; // default 90 days
|
||||||
|
|
||||||
|
this.DataContext = this._vm;
|
||||||
|
SetupAutoCalculation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonExport_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var dlg = new SaveFileDialog
|
||||||
|
{
|
||||||
|
FileName = "proofRequest.xml",
|
||||||
|
Filter = "XML file|*.xml",
|
||||||
|
OverwritePrompt = true
|
||||||
|
};
|
||||||
|
if (dlg.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ser = new XmlSerializer(typeof(ProofRequest));
|
||||||
|
|
||||||
|
// Namespaces (if needed)
|
||||||
|
// var ns = new XmlSerializerNamespaces();
|
||||||
|
// ns.Add("xsd", "http://www.w3.org/2001/XMLSchema");
|
||||||
|
// ns.Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||||
|
|
||||||
|
var settings = new XmlWriterSettings
|
||||||
|
{
|
||||||
|
Indent = true,
|
||||||
|
OmitXmlDeclaration = true
|
||||||
|
};
|
||||||
|
|
||||||
|
using (var fs = File.Create(dlg.FileName))
|
||||||
|
using (var xw = XmlWriter.Create(fs, settings))
|
||||||
|
{
|
||||||
|
ser.Serialize(xw, _vm); //, ns);
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Exported successfully.", "easy-peasy", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Export failed:\n" + ex.Message, "easy-peasy", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonImport_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "XML file|*.xml";
|
||||||
|
ofd.RestoreDirectory = true;
|
||||||
|
ofd.Multiselect = false;
|
||||||
|
|
||||||
|
if (ofd.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
using (var fs = File.OpenRead(ofd.FileName))
|
||||||
|
{
|
||||||
|
CleanupAutoCalculation();
|
||||||
|
var ser = new XmlSerializer(typeof(ProofRequest));
|
||||||
|
_vm = (ProofRequest)ser.Deserialize(fs);
|
||||||
|
// after loading/creating _vm
|
||||||
|
if (_vm.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null)
|
||||||
|
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF = new ObservableCollection<GoodsItemForT2LT2LF>();
|
||||||
|
|
||||||
|
_vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
|
||||||
|
if(_vm.ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays == 9)
|
||||||
|
_vm.ProofInformationT2LT2LF.RequestedValidityOfTheProof.NumberOfDays = 90; // default 90 days
|
||||||
|
|
||||||
|
this.DataContext = _vm;
|
||||||
|
SetupAutoCalculation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region loaded/unloaded event handler
|
||||||
|
|
||||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_vm = EasyPeasyState.LoadOrCreate();
|
||||||
|
if (_vm.ProofInformationT2LT2LF == null)
|
||||||
|
_vm.ProofInformationT2LT2LF = new ProofInformationT2LT2LF();
|
||||||
|
if (_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF == null)
|
||||||
|
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF = new GoodsShipmentForT2LT2LF
|
||||||
|
{
|
||||||
|
LocationOfGoods = new LocationOfGoods(),
|
||||||
|
TransportDocuments = new TransportDocuments()
|
||||||
|
};
|
||||||
|
_vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
|
||||||
|
this.DataContext = _vm;
|
||||||
|
|
||||||
|
SetupAutoCalculation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CleanupAutoCalculation();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EasyPeasyState.Save(_vm);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region auto calculation total gross mass
|
||||||
|
|
||||||
|
private void SetupAutoCalculation()
|
||||||
|
{
|
||||||
|
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF != null)
|
||||||
|
{
|
||||||
|
// Subscribe to collection changes (add/remove items)
|
||||||
|
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF.CollectionChanged += GoodsItems_CollectionChanged;
|
||||||
|
|
||||||
|
// Subscribe to DataGrid cell changes
|
||||||
|
dataGridGoodsItems.CellEditEnding += DataGridGoodsItems_CellEditEnding;
|
||||||
|
|
||||||
|
// Calculate initial total
|
||||||
|
CalculateTotalGrossMass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CleanupAutoCalculation()
|
||||||
|
{
|
||||||
|
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF != null)
|
||||||
|
{
|
||||||
|
// Unsubscribe from collection changes
|
||||||
|
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF.CollectionChanged -= GoodsItems_CollectionChanged;
|
||||||
|
dataGridGoodsItems.CellEditEnding -= DataGridGoodsItems_CellEditEnding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridGoodsItems_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
|
{
|
||||||
|
// Check if the edited column is GrossMass
|
||||||
|
if (e.Column.Header.ToString() == "Gross")
|
||||||
|
{
|
||||||
|
// Delay calculation to allow the binding to update
|
||||||
|
Dispatcher.BeginInvoke(new Action(() => {
|
||||||
|
CalculateTotalGrossMass();
|
||||||
|
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GoodsItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
// Recalculate total after any collection change
|
||||||
|
CalculateTotalGrossMass();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalculateTotalGrossMass()
|
||||||
|
{
|
||||||
|
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF != null)
|
||||||
|
{
|
||||||
|
var total = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF
|
||||||
|
.Sum(item => item.GoodsMeasure?.GrossMass ?? 0m);
|
||||||
|
|
||||||
|
_vm.ProofInformationT2LT2LF.TotalGrossMassKg = total;
|
||||||
|
|
||||||
|
// Force UI update by refreshing the binding
|
||||||
|
var binding = BindingOperations.GetBindingExpression(
|
||||||
|
FindTotalGrossMassTextBox(), TextBox.TextProperty);
|
||||||
|
binding?.UpdateTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simple property changed notification helper
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextBox FindTotalGrossMassTextBox()
|
||||||
|
{
|
||||||
|
// Find the TextBox that displays TotalGrossMassKg
|
||||||
|
return this.FindName("textBoxTotalGrossMass") as TextBox ??
|
||||||
|
this.GetTemplateChild("textBoxTotalGrossMass") as TextBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region cut & paste logic
|
||||||
|
|
||||||
|
private void HandlePasteOperation()
|
||||||
|
{
|
||||||
|
if (Clipboard.ContainsText())
|
||||||
|
{
|
||||||
|
var text = Clipboard.GetText();
|
||||||
|
if (!TryPaste_EspHsPkgsGross(text))
|
||||||
|
PasteGoodsItems(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGrid_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.V && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
|
||||||
|
{
|
||||||
|
if (Clipboard.ContainsText())
|
||||||
|
{
|
||||||
|
var text = Clipboard.GetText();
|
||||||
|
|
||||||
|
if(!TryPaste_EspHsPkgsGross(text))
|
||||||
|
PasteGoodsItems(text);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PasteGoodsItems(string text)
|
||||||
|
{
|
||||||
|
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF == null) return;
|
||||||
|
|
||||||
|
var lines = text.Replace("\r\n", "\n").Replace('\r', '\n')
|
||||||
|
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
// Split by tab first; if only one column, try CSV
|
||||||
|
var cells = line.Split('\t');
|
||||||
|
if (cells.Length == 1) cells = SplitCsv(line);
|
||||||
|
|
||||||
|
// Expected order: HS, Item#, Description, Gross, Net, Pkgs, Type, Marks
|
||||||
|
var item = new GoodsItemForT2LT2LF();
|
||||||
|
|
||||||
|
if (cells.Length > 0) item.Commodity.HarmonizedSystemSubHeadingCode = cells[0].Trim();
|
||||||
|
if (cells.Length > 1 && int.TryParse(cells[1], out var n)) item.GoodsItemNumber = n;
|
||||||
|
if (cells.Length > 2) item.DescriptionOfGoods = cells[2].Trim();
|
||||||
|
if (cells.Length > 3 && decimal.TryParse(cells[3], out var gross)) item.GoodsMeasure.GrossMass = gross;
|
||||||
|
if (cells.Length > 4 && decimal.TryParse(cells[4], out var net)) item.GoodsMeasure.NetMass = net;
|
||||||
|
if (cells.Length > 5 && int.TryParse(cells[5], out var pkgs)) item.Packaging.NumberOfPackages = pkgs;
|
||||||
|
if (cells.Length > 6) item.Packaging.TypeOfPackages = cells[6].Trim();
|
||||||
|
if (cells.Length > 7) item.Packaging.ShippingMarks = cells[7].Trim();
|
||||||
|
|
||||||
|
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Very small CSV splitter (handles quotes)
|
||||||
|
private static string[] SplitCsv(string line)
|
||||||
|
{
|
||||||
|
var res = new System.Collections.Generic.List<string>();
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
bool inQuotes = false;
|
||||||
|
for (int i = 0; i < line.Length; i++)
|
||||||
|
{
|
||||||
|
char c = line[i];
|
||||||
|
if (c == '\"')
|
||||||
|
{
|
||||||
|
if (inQuotes && i + 1 < line.Length && line[i + 1] == '\"')
|
||||||
|
{ sb.Append('\"'); i++; }
|
||||||
|
else { inQuotes = !inQuotes; }
|
||||||
|
}
|
||||||
|
else if (c == ',' && !inQuotes)
|
||||||
|
{ res.Add(sb.ToString()); sb.Clear(); }
|
||||||
|
else { sb.Append(c); }
|
||||||
|
}
|
||||||
|
res.Add(sb.ToString());
|
||||||
|
return res.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryPaste_EspHsPkgsGross(string text)
|
||||||
|
{
|
||||||
|
if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF == null) return false;
|
||||||
|
|
||||||
|
// Normalize and split lines
|
||||||
|
var lines = text.Replace("\r\n", "\n").Replace('\r', '\n')
|
||||||
|
.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (lines.Length == 0) return false;
|
||||||
|
|
||||||
|
// Determine next item number
|
||||||
|
var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
|
||||||
|
int nextItemNo = list.Any() ? list.Max(x => x.GoodsItemNumber) + 1 : 1;
|
||||||
|
|
||||||
|
bool anyAdded = false;
|
||||||
|
bool countrySeen = false;
|
||||||
|
|
||||||
|
foreach (var raw in lines)
|
||||||
|
{
|
||||||
|
var line = raw; // do not Trim() entirely; keep leading tab as empty first cell
|
||||||
|
var cells = line.Split('\t'); // keeps empty entries
|
||||||
|
|
||||||
|
// Expected:
|
||||||
|
// - 4 cells: [ESP or ""], [HS], [Pkgs], [Gross]
|
||||||
|
// - 3 cells: [HS], [Pkgs], [Gross]
|
||||||
|
string hs = null, pkgs = null, gross = null;
|
||||||
|
|
||||||
|
if (cells.Length >= 4)
|
||||||
|
{
|
||||||
|
string c0 = cells[0]?.Trim();
|
||||||
|
// Optionally capture the first token like "ESP" (country tag),
|
||||||
|
// only once and only if alphabetic (won't throw if numeric)
|
||||||
|
if (!countrySeen && !string.IsNullOrWhiteSpace(c0) && c0.All(ch => char.IsLetter(ch)))
|
||||||
|
{
|
||||||
|
// If you decide later this should set a field, uncomment:
|
||||||
|
// if (string.IsNullOrWhiteSpace(_vm.Country)) _vm.Country = c0;
|
||||||
|
countrySeen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hs = (cells.Length > 1 ? cells[1] : null);
|
||||||
|
pkgs = (cells.Length > 2 ? cells[2] : null);
|
||||||
|
gross = (cells.Length > 3 ? cells[3] : null);
|
||||||
|
}
|
||||||
|
else if (cells.Length == 3)
|
||||||
|
{
|
||||||
|
hs = cells[0];
|
||||||
|
pkgs = cells[1];
|
||||||
|
gross = cells[2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Not enough data for this format; skip the row
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(hs)) continue;
|
||||||
|
|
||||||
|
var item = new GoodsItemForT2LT2LF
|
||||||
|
{
|
||||||
|
GoodsItemNumber = nextItemNo++,
|
||||||
|
DescriptionOfGoods = "" // per spec
|
||||||
|
};
|
||||||
|
item.Commodity.HarmonizedSystemSubHeadingCode = hs.Trim();
|
||||||
|
|
||||||
|
if (TryParseIntFlexible(pkgs, out var pk))
|
||||||
|
item.Packaging.NumberOfPackages = pk;
|
||||||
|
|
||||||
|
if (TryParseDecimalFlexible(gross, out var g))
|
||||||
|
{
|
||||||
|
item.GoodsMeasure.GrossMass = g;
|
||||||
|
var net = g; // - 1m; // now net mass equals gross mass (no deduction)
|
||||||
|
if (net < 0m) net = 0m;
|
||||||
|
item.GoodsMeasure.NetMass = net;
|
||||||
|
}
|
||||||
|
|
||||||
|
item.DescriptionOfGoods = "Brand New Vehicles"; // per spec
|
||||||
|
item.Packaging.TypeOfPackages = "UN"; // per spec
|
||||||
|
item.Packaging.ShippingMarks = "-"; // per spec
|
||||||
|
|
||||||
|
list.Add(item);
|
||||||
|
anyAdded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return anyAdded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region static utils
|
||||||
|
|
||||||
|
// this will go somewhere else later
|
||||||
|
|
||||||
|
// Try parse decimal with current culture, invariant, and comma/dot flip
|
||||||
|
private static bool TryParseDecimalFlexible(string s, out decimal value)
|
||||||
|
{
|
||||||
|
s = (s ?? "").Trim();
|
||||||
|
// 1) current culture
|
||||||
|
if (decimal.TryParse(s, NumberStyles.Number, CultureInfo.CurrentCulture, out value)) return true;
|
||||||
|
// 2) invariant
|
||||||
|
if (decimal.TryParse(s, NumberStyles.Number, CultureInfo.InvariantCulture, out value)) return true;
|
||||||
|
// 3) flip comma/dot and retry (helps when clipboard mixes locales)
|
||||||
|
string flipped = s.Contains(",") ? s.Replace(",", ".") : s.Replace(".", ",");
|
||||||
|
if (decimal.TryParse(flipped, NumberStyles.Number, CultureInfo.CurrentCulture, out value)) return true;
|
||||||
|
if (decimal.TryParse(flipped, NumberStyles.Number, CultureInfo.InvariantCulture, out value)) return true;
|
||||||
|
value = 0m;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool TryParseIntFlexible(string s, out int value)
|
||||||
|
{
|
||||||
|
s = (s ?? "").Trim();
|
||||||
|
// Extract leading integer if something like "12 pcs"
|
||||||
|
var digits = new string(s.TakeWhile(ch => char.IsDigit(ch) || ch == '-' || ch == '+').ToArray());
|
||||||
|
if (string.IsNullOrEmpty(digits)) digits = s;
|
||||||
|
return int.TryParse(digits, NumberStyles.Integer, CultureInfo.CurrentCulture, out value)
|
||||||
|
|| int.TryParse(digits, NumberStyles.Integer, CultureInfo.InvariantCulture, out value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -2,23 +2,23 @@
|
|||||||
// Description: Request dbh ids for Maersk data lists
|
// Description: Request dbh ids for Maersk data lists
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
using ExcelDataReader;
|
using ClosedXML.Excel;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using ENI2.Excel;
|
using ENI2.Excel;
|
||||||
using ENI2.Locode;
|
using ENI2.Locode;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
|
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace ENI2.Controls
|
namespace ENI2.Controls
|
||||||
{
|
{
|
||||||
@ -336,80 +336,72 @@ namespace ENI2.Controls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<MaerskData> importData = new List<MaerskData>();
|
|
||||||
|
|
||||||
bool isFirstRow = true;
|
|
||||||
int currentRow = 0;
|
|
||||||
bool imosAreOkay = true;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
while (reader.Read())
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row
|
||||||
|
|
||||||
|
List<MaerskData> importData = new List<MaerskData>();
|
||||||
|
|
||||||
|
int currentRow = 1; // Start at 1 since we skip header
|
||||||
|
bool imosAreOkay = true;
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
{
|
{
|
||||||
currentRow++;
|
currentRow++;
|
||||||
|
|
||||||
if (isFirstRow)
|
if (worksheet.RangeUsed().ColumnCount() < 13)
|
||||||
{
|
|
||||||
isFirstRow = false; // this must be a header row, skip
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reader.FieldCount < 13)
|
|
||||||
{
|
{
|
||||||
throw new InvalidDataException("Sheet must have 13 columns of data");
|
throw new InvalidDataException("Sheet must have 13 columns of data");
|
||||||
}
|
}
|
||||||
|
|
||||||
MaerskData md = new MaerskData();
|
MaerskData md = new MaerskData();
|
||||||
if (!reader.IsDBNull(0))
|
|
||||||
|
if (!row.Cell(1).IsEmpty())
|
||||||
{
|
{
|
||||||
if (reader.GetFieldType(0) == typeof(DateTime))
|
var cellValue = row.Cell(1).Value;
|
||||||
|
if (cellValue.IsDateTime)
|
||||||
{
|
{
|
||||||
md.ETA = reader.GetDateTime(0);
|
var dateTime = cellValue.GetDateTime();
|
||||||
|
md.ETA = dateTime;
|
||||||
md.ColA = md.ETA.ToString();
|
md.ColA = md.ETA.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
md.ColA = reader.GetString(0);
|
md.ColA = row.Cell(1).GetString();
|
||||||
if (DateTime.TryParse(md.ColA, out DateTime aDateTime))
|
if (DateTime.TryParse(md.ColA, out DateTime aDateTime))
|
||||||
md.ETA = aDateTime;
|
md.ETA = aDateTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!reader.IsDBNull(1)) md.ColB = reader.ReadAsString(1);
|
|
||||||
if (!reader.IsDBNull(2)) md.ColC = reader.ReadAsString(2);
|
if (!row.Cell(2).IsEmpty()) md.ColB = row.Cell(2).GetString();
|
||||||
if (!reader.IsDBNull(3)) md.ColD = reader.ReadAsString(3);
|
if (!row.Cell(3).IsEmpty()) md.ColC = row.Cell(3).GetString();
|
||||||
if (!reader.IsDBNull(4)) md.ColE = reader.ReadAsString(4);
|
if (!row.Cell(4).IsEmpty()) md.ColD = row.Cell(4).GetString();
|
||||||
if (!reader.IsDBNull(5)) md.ColF = reader.ReadAsString(5);
|
if (!row.Cell(5).IsEmpty()) md.ColE = row.Cell(5).GetString();
|
||||||
if (!reader.IsDBNull(6)) md.ColG = reader.ReadAsString(6);
|
if (!row.Cell(6).IsEmpty()) md.ColF = row.Cell(6).GetString();
|
||||||
if (!reader.IsDBNull(7)) md.ColH = reader.ReadAsString(7);
|
if (!row.Cell(7).IsEmpty()) md.ColG = row.Cell(7).GetString();
|
||||||
if (!reader.IsDBNull(8)) md.ColI = reader.ReadAsString(8);
|
if (!row.Cell(8).IsEmpty()) md.ColH = row.Cell(8).GetString();
|
||||||
|
if (!row.Cell(9).IsEmpty()) md.ColI = row.Cell(9).GetString();
|
||||||
|
|
||||||
if (md.ColI != null)
|
if (md.ColI != null)
|
||||||
{
|
{
|
||||||
if ((md.ColI.Contains("bremerhaven", StringComparison.OrdinalIgnoreCase) && this.PortLocode.Equals("DEWVN")) ||
|
if ((md.ColI.Contains("bremerhaven", StringComparison.OrdinalIgnoreCase) && this.PortLocode.Equals("DEWVN")) ||
|
||||||
(md.ColI.Contains("eurogate", StringComparison.OrdinalIgnoreCase) && this.PortLocode.Equals("DEBRV")))
|
(md.ColI.Contains("eurogate", StringComparison.OrdinalIgnoreCase) && this.PortLocode.Equals("DEBRV")))
|
||||||
throw new InvalidOperationException($"{md.ColI} found in import to {PortLocode}, this is probably an error. Aborting import");
|
throw new InvalidOperationException($"{md.ColI} found in import to {PortLocode}, this is probably an error. Aborting import");
|
||||||
}
|
}
|
||||||
if (!reader.IsDBNull(9)) md.ColJ = reader.ReadAsString(9);
|
|
||||||
|
if (!row.Cell(10).IsEmpty()) md.ColJ = row.Cell(10).GetString();
|
||||||
if (md.ColJ == null) continue;
|
if (md.ColJ == null) continue;
|
||||||
if (!(md.ColJ.Equals("msk", StringComparison.OrdinalIgnoreCase) || md.ColJ.Equals("sgl", StringComparison.OrdinalIgnoreCase))) continue; // skip operator we are not interested in
|
if (!(md.ColJ.Equals("msk", StringComparison.OrdinalIgnoreCase) || md.ColJ.Equals("sgl", StringComparison.OrdinalIgnoreCase))) continue; // skip operator we are not interested in
|
||||||
if (!reader.IsDBNull(10)) md.ColK = reader.ReadAsString(10);
|
|
||||||
if (!reader.IsDBNull(11)) md.ColL = reader.ReadAsString(11);
|
|
||||||
if (!reader.IsDBNull(12)) md.ColM = reader.ReadAsString(12);
|
|
||||||
if (!reader.IsDBNull(13)) md.Remark = reader.ReadAsString(13);
|
|
||||||
|
|
||||||
if(!md.ColF.IsNullOrEmpty())
|
if (!row.Cell(11).IsEmpty()) md.ColK = row.Cell(11).GetString();
|
||||||
|
if (!row.Cell(12).IsEmpty()) md.ColL = row.Cell(12).GetString();
|
||||||
|
if (!row.Cell(13).IsEmpty()) md.ColM = row.Cell(13).GetString();
|
||||||
|
if (!row.Cell(14).IsEmpty()) md.Remark = row.Cell(14).GetString();
|
||||||
|
|
||||||
|
if (!md.ColF.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
if (Int32.TryParse(md.ColF, out int imo))
|
if (Int32.TryParse(md.ColF, out int imo))
|
||||||
{
|
{
|
||||||
@ -435,71 +427,67 @@ namespace ENI2.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
importData.Add(md);
|
importData.Add(md);
|
||||||
|
|
||||||
if (isFirstRow) isFirstRow = false;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imosAreOkay && importData.Count > 0)
|
if (imosAreOkay && importData.Count > 0)
|
||||||
{
|
|
||||||
busyControl.BusyState = Util.UIHelper.BusyStateEnum.BUSY;
|
|
||||||
|
|
||||||
foreach (MaerskData md in importData)
|
|
||||||
{
|
{
|
||||||
if (this.maerskDataList.Contains(md))
|
busyControl.BusyState = Util.UIHelper.BusyStateEnum.BUSY;
|
||||||
{
|
|
||||||
// update record with imported record
|
|
||||||
MaerskData foundData = this.maerskDataList.First((m) => (m.ColF != null) ? m.ColF.Equals(md.ColF) : (md.ColF == null) &&
|
|
||||||
(m.ColG != null) ? m.ColG.Equals(md.ColG) : (md.ColG == null) &&
|
|
||||||
(m.ColH != null) ? m.ColH.Equals(md.ColH) : (md.ColH == null));
|
|
||||||
|
|
||||||
if ((foundData.MessageCore == null) || !(foundData.MessageCore.Cancelled ?? false))
|
foreach (MaerskData md in importData)
|
||||||
{
|
|
||||||
if (foundData.ETA.HasValue && ((foundData.ETA.Value - DateTime.Now).TotalSeconds > 0) && foundData.Update(md))
|
|
||||||
foundData.Status = MaerskData.MDStatus.UPDATED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (!md.ColM.IsNullOrEmpty())
|
if (this.maerskDataList.Contains(md))
|
||||||
{
|
{
|
||||||
md.MessageCore = await DBManagerAsync.LoadCoreByVisitIdAsync(md.ColM);
|
// update record with imported record
|
||||||
if (md.MessageCore != null)
|
MaerskData foundData = this.maerskDataList.First((m) => (m.ColF != null) ? m.ColF.Equals(md.ColF) : (md.ColF == null) &&
|
||||||
|
(m.ColG != null) ? m.ColG.Equals(md.ColG) : (md.ColG == null) &&
|
||||||
|
(m.ColH != null) ? m.ColH.Equals(md.ColH) : (md.ColH == null));
|
||||||
|
|
||||||
|
if ((foundData.MessageCore == null) || !(foundData.MessageCore.Cancelled ?? false))
|
||||||
{
|
{
|
||||||
MaerskData existingMD = await DBManagerAsync.LoadMaerskDataForCoreAsync(md.MessageCore.Id.Value);
|
if (foundData.ETA.HasValue && ((foundData.ETA.Value - DateTime.Now).TotalSeconds > 0) && foundData.Update(md))
|
||||||
if(existingMD == null)
|
foundData.Status = MaerskData.MDStatus.UPDATED;
|
||||||
{
|
|
||||||
// we have a core but no MarskData for this import -> save it
|
|
||||||
md.MessageCoreId = (Guid) md.MessageCore.Id;
|
|
||||||
_ = DBManagerAsync.SaveAsync(md);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
existingMD.Update(md);
|
|
||||||
_ = DBManagerAsync.SaveAsync(existingMD);
|
|
||||||
this.UpdateStatus(existingMD);
|
|
||||||
maerskDataList.Add(existingMD);
|
|
||||||
continue; // add existing instead of new one
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!md.ColM.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
md.MessageCore = await DBManagerAsync.LoadCoreByVisitIdAsync(md.ColM);
|
||||||
|
if (md.MessageCore != null)
|
||||||
|
{
|
||||||
|
MaerskData existingMD = await DBManagerAsync.LoadMaerskDataForCoreAsync(md.MessageCore.Id.Value);
|
||||||
|
if (existingMD == null)
|
||||||
|
{
|
||||||
|
// we have a core but no MarskData for this import -> save it
|
||||||
|
md.MessageCoreId = (Guid)md.MessageCore.Id;
|
||||||
|
_ = DBManagerAsync.SaveAsync(md);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
existingMD.Update(md);
|
||||||
|
_ = DBManagerAsync.SaveAsync(existingMD);
|
||||||
|
this.UpdateStatus(existingMD);
|
||||||
|
maerskDataList.Add(existingMD);
|
||||||
|
continue; // add existing instead of new one
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.UpdateStatus(md);
|
this.UpdateStatus(md);
|
||||||
maerskDataList.Add(md);
|
maerskDataList.Add(md);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
this.TimeFilterItemSource();
|
||||||
this.TimeFilterItemSource();
|
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
|
||||||
busyControl.BusyState = Util.UIHelper.BusyStateEnum.NEUTRAL;
|
|
||||||
|
|
||||||
this.dataGridPOCores.Items.Refresh();
|
this.dataGridPOCores.Items.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
stream.Close();
|
{
|
||||||
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -226,6 +226,7 @@ namespace ENI2
|
|||||||
public void CoreChanged(MessageCore newCore)
|
public void CoreChanged(MessageCore newCore)
|
||||||
{
|
{
|
||||||
this.Core = newCore;
|
this.Core = newCore;
|
||||||
|
this.ReloadCore();
|
||||||
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
||||||
{
|
{
|
||||||
if(controlCache.ContainsKey(Properties.Resources.textOverview))
|
if(controlCache.ContainsKey(Properties.Resources.textOverview))
|
||||||
@ -527,9 +528,14 @@ namespace ENI2
|
|||||||
{
|
{
|
||||||
if ((message.Status == Message.MessageStatus.ACCEPTED) &&
|
if ((message.Status == Message.MessageStatus.ACCEPTED) &&
|
||||||
((message.InternalStatus == Message.BSMDStatus.CONFIRMED) || (message.InternalStatus == Message.BSMDStatus.VIOLATION)))
|
((message.InternalStatus == Message.BSMDStatus.CONFIRMED) || (message.InternalStatus == Message.BSMDStatus.VIOLATION)))
|
||||||
|
{
|
||||||
message.InternalStatus = Message.BSMDStatus.UPDATED;
|
message.InternalStatus = Message.BSMDStatus.UPDATED;
|
||||||
|
message.Status = null; // reset send status
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
message.InternalStatus = Message.BSMDStatus.SAVED;
|
message.InternalStatus = Message.BSMDStatus.SAVED;
|
||||||
|
}
|
||||||
|
|
||||||
string userName = "?";
|
string userName = "?";
|
||||||
if(App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
|
if(App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
|
||||||
|
|||||||
@ -11,7 +11,7 @@ using System.Windows.Controls;
|
|||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using ENI2.Locode;
|
using ENI2.Locode;
|
||||||
using ExcelDataReader;
|
using ClosedXML.Excel;
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -1049,70 +1049,65 @@ namespace ENI2.DetailViewControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<CREW> importCrew = new List<CREW>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
// Check if we have at least 13 columns
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 13)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 13 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
CREW crew = new CREW();
|
||||||
|
|
||||||
|
// Check if first two cells are empty
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) crew.CrewMemberLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (crew.CrewMemberLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(crew.CrewMemberLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) crew.CrewMemberFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) crew.CrewMemberGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) crew.CrewMemberDuty = row.Cell(4).GetString().Clean();
|
||||||
|
if (!row.Cell(5).IsEmpty()) crew.CrewMemberNationality = row.Cell(5).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(6).IsEmpty()) crew.CrewMemberPlaceOfBirth = row.Cell(6).GetString().Clean();
|
||||||
|
if (!row.Cell(7).IsEmpty()) crew.CrewMemberCountryOfBirth = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) crew.CrewMemberDateOfBirth = row.Cell(8).GetDateTime();
|
||||||
|
if (!row.Cell(9).IsEmpty()) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(9).GetString());
|
||||||
|
if (!row.Cell(10).IsEmpty()) crew.CrewMemberIdentityDocumentId = row.Cell(10).GetString().Clean();
|
||||||
|
if (!row.Cell(11).IsEmpty()) crew.CrewMemberIdentityDocumentIssuingState = row.Cell(11).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(12).IsEmpty()) crew.CrewMemberIdentityDocumentExpiryDate = row.Cell(12).GetDateTime();
|
||||||
|
if (!row.Cell(13).IsEmpty()) crew.CrewMemberVisaNumber = row.Cell(13).GetString().Clean();
|
||||||
|
|
||||||
|
crew.MessageHeader = this._crewMessage;
|
||||||
|
crew.IsDirty = true;
|
||||||
|
crew.Identifier = CREW.GetNewIdentifier(this._crewMessage.Elements);
|
||||||
|
this._crewMessage.Elements.Add(crew);
|
||||||
|
importCrew.Add(crew);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importCrew.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridCrewList.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.CREWA);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<CREW> importCrew = new List<CREW>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if(reader.FieldCount < 13)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 13 columns of data");
|
|
||||||
}
|
|
||||||
CREW crew = new CREW();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0).Clean();
|
|
||||||
if (crew.CrewMemberLastName.Equals("Family Name") || (crew.CrewMemberLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1).Clean();
|
|
||||||
if (!reader.IsDBNull(2)) crew.CrewMemberGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3).Clean();
|
|
||||||
if (!reader.IsDBNull(4)) crew.CrewMemberNationality = reader.GetString(4).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5).Clean();
|
|
||||||
if (!reader.IsDBNull(6)) crew.CrewMemberCountryOfBirth = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) crew.CrewMemberDateOfBirth = reader.GetDateTime(7);
|
|
||||||
if (!reader.IsDBNull(8)) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(8));
|
|
||||||
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = reader.ReadAsString(9).Clean();
|
|
||||||
if (!reader.IsDBNull(10)) crew.CrewMemberIdentityDocumentIssuingState = reader.GetString(10).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(11)) crew.CrewMemberIdentityDocumentExpiryDate = reader.GetDateTime(11);
|
|
||||||
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = reader.ReadAsString(12).Clean();
|
|
||||||
|
|
||||||
crew.MessageHeader = this._crewMessage;
|
|
||||||
crew.IsDirty = true;
|
|
||||||
crew.Identifier = CREW.GetNewIdentifier(this._crewMessage.Elements);
|
|
||||||
this._crewMessage.Elements.Add(crew);
|
|
||||||
importCrew.Add(crew);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importCrew.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridCrewList.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.CREWA);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1124,72 +1119,66 @@ namespace ENI2.DetailViewControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<CREWD> importCrew = new List<CREWD>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
// Check if we have at least 13 columns
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 13)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 13 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
CREWD crew = new CREWD();
|
||||||
|
crew.IsDeparture = true;
|
||||||
|
|
||||||
|
// Check if first two cells are empty
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) crew.CrewMemberLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (crew.CrewMemberLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(crew.CrewMemberLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) crew.CrewMemberFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) crew.CrewMemberGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) crew.CrewMemberDuty = row.Cell(4).GetString().Clean();
|
||||||
|
if (!row.Cell(5).IsEmpty()) crew.CrewMemberNationality = row.Cell(5).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(6).IsEmpty()) crew.CrewMemberPlaceOfBirth = row.Cell(6).GetString().Clean();
|
||||||
|
if (!row.Cell(7).IsEmpty()) crew.CrewMemberCountryOfBirth = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) crew.CrewMemberDateOfBirth = row.Cell(8).GetDateTime();
|
||||||
|
if (!row.Cell(9).IsEmpty()) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(9).GetString());
|
||||||
|
if (!row.Cell(10).IsEmpty()) crew.CrewMemberIdentityDocumentId = row.Cell(10).GetString().Clean();
|
||||||
|
if (!row.Cell(11).IsEmpty()) crew.CrewMemberIdentityDocumentIssuingState = row.Cell(11).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(12).IsEmpty()) crew.CrewMemberIdentityDocumentExpiryDate = row.Cell(12).GetDateTime();
|
||||||
|
if (!row.Cell(13).IsEmpty()) crew.CrewMemberVisaNumber = row.Cell(13).GetString().Clean();
|
||||||
|
|
||||||
|
crew.MessageHeader = this._crewdMessage;
|
||||||
|
crew.IsDirty = true;
|
||||||
|
crew.Identifier = CREWD.GetNewIdentifier(this._crewdMessage.Elements);
|
||||||
|
this._crewdMessage.Elements.Add(crew);
|
||||||
|
importCrew.Add(crew);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importCrew.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridCrewListDeparture.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.CREWD);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<CREWD> importCrew = new List<CREWD>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (reader.FieldCount < 13)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 13 columns of data");
|
|
||||||
}
|
|
||||||
CREWD crew = new CREWD();
|
|
||||||
crew.IsDeparture = true;
|
|
||||||
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0);
|
|
||||||
if (crew.CrewMemberLastName.Equals("Family Name") || (crew.CrewMemberLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1);
|
|
||||||
if (!reader.IsDBNull(2)) crew.CrewMemberGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3).Clean();
|
|
||||||
if (!reader.IsDBNull(4)) crew.CrewMemberNationality = reader.GetString(4).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5);
|
|
||||||
if (!reader.IsDBNull(6)) crew.CrewMemberCountryOfBirth = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) crew.CrewMemberDateOfBirth = reader.GetDateTime(7);
|
|
||||||
if (!reader.IsDBNull(8)) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(8));
|
|
||||||
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = reader.ReadAsString(9);
|
|
||||||
if (!reader.IsDBNull(10)) crew.CrewMemberIdentityDocumentIssuingState = reader.GetString(10).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(11)) crew.CrewMemberIdentityDocumentExpiryDate = reader.GetDateTime(11);
|
|
||||||
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = reader.ReadAsString(12);
|
|
||||||
|
|
||||||
crew.MessageHeader = this._crewdMessage;
|
|
||||||
crew.IsDirty = true;
|
|
||||||
crew.Identifier = CREWD.GetNewIdentifier(this._crewdMessage.Elements);
|
|
||||||
this._crewdMessage.Elements.Add(crew);
|
|
||||||
importCrew.Add(crew);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importCrew.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridCrewListDeparture.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.CREWD);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,78 +1190,71 @@ namespace ENI2.DetailViewControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1);
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<PAS> importPassenger = new List<PAS>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 17)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 17 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
PAS pas = new PAS();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) pas.PassengerLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (pas.PassengerLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(pas.PassengerLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) pas.PassengerFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) pas.PassengerGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) pas.PassengerPortOfEmbarkation = row.Cell(4).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
||||||
|
pas.PassengerPortOfEmbarkation = null;
|
||||||
|
if (!row.Cell(5).IsEmpty()) pas.PassengerPortOfDisembarkation = row.Cell(5).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
||||||
|
pas.PassengerPortOfDisembarkation = null;
|
||||||
|
if (!row.Cell(6).IsEmpty()) pas.PassengerInTransit = GlobalStructures.ReadBoolean(row.Cell(6).GetString());
|
||||||
|
if (!row.Cell(7).IsEmpty()) pas.PassengerNationality = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) pas.PassengerPlaceOfBirth = row.Cell(8).GetString().Clean();
|
||||||
|
if (!row.Cell(9).IsEmpty()) pas.PassengerCountryOfBirth = row.Cell(9).GetString().Substring(0, 2).ToUpper().Clean();
|
||||||
|
if (!row.Cell(10).IsEmpty()) pas.PassengerDateOfBirth = row.Cell(10).GetDateTime();
|
||||||
|
if (!row.Cell(11).IsEmpty()) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(11).GetString());
|
||||||
|
if (!row.Cell(12).IsEmpty()) pas.PassengerIdentityDocumentId = row.Cell(12).GetString().Clean();
|
||||||
|
if (!row.Cell(13).IsEmpty()) pas.PassengerIdentityDocumentIssuingState = row.Cell(13).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(14).IsEmpty()) pas.PassengerIdentityDocumentExpiryDate = row.Cell(14).GetDateTime();
|
||||||
|
if (!row.Cell(15).IsEmpty()) pas.PassengerVisaNumber = row.Cell(15).GetString().Clean();
|
||||||
|
if (!row.Cell(16).IsEmpty()) pas.EmergencyCare = row.Cell(16).GetString().Clean();
|
||||||
|
if (!row.Cell(17).IsEmpty()) pas.EmergencyContactNumber = row.Cell(17).GetString().Clean();
|
||||||
|
|
||||||
|
pas.MessageHeader = this._pasMessage;
|
||||||
|
pas.IsDirty = true;
|
||||||
|
pas.Identifier = PAS.GetNewIdentifier(this._pasMessage.Elements);
|
||||||
|
this._pasMessage.Elements.Add(pas);
|
||||||
|
importPassenger.Add(pas);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importPassenger.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridPassengerList.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.PASA);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<PAS> importPassenger = new List<PAS>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (((IExcelDataReader)reader).FieldCount < 17)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 17 columns of data");
|
|
||||||
}
|
|
||||||
|
|
||||||
PAS pas = new PAS();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetValue(0).ToString().Clean();
|
|
||||||
if (pas.PassengerLastName.Equals("Family Name") || (pas.PassengerLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) pas.PassengerFirstName = reader.GetValue(1).ToString().Clean();
|
|
||||||
if (!reader.IsDBNull(2)) pas.PassengerGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) pas.PassengerPortOfEmbarkation = reader.GetString(3).Clean();
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
|
||||||
pas.PassengerPortOfEmbarkation = null;
|
|
||||||
if (!reader.IsDBNull(4)) pas.PassengerPortOfDisembarkation = reader.GetString(4).Clean();
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
|
||||||
pas.PassengerPortOfDisembarkation = null;
|
|
||||||
if (!reader.IsDBNull(5)) pas.PassengerInTransit = GlobalStructures.ReadBoolean(reader.GetString(5));
|
|
||||||
if (!reader.IsDBNull(6)) pas.PassengerNationality = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) pas.PassengerPlaceOfBirth = reader.GetString(7).Clean();
|
|
||||||
if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper().Clean();
|
|
||||||
if (!reader.IsDBNull(9)) pas.PassengerDateOfBirth = reader.GetDateTime(9);
|
|
||||||
if (!reader.IsDBNull(10)) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(10));
|
|
||||||
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = reader.ReadAsString(11).Clean();
|
|
||||||
if (!reader.IsDBNull(12)) pas.PassengerIdentityDocumentIssuingState = reader.GetString(12).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(13)) pas.PassengerIdentityDocumentExpiryDate = reader.GetDateTime(13);
|
|
||||||
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = reader.ReadAsString(14).Clean();
|
|
||||||
if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15).Clean();
|
|
||||||
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = reader.ReadAsString(16).Clean();
|
|
||||||
|
|
||||||
pas.MessageHeader = this._pasMessage;
|
|
||||||
pas.IsDirty = true;
|
|
||||||
pas.Identifier = PAS.GetNewIdentifier(this._pasMessage.Elements);
|
|
||||||
this._pasMessage.Elements.Add(pas);
|
|
||||||
importPassenger.Add(pas);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importPassenger.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridPassengerList.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.PASA);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1284,78 +1266,71 @@ namespace ENI2.DetailViewControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1);
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<PASD> importPassenger = new List<PASD>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 17)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 17 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
PASD pas = new PASD();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) pas.PassengerLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (pas.PassengerLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(pas.PassengerLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) pas.PassengerFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) pas.PassengerGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) pas.PassengerPortOfEmbarkation = row.Cell(4).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
||||||
|
pas.PassengerPortOfEmbarkation = null;
|
||||||
|
if (!row.Cell(5).IsEmpty()) pas.PassengerPortOfDisembarkation = row.Cell(5).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
||||||
|
pas.PassengerPortOfDisembarkation = null;
|
||||||
|
if (!row.Cell(6).IsEmpty()) pas.PassengerInTransit = GlobalStructures.ReadBoolean(row.Cell(6).GetString());
|
||||||
|
if (!row.Cell(7).IsEmpty()) pas.PassengerNationality = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) pas.PassengerPlaceOfBirth = row.Cell(8).GetString().Clean();
|
||||||
|
if (!row.Cell(9).IsEmpty()) pas.PassengerCountryOfBirth = row.Cell(9).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(10).IsEmpty()) pas.PassengerDateOfBirth = row.Cell(10).GetDateTime();
|
||||||
|
if (!row.Cell(11).IsEmpty()) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(11).GetString());
|
||||||
|
if (!row.Cell(12).IsEmpty()) pas.PassengerIdentityDocumentId = row.Cell(12).GetString().Clean();
|
||||||
|
if (!row.Cell(13).IsEmpty()) pas.PassengerIdentityDocumentIssuingState = row.Cell(13).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(14).IsEmpty()) pas.PassengerIdentityDocumentExpiryDate = row.Cell(14).GetDateTime();
|
||||||
|
if (!row.Cell(15).IsEmpty()) pas.PassengerVisaNumber = row.Cell(15).GetString().Clean();
|
||||||
|
if (!row.Cell(16).IsEmpty()) pas.EmergencyCare = row.Cell(16).GetString().Clean();
|
||||||
|
if (!row.Cell(17).IsEmpty()) pas.EmergencyContactNumber = row.Cell(17).GetString().Clean();
|
||||||
|
|
||||||
|
pas.MessageHeader = this._pasdMessage;
|
||||||
|
pas.IsDirty = true;
|
||||||
|
pas.Identifier = PASD.GetNewIdentifier(this._pasdMessage.Elements);
|
||||||
|
this._pasdMessage.Elements.Add(pas);
|
||||||
|
importPassenger.Add(pas);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importPassenger.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridPassengerListDeparture.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.PASD);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<PASD> importPassenger = new List<PASD>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (((IExcelDataReader)reader).FieldCount < 17)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 17 columns of data");
|
|
||||||
}
|
|
||||||
|
|
||||||
PASD pas = new PASD();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetValue(0).ToString();
|
|
||||||
if (pas.PassengerLastName.Equals("Family Name") || (pas.PassengerLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) pas.PassengerFirstName = reader.GetValue(1).ToString();
|
|
||||||
if (!reader.IsDBNull(2)) pas.PassengerGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) pas.PassengerPortOfEmbarkation = reader.GetString(3);
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
|
||||||
pas.PassengerPortOfEmbarkation = null;
|
|
||||||
if (!reader.IsDBNull(4)) pas.PassengerPortOfDisembarkation = reader.GetString(4);
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
|
||||||
pas.PassengerPortOfDisembarkation = null;
|
|
||||||
if (!reader.IsDBNull(5)) pas.PassengerInTransit = GlobalStructures.ReadBoolean(reader.GetString(5));
|
|
||||||
if (!reader.IsDBNull(6)) pas.PassengerNationality = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) pas.PassengerPlaceOfBirth = reader.GetString(7);
|
|
||||||
if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(9)) pas.PassengerDateOfBirth = reader.GetDateTime(9);
|
|
||||||
if (!reader.IsDBNull(10)) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(10));
|
|
||||||
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = reader.ReadAsString(11);
|
|
||||||
if (!reader.IsDBNull(12)) pas.PassengerIdentityDocumentIssuingState = reader.GetString(12).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(13)) pas.PassengerIdentityDocumentExpiryDate = reader.GetDateTime(13);
|
|
||||||
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = reader.ReadAsString(14);
|
|
||||||
if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15);
|
|
||||||
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = reader.ReadAsString(16);
|
|
||||||
|
|
||||||
pas.MessageHeader = this._pasMessage;
|
|
||||||
pas.IsDirty = true;
|
|
||||||
pas.Identifier = PASD.GetNewIdentifier(this._pasdMessage.Elements);
|
|
||||||
this._pasdMessage.Elements.Add(pas);
|
|
||||||
importPassenger.Add(pas);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importPassenger.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridPassengerListDeparture.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.PASD);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,18 +2,16 @@
|
|||||||
// Description: MDH Meldung Bearbeitungsseite
|
// Description: MDH Meldung Bearbeitungsseite
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using bsmd.database;
|
||||||
using System.Collections.Generic;
|
using ClosedXML.Excel;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Microsoft.Win32;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using bsmd.database;
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
using ExcelDataReader;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace ENI2.DetailViewControls
|
namespace ENI2.DetailViewControls
|
||||||
{
|
{
|
||||||
@ -289,80 +287,73 @@ namespace ENI2.DetailViewControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data
|
||||||
|
|
||||||
|
List<PortOfCallLast30Days> importPoC30 = new List<PortOfCallLast30Days>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 3)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have at least 3 Columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) poc30.PortOfCallLast30DaysLocode = row.Cell(1).GetString();
|
||||||
|
if (!row.Cell(2).IsEmpty()) poc30.PortOfCallLast30DaysDateOfDeparture = row.Cell(2).GetDateTime();
|
||||||
|
|
||||||
|
string boolString = "";
|
||||||
|
if (!row.Cell(3).IsEmpty()) boolString = row.Cell(3).GetString();
|
||||||
|
poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
(boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) ||
|
||||||
|
(boolString.Equals("j", StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() > 3)
|
||||||
|
{
|
||||||
|
string allNewCrew = row.Cell(4).IsEmpty() ? null : row.Cell(4).GetString()?.Trim();
|
||||||
|
if (!allNewCrew.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
string[] crewNames = allNewCrew.Split(',', ';');
|
||||||
|
for (int i = 0; i < crewNames.Length; i++)
|
||||||
|
{
|
||||||
|
string crewName = crewNames[i].Trim();
|
||||||
|
if (crewName.IsNullOrEmpty()) continue;
|
||||||
|
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
|
||||||
|
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName;
|
||||||
|
poc30Crew.PortOfCallLast30Days = poc30;
|
||||||
|
poc30.CrewJoinedShip.Add(poc30Crew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
poc30.MDH = this._mdh;
|
||||||
|
this._mdh.PortOfCallLast30Days.Add(poc30);
|
||||||
|
importPoC30.Add(poc30);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importPoC30.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridPortOfCallLast30Days.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.MDH);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, importPoC30.Count), Properties.Resources.textCaptionInformation,
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<PortOfCallLast30Days> importPoC30 = new List<PortOfCallLast30Days>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (reader.FieldCount < 3)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have at least 3 Columns of data");
|
|
||||||
}
|
|
||||||
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) poc30.PortOfCallLast30DaysLocode = reader.GetString(0);
|
|
||||||
if (!reader.IsDBNull(1)) poc30.PortOfCallLast30DaysDateOfDeparture = reader.GetDateTime(1);
|
|
||||||
string boolString = "";
|
|
||||||
if (!reader.IsDBNull(2)) boolString = reader.GetString(2);
|
|
||||||
poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) || (boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) ||
|
|
||||||
(boolString.Equals("j", StringComparison.OrdinalIgnoreCase)));
|
|
||||||
|
|
||||||
if(reader.FieldCount > 3)
|
|
||||||
{
|
|
||||||
string allNewCrew = reader.GetString(3)?.Trim();
|
|
||||||
if(!allNewCrew.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
string[] crewNames = allNewCrew.Split(',', ';');
|
|
||||||
for(int i=0;i<crewNames.Length;i++)
|
|
||||||
{
|
|
||||||
string crewName = crewNames[i].Trim();
|
|
||||||
if (crewName.IsNullOrEmpty()) continue;
|
|
||||||
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
|
|
||||||
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName;
|
|
||||||
poc30Crew.PortOfCallLast30Days = poc30;
|
|
||||||
poc30.CrewJoinedShip.Add(poc30Crew);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
poc30.MDH = this._mdh;
|
|
||||||
this._mdh.PortOfCallLast30Days.Add(poc30);
|
|
||||||
importPoC30.Add(poc30);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importPoC30.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridPortOfCallLast30Days.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.MDH);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, importPoC30.Count), Properties.Resources.textCaptionInformation,
|
|
||||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -253,7 +253,16 @@ SelectionMode="Extended" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_
|
|||||||
<Setter Property="Background" Value="Yellow" />
|
<Setter Property="Background" Value="Yellow" />
|
||||||
</MultiDataTrigger>
|
</MultiDataTrigger>
|
||||||
<DataTrigger Binding="{Binding SendSuccess}" Value="True">
|
<DataTrigger Binding="{Binding SendSuccess}" Value="True">
|
||||||
<Setter Property="Background" Value="LightGreen"></Setter>
|
<Setter Property="Background" Value="#92F592"></Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding InternalStatus}" Value="UPDATED">
|
||||||
|
<Setter Property="Background" Value="#DFFDDF"></Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding InternalStatus}" Value="TOSEND">
|
||||||
|
<Setter Property="Background" Value="#BFFDBF"></Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding InternalStatus}" Value="SENT">
|
||||||
|
<Setter Property="Background" Value="#BFFDBF"></Setter>
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
<DataTrigger Binding="{Binding HasSystemErrors}" Value="True">
|
<DataTrigger Binding="{Binding HasSystemErrors}" Value="True">
|
||||||
<Setter Property="Background" Value="MistyRose"></Setter>
|
<Setter Property="Background" Value="MistyRose"></Setter>
|
||||||
|
|||||||
@ -357,6 +357,9 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
this.buttonExcelImport.IsEnabled = !this.Core.DisplayId.IsNullOrEmpty();
|
this.buttonExcelImport.IsEnabled = !this.Core.DisplayId.IsNullOrEmpty();
|
||||||
|
|
||||||
|
this.dataGridMessages.ItemsSource = null;
|
||||||
|
this.dataGridMessages.ItemsSource = this.Messages;
|
||||||
|
|
||||||
//MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId));
|
//MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId));
|
||||||
//ShowIdDialog sid = new ShowIdDialog(this.Core)
|
//ShowIdDialog sid = new ShowIdDialog(this.Core)
|
||||||
//{
|
//{
|
||||||
@ -843,14 +846,14 @@ namespace ENI2.DetailViewControls
|
|||||||
{
|
{
|
||||||
addToSend = true;
|
addToSend = true;
|
||||||
|
|
||||||
if ((message.ErrorCount ?? 0) > 0) continue; // skip selection if there are any errors left
|
// if ((message.ErrorCount ?? 0) > 0) continue; // skip selection if there are any errors left
|
||||||
|
|
||||||
switch(message.MessageNotificationClass)
|
switch(message.MessageNotificationClass)
|
||||||
{
|
{
|
||||||
case NotificationClass.HAZA:
|
case NotificationClass.HAZA:
|
||||||
addToSend = XtraSendLogic.ShouldSendMessage(message) && ((message.ViolationCount ?? 0) == 0); break;
|
addToSend = XtraSendLogic.ShouldSendMessage(message); break;
|
||||||
case NotificationClass.HAZD:
|
case NotificationClass.HAZD:
|
||||||
addToSend = XtraSendLogic.ShouldSendMessage(message) && ((message.ViolationCount ?? 0) == 0); break;
|
addToSend = XtraSendLogic.ShouldSendMessage(message); break;
|
||||||
case NotificationClass.BPOL:
|
case NotificationClass.BPOL:
|
||||||
if (message.Elements.Count > 0)
|
if (message.Elements.Count > 0)
|
||||||
{
|
{
|
||||||
@ -858,26 +861,16 @@ namespace ENI2.DetailViewControls
|
|||||||
{
|
{
|
||||||
if (bpol.PortOfItineraries.Count == 0) addToSend = false;
|
if (bpol.PortOfItineraries.Count == 0) addToSend = false;
|
||||||
}
|
}
|
||||||
if((message.ViolationCount ?? 0) > 0) addToSend = false;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NotificationClass.WAS:
|
|
||||||
// if ((message.PositionViolationCount ?? 0) > 0) addToSend = false;
|
|
||||||
break; // WAS will be selected even if there are (any) violations left
|
|
||||||
case NotificationClass.WAS_RCPT:
|
case NotificationClass.WAS_RCPT:
|
||||||
addToSend = false;
|
addToSend = false;
|
||||||
break;
|
break;
|
||||||
case NotificationClass.NOA_NOD:
|
|
||||||
if ((message.PositionViolationCount ?? 0) > 0) addToSend = false;
|
|
||||||
break;
|
|
||||||
case NotificationClass.INFO:
|
case NotificationClass.INFO:
|
||||||
if (Core.PoC == "DEHAM") addToSend = false;
|
if (Core.PoC == "DEHAM") addToSend = false;
|
||||||
else addToSend = !((message.ViolationCount ?? 0) > 0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if((message.ViolationCount ?? 0) > 0) addToSend = false;
|
|
||||||
if(Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0)) addToSend = false;
|
if(Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0)) addToSend = false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,9 @@ namespace ENI2.DetailViewControls
|
|||||||
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
|
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
|
||||||
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
|
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
|
||||||
|
|
||||||
|
// WAS
|
||||||
|
this.RegisterTextboxChange(this.textBox_WasteDisposalServiceProvider, Message.NotificationClass.WAS);
|
||||||
|
|
||||||
this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
||||||
this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
||||||
}
|
}
|
||||||
@ -352,7 +355,6 @@ namespace ENI2.DetailViewControls
|
|||||||
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
|
this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
|
||||||
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
|
||||||
|
|
||||||
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
|
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
|
||||||
}
|
}
|
||||||
@ -390,9 +392,11 @@ namespace ENI2.DetailViewControls
|
|||||||
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
|
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
|
||||||
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
|
if ((this._currentTemplate.WasteDisposalServiceProviderName ?? "").Trim() != (this.textBox_WasteDisposalServiceProvider.Text ?? "").Trim())
|
||||||
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
{
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
|
||||||
|
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
|
}
|
||||||
|
|
||||||
this.buttonUndoTemplate.IsEnabled = true;
|
this.buttonUndoTemplate.IsEnabled = true;
|
||||||
this.buttonSetTemplate.IsEnabled = false;
|
this.buttonSetTemplate.IsEnabled = false;
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
</col:ArrayList>
|
</col:ArrayList>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<GroupBox Name="portNotificationGroupBox" Header="{x:Static p:Resources.textPortNotification}">
|
<GroupBox Name="portNotificationGroupBox" Header="{x:Static p:Resources.textPortNotification}">
|
||||||
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
<ScrollViewer>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
|
|||||||
@ -2,18 +2,17 @@
|
|||||||
// Description: SEC Meldung Bearbeitungsseite
|
// Description: SEC Meldung Bearbeitungsseite
|
||||||
//
|
//
|
||||||
|
|
||||||
using System.Windows;
|
using bsmd.database;
|
||||||
using System.Windows.Controls;
|
using ClosedXML.Excel;
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using bsmd.database;
|
|
||||||
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.IO;
|
using System;
|
||||||
using ExcelDataReader;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace ENI2.DetailViewControls
|
namespace ENI2.DetailViewControls
|
||||||
{
|
{
|
||||||
@ -345,76 +344,73 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data
|
||||||
|
|
||||||
|
List<LastTenPortFacilitiesCalled> importL10C = new List<LastTenPortFacilitiesCalled>();
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (cnt >= 10) break; // Maximum 10 rows
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 8)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 8 Columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) l10c.PortFacilityPortName = row.Cell(1).GetString();
|
||||||
|
if (!row.Cell(3).IsEmpty()) l10c.PortFacilityPortCountry = row.Cell(3).GetString();
|
||||||
|
if (!row.Cell(4).IsEmpty()) l10c.PortFacilityPortLoCode = row.Cell(4).GetString();
|
||||||
|
|
||||||
|
object o = null;
|
||||||
|
if (!row.Cell(5).IsEmpty()) o = row.Cell(5).Value;
|
||||||
|
if (o != null) l10c.PortFacilityDateOfArrival = Convert.ToDateTime(o);
|
||||||
|
|
||||||
|
if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value;
|
||||||
|
if (o != null) l10c.PortFacilityDateOfDeparture = Convert.ToDateTime(o);
|
||||||
|
|
||||||
|
if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value;
|
||||||
|
if (o != null) l10c.PortFacilityShipSecurityLevel = Convert.ToByte(o);
|
||||||
|
|
||||||
|
if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value;
|
||||||
|
int gisis = Convert.ToInt32(o);
|
||||||
|
if (!row.Cell(8).IsEmpty()) l10c.PortFacilityGISISCode = gisis.ToString().PadLeft(4, '0');
|
||||||
|
|
||||||
|
if (!row.Cell(9).IsEmpty()) l10c.PortFacilitySecurityMattersToReport = row.Cell(9).GetString();
|
||||||
|
if (l10c.PortFacilitySecurityMattersToReport?.Equals("nil", StringComparison.CurrentCultureIgnoreCase) == true)
|
||||||
|
l10c.PortFacilitySecurityMattersToReport = null;
|
||||||
|
|
||||||
|
if (!row.Cell(10).IsEmpty()) l10c.PortFacilityGISISCodeLocode = row.Cell(10).GetString();
|
||||||
|
|
||||||
|
l10c.SEC = this._sec;
|
||||||
|
l10c.IsDirty = true;
|
||||||
|
l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(this._sec.LastTenPortFacilitesCalled);
|
||||||
|
this._sec.LastTenPortFacilitesCalled.Add(l10c);
|
||||||
|
importL10C.Add(l10c);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importL10C.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridLast10PortFacilities.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.SEC);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importL10C.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<LastTenPortFacilitiesCalled> importL10C = new List<LastTenPortFacilitiesCalled>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
int cnt = 0;
|
|
||||||
while (reader.Read() && (cnt < 10))
|
|
||||||
{
|
|
||||||
if (((IExcelDataReader)reader).FieldCount < 8)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 8 Columns of data");
|
|
||||||
}
|
|
||||||
LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) l10c.PortFacilityPortName = reader.GetString(0);
|
|
||||||
if (!reader.IsDBNull(2)) l10c.PortFacilityPortCountry = reader.GetString(2);
|
|
||||||
if (!reader.IsDBNull(3)) l10c.PortFacilityPortLoCode = reader.GetString(3);
|
|
||||||
object o = null;
|
|
||||||
if (!reader.IsDBNull(4)) o = reader.GetValue(4);
|
|
||||||
if(o != null) l10c.PortFacilityDateOfArrival = Convert.ToDateTime(o);
|
|
||||||
if (!reader.IsDBNull(5)) o = reader.GetValue(5);
|
|
||||||
if (o != null) l10c.PortFacilityDateOfDeparture = Convert.ToDateTime(o);
|
|
||||||
// if (!reader.IsDBNull(4)) l10c.PortFacilityDateOfArrival = reader.GetDateTime(4);
|
|
||||||
// if (!reader.IsDBNull(5)) l10c.PortFacilityDateOfDeparture = reader.GetDateTime(5);
|
|
||||||
if (!reader.IsDBNull(6)) o = reader.GetValue(6);
|
|
||||||
if (o != null) l10c.PortFacilityShipSecurityLevel = Convert.ToByte(o);
|
|
||||||
if (!reader.IsDBNull(7)) o = reader.GetValue(7);
|
|
||||||
int gisis = Convert.ToInt32(o);
|
|
||||||
if (!reader.IsDBNull(7)) l10c.PortFacilityGISISCode = gisis.ToString().PadLeft(4, '0');
|
|
||||||
if (!reader.IsDBNull(8)) l10c.PortFacilitySecurityMattersToReport = reader.GetString(8);
|
|
||||||
if (l10c.PortFacilitySecurityMattersToReport.Equals("nil", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
l10c.PortFacilitySecurityMattersToReport = null;
|
|
||||||
if (!reader.IsDBNull(9)) l10c.PortFacilityGISISCodeLocode = reader.GetString(9);
|
|
||||||
l10c.SEC = this._sec;
|
|
||||||
l10c.IsDirty = true;
|
|
||||||
l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(this._sec.LastTenPortFacilitesCalled);
|
|
||||||
this._sec.LastTenPortFacilitesCalled.Add(l10c);
|
|
||||||
importL10C.Add(l10c);
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importL10C.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridLast10PortFacilities.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.SEC);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importL10C.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="600" d:DesignWidth="800">
|
d:DesignHeight="600" d:DesignWidth="800">
|
||||||
<GroupBox Name="shipDataGroupBox" Header="{x:Static p:Resources.textShipData}" >
|
<GroupBox Name="shipDataGroupBox" Header="{x:Static p:Resources.textShipData}" >
|
||||||
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="260" />
|
<RowDefinition Height="260" />
|
||||||
@ -104,6 +104,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</src:DetailBaseControl>
|
</src:DetailBaseControl>
|
||||||
|
|||||||
@ -2,17 +2,17 @@
|
|||||||
// Description: Detailansicht Müllmeldung
|
// Description: Detailansicht Müllmeldung
|
||||||
//
|
//
|
||||||
|
|
||||||
using System.Linq;
|
using bsmd.database;
|
||||||
using System.Collections.Generic;
|
using ClosedXML.Excel;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using bsmd.database;
|
|
||||||
using ExcelDataReader;
|
|
||||||
using System.IO;
|
|
||||||
using System;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
namespace ENI2.DetailViewControls
|
namespace ENI2.DetailViewControls
|
||||||
{
|
{
|
||||||
@ -483,100 +483,82 @@ namespace ENI2.DetailViewControls
|
|||||||
ofd.Filter = "Excel Files|*.xls;*.xlsx";
|
ofd.Filter = "Excel Files|*.xls;*.xlsx";
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(3); // Skip first three rows
|
||||||
|
|
||||||
|
List<Waste> importWasteList = new List<Waste>();
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
object o = null;
|
||||||
|
|
||||||
|
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (cnt >= 35) break; // Maximum 35 rows
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 9)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) o = row.Cell(2).Value; else o = null;
|
||||||
|
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
||||||
|
{
|
||||||
|
Waste waste = _was.GetWasteForType(wasteType);
|
||||||
|
if (waste == null)
|
||||||
|
{
|
||||||
|
waste = new Waste();
|
||||||
|
waste.WasteType = wasteType;
|
||||||
|
waste.WAS = this._was;
|
||||||
|
waste.IsDirty = true;
|
||||||
|
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
|
||||||
|
this._was.Waste.Add(waste);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
waste.IsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!row.Cell(5).IsEmpty()) waste.WasteDescription = row.Cell(5).GetString();
|
||||||
|
if (waste.WasteDescription.IsNullOrEmpty())
|
||||||
|
waste.WasteDescription = "-";
|
||||||
|
|
||||||
|
if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
if (!row.Cell(9).IsEmpty()) waste.WasteDisposalPort = row.Cell(9).GetString().ToUpper();
|
||||||
|
|
||||||
|
if (!row.Cell(10).IsEmpty()) o = row.Cell(10).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
importWasteList.Add(waste);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importWasteList.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridWaste.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.WAS);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<Waste> importWasteList = new List<Waste>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// skip first three rows
|
|
||||||
reader.Read();
|
|
||||||
reader.Read();
|
|
||||||
reader.Read();
|
|
||||||
|
|
||||||
int cnt = 0;
|
|
||||||
object o = null;
|
|
||||||
|
|
||||||
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
|
||||||
|
|
||||||
while (reader.Read() && (cnt < 35))
|
|
||||||
{
|
|
||||||
if (reader.FieldCount < 9)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(1)) o = reader.GetValue(1); else o = null;
|
|
||||||
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
|
||||||
{
|
|
||||||
Waste waste = _was.GetWasteForType(wasteType);
|
|
||||||
if (waste == null)
|
|
||||||
{
|
|
||||||
waste = new Waste();
|
|
||||||
waste.WasteType = wasteType;
|
|
||||||
waste.WAS = this._was;
|
|
||||||
waste.IsDirty = true;
|
|
||||||
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
|
|
||||||
this._was.Waste.Add(waste);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
waste.IsDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(4)) waste.WasteDescription = reader.GetString(4);
|
|
||||||
if (waste.WasteDescription.IsNullOrEmpty())
|
|
||||||
waste.WasteDescription = "-";
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(5)) o = reader.GetValue(5); else o = null;
|
|
||||||
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(6)) o = reader.GetValue(6); else o = null;
|
|
||||||
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(7)) o = reader.GetValue(7); else o = null;
|
|
||||||
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(8)) waste.WasteDisposalPort = reader.GetString(8).ToUpper();
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(9)) o = reader.GetValue(9); else o = null;
|
|
||||||
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
importWasteList.Add(waste);
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importWasteList.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridWaste.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
153
ENI2/ENI2.csproj
153
ENI2/ENI2.csproj
@ -9,7 +9,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ENI2</RootNamespace>
|
<RootNamespace>ENI2</RootNamespace>
|
||||||
<AssemblyName>ENI2Test</AssemblyName>
|
<AssemblyName>ENI2Test</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@ -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>3</ApplicationRevision>
|
<ApplicationRevision>7</ApplicationRevision>
|
||||||
<ApplicationVersion>7.2.11.3</ApplicationVersion>
|
<ApplicationVersion>7.2.12.7</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@ -134,75 +134,92 @@
|
|||||||
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>..\code.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ExcelDataReader, Version=3.7.0.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa, processorArchitecture=MSIL">
|
<Reference Include="ClosedXML, Version=0.105.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\ExcelDataReader.3.7.0\lib\net462\ExcelDataReader.dll</HintPath>
|
<HintPath>packages\ClosedXML.0.105.0\lib\netstandard2.0\ClosedXML.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="ClosedXML.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d5f7376574c51ec, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\ClosedXML.Parser.2.0.0\lib\netstandard2.0\ClosedXML.Parser.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="DocumentFormat.OpenXml, Version=3.3.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\DocumentFormat.OpenXml.3.3.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="DocumentFormat.OpenXml.Framework, Version=3.3.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\DocumentFormat.OpenXml.Framework.3.3.0\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
<HintPath>packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.9.0.8\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.9.0.9\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.Cryptography, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.Cryptography, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Bcl.Cryptography.9.0.8\lib\net462\Microsoft.Bcl.Cryptography.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.Cryptography.9.0.9\lib\net462\Microsoft.Bcl.Cryptography.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=9.0.0.8, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.HashCode, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.DependencyInjection.9.0.8\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=9.0.0.8, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.8\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.DependencyInjection.9.0.9\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging, Version=9.0.0.8, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Logging.9.0.8\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.9\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=9.0.0.8, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.9.0.8\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Logging.9.0.9\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Options, Version=9.0.0.8, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Options.9.0.8\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.9.0.9\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Primitives, Version=9.0.0.8, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Options, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Primitives.9.0.8\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Options.9.0.9\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Primitives, Version=9.0.0.9, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Primitives.9.0.9\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MigraDoc.DocumentObjectModel, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="MigraDoc.DocumentObjectModel, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp-MigraDoc.6.2.1\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll</HintPath>
|
<HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MigraDoc.Rendering, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="MigraDoc.Rendering, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp-MigraDoc.6.2.1\lib\netstandard2.0\MigraDoc.Rendering.dll</HintPath>
|
<HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.Rendering.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MigraDoc.RtfRendering, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="MigraDoc.RtfRendering, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp-MigraDoc.6.2.1\lib\netstandard2.0\MigraDoc.RtfRendering.dll</HintPath>
|
<HintPath>packages\PDFsharp-MigraDoc.6.2.2\lib\netstandard2.0\MigraDoc.RtfRendering.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.BarCodes, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.BarCodes, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.BarCodes.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.BarCodes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Charting, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Charting, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.Charting.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Charting.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Cryptography, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Cryptography, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.Cryptography.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Cryptography.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Quality, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Quality, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.Quality.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Quality.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Shared, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Shared, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.Shared.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Shared.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Snippets, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Snippets, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.Snippets.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.Snippets.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.System, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.System, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.System.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.System.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.WPFonts, Version=6.2.1.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.WPFonts, Version=6.2.2.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.1\lib\netstandard2.0\PdfSharp.WPFonts.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.2\lib\netstandard2.0\PdfSharp.WPFonts.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="RBush, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c77e27b81f4d0187, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\RBush.Signed.4.0.0\lib\net47\RBush.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\SixLabors.Fonts.1.0.0\lib\netstandard2.0\SixLabors.Fonts.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
@ -214,12 +231,12 @@
|
|||||||
<Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
<Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Diagnostics.DiagnosticSource.9.0.8\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
<HintPath>packages\System.Diagnostics.DiagnosticSource.9.0.9\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Formats.Asn1, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Formats.Asn1, Version=9.0.0.9, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Formats.Asn1.9.0.8\lib\net462\System.Formats.Asn1.dll</HintPath>
|
<HintPath>packages\System.Formats.Asn1.9.0.9\lib\net462\System.Formats.Asn1.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.IO.Compression" />
|
<Reference Include="System.IO.Compression" />
|
||||||
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
@ -234,8 +251,8 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
<Reference Include="System.Security" />
|
<Reference Include="System.Security" />
|
||||||
<Reference Include="System.Security.Cryptography.Pkcs, Version=9.0.0.8, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Security.Cryptography.Pkcs, Version=9.0.0.9, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Security.Cryptography.Pkcs.9.0.8\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
|
<HintPath>packages\System.Security.Cryptography.Pkcs.9.0.9\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.ServiceModel" />
|
<Reference Include="System.ServiceModel" />
|
||||||
<Reference Include="System.ServiceModel.Web" />
|
<Reference Include="System.ServiceModel.Web" />
|
||||||
@ -257,20 +274,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.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.7.25104.5739\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=4.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.7.25104.5739\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=4.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.7.25104.5739\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=4.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.7.25104.5739\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xceed.Wpf.Toolkit, Version=4.7.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
<Reference Include="Xceed.Wpf.Toolkit, Version=5.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Extended.Wpf.Toolkit.4.7.25104.5739\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
<HintPath>packages\Extended.Wpf.Toolkit.5.0.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -297,6 +314,9 @@
|
|||||||
<Compile Include="Controls\ConditionGroupControl.xaml.cs">
|
<Compile Include="Controls\ConditionGroupControl.xaml.cs">
|
||||||
<DependentUpon>ConditionGroupControl.xaml</DependentUpon>
|
<DependentUpon>ConditionGroupControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\EasyPeasyControl.xaml.cs">
|
||||||
|
<DependentUpon>EasyPeasyControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Controls\EditWindowBase.cs" />
|
<Compile Include="Controls\EditWindowBase.cs" />
|
||||||
<Compile Include="Controls\ENIDataGrid.cs" />
|
<Compile Include="Controls\ENIDataGrid.cs" />
|
||||||
<Compile Include="Controls\IHighlightControlContainer.cs" />
|
<Compile Include="Controls\IHighlightControlContainer.cs" />
|
||||||
@ -558,6 +578,7 @@
|
|||||||
<Compile Include="Util\ByteConverter.cs" />
|
<Compile Include="Util\ByteConverter.cs" />
|
||||||
<Compile Include="Util\CutoffConverter.cs" />
|
<Compile Include="Util\CutoffConverter.cs" />
|
||||||
<Compile Include="Util\DatabaseEntityWatchdog.cs" />
|
<Compile Include="Util\DatabaseEntityWatchdog.cs" />
|
||||||
|
<Compile Include="Util\EasyPeasyState.cs" />
|
||||||
<Compile Include="Util\EnumHelper.cs" />
|
<Compile Include="Util\EnumHelper.cs" />
|
||||||
<Compile Include="Util\EnumToBooleanConverter.cs" />
|
<Compile Include="Util\EnumToBooleanConverter.cs" />
|
||||||
<Compile Include="Util\EnumToCollectionConverter.cs" />
|
<Compile Include="Util\EnumToCollectionConverter.cs" />
|
||||||
@ -587,6 +608,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Controls\EasyPeasyControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Controls\LocodeControl.xaml">
|
<Page Include="Controls\LocodeControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@ -1,13 +1,14 @@
|
|||||||
// Copyright (c) 2017-today Informatikbüro Daniel Schick
|
// Copyright (c) 2017-today Informatikbüro Daniel Schick
|
||||||
// Base class excel (writer not yet implemented but eventually..)
|
// Base class excel access (named ranges, colorizing, etc.)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.Office.Interop.Excel;
|
using ClosedXML.Excel;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace ENI2.Excel
|
namespace ENI2.Excel
|
||||||
{
|
{
|
||||||
@ -20,10 +21,8 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
protected CountryMode _countryMode = CountryMode.DE;
|
protected CountryMode _countryMode = CountryMode.DE;
|
||||||
|
|
||||||
protected Workbooks _excelWorkbooks;
|
protected XLWorkbook _workBook;
|
||||||
protected Workbook _workBook;
|
protected Dictionary<string, IXLDefinedName> _nameDict;
|
||||||
protected Application _excelApp;
|
|
||||||
protected Dictionary<string, Name> _nameDict;
|
|
||||||
protected ILog _log;
|
protected ILog _log;
|
||||||
|
|
||||||
#endregion Fields
|
#endregion Fields
|
||||||
@ -32,12 +31,7 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
public ExcelBase()
|
public ExcelBase()
|
||||||
{
|
{
|
||||||
|
|
||||||
_log = LogManager.GetLogger(this.GetType().Name);
|
_log = LogManager.GetLogger(this.GetType().Name);
|
||||||
|
|
||||||
this._excelApp = new Application();
|
|
||||||
this._excelApp.DisplayAlerts = false;
|
|
||||||
this._excelWorkbooks = _excelApp.Workbooks;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Construction
|
#endregion Construction
|
||||||
@ -46,9 +40,9 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
internal CountryMode Mode { get { return _countryMode; } }
|
internal CountryMode Mode { get { return _countryMode; } }
|
||||||
|
|
||||||
internal Dictionary<string, Name> NameDict { get { return _nameDict; } }
|
internal Dictionary<string, IXLDefinedName> NameDict { get { return _nameDict; } }
|
||||||
|
|
||||||
internal Sheets Worksheets { get { return _workBook.Worksheets; } }
|
internal IXLWorksheets Worksheets { get { return _workBook?.Worksheets; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -56,17 +50,17 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
protected void InitNameFields()
|
protected void InitNameFields()
|
||||||
{
|
{
|
||||||
_nameDict = new Dictionary<string, Name>();
|
_nameDict = new Dictionary<string, IXLDefinedName>();
|
||||||
int bookCnt = 0;
|
int bookCnt = 0;
|
||||||
foreach (Name name in _workBook.Names)
|
|
||||||
{
|
|
||||||
string theValue = name.Value;
|
|
||||||
// Namensbezug: =SheetZelle. Leere Referenzen überspringen (kommt immer mal wieder vor!)
|
|
||||||
|
|
||||||
string nameKey = name.Name;
|
// Get workbook-level defined names
|
||||||
|
foreach (var definedName in _workBook.DefinedNames)
|
||||||
|
{
|
||||||
|
string nameKey = definedName.Name;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Handle sheet-scoped names (Sheet1!Name format)
|
||||||
if (nameKey.Contains("!"))
|
if (nameKey.Contains("!"))
|
||||||
nameKey = nameKey.Substring(nameKey.IndexOf('!') + 1);
|
nameKey = nameKey.Substring(nameKey.IndexOf('!') + 1);
|
||||||
}
|
}
|
||||||
@ -76,33 +70,34 @@ namespace ENI2.Excel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((theValue != "=#REF!#REF!") && (theValue != "=#BEZUG!#BEZUG!"))
|
// Check if the defined name is valid (not a broken reference)
|
||||||
|
if (definedName.IsValid)
|
||||||
{
|
{
|
||||||
_nameDict[nameKey] = name;
|
_nameDict[nameKey] = definedName;
|
||||||
bookCnt++;
|
bookCnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_log.DebugFormat("{0} named ranges found at Workbook level", bookCnt);
|
_log.DebugFormat("{0} defined names found at Workbook level", bookCnt);
|
||||||
|
|
||||||
|
// Get worksheet-level defined names
|
||||||
foreach (Worksheet ws in _workBook.Worksheets)
|
foreach (var ws in _workBook.Worksheets)
|
||||||
{
|
{
|
||||||
int wsCnt = 0;
|
int wsCnt = 0;
|
||||||
foreach (Name name in ws.Names)
|
foreach (var definedName in ws.DefinedNames)
|
||||||
{
|
{
|
||||||
string theValue = name.Value;
|
string nameKey = definedName.Name;
|
||||||
// Namensbezug: =SheetZelle. Leere Referenzen überspringen (kommt immer mal wieder vor!)
|
|
||||||
if (!_nameDict.ContainsKey(name.Name))
|
if (!_nameDict.ContainsKey(nameKey))
|
||||||
{
|
{
|
||||||
if ((theValue != "=#REF!#REF!") && (theValue != "=#BEZUG!#BEZUG!"))
|
if (definedName.IsValid)
|
||||||
{
|
{
|
||||||
_nameDict[name.Name] = name;
|
_nameDict[nameKey] = definedName;
|
||||||
wsCnt++;
|
wsCnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wsCnt > 0)
|
if (wsCnt > 0)
|
||||||
_log.DebugFormat("{0} named ranges found in Worksheet {1}", wsCnt, ws.Name);
|
_log.DebugFormat("{0} defined names found in Worksheet {1}", wsCnt, ws.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,27 +122,40 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if (_nameDict.ContainsKey(lookup))
|
if (_nameDict.ContainsKey(lookup))
|
||||||
{
|
{
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var definedName = _nameDict[lookup];
|
||||||
if (val is double) result = val;
|
var ranges = definedName.Ranges;
|
||||||
if ((val is string) && (val.Length > 0))
|
var range = ranges.FirstOrDefault();
|
||||||
{
|
|
||||||
result = ParseAnyDouble(val);
|
|
||||||
|
|
||||||
if(result == null)
|
if (range != null)
|
||||||
|
{
|
||||||
|
var cell = range.FirstCell();
|
||||||
|
if (cell != null)
|
||||||
{
|
{
|
||||||
Match m = Regex.Match(val, "([0-9\\.\\,]+)([a-zA-Z]*)");
|
var cellValue = cell.Value;
|
||||||
if (m.Success)
|
|
||||||
|
if (cellValue.IsNumber)
|
||||||
{
|
{
|
||||||
result = ParseAnyDouble(m.Groups[1].Value);
|
result = cellValue.GetNumber();
|
||||||
|
}
|
||||||
|
else if (cellValue.IsText)
|
||||||
|
{
|
||||||
|
string textVal = cellValue.GetText();
|
||||||
|
if (!string.IsNullOrEmpty(textVal))
|
||||||
|
{
|
||||||
|
result = ParseAnyDouble(textVal);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
Match m = Regex.Match(textVal, "([0-9\\.\\,]+)([a-zA-Z]*)");
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
result = ParseAnyDouble(m.Groups[1].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result == null) && (val != null))
|
|
||||||
{
|
|
||||||
double tmpDouble2 = val[1, 1];
|
|
||||||
result = tmpDouble2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@ -159,17 +167,26 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
internal void Colorize(string lookup, int color)
|
internal void Colorize(string lookup, int color)
|
||||||
{
|
{
|
||||||
if(_nameDict.ContainsKey(lookup))
|
if (_nameDict.ContainsKey(lookup))
|
||||||
{
|
{
|
||||||
var range = _nameDict[lookup].RefersToRange;
|
var definedName = _nameDict[lookup];
|
||||||
Colorize(range, color);
|
var ranges = definedName.Ranges;
|
||||||
|
var range = ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
|
{
|
||||||
|
Colorize(range, color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Colorize(Range range, int color)
|
internal void Colorize(IXLRange range, int color)
|
||||||
{
|
{
|
||||||
range.Interior.Color = color;
|
// Convert int color to Color object
|
||||||
range.Worksheet.Tab.Color = color;
|
Color backgroundColor = Color.FromArgb(color);
|
||||||
|
range.Style.Fill.BackgroundColor = XLColor.FromColor(backgroundColor);
|
||||||
|
|
||||||
|
// Set worksheet tab color
|
||||||
|
range.Worksheet.SetTabColor(XLColor.FromColor(backgroundColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -178,9 +195,7 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
public void Save(string path)
|
public void Save(string path)
|
||||||
{
|
{
|
||||||
this._workBook.SaveAs(path, XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange,
|
_workBook.SaveAs(path);
|
||||||
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
|
|
||||||
this._workBook.Saved = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -191,29 +206,16 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (this._workBook != null)
|
if (_workBook != null)
|
||||||
{
|
{
|
||||||
this._workBook.Close(0);
|
_log.Debug("Disposing Workbook");
|
||||||
_log.Debug("Close Worksheet");
|
_workBook.Dispose();
|
||||||
Marshal.ReleaseComObject(this._workBook);
|
_workBook = null;
|
||||||
}
|
|
||||||
|
|
||||||
if (this._excelWorkbooks != null)
|
|
||||||
{
|
|
||||||
this._excelWorkbooks.Close();
|
|
||||||
_log.Debug("Close Workbooks");
|
|
||||||
Marshal.ReleaseComObject(this._excelWorkbooks);
|
|
||||||
}
|
|
||||||
if (this._excelApp != null)
|
|
||||||
{
|
|
||||||
_log.Debug("Quit Excel");
|
|
||||||
this._excelApp.Quit();
|
|
||||||
Marshal.ReleaseComObject(this._excelApp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_log.ErrorFormat("Exception disposing ExcelReader: {0}", ex.Message);
|
_log.ErrorFormat("Exception disposing ExcelBase: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Drawing;
|
using ClosedXML.Excel;
|
||||||
using Microsoft.Office.Interop.Excel;
|
|
||||||
|
|
||||||
namespace ENI2.Excel
|
namespace ENI2.Excel
|
||||||
{
|
{
|
||||||
@ -17,29 +16,27 @@ namespace ENI2.Excel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ExcelComparer
|
public static class ExcelComparer
|
||||||
{
|
{
|
||||||
private static readonly int diffColor = ColorTranslator.ToOle(Color.FromArgb(150, 150, 255)); // blue
|
private static readonly XLColor diffColor = XLColor.FromArgb(150, 150, 255); // blue
|
||||||
|
|
||||||
private static bool GetSheetRange(Worksheet sheet, out int lastUsedRow, out int lastUsedColumn)
|
private static bool GetSheetRange(IXLWorksheet sheet, out int lastUsedRow, out int lastUsedColumn)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// sheet.Columns.ClearFormats();
|
var usedRange = sheet.RangeUsed();
|
||||||
// sheet.Rows.ClearFormats();
|
if (usedRange != null)
|
||||||
Range usedRange = sheet.UsedRange;
|
{
|
||||||
lastUsedRow = usedRange.Rows.Count;
|
lastUsedRow = usedRange.RowCount();
|
||||||
lastUsedColumn = usedRange.Columns.Count;
|
lastUsedColumn = usedRange.ColumnCount();
|
||||||
|
return true;
|
||||||
/*
|
}
|
||||||
Range last = sheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing);
|
else
|
||||||
Range range = sheet.get_Range("A1", last);
|
{
|
||||||
|
lastUsedColumn = 0;
|
||||||
lastUsedRow = last.Row;
|
lastUsedRow = 0;
|
||||||
lastUsedColumn = last.Column;
|
return false;
|
||||||
*/
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
lastUsedColumn = 0;
|
lastUsedColumn = 0;
|
||||||
lastUsedRow = 0;
|
lastUsedRow = 0;
|
||||||
@ -47,20 +44,6 @@ namespace ENI2.Excel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetExcelColumnName(int columnNumber)
|
|
||||||
{
|
|
||||||
string columnName = "";
|
|
||||||
|
|
||||||
while (columnNumber > 0)
|
|
||||||
{
|
|
||||||
int modulo = (columnNumber - 1) % 26;
|
|
||||||
columnName = Convert.ToChar('A' + modulo) + columnName;
|
|
||||||
columnNumber = (columnNumber - modulo) / 26;
|
|
||||||
}
|
|
||||||
|
|
||||||
return columnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Compare(string sourcePath, string targetPath, string comparisonFileName, out string errorMessage)
|
public static string Compare(string sourcePath, string targetPath, string comparisonFileName, out string errorMessage)
|
||||||
{
|
{
|
||||||
errorMessage = "";
|
errorMessage = "";
|
||||||
@ -68,122 +51,97 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Copy(targetPath, comparisonFileName);
|
File.Copy(targetPath, comparisonFileName, true);
|
||||||
ExcelReader source = new ExcelReader(sourcePath, true, false);
|
|
||||||
ExcelReader comparison = new ExcelReader(comparisonFileName, false, false);
|
|
||||||
|
|
||||||
/* erste Variante Vergleich über Namen der Zellen
|
using (var sourceWorkbook = new XLWorkbook(sourcePath))
|
||||||
|
using (var comparisonWorkbook = new XLWorkbook(comparisonFileName))
|
||||||
// loop through named cells
|
|
||||||
foreach (string name in comparison.NameDict.Keys)
|
|
||||||
{
|
{
|
||||||
if (!source.NameDict.ContainsKey(name)) continue;
|
// Es werden Zellen der "used range" miteinander verglichen
|
||||||
string sourceText = source.ReadText(name);
|
foreach (var sourceSheet in sourceWorkbook.Worksheets)
|
||||||
string targetText = comparison.ReadText(name);
|
|
||||||
|
|
||||||
if (sourceText == null)
|
|
||||||
{
|
{
|
||||||
if (targetText != null)
|
IXLWorksheet targetSheet = null;
|
||||||
|
foreach (var sheet in comparisonWorkbook.Worksheets)
|
||||||
{
|
{
|
||||||
comparison.Colorize(name, diffColor);
|
if (sourceSheet.Name.Equals(sheet.Name))
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (targetText == null)
|
|
||||||
{
|
|
||||||
if (sourceText != null)
|
|
||||||
{
|
|
||||||
comparison.Colorize(name, diffColor);
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((sourceText != null) && (targetText != null))
|
|
||||||
{
|
|
||||||
if (!sourceText.Equals(targetText))
|
|
||||||
{
|
|
||||||
// turn cell blue
|
|
||||||
comparison.Colorize(name, diffColor);
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Zweite Version durch alle Sheets werden Zellen der "used range" miteinander verglichen
|
|
||||||
|
|
||||||
foreach(Worksheet sourceSheet in source.Worksheets)
|
|
||||||
{
|
|
||||||
Worksheet targetSheet = null;
|
|
||||||
foreach(Worksheet sheet in comparison.Worksheets)
|
|
||||||
{
|
|
||||||
if (sourceSheet.Name.Equals(sheet.Name))
|
|
||||||
{
|
|
||||||
targetSheet = sheet;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetSheet == null) continue;
|
|
||||||
System.Diagnostics.Trace.WriteLine(string.Format("Processing sheet {0}", targetSheet.Name));
|
|
||||||
|
|
||||||
if(GetSheetRange(sourceSheet, out int sourceRows, out int sourceCols) && GetSheetRange(targetSheet, out int targetRows, out int targetCols))
|
|
||||||
{
|
|
||||||
// read source into 2 dim array
|
|
||||||
string rangeString = string.Format("A1:{0}{1}", GetExcelColumnName(Math.Max(sourceCols, targetCols)), Math.Max(sourceRows, targetRows));
|
|
||||||
object[,] sourceArray = sourceSheet.get_Range(rangeString).Value;
|
|
||||||
// read target into 2 dim array
|
|
||||||
object[,] targetArray = targetSheet.get_Range(rangeString).Value;
|
|
||||||
|
|
||||||
for (int rowidx = 1; rowidx <= Math.Max(sourceRows, targetRows); rowidx++)
|
|
||||||
{
|
|
||||||
for( int colidx = 1; colidx <= Math.Max(sourceCols, targetCols); colidx++)
|
|
||||||
{
|
{
|
||||||
string sourceText = null;
|
targetSheet = sheet;
|
||||||
if(sourceArray[rowidx,colidx] != null) sourceText = sourceArray[rowidx,colidx].ToString();
|
break;
|
||||||
string targetText = null;
|
|
||||||
if(targetArray[rowidx,colidx] != null) targetText = targetArray[rowidx, colidx].ToString();
|
|
||||||
|
|
||||||
if (sourceText == null)
|
|
||||||
{
|
|
||||||
if (targetText != null)
|
|
||||||
{
|
|
||||||
string targetRangeName = string.Format("{0}{1}", GetExcelColumnName(colidx), rowidx);
|
|
||||||
comparison.Colorize(targetSheet.Range[targetRangeName], diffColor);
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (targetText == null)
|
|
||||||
{
|
|
||||||
if (sourceText != null)
|
|
||||||
{
|
|
||||||
string targetRangeName = string.Format("{0}{1}", GetExcelColumnName(colidx), rowidx);
|
|
||||||
comparison.Colorize(targetSheet.Range[targetRangeName], diffColor);
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((sourceText != null) && (targetText != null))
|
|
||||||
{
|
|
||||||
if (!sourceText.Equals(targetText))
|
|
||||||
{
|
|
||||||
string targetRangeName = string.Format("{0}{1}", GetExcelColumnName(colidx), rowidx);
|
|
||||||
// turn cell blue
|
|
||||||
comparison.Colorize(targetSheet.Range[targetRangeName], diffColor);
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errorMessage = "failed to get sheet ranges";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
comparison.Save(comparisonFileName);
|
if (targetSheet == null) continue;
|
||||||
source.Dispose();
|
System.Diagnostics.Trace.WriteLine(string.Format("Processing sheet {0}", targetSheet.Name));
|
||||||
comparison.Dispose();
|
|
||||||
|
if (GetSheetRange(sourceSheet, out int sourceRows, out int sourceCols) && GetSheetRange(targetSheet, out int targetRows, out int targetCols))
|
||||||
|
{
|
||||||
|
int maxRows = Math.Max(sourceRows, targetRows);
|
||||||
|
int maxCols = Math.Max(sourceCols, targetCols);
|
||||||
|
|
||||||
|
for (int rowidx = 1; rowidx <= maxRows; rowidx++)
|
||||||
|
{
|
||||||
|
for (int colidx = 1; colidx <= maxCols; colidx++)
|
||||||
|
{
|
||||||
|
string sourceText = null;
|
||||||
|
string targetText = null;
|
||||||
|
|
||||||
|
// Get source cell value
|
||||||
|
if (rowidx <= sourceRows && colidx <= sourceCols)
|
||||||
|
{
|
||||||
|
var sourceCell = sourceSheet.Cell(rowidx, colidx);
|
||||||
|
if (!sourceCell.IsEmpty())
|
||||||
|
{
|
||||||
|
sourceText = sourceCell.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get target cell value
|
||||||
|
if (rowidx <= targetRows && colidx <= targetCols)
|
||||||
|
{
|
||||||
|
var targetCell = targetSheet.Cell(rowidx, colidx);
|
||||||
|
if (!targetCell.IsEmpty())
|
||||||
|
{
|
||||||
|
targetText = targetCell.GetString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceText == null)
|
||||||
|
{
|
||||||
|
if (targetText != null)
|
||||||
|
{
|
||||||
|
var cellToHighlight = targetSheet.Cell(rowidx, colidx);
|
||||||
|
cellToHighlight.Style.Fill.BackgroundColor = diffColor;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (targetText == null)
|
||||||
|
{
|
||||||
|
if (sourceText != null)
|
||||||
|
{
|
||||||
|
var cellToHighlight = targetSheet.Cell(rowidx, colidx);
|
||||||
|
cellToHighlight.Style.Fill.BackgroundColor = diffColor;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((sourceText != null) && (targetText != null))
|
||||||
|
{
|
||||||
|
if (!sourceText.Equals(targetText))
|
||||||
|
{
|
||||||
|
var cellToHighlight = targetSheet.Cell(rowidx, colidx);
|
||||||
|
cellToHighlight.Style.Fill.BackgroundColor = diffColor;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errorMessage = "failed to get sheet ranges";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
comparisonWorkbook.SaveAs(comparisonFileName);
|
||||||
|
}
|
||||||
errorMessage = string.Format("{0} differences found", counter);
|
errorMessage = string.Format("{0} differences found", counter);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -193,6 +151,5 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
return comparisonFileName;
|
return comparisonFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,13 +9,12 @@
|
|||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
using ENI2.Locode;
|
using ENI2.Locode;
|
||||||
using Microsoft.Office.Interop.Excel;
|
using ClosedXML.Excel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace ENI2.Excel
|
namespace ENI2.Excel
|
||||||
{
|
{
|
||||||
@ -31,9 +30,9 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
internal Dictionary<string, string> ImportValues { get; } = new Dictionary<string, string>();
|
internal Dictionary<string, string> ImportValues { get; } = new Dictionary<string, string>();
|
||||||
|
|
||||||
public ExcelReader(string filePath, bool openReadonly = true, bool createNameFields = true)
|
public ExcelReader(string filePath, bool createNameFields = true)
|
||||||
{
|
{
|
||||||
this._workBook = _excelWorkbooks.Open(filePath, 0, openReadonly, 5, "", "", false, XlPlatform.xlWindows, "", false, false, 0, false, false, false);
|
this._workBook = new XLWorkbook(filePath);
|
||||||
if (createNameFields)
|
if (createNameFields)
|
||||||
this.InitNameFields();
|
this.InitNameFields();
|
||||||
|
|
||||||
@ -69,16 +68,20 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var definedName = _nameDict[lookup];
|
||||||
var val2 = _nameDict[lookup].RefersToRange.Value2;
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
if (val != null)
|
if (range != null)
|
||||||
result = val.ToString().Trim();
|
{
|
||||||
else if (val2 != null)
|
var cell = range.FirstCell();
|
||||||
result = val2.ToString().Trim();
|
if (cell != null && !cell.Value.IsBlank)
|
||||||
|
{
|
||||||
|
result = cell.Value.ToString().Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (COMException ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_log.WarnFormat("COMException reading field {0}: {1}", lookup, ex.ErrorCode);
|
_log.WarnFormat("Exception reading field {0}: {1}", lookup, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result != null)
|
if (result != null)
|
||||||
@ -441,47 +444,61 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
if (_nameDict.ContainsKey(lookup))
|
if (_nameDict.ContainsKey(lookup))
|
||||||
{
|
{
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var definedName = _nameDict[lookup];
|
||||||
if (val is DateTime)
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
{
|
{
|
||||||
date = val;
|
var cell = range.FirstCell();
|
||||||
}
|
if (cell != null && !cell.Value.IsBlank)
|
||||||
else if (val is double)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
date = DateTime.FromOADate(val);
|
var cellValue = cell.Value;
|
||||||
|
|
||||||
|
if (cellValue.IsDateTime)
|
||||||
|
{
|
||||||
|
date = cellValue.GetDateTime();
|
||||||
|
}
|
||||||
|
else if (cellValue.IsNumber)
|
||||||
|
{
|
||||||
|
double numValue = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
numValue = cellValue.GetNumber();
|
||||||
|
date = DateTime.FromOADate(numValue);
|
||||||
|
}
|
||||||
|
catch (ArgumentException) { /* .. */ }
|
||||||
|
|
||||||
|
if (date == null)
|
||||||
|
{
|
||||||
|
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||||
|
string dateString = numValue.ToString();
|
||||||
|
const string format = "yyyyMMdd";
|
||||||
|
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
|
||||||
|
date = tmpDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cellValue.IsText)
|
||||||
|
{
|
||||||
|
string textValue = cellValue.GetText();
|
||||||
|
|
||||||
|
if (DateTime.TryParse(textValue, out DateTime tmpDate))
|
||||||
|
date = tmpDate;
|
||||||
|
|
||||||
|
if (date == null)
|
||||||
|
{
|
||||||
|
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
|
||||||
|
if (DateTime.TryParseExact(textValue, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate2))
|
||||||
|
date = tmpDate2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (date == null)
|
||||||
|
{
|
||||||
|
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
|
||||||
|
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
|
||||||
|
if (DateTime.TryParseExact(textValue, formats, en, DateTimeStyles.None, out DateTime tmpDate3))
|
||||||
|
date = tmpDate3;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (ArgumentException) { /* .. */ }
|
|
||||||
if (date == null)
|
|
||||||
{
|
|
||||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
|
||||||
string dateString = val.ToString();
|
|
||||||
const string format = "yyyyMMdd";
|
|
||||||
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
|
|
||||||
date = tmpDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (date == null)
|
|
||||||
{
|
|
||||||
if (DateTime.TryParse(val, out DateTime tmpDate))
|
|
||||||
date = tmpDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (date == null)
|
|
||||||
{
|
|
||||||
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
|
|
||||||
if (DateTime.TryParseExact(val, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
|
|
||||||
date = tmpDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (date == null)
|
|
||||||
{
|
|
||||||
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
|
|
||||||
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
|
|
||||||
if (DateTime.TryParseExact(val, formats, en, DateTimeStyles.None, out DateTime tmpDate))
|
|
||||||
return tmpDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (date != null)
|
if (date != null)
|
||||||
@ -532,61 +549,67 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if (_nameDict.ContainsKey(lookup))
|
if (_nameDict.ContainsKey(lookup))
|
||||||
{
|
{
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var definedName = _nameDict[lookup];
|
||||||
if (val is DateTime)
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
{
|
{
|
||||||
result = val;
|
var cell = range.FirstCell();
|
||||||
}
|
if (cell != null && !cell.Value.IsBlank)
|
||||||
if (val is double)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
result = DateTime.FromOADate(val);
|
var cellValue = cell.Value;
|
||||||
}
|
|
||||||
catch (ArgumentException) { }
|
|
||||||
|
|
||||||
if (result == null)
|
if (cellValue.IsDateTime)
|
||||||
{
|
|
||||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
|
||||||
string dateString = val.ToString();
|
|
||||||
if (!dateString.Contains(":"))
|
|
||||||
{
|
{
|
||||||
const string format = "HHmm";
|
result = cellValue.GetDateTime();
|
||||||
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
|
|
||||||
result = tmpDate;
|
|
||||||
}
|
}
|
||||||
}
|
else if (cellValue.IsNumber)
|
||||||
}
|
{
|
||||||
|
double numValue = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
numValue = cellValue.GetNumber();
|
||||||
|
result = DateTime.FromOADate(numValue);
|
||||||
|
}
|
||||||
|
catch (ArgumentException) { }
|
||||||
|
|
||||||
if (val is string @string)
|
if (result == null)
|
||||||
{
|
{
|
||||||
if (@string.EndsWith("lt", StringComparison.OrdinalIgnoreCase))
|
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||||
val = @string.Substring(0, @string.Length - 2).Trim();
|
string dateString = numValue.ToString();
|
||||||
else
|
if (!dateString.Contains(":"))
|
||||||
val = @string.Trim();
|
{
|
||||||
}
|
const string format = "HHmm";
|
||||||
|
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
|
||||||
|
result = tmpDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cellValue.IsText)
|
||||||
|
{
|
||||||
|
string textValue = cellValue.GetText();
|
||||||
|
|
||||||
if (result == null)
|
if (textValue.EndsWith("lt", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
textValue = textValue.Substring(0, textValue.Length - 2).Trim();
|
||||||
if (DateTime.TryParseExact(val, "HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date))
|
else
|
||||||
result = date;
|
textValue = textValue.Trim();
|
||||||
}
|
|
||||||
|
|
||||||
if (result == null)
|
if (DateTime.TryParseExact(textValue, "HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date))
|
||||||
{
|
result = date;
|
||||||
if (DateTime.TryParseExact(val, "HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date))
|
|
||||||
result = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((result == null) && (val != null))
|
if (result == null)
|
||||||
{
|
{
|
||||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
if (DateTime.TryParseExact(textValue, "HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out DateTime date2))
|
||||||
string dateString = val.ToString();
|
result = date2;
|
||||||
if (!dateString.Contains(":"))
|
}
|
||||||
{
|
|
||||||
const string format = "HHmm";
|
if (result == null && !textValue.Contains(":"))
|
||||||
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out DateTime tmpDate))
|
{
|
||||||
result = tmpDate;
|
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||||
|
const string format = "HHmm";
|
||||||
|
if (DateTime.TryParseExact(textValue, format, provider, DateTimeStyles.None, out DateTime tmpDate))
|
||||||
|
result = tmpDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -627,7 +650,7 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Worksheet theWorkSheet = _workBook.Worksheets[sheetName];
|
var theWorkSheet = _workBook.Worksheets.Worksheet(sheetName);
|
||||||
return theWorkSheet != null;
|
return theWorkSheet != null;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
@ -640,12 +663,13 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName];
|
var workSheet = _workBook.Worksheets.Worksheet(sheetName);
|
||||||
string result = workSheet.Range[range].Text.ToString();
|
var cell = workSheet.Range(range).FirstCell();
|
||||||
|
string result = cell.Value.ToString();
|
||||||
if (!result.IsNullOrEmpty())
|
if (!result.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
result = result.Trim().Clean();
|
result = result.Trim().Clean();
|
||||||
if(maxLength.HasValue && result.Length > maxLength.Value)
|
if (maxLength.HasValue && result.Length > maxLength.Value)
|
||||||
{
|
{
|
||||||
result = result.Substring(0, maxLength.Value);
|
result = result.Substring(0, maxLength.Value);
|
||||||
}
|
}
|
||||||
@ -663,8 +687,9 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName];
|
var workSheet = _workBook.Worksheets.Worksheet(sheetName);
|
||||||
string result = workSheet.Range[row, col].Text.ToString();
|
var cell = workSheet.Cell(row, col);
|
||||||
|
string result = cell.Value.ToString();
|
||||||
if (!result.IsNullOrEmpty())
|
if (!result.IsNullOrEmpty())
|
||||||
result = result.Trim().Clean();
|
result = result.Trim().Clean();
|
||||||
return result;
|
return result;
|
||||||
@ -681,10 +706,11 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName];
|
var workSheet = _workBook.Worksheets.Worksheet(sheetName);
|
||||||
Range aRange = workSheet.Range[range];
|
var aRange = workSheet.Range(range);
|
||||||
if (aRange != null)
|
if (aRange != null)
|
||||||
{
|
{
|
||||||
|
// TODO: Implement dropdown reading logic for ClosedXML
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -713,26 +739,27 @@ namespace ENI2.Excel
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
double? result = null;
|
double? result = null;
|
||||||
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName];
|
var workSheet = _workBook.Worksheets.Worksheet(sheetName);
|
||||||
var val = workSheet.Range[range].Value;
|
var cell = workSheet.Range(range).FirstCell();
|
||||||
if (val is double) result = val;
|
var cellValue = cell.Value;
|
||||||
if (val is string)
|
|
||||||
|
if (cellValue.IsNumber)
|
||||||
{
|
{
|
||||||
if (double.TryParse(val, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
|
result = cellValue.GetNumber();
|
||||||
|
}
|
||||||
|
else if (cellValue.IsText)
|
||||||
|
{
|
||||||
|
string textValue = cellValue.GetText();
|
||||||
|
if (double.TryParse(textValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
|
||||||
CultureInfo.InvariantCulture, out double tmpDouble))
|
CultureInfo.InvariantCulture, out double tmpDouble))
|
||||||
result = tmpDouble;
|
result = tmpDouble;
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
if (double.TryParse(val, out tmpDouble)) // current language style (==GER, mit , statt .)
|
if (double.TryParse(textValue, out tmpDouble)) // current language style (==GER, mit , statt .)
|
||||||
result = tmpDouble;
|
result = tmpDouble;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((result == null) && (val != null))
|
|
||||||
{
|
|
||||||
double tmpDouble2 = val[1, 1];
|
|
||||||
result = tmpDouble2;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -759,7 +786,6 @@ namespace ENI2.Excel
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion Dakosy-specific functions
|
#endregion Dakosy-specific functions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,10 @@
|
|||||||
using System;
|
// Copyright (c) 2017- schick Informatik
|
||||||
|
// Description: Dumps Maersk data into a simple Excel file
|
||||||
|
//
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using ClosedXML.Excel;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Microsoft.Office.Interop.Excel;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
|
||||||
namespace ENI2.Excel
|
namespace ENI2.Excel
|
||||||
@ -17,68 +15,58 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
data.Sort();
|
data.Sort();
|
||||||
|
|
||||||
Application excelApp = new Application();
|
using (var workbook = new XLWorkbook())
|
||||||
excelApp.DisplayAlerts = false;
|
|
||||||
excelApp.Visible = false;
|
|
||||||
Workbook wb = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
|
|
||||||
|
|
||||||
Worksheet ws = wb.Worksheets[1];
|
|
||||||
|
|
||||||
// Überschriften erste Zeile
|
|
||||||
ws.Cells[1, 1] = "ETA";
|
|
||||||
ws.Cells[1, 2] = "ETD";
|
|
||||||
ws.Cells[1, 3] = "Rotation name";
|
|
||||||
ws.Cells[1, 4] = "Vessel code";
|
|
||||||
ws.Cells[1, 5] = "Vessel name";
|
|
||||||
ws.Cells[1, 6] = "IMO";
|
|
||||||
ws.Cells[1, 7] = "Arr voy";
|
|
||||||
ws.Cells[1, 8] = "Dep voy";
|
|
||||||
ws.Cells[1, 9] = "Terminal name";
|
|
||||||
ws.Cells[1, 10] = "Operator code";
|
|
||||||
ws.Cells[1, 11] = "Pro arr";
|
|
||||||
ws.Cells[1, 12] = "Pro dep";
|
|
||||||
ws.Cells[1, 13] = "ID";
|
|
||||||
ws.Cells[1, 14] = "Remark";
|
|
||||||
|
|
||||||
for (int i = 0; i < data.Count; i++)
|
|
||||||
{
|
{
|
||||||
MaerskData md = data[i];
|
var worksheet = workbook.Worksheets.Add("Sheet1");
|
||||||
|
|
||||||
ws.Cells[i + 2, 1].NumberFormat = "TT/hh:mm";
|
// Headers in first row
|
||||||
ws.Cells[i + 2, 1] = md.ColA;
|
worksheet.Cell(1, 1).Value = "ETA";
|
||||||
ws.Cells[i + 2, 2].NumberFormat = "TT/hh:mm";
|
worksheet.Cell(1, 2).Value = "ETD";
|
||||||
ws.Cells[i + 2, 2] = md.ColB;
|
worksheet.Cell(1, 3).Value = "Rotation name";
|
||||||
ws.Cells[i + 2, 3] = md.ColC;
|
worksheet.Cell(1, 4).Value = "Vessel code";
|
||||||
ws.Cells[i + 2, 4] = md.ColD;
|
worksheet.Cell(1, 5).Value = "Vessel name";
|
||||||
ws.Cells[i + 2, 5] = md.ColE;
|
worksheet.Cell(1, 6).Value = "IMO";
|
||||||
ws.Cells[i + 2, 6] = md.ColF;
|
worksheet.Cell(1, 7).Value = "Arr voy";
|
||||||
ws.Cells[i + 2, 7] = md.ColG;
|
worksheet.Cell(1, 8).Value = "Dep voy";
|
||||||
ws.Cells[i + 2, 8] = md.ColH;
|
worksheet.Cell(1, 9).Value = "Terminal name";
|
||||||
ws.Cells[i + 2, 9] = md.ColI;
|
worksheet.Cell(1, 10).Value = "Operator code";
|
||||||
ws.Cells[i + 2, 10] = md.ColJ;
|
worksheet.Cell(1, 11).Value = "Pro arr";
|
||||||
ws.Cells[i + 2, 11] = md.ColK;
|
worksheet.Cell(1, 12).Value = "Pro dep";
|
||||||
ws.Cells[i + 2, 12] = md.ColL;
|
worksheet.Cell(1, 13).Value = "ID";
|
||||||
ws.Cells[i + 2, 13] = md.ColM ;
|
worksheet.Cell(1, 14).Value = "Remark";
|
||||||
ws.Cells[i + 2, 14] = md.Remark;
|
|
||||||
|
|
||||||
if((md.MessageCore != null) && (md.MessageCore.Cancelled ?? false))
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
ws.Rows[i + 2].Font.Strikethrough = true;
|
MaerskData md = data[i];
|
||||||
|
int row = i + 2; // Data starts from row 2
|
||||||
|
|
||||||
|
worksheet.Cell(row, 1).Value = md.ColA;
|
||||||
|
worksheet.Cell(row, 1).Style.NumberFormat.Format = "dd/hh:mm";
|
||||||
|
|
||||||
|
worksheet.Cell(row, 2).Value = md.ColB;
|
||||||
|
worksheet.Cell(row, 2).Style.NumberFormat.Format = "dd/hh:mm";
|
||||||
|
|
||||||
|
worksheet.Cell(row, 3).Value = md.ColC;
|
||||||
|
worksheet.Cell(row, 4).Value = md.ColD;
|
||||||
|
worksheet.Cell(row, 5).Value = md.ColE;
|
||||||
|
worksheet.Cell(row, 6).Value = md.ColF;
|
||||||
|
worksheet.Cell(row, 7).Value = md.ColG;
|
||||||
|
worksheet.Cell(row, 8).Value = md.ColH;
|
||||||
|
worksheet.Cell(row, 9).Value = md.ColI;
|
||||||
|
worksheet.Cell(row, 10).Value = md.ColJ;
|
||||||
|
worksheet.Cell(row, 11).Value = md.ColK;
|
||||||
|
worksheet.Cell(row, 12).Value = md.ColL;
|
||||||
|
worksheet.Cell(row, 13).Value = md.ColM;
|
||||||
|
worksheet.Cell(row, 14).Value = md.Remark;
|
||||||
|
|
||||||
|
if ((md.MessageCore != null) && (md.MessageCore.Cancelled ?? false))
|
||||||
|
{
|
||||||
|
worksheet.Row(row).Style.Font.Strikethrough = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
workbook.SaveAs(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
wb.SaveAs(filename, XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing,
|
|
||||||
Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing,
|
|
||||||
Type.Missing, Type.Missing);
|
|
||||||
wb.Saved = true;
|
|
||||||
wb.Close(0);
|
|
||||||
|
|
||||||
Marshal.ReleaseComObject(ws);
|
|
||||||
Marshal.ReleaseComObject(wb);
|
|
||||||
|
|
||||||
excelApp.Quit();
|
|
||||||
Marshal.ReleaseComObject(excelApp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15,6 +15,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ENI2.Excel
|
namespace ENI2.Excel
|
||||||
@ -1007,15 +1008,18 @@ namespace ENI2.Excel
|
|||||||
STAT stat = statMessage.Elements[0] as STAT;
|
STAT stat = statMessage.Elements[0] as STAT;
|
||||||
ScanMessage(stat, reader);
|
ScanMessage(stat, reader);
|
||||||
|
|
||||||
foreach (Message preMessage in messages)
|
if (!messageCore.IsTransit) // let's not do this for transit messages
|
||||||
{
|
{
|
||||||
if (preMessage.MessageNotificationClass == Message.NotificationClass.PRE72H)
|
foreach (Message preMessage in messages)
|
||||||
{
|
{
|
||||||
if (preMessage.Elements.Count > 0)
|
if (preMessage.MessageNotificationClass == Message.NotificationClass.PRE72H)
|
||||||
{
|
{
|
||||||
PRE72H pre72h = preMessage.Elements[0] as PRE72H;
|
if (preMessage.Elements.Count > 0)
|
||||||
pre72h.Tanker = stat.IsTanker;
|
{
|
||||||
ExcelReader.SaveMessage(preMessage);
|
PRE72H pre72h = preMessage.Elements[0] as PRE72H;
|
||||||
|
pre72h.Tanker = stat.IsTanker;
|
||||||
|
ExcelReader.SaveMessage(preMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1467,7 +1471,7 @@ namespace ENI2.Excel
|
|||||||
bool? PortOfCallLast30DaysCrewMembersJoinedFlag = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", 82 + i));
|
bool? PortOfCallLast30DaysCrewMembersJoinedFlag = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", 82 + i));
|
||||||
|
|
||||||
string crewNameString = reader.ReadCellAsText(sheetTitle, string.Format("I{0}", 82 + i));
|
string crewNameString = reader.ReadCellAsText(sheetTitle, string.Format("I{0}", 82 + i));
|
||||||
poc30d.PortOfCallLast30DaysCrewMembersJoined = !crewNameString.IsNullOrEmpty();
|
poc30d.PortOfCallLast30DaysCrewMembersJoined = !crewNameString.IsNullOrEmpty() && (crewNameString.Length > 1);
|
||||||
|
|
||||||
// if crew members joined is set explicitly to true and the name is empty, still set the field to true
|
// if crew members joined is set explicitly to true and the name is empty, still set the field to true
|
||||||
if (!(poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false) && (PortOfCallLast30DaysCrewMembersJoinedFlag ?? false))
|
if (!(poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false) && (PortOfCallLast30DaysCrewMembersJoinedFlag ?? false))
|
||||||
@ -1688,7 +1692,7 @@ namespace ENI2.Excel
|
|||||||
l10fc.PortFacilityDateOfArrival = reader.ReadCellAsDateTime(sheetTitle, string.Format("G{0}", 54 + i));
|
l10fc.PortFacilityDateOfArrival = reader.ReadCellAsDateTime(sheetTitle, string.Format("G{0}", 54 + i));
|
||||||
l10fc.PortFacilityDateOfDeparture = reader.ReadCellAsDateTime(sheetTitle, string.Format("H{0}", 54 + i));
|
l10fc.PortFacilityDateOfDeparture = reader.ReadCellAsDateTime(sheetTitle, string.Format("H{0}", 54 + i));
|
||||||
|
|
||||||
string sLevel = reader.ReadCellAsText(sheetTitle, string.Format("I{0}", 54 + i), 1);
|
string sLevel = reader.ReadCellAsText(sheetTitle, string.Format("I{0}", 54 + i));
|
||||||
if (!sLevel.IsNullOrEmpty())
|
if (!sLevel.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
if (sLevel.Contains('1')) l10fc.PortFacilityShipSecurityLevel = 1;
|
if (sLevel.Contains('1')) l10fc.PortFacilityShipSecurityLevel = 1;
|
||||||
@ -1696,14 +1700,9 @@ namespace ENI2.Excel
|
|||||||
if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
|
if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
l10fc.PortFacilityGISISCode = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", 54 + i), 4);
|
string s = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", 54 + i));
|
||||||
|
// All invalid codes become "0000", Oct/25
|
||||||
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
|
l10fc.PortFacilityGISISCode = (s != null) && Regex.IsMatch(s.Trim(), @"^\d{4}$") ? s.Trim() : "0000";
|
||||||
l10fc.PortFacilityGISISCode = "0000";
|
|
||||||
if (l10fc.PortFacilityGISISCode?.Length < 4)
|
|
||||||
{
|
|
||||||
while (l10fc.PortFacilityGISISCode.Length < 4) l10fc.PortFacilityGISISCode = "0" + l10fc.PortFacilityGISISCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
l10fc.PortFacilitySecurityMattersToReport = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", 54 + i), 255);
|
l10fc.PortFacilitySecurityMattersToReport = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", 54 + i), 255);
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
// Copyright (c) 2017- schick Informatik
|
// Copyright (c) 2017- schick Informatik
|
||||||
// Description:
|
// Description: Writing excel files
|
||||||
//
|
//
|
||||||
|
|
||||||
using Microsoft.Office.Interop.Excel;
|
using ClosedXML.Excel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -26,10 +26,9 @@ namespace ENI2.Excel
|
|||||||
if (isRefSheet) filename = @"Excel\Reference_Sheet_DE.xlsx";
|
if (isRefSheet) filename = @"Excel\Reference_Sheet_DE.xlsx";
|
||||||
|
|
||||||
string refFilePath = System.IO.Path.Combine(Environment.CurrentDirectory, filename);
|
string refFilePath = System.IO.Path.Combine(Environment.CurrentDirectory, filename);
|
||||||
this._workBook = _excelWorkbooks.Open(refFilePath, 0, true, 5, "", "", false, XlPlatform.xlWindows, "", false, false, 0, false, false, false);
|
this._workBook = new XLWorkbook(refFilePath);
|
||||||
|
|
||||||
this.InitNameFields();
|
this.InitNameFields();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -44,7 +43,7 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
switch(message.MessageNotificationClass)
|
switch (message.MessageNotificationClass)
|
||||||
{
|
{
|
||||||
case Message.NotificationClass.AGNT:
|
case Message.NotificationClass.AGNT:
|
||||||
if (message.Elements[0] is AGNT agnt) this.WriteMessage(agnt);
|
if (message.Elements[0] is AGNT agnt) this.WriteMessage(agnt);
|
||||||
@ -84,10 +83,10 @@ namespace ENI2.Excel
|
|||||||
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:
|
||||||
if (message.Elements[0] is INFO info)
|
if (message.Elements[0] is INFO info)
|
||||||
{
|
{
|
||||||
@ -192,11 +191,6 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteMaerskList(List<MaerskData> maerskList)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region private excel field writing
|
#region private excel field writing
|
||||||
@ -242,7 +236,7 @@ namespace ENI2.Excel
|
|||||||
else if (property.PropertyType == typeof(Boolean?))
|
else if (property.PropertyType == typeof(Boolean?))
|
||||||
{
|
{
|
||||||
object boolVal = property.GetValue(dbEntity);
|
object boolVal = property.GetValue(dbEntity);
|
||||||
if(boolVal != null)
|
if (boolVal != null)
|
||||||
success = this.WriteBoolean(lookupNameAttribute.LookupName, boolVal);
|
success = this.WriteBoolean(lookupNameAttribute.LookupName, boolVal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -374,6 +368,9 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
// [Rest of the methods remain exactly the same as they only call the base class methods]
|
||||||
|
// I'll include a few key ones to show the pattern, but the rest are identical...
|
||||||
|
|
||||||
#region CREW
|
#region CREW
|
||||||
|
|
||||||
private void WriteCREW(Message crewMessage, bool isArrival, bool isRefSheet)
|
private void WriteCREW(Message crewMessage, bool isArrival, bool isRefSheet)
|
||||||
@ -385,7 +382,7 @@ namespace ENI2.Excel
|
|||||||
WriteBoolean(string.Format("CREW{0}.NotificationPAX", isArrival ? "" : "D"), ((CREW)crewMessage.Elements[0]).NotificationPAX);
|
WriteBoolean(string.Format("CREW{0}.NotificationPAX", isArrival ? "" : "D"), ((CREW)crewMessage.Elements[0]).NotificationPAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i<Math.Min(crewMessage.NumberOfExcelRows, crewMessage.Elements.Count); i++)
|
for (int i = 0; i < Math.Min(crewMessage.NumberOfExcelRows, crewMessage.Elements.Count); i++)
|
||||||
{
|
{
|
||||||
string crewLastName = string.Format("CREW{1}.CrewMemberLastName_{0}", i + 1, isArrival ? "" : "D");
|
string crewLastName = string.Format("CREW{1}.CrewMemberLastName_{0}", i + 1, isArrival ? "" : "D");
|
||||||
string crewFirstName = string.Format("CREW{1}.CrewMemberFirstName_{0}", i + 1, isArrival ? "" : "D");
|
string crewFirstName = string.Format("CREW{1}.CrewMemberFirstName_{0}", i + 1, isArrival ? "" : "D");
|
||||||
@ -413,7 +410,7 @@ namespace ENI2.Excel
|
|||||||
WriteText(crewNationality, crew.CrewMemberNationality);
|
WriteText(crewNationality, crew.CrewMemberNationality);
|
||||||
WriteText(crewDuty, crew.CrewMemberDuty);
|
WriteText(crewDuty, crew.CrewMemberDuty);
|
||||||
WriteText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth);
|
WriteText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth);
|
||||||
if(crew.CrewMemberDateOfBirth.HasValue)
|
if (crew.CrewMemberDateOfBirth.HasValue)
|
||||||
WriteDate(crewDateOfBirth, crew.CrewMemberDateOfBirth.Value);
|
WriteDate(crewDateOfBirth, crew.CrewMemberDateOfBirth.Value);
|
||||||
WriteText(crewIdentDocType, crew.CrewMemberIdentityDocumentTypeDisplay);
|
WriteText(crewIdentDocType, crew.CrewMemberIdentityDocumentTypeDisplay);
|
||||||
WriteText(crewIdentDocId, crew.CrewMemberIdentityDocumentId);
|
WriteText(crewIdentDocId, crew.CrewMemberIdentityDocumentId);
|
||||||
@ -424,16 +421,16 @@ namespace ENI2.Excel
|
|||||||
}
|
}
|
||||||
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)
|
||||||
{
|
{
|
||||||
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
|
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(crew.CrewMemberIdentityDocumentExpiryDate != new DateTime(2100, 12, 31))
|
if (crew.CrewMemberIdentityDocumentExpiryDate != new DateTime(2100, 12, 31))
|
||||||
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
|
WriteDate(crewExpiry, crew.CrewMemberIdentityDocumentExpiryDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,7 +1063,7 @@ namespace ENI2.Excel
|
|||||||
string tLen = string.Format("TOWD.TowageOnDepartureLengthOverall_MTR_{0}", i + 1);
|
string tLen = string.Format("TOWD.TowageOnDepartureLengthOverall_MTR_{0}", i + 1);
|
||||||
string tBeam = string.Format("TOWD.TowageOnDepartureBeam_MTR_{0}", i + 1);
|
string tBeam = string.Format("TOWD.TowageOnDepartureBeam_MTR_{0}", i + 1);
|
||||||
string tOp = string.Format("TOWD.TowageOnDepartureOperatorCompanyName_{0}", i + 1);
|
string tOp = string.Format("TOWD.TowageOnDepartureOperatorCompanyName_{0}", i + 1);
|
||||||
string tPoc = string.Format("TOWD.TowageOnDeparturePurposeOfCall_{0}", i + 1);
|
// string tPoc = string.Format("TOWD.TowageOnDeparturePurposeOfCall_{0}", i + 1);
|
||||||
|
|
||||||
TOWD towd = towdMessage.Elements[i] as TOWD;
|
TOWD towd = towdMessage.Elements[i] as TOWD;
|
||||||
|
|
||||||
@ -1276,7 +1273,7 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
private void WriteGenderCode(string label, byte? gender)
|
private void WriteGenderCode(string label, byte? gender)
|
||||||
{
|
{
|
||||||
if(gender.HasValue)
|
if (gender.HasValue)
|
||||||
{
|
{
|
||||||
if (gender == 0) WriteText(label, "not known");
|
if (gender == 0) WriteText(label, "not known");
|
||||||
if (gender == 1) WriteText(label, "m");
|
if (gender == 1) WriteText(label, "m");
|
||||||
@ -1303,15 +1300,24 @@ namespace ENI2.Excel
|
|||||||
private bool WriteBoolean(string lookupName, object v)
|
private bool WriteBoolean(string lookupName, object v)
|
||||||
{
|
{
|
||||||
bool result = _nameDict.ContainsKey(lookupName);
|
bool result = _nameDict.ContainsKey(lookupName);
|
||||||
bool? b = (bool?) v;
|
bool? b = (bool?)v;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (result && b.HasValue)
|
if (result && b.HasValue)
|
||||||
{
|
{
|
||||||
_nameDict[lookupName].RefersToRange.Value = b.Value ? "Y" : "N";
|
var definedName = _nameDict[lookupName];
|
||||||
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
|
{
|
||||||
|
var cell = range.FirstCell();
|
||||||
|
if (cell != null)
|
||||||
|
{
|
||||||
|
cell.Value = b.Value ? "Y" : "N";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
@ -1326,10 +1332,19 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
_nameDict[lookupName].RefersToRange.Value = v;
|
var definedName = _nameDict[lookupName];
|
||||||
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
|
{
|
||||||
|
var cell = range.FirstCell();
|
||||||
|
if (cell != null)
|
||||||
|
{
|
||||||
|
cell.Value = ClosedXML.Excel.XLCellValue.FromObject(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
@ -1343,7 +1358,16 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
_nameDict[lookupName].RefersToRange.Value = v;
|
var definedName = _nameDict[lookupName];
|
||||||
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
|
{
|
||||||
|
var cell = range.FirstCell();
|
||||||
|
if (cell != null)
|
||||||
|
{
|
||||||
|
cell.Value = ClosedXML.Excel.XLCellValue.FromObject(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -1355,11 +1379,19 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
if(v != null)
|
if (v != null)
|
||||||
{
|
{
|
||||||
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate();
|
var definedName = _nameDict[lookupName];
|
||||||
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
|
{
|
||||||
|
var cell = range.FirstCell();
|
||||||
|
if (cell != null)
|
||||||
|
{
|
||||||
|
cell.Value = ClosedXML.Excel.XLCellValue.FromObject(((DateTime)v).ToLocalTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -1373,9 +1405,17 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if (v != null)
|
if (v != null)
|
||||||
{
|
{
|
||||||
_nameDict[lookupName].RefersToRange.Value = ((DateTime)v).ToLocalTime().ToShortTimeString();
|
var definedName = _nameDict[lookupName];
|
||||||
|
var range = definedName.Ranges.FirstOrDefault();
|
||||||
|
if (range != null)
|
||||||
|
{
|
||||||
|
var cell = range.FirstCell();
|
||||||
|
if (cell != null)
|
||||||
|
{
|
||||||
|
cell.Value = ((DateTime)v).ToLocalTime().ToString("HH:mm");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -95,6 +95,7 @@
|
|||||||
<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="menuItemValueMappings" Header="{x:Static p:Resources.textExcelValueMappings}" Click="radioButton_Click" Visibility="Hidden" />
|
||||||
|
<MenuItem x:Name="menuItemEasyPeasy" Header="{x:Static p:Resources.textEasyPeasy}" 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="Change Password" Click="buttonChangePassword_Click">
|
<MenuItem Header="Change Password" Click="buttonChangePassword_Click">
|
||||||
|
|||||||
@ -39,6 +39,7 @@ namespace ENI2
|
|||||||
private ServerStatusControl statusControl;
|
private ServerStatusControl statusControl;
|
||||||
private readonly SucheControl sucheControl;
|
private readonly SucheControl sucheControl;
|
||||||
private CompareExcelDialog compareExcelDialog;
|
private CompareExcelDialog compareExcelDialog;
|
||||||
|
private EasyPeasyControl easyPeasyControl;
|
||||||
|
|
||||||
private bool dbConnected;
|
private bool dbConnected;
|
||||||
private readonly ScaleTransform _transform = new ScaleTransform(1.0, 1.0);
|
private readonly ScaleTransform _transform = new ScaleTransform(1.0, 1.0);
|
||||||
@ -324,6 +325,14 @@ namespace ENI2
|
|||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(this.vmControl);
|
this.rootContainer.Children.Add(this.vmControl);
|
||||||
}
|
}
|
||||||
|
else if(sender == this.menuItemEasyPeasy)
|
||||||
|
{
|
||||||
|
if(this.easyPeasyControl == null)
|
||||||
|
{
|
||||||
|
this.easyPeasyControl = new EasyPeasyControl();
|
||||||
|
}
|
||||||
|
this.rootContainer.Children.Add(this.easyPeasyControl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCompareSheets_Click(object sender, RoutedEventArgs ev)
|
private void buttonCompareSheets_Click(object sender, RoutedEventArgs ev)
|
||||||
@ -377,6 +386,8 @@ namespace ENI2
|
|||||||
Properties.Settings.Default.MainWindowPlacement = this.GetPlacement();
|
Properties.Settings.Default.MainWindowPlacement = this.GetPlacement();
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
Microsoft.Win32.SystemEvents.SessionEnded -= SystemEvents_SessionEnded;
|
Microsoft.Win32.SystemEvents.SessionEnded -= SystemEvents_SessionEnded;
|
||||||
|
if (easyPeasyControl != null)
|
||||||
|
easyPeasyControl.SaveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_SourceInitialized(object sender, EventArgs e)
|
private void Window_SourceInitialized(object sender, EventArgs e)
|
||||||
@ -690,6 +701,7 @@ namespace ENI2
|
|||||||
ReportingParty.CurrentReportingParty = this.userEntity;
|
ReportingParty.CurrentReportingParty = this.userEntity;
|
||||||
this.menuItemMaersk.Visibility = Visibility.Visible;
|
this.menuItemMaersk.Visibility = Visibility.Visible;
|
||||||
this.menuItemValueMappings.Visibility = Visibility.Visible;
|
this.menuItemValueMappings.Visibility = Visibility.Visible;
|
||||||
|
this.menuItemEasyPeasy.Visibility = Visibility.Visible;
|
||||||
if (this.userEntity.IsAdmin)
|
if (this.userEntity.IsAdmin)
|
||||||
{
|
{
|
||||||
this.menuItemUserAdministration.Visibility = Visibility.Visible;
|
this.menuItemUserAdministration.Visibility = Visibility.Visible;
|
||||||
@ -753,5 +765,6 @@ namespace ENI2
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
ENI2/Properties/Resources.Designer.cs
generated
9
ENI2/Properties/Resources.Designer.cs
generated
@ -2871,6 +2871,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Easy Peasy 🍋.
|
||||||
|
/// </summary>
|
||||||
|
public static string textEasyPeasy {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textEasyPeasy", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to _Edit.
|
/// Looks up a localized string similar to _Edit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2265,4 +2265,7 @@ New entry: {1}
|
|||||||
|
|
||||||
Proceed?</value>
|
Proceed?</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textEasyPeasy" xml:space="preserve">
|
||||||
|
<value>Easy Peasy 🍋</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
2
ENI2/Properties/Settings.Designer.cs
generated
2
ENI2/Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace ENI2.Properties {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|||||||
@ -117,7 +117,7 @@ namespace ENI2.LockingServiceReference {
|
|||||||
return this.CORRUPTFilesField;
|
return this.CORRUPTFilesField;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if ((ReferenceEquals(this.CORRUPTFilesField, value) != true)) {
|
if ((object.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 ((ReferenceEquals(this.IMPFilesField, value) != true)) {
|
if ((object.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 ((ReferenceEquals(this.READYFilesField, value) != true)) {
|
if ((object.ReferenceEquals(this.READYFilesField, value) != true)) {
|
||||||
this.READYFilesField = value;
|
this.READYFilesField = value;
|
||||||
this.RaisePropertyChanged("READYFiles");
|
this.RaisePropertyChanged("READYFiles");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using ClosedXML.Excel;
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using ExcelDataReader;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -126,72 +126,66 @@ namespace ENI2.SheetDisplayControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<CREWD> importCrew = new List<CREWD>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
// Check if we have at least 13 columns
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 13)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 13 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
CREWD crew = new CREWD();
|
||||||
|
crew.IsDeparture = true;
|
||||||
|
|
||||||
|
// Check if first two cells are empty
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) crew.CrewMemberLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (crew.CrewMemberLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(crew.CrewMemberLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) crew.CrewMemberFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) crew.CrewMemberGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) crew.CrewMemberDuty = row.Cell(4).GetString().Clean();
|
||||||
|
if (!row.Cell(5).IsEmpty()) crew.CrewMemberNationality = row.Cell(5).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(6).IsEmpty()) crew.CrewMemberPlaceOfBirth = row.Cell(6).GetString().Clean();
|
||||||
|
if (!row.Cell(7).IsEmpty()) crew.CrewMemberCountryOfBirth = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) crew.CrewMemberDateOfBirth = row.Cell(8).GetDateTime();
|
||||||
|
if (!row.Cell(9).IsEmpty()) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(9).GetString());
|
||||||
|
if (!row.Cell(10).IsEmpty()) crew.CrewMemberIdentityDocumentId = row.Cell(10).GetString().Clean();
|
||||||
|
if (!row.Cell(11).IsEmpty()) crew.CrewMemberIdentityDocumentIssuingState = row.Cell(11).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(12).IsEmpty()) crew.CrewMemberIdentityDocumentExpiryDate = row.Cell(12).GetDateTime();
|
||||||
|
if (!row.Cell(13).IsEmpty()) crew.CrewMemberVisaNumber = row.Cell(13).GetString().Clean();
|
||||||
|
|
||||||
|
crew.MessageHeader = this._crewdMessage;
|
||||||
|
crew.IsDirty = true;
|
||||||
|
crew.Identifier = CREWD.GetNewIdentifier(this._crewdMessage.Elements);
|
||||||
|
this._crewdMessage.Elements.Add(crew);
|
||||||
|
importCrew.Add(crew);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importCrew.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridCrewListDeparture.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.CREWD);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<CREWD> importCrew = new List<CREWD>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (reader.FieldCount < 13)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 13 columns of data");
|
|
||||||
}
|
|
||||||
CREWD crew = new CREWD();
|
|
||||||
crew.IsDeparture = true;
|
|
||||||
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0);
|
|
||||||
if (crew.CrewMemberLastName.Equals("Family Name") || (crew.CrewMemberLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1);
|
|
||||||
if (!reader.IsDBNull(2)) crew.CrewMemberGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3).Clean();
|
|
||||||
if (!reader.IsDBNull(4)) crew.CrewMemberNationality = reader.GetString(4).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5);
|
|
||||||
if (!reader.IsDBNull(6)) crew.CrewMemberCountryOfBirth = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) crew.CrewMemberDateOfBirth = reader.GetDateTime(7);
|
|
||||||
if (!reader.IsDBNull(8)) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(8));
|
|
||||||
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = reader.ReadAsString(9);
|
|
||||||
if (!reader.IsDBNull(10)) crew.CrewMemberIdentityDocumentIssuingState = reader.GetString(10).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(11)) crew.CrewMemberIdentityDocumentExpiryDate = reader.GetDateTime(11);
|
|
||||||
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = reader.ReadAsString(12);
|
|
||||||
|
|
||||||
crew.MessageHeader = this._crewdMessage;
|
|
||||||
crew.IsDirty = true;
|
|
||||||
crew.Identifier = CREWD.GetNewIdentifier(this._crewdMessage.Elements);
|
|
||||||
this._crewdMessage.Elements.Add(crew);
|
|
||||||
importCrew.Add(crew);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importCrew.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridCrewListDeparture.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.CREWD);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using ClosedXML.Excel;
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using ExcelDataReader;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -166,70 +166,65 @@ namespace ENI2.SheetDisplayControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<CREW> importCrew = new List<CREW>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
// Check if we have at least 13 columns
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 13)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 13 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
CREW crew = new CREW();
|
||||||
|
|
||||||
|
// Check if first two cells are empty
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) crew.CrewMemberLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (crew.CrewMemberLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(crew.CrewMemberLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) crew.CrewMemberFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) crew.CrewMemberGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) crew.CrewMemberDuty = row.Cell(4).GetString().Clean();
|
||||||
|
if (!row.Cell(5).IsEmpty()) crew.CrewMemberNationality = row.Cell(5).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(6).IsEmpty()) crew.CrewMemberPlaceOfBirth = row.Cell(6).GetString().Clean();
|
||||||
|
if (!row.Cell(7).IsEmpty()) crew.CrewMemberCountryOfBirth = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) crew.CrewMemberDateOfBirth = row.Cell(8).GetDateTime();
|
||||||
|
if (!row.Cell(9).IsEmpty()) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(9).GetString());
|
||||||
|
if (!row.Cell(10).IsEmpty()) crew.CrewMemberIdentityDocumentId = row.Cell(10).GetString().Clean();
|
||||||
|
if (!row.Cell(11).IsEmpty()) crew.CrewMemberIdentityDocumentIssuingState = row.Cell(11).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(12).IsEmpty()) crew.CrewMemberIdentityDocumentExpiryDate = row.Cell(12).GetDateTime();
|
||||||
|
if (!row.Cell(13).IsEmpty()) crew.CrewMemberVisaNumber = row.Cell(13).GetString().Clean();
|
||||||
|
|
||||||
|
crew.MessageHeader = this._crewaMessage;
|
||||||
|
crew.IsDirty = true;
|
||||||
|
crew.Identifier = CREW.GetNewIdentifier(this._crewaMessage.Elements);
|
||||||
|
this._crewaMessage.Elements.Add(crew);
|
||||||
|
importCrew.Add(crew);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importCrew.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridCrewList.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.CREWA);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<CREW> importCrew = new List<CREW>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (reader.FieldCount < 13)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 13 columns of data");
|
|
||||||
}
|
|
||||||
CREW crew = new CREW();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0).Clean();
|
|
||||||
if (crew.CrewMemberLastName.Equals("Family Name") || (crew.CrewMemberLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1).Clean();
|
|
||||||
if (!reader.IsDBNull(2)) crew.CrewMemberGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) crew.CrewMemberDuty = reader.GetString(3).Clean();
|
|
||||||
if (!reader.IsDBNull(4)) crew.CrewMemberNationality = reader.GetString(4).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5).Clean();
|
|
||||||
if (!reader.IsDBNull(6)) crew.CrewMemberCountryOfBirth = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) crew.CrewMemberDateOfBirth = reader.GetDateTime(7);
|
|
||||||
if (!reader.IsDBNull(8)) crew.CrewMemberIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(8));
|
|
||||||
if (!reader.IsDBNull(9)) crew.CrewMemberIdentityDocumentId = reader.ReadAsString(9).Clean();
|
|
||||||
if (!reader.IsDBNull(10)) crew.CrewMemberIdentityDocumentIssuingState = reader.GetString(10).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(11)) crew.CrewMemberIdentityDocumentExpiryDate = reader.GetDateTime(11);
|
|
||||||
if (!reader.IsDBNull(12)) crew.CrewMemberVisaNumber = reader.ReadAsString(12).Clean();
|
|
||||||
|
|
||||||
crew.MessageHeader = this._crewaMessage;
|
|
||||||
crew.IsDirty = true;
|
|
||||||
crew.Identifier = CREW.GetNewIdentifier(this._crewaMessage.Elements);
|
|
||||||
this._crewaMessage.Elements.Add(crew);
|
|
||||||
importCrew.Add(crew);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importCrew.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridCrewList.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.CREWA);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textCrewImported, importCrew.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using ClosedXML.Excel;
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Locode;
|
using ENI2.Locode;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using ExcelDataReader;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -144,78 +144,71 @@ namespace ENI2.SheetDisplayControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<PASD> importPassenger = new List<PASD>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 17)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 17 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
PASD pas = new PASD();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) pas.PassengerLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (pas.PassengerLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(pas.PassengerLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) pas.PassengerFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) pas.PassengerGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) pas.PassengerPortOfEmbarkation = row.Cell(4).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
||||||
|
pas.PassengerPortOfEmbarkation = null;
|
||||||
|
if (!row.Cell(5).IsEmpty()) pas.PassengerPortOfDisembarkation = row.Cell(5).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
||||||
|
pas.PassengerPortOfDisembarkation = null;
|
||||||
|
if (!row.Cell(6).IsEmpty()) pas.PassengerInTransit = GlobalStructures.ReadBoolean(row.Cell(6).GetString());
|
||||||
|
if (!row.Cell(7).IsEmpty()) pas.PassengerNationality = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) pas.PassengerPlaceOfBirth = row.Cell(8).GetString().Clean();
|
||||||
|
if (!row.Cell(9).IsEmpty()) pas.PassengerCountryOfBirth = row.Cell(9).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(10).IsEmpty()) pas.PassengerDateOfBirth = row.Cell(10).GetDateTime();
|
||||||
|
if (!row.Cell(11).IsEmpty()) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(11).GetString());
|
||||||
|
if (!row.Cell(12).IsEmpty()) pas.PassengerIdentityDocumentId = row.Cell(12).GetString().Clean();
|
||||||
|
if (!row.Cell(13).IsEmpty()) pas.PassengerIdentityDocumentIssuingState = row.Cell(13).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(14).IsEmpty()) pas.PassengerIdentityDocumentExpiryDate = row.Cell(14).GetDateTime();
|
||||||
|
if (!row.Cell(15).IsEmpty()) pas.PassengerVisaNumber = row.Cell(15).GetString().Clean();
|
||||||
|
if (!row.Cell(16).IsEmpty()) pas.EmergencyCare = row.Cell(16).GetString().Clean();
|
||||||
|
if (!row.Cell(17).IsEmpty()) pas.EmergencyContactNumber = row.Cell(17).GetString().Clean();
|
||||||
|
|
||||||
|
pas.MessageHeader = this._pasdMessage;
|
||||||
|
pas.IsDirty = true;
|
||||||
|
pas.Identifier = PASD.GetNewIdentifier(this._pasdMessage.Elements);
|
||||||
|
this._pasdMessage.Elements.Add(pas);
|
||||||
|
importPassenger.Add(pas);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importPassenger.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridPassengerListDeparture.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.PASD);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<PASD> importPassenger = new List<PASD>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (((IExcelDataReader)reader).FieldCount < 17)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 17 columns of data");
|
|
||||||
}
|
|
||||||
|
|
||||||
PASD pas = new PASD();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetValue(0).ToString();
|
|
||||||
if (pas.PassengerLastName.Equals("Family Name") || (pas.PassengerLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) pas.PassengerFirstName = reader.GetValue(1).ToString();
|
|
||||||
if (!reader.IsDBNull(2)) pas.PassengerGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) pas.PassengerPortOfEmbarkation = reader.GetString(3);
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
|
||||||
pas.PassengerPortOfEmbarkation = null;
|
|
||||||
if (!reader.IsDBNull(4)) pas.PassengerPortOfDisembarkation = reader.GetString(4);
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
|
||||||
pas.PassengerPortOfDisembarkation = null;
|
|
||||||
if (!reader.IsDBNull(5)) pas.PassengerInTransit = GlobalStructures.ReadBoolean(reader.GetString(5));
|
|
||||||
if (!reader.IsDBNull(6)) pas.PassengerNationality = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) pas.PassengerPlaceOfBirth = reader.GetString(7);
|
|
||||||
if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(9)) pas.PassengerDateOfBirth = reader.GetDateTime(9);
|
|
||||||
if (!reader.IsDBNull(10)) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(10));
|
|
||||||
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = reader.ReadAsString( 11);
|
|
||||||
if (!reader.IsDBNull(12)) pas.PassengerIdentityDocumentIssuingState = reader.GetString(12).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(13)) pas.PassengerIdentityDocumentExpiryDate = reader.GetDateTime(13);
|
|
||||||
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = reader.ReadAsString(14);
|
|
||||||
if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15);
|
|
||||||
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = reader.ReadAsString(16);
|
|
||||||
|
|
||||||
pas.MessageHeader = this._pasMessage;
|
|
||||||
pas.IsDirty = true;
|
|
||||||
pas.Identifier = PASD.GetNewIdentifier(this._pasdMessage.Elements);
|
|
||||||
this._pasdMessage.Elements.Add(pas);
|
|
||||||
importPassenger.Add(pas);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importPassenger.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridPassengerListDeparture.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.PASD);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using ClosedXML.Excel;
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ENI2.Locode;
|
using ENI2.Locode;
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using ExcelDataReader;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -126,78 +126,71 @@ namespace ENI2.SheetDisplayControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(1); // Skip header row if present
|
||||||
|
|
||||||
|
List<PAS> importPassenger = new List<PAS>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 17)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 17 columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
PAS pas = new PAS();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) pas.PassengerLastName = row.Cell(1).GetString().Clean();
|
||||||
|
if (pas.PassengerLastName?.Equals("Family Name") == true || string.IsNullOrWhiteSpace(pas.PassengerLastName)) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) pas.PassengerFirstName = row.Cell(2).GetString().Clean();
|
||||||
|
if (!row.Cell(3).IsEmpty()) pas.PassengerGender = GlobalStructures.ParseGender(row.Cell(3).GetString());
|
||||||
|
if (!row.Cell(4).IsEmpty()) pas.PassengerPortOfEmbarkation = row.Cell(4).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
||||||
|
pas.PassengerPortOfEmbarkation = null;
|
||||||
|
if (!row.Cell(5).IsEmpty()) pas.PassengerPortOfDisembarkation = row.Cell(5).GetString().Clean();
|
||||||
|
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
||||||
|
pas.PassengerPortOfDisembarkation = null;
|
||||||
|
if (!row.Cell(6).IsEmpty()) pas.PassengerInTransit = GlobalStructures.ReadBoolean(row.Cell(6).GetString());
|
||||||
|
if (!row.Cell(7).IsEmpty()) pas.PassengerNationality = row.Cell(7).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(8).IsEmpty()) pas.PassengerPlaceOfBirth = row.Cell(8).GetString().Clean();
|
||||||
|
if (!row.Cell(9).IsEmpty()) pas.PassengerCountryOfBirth = row.Cell(9).GetString().Substring(0, 2).ToUpper().Clean();
|
||||||
|
if (!row.Cell(10).IsEmpty()) pas.PassengerDateOfBirth = row.Cell(10).GetDateTime();
|
||||||
|
if (!row.Cell(11).IsEmpty()) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(row.Cell(11).GetString());
|
||||||
|
if (!row.Cell(12).IsEmpty()) pas.PassengerIdentityDocumentId = row.Cell(12).GetString().Clean();
|
||||||
|
if (!row.Cell(13).IsEmpty()) pas.PassengerIdentityDocumentIssuingState = row.Cell(13).GetString().Substring(0, 2).ToUpper();
|
||||||
|
if (!row.Cell(14).IsEmpty()) pas.PassengerIdentityDocumentExpiryDate = row.Cell(14).GetDateTime();
|
||||||
|
if (!row.Cell(15).IsEmpty()) pas.PassengerVisaNumber = row.Cell(15).GetString().Clean();
|
||||||
|
if (!row.Cell(16).IsEmpty()) pas.EmergencyCare = row.Cell(16).GetString().Clean();
|
||||||
|
if (!row.Cell(17).IsEmpty()) pas.EmergencyContactNumber = row.Cell(17).GetString().Clean();
|
||||||
|
|
||||||
|
pas.MessageHeader = this._pasMessage;
|
||||||
|
pas.IsDirty = true;
|
||||||
|
pas.Identifier = PAS.GetNewIdentifier(this._pasMessage.Elements);
|
||||||
|
this._pasMessage.Elements.Add(pas);
|
||||||
|
importPassenger.Add(pas);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importPassenger.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridPassengerList.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.PASA);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<PAS> importPassenger = new List<PAS>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (((IExcelDataReader)reader).FieldCount < 17)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 17 columns of data");
|
|
||||||
}
|
|
||||||
|
|
||||||
PAS pas = new PAS();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetValue(0).ToString().Clean();
|
|
||||||
if (pas.PassengerLastName.Equals("Family Name") || (pas.PassengerLastName.Trim().Length == 0)) continue;
|
|
||||||
if (!reader.IsDBNull(1)) pas.PassengerFirstName = reader.GetValue(1).ToString().Clean();
|
|
||||||
if (!reader.IsDBNull(2)) pas.PassengerGender = GlobalStructures.ParseGender(reader.GetString(2));
|
|
||||||
if (!reader.IsDBNull(3)) pas.PassengerPortOfEmbarkation = reader.GetString(3).Clean();
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
|
||||||
pas.PassengerPortOfEmbarkation = null;
|
|
||||||
if (!reader.IsDBNull(4)) pas.PassengerPortOfDisembarkation = reader.GetString(4).Clean();
|
|
||||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfDisembarkation) == null)
|
|
||||||
pas.PassengerPortOfDisembarkation = null;
|
|
||||||
if (!reader.IsDBNull(5)) pas.PassengerInTransit = GlobalStructures.ReadBoolean(reader.GetString(5));
|
|
||||||
if (!reader.IsDBNull(6)) pas.PassengerNationality = reader.GetString(6).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(7)) pas.PassengerPlaceOfBirth = reader.GetString(7).Clean();
|
|
||||||
if (!reader.IsDBNull(8)) pas.PassengerCountryOfBirth = reader.GetString(8).Substring(0, 2).ToUpper().Clean();
|
|
||||||
if (!reader.IsDBNull(9)) pas.PassengerDateOfBirth = reader.GetDateTime(9);
|
|
||||||
if (!reader.IsDBNull(10)) pas.PassengerIdentityDocumentType = GlobalStructures.ReadIdentityDocumentType(reader.GetString(10));
|
|
||||||
if (!reader.IsDBNull(11)) pas.PassengerIdentityDocumentId = reader.ReadAsString(11).Clean();
|
|
||||||
if (!reader.IsDBNull(12)) pas.PassengerIdentityDocumentIssuingState = reader.GetString(12).Substring(0, 2).ToUpper();
|
|
||||||
if (!reader.IsDBNull(13)) pas.PassengerIdentityDocumentExpiryDate = reader.GetDateTime(13);
|
|
||||||
if (!reader.IsDBNull(14)) pas.PassengerVisaNumber = reader.ReadAsString(14).Clean();
|
|
||||||
if (!reader.IsDBNull(15)) pas.EmergencyCare = reader.GetString(15).Clean();
|
|
||||||
if (!reader.IsDBNull(16)) pas.EmergencyContactNumber = reader.ReadAsString(16).Clean();
|
|
||||||
|
|
||||||
pas.MessageHeader = this._pasMessage;
|
|
||||||
pas.IsDirty = true;
|
|
||||||
pas.Identifier = PAS.GetNewIdentifier(this._pasMessage.Elements);
|
|
||||||
this._pasMessage.Elements.Add(pas);
|
|
||||||
importPassenger.Add(pas);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importPassenger.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridPassengerList.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.PASA);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textPassengerImported, importPassenger.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,11 +3,11 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using ClosedXML.Excel;
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using ExcelDataReader;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -34,7 +34,6 @@ namespace ENI2.SheetDisplayControls
|
|||||||
private SEC _sec;
|
private SEC _sec;
|
||||||
private WAS _was;
|
private WAS _was;
|
||||||
private Message _stoMessage;
|
private Message _stoMessage;
|
||||||
// private Message _crewMessage;
|
|
||||||
|
|
||||||
private Dictionary<string, string> portAreas = null;
|
private Dictionary<string, string> portAreas = null;
|
||||||
|
|
||||||
@ -266,6 +265,7 @@ namespace ENI2.SheetDisplayControls
|
|||||||
this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT);
|
this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT);
|
||||||
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
|
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
|
||||||
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
|
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
|
||||||
|
this.RegisterTextboxChange(this.textBox_WasteDisposalServiceProvider, Message.NotificationClass.WAS);
|
||||||
|
|
||||||
this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
||||||
this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
|
||||||
@ -369,9 +369,11 @@ namespace ENI2.SheetDisplayControls
|
|||||||
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
|
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
|
||||||
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
|
if ((this._currentTemplate.WasteDisposalServiceProviderName ?? "").Trim() != (this.textBox_WasteDisposalServiceProvider.Text ?? "").Trim())
|
||||||
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
{
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
|
||||||
|
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
|
}
|
||||||
|
|
||||||
this.buttonUndoTemplate.IsEnabled = true;
|
this.buttonUndoTemplate.IsEnabled = true;
|
||||||
this.buttonSetTemplate.IsEnabled = false;
|
this.buttonSetTemplate.IsEnabled = false;
|
||||||
@ -461,7 +463,6 @@ namespace ENI2.SheetDisplayControls
|
|||||||
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
|
this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
|
||||||
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
|
||||||
|
|
||||||
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
|
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
|
||||||
}
|
}
|
||||||
@ -517,100 +518,83 @@ namespace ENI2.SheetDisplayControls
|
|||||||
ofd.Filter = "Excel Files|*.xls;*.xlsx";
|
ofd.Filter = "Excel Files|*.xls;*.xlsx";
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed().Skip(3); // Skip first three rows
|
||||||
|
|
||||||
|
List<Waste> importWasteList = new List<Waste>();
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (cnt >= 35) break; // Maximum 35 rows
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 9)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
object o = null;
|
||||||
|
|
||||||
|
if (!row.Cell(2).IsEmpty()) o = row.Cell(2).Value; else o = null;
|
||||||
|
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
||||||
|
{
|
||||||
|
Waste waste = _was.GetWasteForType(wasteType);
|
||||||
|
if (waste == null)
|
||||||
|
{
|
||||||
|
waste = new Waste();
|
||||||
|
waste.WasteType = wasteType;
|
||||||
|
waste.WAS = this._was;
|
||||||
|
waste.IsDirty = true;
|
||||||
|
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
|
||||||
|
this._was.Waste.Add(waste);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
waste.IsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!row.Cell(5).IsEmpty()) waste.WasteDescription = row.Cell(5).GetString();
|
||||||
|
if (waste.WasteDescription.IsNullOrEmpty())
|
||||||
|
waste.WasteDescription = "-";
|
||||||
|
|
||||||
|
if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
if (!row.Cell(9).IsEmpty()) waste.WasteDisposalPort = row.Cell(9).GetString().ToUpper();
|
||||||
|
|
||||||
|
if (!row.Cell(10).IsEmpty()) o = row.Cell(10).Value; else o = null;
|
||||||
|
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
||||||
|
|
||||||
|
importWasteList.Add(waste);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importWasteList.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridWaste.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.WAS);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<Waste> importWasteList = new List<Waste>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
// skip first three rows
|
|
||||||
reader.Read();
|
|
||||||
reader.Read();
|
|
||||||
reader.Read();
|
|
||||||
|
|
||||||
int cnt = 0;
|
|
||||||
object o = null;
|
|
||||||
|
|
||||||
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
|
||||||
|
|
||||||
while (reader.Read() && (cnt < 35))
|
|
||||||
{
|
|
||||||
if (reader.FieldCount < 9)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(1)) o = reader.GetValue(1); else o = null;
|
|
||||||
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
|
||||||
{
|
|
||||||
Waste waste = _was.GetWasteForType(wasteType);
|
|
||||||
if (waste == null)
|
|
||||||
{
|
|
||||||
waste = new Waste();
|
|
||||||
waste.WasteType = wasteType;
|
|
||||||
waste.WAS = this._was;
|
|
||||||
waste.IsDirty = true;
|
|
||||||
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
|
|
||||||
this._was.Waste.Add(waste);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
waste.IsDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(4)) waste.WasteDescription = reader.GetString(4);
|
|
||||||
if (waste.WasteDescription.IsNullOrEmpty())
|
|
||||||
waste.WasteDescription = "-";
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(5)) o = reader.GetValue(5); else o = null;
|
|
||||||
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(6)) o = reader.GetValue(6); else o = null;
|
|
||||||
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(7)) o = reader.GetValue(7); else o = null;
|
|
||||||
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(8)) waste.WasteDisposalPort = reader.GetString(8).ToUpper();
|
|
||||||
|
|
||||||
if (!reader.IsDBNull(9)) o = reader.GetValue(9); else o = null;
|
|
||||||
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
|
||||||
|
|
||||||
importWasteList.Add(waste);
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importWasteList.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridWaste.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,17 +2,16 @@
|
|||||||
// Description: Display control of formsheet Tab 1. Voyage
|
// Description: Display control of formsheet Tab 1. Voyage
|
||||||
//
|
//
|
||||||
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using ClosedXML.Excel;
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System;
|
|
||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
using System.Collections.Generic;
|
|
||||||
using ExcelDataReader;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
|
||||||
namespace ENI2.SheetDisplayControls
|
namespace ENI2.SheetDisplayControls
|
||||||
@ -308,76 +307,73 @@ namespace ENI2.SheetDisplayControls
|
|||||||
|
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data
|
||||||
|
|
||||||
|
List<LastTenPortFacilitiesCalled> importL10C = new List<LastTenPortFacilitiesCalled>();
|
||||||
|
|
||||||
|
int cnt = 0;
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (cnt >= 10) break; // Maximum 10 rows
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 8)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have 8 Columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) l10c.PortFacilityPortName = row.Cell(1).GetString();
|
||||||
|
if (!row.Cell(3).IsEmpty()) l10c.PortFacilityPortCountry = row.Cell(3).GetString();
|
||||||
|
if (!row.Cell(4).IsEmpty()) l10c.PortFacilityPortLoCode = row.Cell(4).GetString();
|
||||||
|
|
||||||
|
object o = null;
|
||||||
|
if (!row.Cell(5).IsEmpty()) o = row.Cell(5).Value;
|
||||||
|
if (o != null) l10c.PortFacilityDateOfArrival = Convert.ToDateTime(o);
|
||||||
|
|
||||||
|
if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value;
|
||||||
|
if (o != null) l10c.PortFacilityDateOfDeparture = Convert.ToDateTime(o);
|
||||||
|
|
||||||
|
if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value;
|
||||||
|
if (o != null) l10c.PortFacilityShipSecurityLevel = Convert.ToByte(o);
|
||||||
|
|
||||||
|
if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value;
|
||||||
|
int gisis = Convert.ToInt32(o);
|
||||||
|
if (!row.Cell(8).IsEmpty()) l10c.PortFacilityGISISCode = gisis.ToString().PadLeft(4, '0');
|
||||||
|
|
||||||
|
if (!row.Cell(9).IsEmpty()) l10c.PortFacilitySecurityMattersToReport = row.Cell(9).GetString();
|
||||||
|
if (l10c.PortFacilitySecurityMattersToReport?.Equals("nil", StringComparison.CurrentCultureIgnoreCase) == true)
|
||||||
|
l10c.PortFacilitySecurityMattersToReport = null;
|
||||||
|
|
||||||
|
if (!row.Cell(10).IsEmpty()) l10c.PortFacilityGISISCodeLocode = row.Cell(10).GetString();
|
||||||
|
|
||||||
|
l10c.SEC = this._sec;
|
||||||
|
l10c.IsDirty = true;
|
||||||
|
l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(this._sec.LastTenPortFacilitesCalled);
|
||||||
|
this._sec.LastTenPortFacilitesCalled.Add(l10c);
|
||||||
|
importL10C.Add(l10c);
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importL10C.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridLast10PortFacilities.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.SEC);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importL10C.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<LastTenPortFacilitiesCalled> importL10C = new List<LastTenPortFacilitiesCalled>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
int cnt = 0;
|
|
||||||
while (reader.Read() && (cnt < 10))
|
|
||||||
{
|
|
||||||
if (((IExcelDataReader)reader).FieldCount < 8)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have 8 Columns of data");
|
|
||||||
}
|
|
||||||
LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) l10c.PortFacilityPortName = reader.GetString(0);
|
|
||||||
if (!reader.IsDBNull(2)) l10c.PortFacilityPortCountry = reader.GetString(2);
|
|
||||||
if (!reader.IsDBNull(3)) l10c.PortFacilityPortLoCode = reader.GetString(3);
|
|
||||||
object o = null;
|
|
||||||
if (!reader.IsDBNull(4)) o = reader.GetValue(4);
|
|
||||||
if (o != null) l10c.PortFacilityDateOfArrival = Convert.ToDateTime(o);
|
|
||||||
if (!reader.IsDBNull(5)) o = reader.GetValue(5);
|
|
||||||
if (o != null) l10c.PortFacilityDateOfDeparture = Convert.ToDateTime(o);
|
|
||||||
// if (!reader.IsDBNull(4)) l10c.PortFacilityDateOfArrival = reader.GetDateTime(4);
|
|
||||||
// if (!reader.IsDBNull(5)) l10c.PortFacilityDateOfDeparture = reader.GetDateTime(5);
|
|
||||||
if (!reader.IsDBNull(6)) o = reader.GetValue(6);
|
|
||||||
if (o != null) l10c.PortFacilityShipSecurityLevel = Convert.ToByte(o);
|
|
||||||
if (!reader.IsDBNull(7)) o = reader.GetValue(7);
|
|
||||||
int gisis = Convert.ToInt32(o);
|
|
||||||
if (!reader.IsDBNull(7)) l10c.PortFacilityGISISCode = gisis.ToString().PadLeft(4, '0');
|
|
||||||
if (!reader.IsDBNull(8)) l10c.PortFacilitySecurityMattersToReport = reader.GetString(8);
|
|
||||||
if (l10c.PortFacilitySecurityMattersToReport.Equals("nil", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
l10c.PortFacilitySecurityMattersToReport = null;
|
|
||||||
if (!reader.IsDBNull(9)) l10c.PortFacilityGISISCodeLocode = reader.GetString(9);
|
|
||||||
l10c.SEC = this._sec;
|
|
||||||
l10c.IsDirty = true;
|
|
||||||
l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(this._sec.LastTenPortFacilitesCalled);
|
|
||||||
this._sec.LastTenPortFacilitesCalled.Add(l10c);
|
|
||||||
importL10C.Add(l10c);
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importL10C.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridLast10PortFacilities.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.SEC);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importL10C.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,80 +449,73 @@ namespace ENI2.SheetDisplayControls
|
|||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
FileStream stream;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read);
|
using (var workbook = new XLWorkbook(ofd.FileName))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1); // Get first worksheet
|
||||||
|
var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data
|
||||||
|
|
||||||
|
List<PortOfCallLast30Days> importPoC30 = new List<PortOfCallLast30Days>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break;
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() < 3)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have at least 3 Columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
|
||||||
|
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue;
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty()) poc30.PortOfCallLast30DaysLocode = row.Cell(1).GetString();
|
||||||
|
if (!row.Cell(2).IsEmpty()) poc30.PortOfCallLast30DaysDateOfDeparture = row.Cell(2).GetDateTime();
|
||||||
|
|
||||||
|
string boolString = "";
|
||||||
|
if (!row.Cell(3).IsEmpty()) boolString = row.Cell(3).GetString();
|
||||||
|
poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
(boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) ||
|
||||||
|
(boolString.Equals("j", StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
|
if (worksheet.RangeUsed().ColumnCount() > 3)
|
||||||
|
{
|
||||||
|
string allNewCrew = row.Cell(4).IsEmpty() ? null : row.Cell(4).GetString()?.Trim();
|
||||||
|
if (!allNewCrew.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
string[] crewNames = allNewCrew.Split(',', ';');
|
||||||
|
for (int i = 0; i < crewNames.Length; i++)
|
||||||
|
{
|
||||||
|
string crewName = crewNames[i].Trim();
|
||||||
|
if (crewName.IsNullOrEmpty()) continue;
|
||||||
|
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
|
||||||
|
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName;
|
||||||
|
poc30Crew.PortOfCallLast30Days = poc30;
|
||||||
|
poc30.CrewJoinedShip.Add(poc30Crew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
poc30.MDH = this._mdh;
|
||||||
|
this._mdh.PortOfCallLast30Days.Add(poc30);
|
||||||
|
importPoC30.Add(poc30);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importPoC30.Count > 0)
|
||||||
|
{
|
||||||
|
this.dataGridPortOfCallLast30Days.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.MDH);
|
||||||
|
MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, importPoC30.Count), Properties.Resources.textCaptionInformation,
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = ExcelReaderFactory.CreateReader(stream))
|
|
||||||
{
|
|
||||||
List<PortOfCallLast30Days> importPoC30 = new List<PortOfCallLast30Days>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (reader.FieldCount < 3)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("Sheet must have at least 3 Columns of data");
|
|
||||||
}
|
|
||||||
PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
|
|
||||||
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
|
|
||||||
if (!reader.IsDBNull(0)) poc30.PortOfCallLast30DaysLocode = reader.GetString(0);
|
|
||||||
if (!reader.IsDBNull(1)) poc30.PortOfCallLast30DaysDateOfDeparture = reader.GetDateTime(1);
|
|
||||||
string boolString = "";
|
|
||||||
if (!reader.IsDBNull(2)) boolString = reader.GetString(2);
|
|
||||||
poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) || (boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) ||
|
|
||||||
(boolString.Equals("j", StringComparison.OrdinalIgnoreCase)));
|
|
||||||
|
|
||||||
if (reader.FieldCount > 3)
|
|
||||||
{
|
|
||||||
string allNewCrew = reader.GetString(3)?.Trim();
|
|
||||||
if (!allNewCrew.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
string[] crewNames = allNewCrew.Split(',', ';');
|
|
||||||
for (int i = 0; i < crewNames.Length; i++)
|
|
||||||
{
|
|
||||||
string crewName = crewNames[i].Trim();
|
|
||||||
if (crewName.IsNullOrEmpty()) continue;
|
|
||||||
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
|
|
||||||
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName;
|
|
||||||
poc30Crew.PortOfCallLast30Days = poc30;
|
|
||||||
poc30.CrewJoinedShip.Add(poc30Crew);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
poc30.MDH = this._mdh;
|
|
||||||
this._mdh.PortOfCallLast30Days.Add(poc30);
|
|
||||||
importPoC30.Add(poc30);
|
|
||||||
}
|
|
||||||
} while (reader.NextResult());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (importPoC30.Count > 0)
|
|
||||||
{
|
|
||||||
this.dataGridPortOfCallLast30Days.Items.Refresh();
|
|
||||||
this.SublistElementChanged(Message.NotificationClass.MDH);
|
|
||||||
MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, importPoC30.Count), Properties.Resources.textCaptionInformation,
|
|
||||||
MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,8 @@ namespace ENI2
|
|||||||
private void ContextMenu_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
private void ContextMenu_ContextMenuOpening(object sender, ContextMenuEventArgs e)
|
||||||
{
|
{
|
||||||
MessageCore selectedCore = this.dataGrid.SelectedItem as MessageCore;
|
MessageCore selectedCore = this.dataGrid.SelectedItem as MessageCore;
|
||||||
cancelItem.Visibility = (this.AdminMode && (selectedCore.Cancelled ?? false)) ? Visibility.Visible : Visibility.Collapsed;
|
if(selectedCore != null)
|
||||||
|
cancelItem.Visibility = (this.AdminMode && (selectedCore.Cancelled ?? false)) ? Visibility.Visible : Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CancelItem_Click(object sender, RoutedEventArgs e)
|
private void CancelItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
63
ENI2/Util/EasyPeasyState.cs
Normal file
63
ENI2/Util/EasyPeasyState.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// Copyright (c) 2017- schick Informatik
|
||||||
|
// Description: Helper class for customs data serialization
|
||||||
|
//
|
||||||
|
|
||||||
|
using bsmd.database.EasyPeasy;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace ENI2.Util
|
||||||
|
{
|
||||||
|
public static class EasyPeasyState
|
||||||
|
{
|
||||||
|
private static readonly string Root = Path.Combine(
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||||
|
"EasyPeasy");
|
||||||
|
private static readonly string StatePath = Path.Combine(Root, "state.xml");
|
||||||
|
|
||||||
|
public static ProofRequest LoadOrCreate()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(StatePath))
|
||||||
|
{
|
||||||
|
using (var fs = File.OpenRead(StatePath))
|
||||||
|
{
|
||||||
|
var ser = new XmlSerializer(typeof(ProofRequest));
|
||||||
|
return (ProofRequest)ser.Deserialize(fs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { /* swallow & create new */ }
|
||||||
|
|
||||||
|
return CreateDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Save(ProofRequest data)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Root);
|
||||||
|
using (var fs = File.Create(StatePath))
|
||||||
|
{
|
||||||
|
var ser = new XmlSerializer(typeof(ProofRequest));
|
||||||
|
ser.Serialize(fs, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProofRequest CreateDefault()
|
||||||
|
{
|
||||||
|
return new ProofRequest
|
||||||
|
{
|
||||||
|
ProofInformationT2LT2LF = new ProofInformationT2LT2LF
|
||||||
|
{
|
||||||
|
RequestedValidityOfTheProof = new RequestedValidityOfTheProof(),
|
||||||
|
GoodsShipmentForT2LT2LF = new GoodsShipmentForT2LT2LF
|
||||||
|
{
|
||||||
|
LocationOfGoods = new LocationOfGoods(),
|
||||||
|
TransportDocuments = new TransportDocuments()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
using ExcelDataReader;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ENI2.Util
|
namespace ENI2.Util
|
||||||
@ -11,20 +11,6 @@ namespace ENI2.Util
|
|||||||
internal static class Extensions
|
internal static class Extensions
|
||||||
{
|
{
|
||||||
|
|
||||||
public static string ReadAsString(this IExcelDataReader reader, int index)
|
|
||||||
{
|
|
||||||
if (index >= reader.FieldCount) return null;
|
|
||||||
Type fieldType = reader.GetFieldType(index);
|
|
||||||
if (fieldType == null) return null;
|
|
||||||
if (fieldType == typeof(string))
|
|
||||||
return reader.GetString(index).Clean();
|
|
||||||
if (fieldType == typeof(DateTime))
|
|
||||||
return reader.GetDateTime(index).ToString();
|
|
||||||
if (fieldType == typeof(int))
|
|
||||||
return reader.GetInt32(index).ToString();
|
|
||||||
if (fieldType == typeof(double))
|
|
||||||
return ((int)reader.GetDouble(index)).ToString();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +1,34 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ExcelDataReader" version="3.7.0" targetFramework="net48" />
|
<package id="ClosedXML" version="0.105.0" targetFramework="net48" />
|
||||||
<package id="Extended.Wpf.Toolkit" version="4.7.25104.5739" targetFramework="net48" />
|
<package id="ClosedXML.Parser" version="2.0.0" targetFramework="net48" />
|
||||||
|
<package id="DocumentFormat.OpenXml" version="3.3.0" targetFramework="net481" />
|
||||||
|
<package id="DocumentFormat.OpenXml.Framework" version="3.3.0" targetFramework="net481" />
|
||||||
|
<package id="ExcelNumberFormat" version="1.1.0" targetFramework="net48" />
|
||||||
|
<package id="Extended.Wpf.Toolkit" version="5.0.0" targetFramework="net48" />
|
||||||
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
||||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="Microsoft.Bcl.Cryptography" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Bcl.Cryptography" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="Microsoft.Extensions.DependencyInjection" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net481" />
|
||||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Extensions.DependencyInjection" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="Microsoft.Extensions.Logging" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Extensions.Logging" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="Microsoft.Extensions.Options" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Extensions.Logging.Abstractions" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="Microsoft.Extensions.Primitives" version="9.0.8" targetFramework="net48" />
|
<package id="Microsoft.Extensions.Options" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net48" />
|
<package id="Microsoft.Extensions.Primitives" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="PDFsharp" version="6.2.1" targetFramework="net48" />
|
<package id="PDFsharp" version="6.2.2" targetFramework="net48" />
|
||||||
<package id="PDFsharp-MigraDoc" version="6.2.1" targetFramework="net48" />
|
<package id="PDFsharp-MigraDoc" version="6.2.2" targetFramework="net48" />
|
||||||
|
<package id="RBush.Signed" version="4.0.0" targetFramework="net48" />
|
||||||
|
<package id="SixLabors.Fonts" version="1.0.0" targetFramework="net481" />
|
||||||
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" />
|
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net48" />
|
||||||
<package id="System.Buffers" version="4.6.1" targetFramework="net48" />
|
<package id="System.Buffers" version="4.6.1" targetFramework="net48" />
|
||||||
<package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" />
|
<package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net48" />
|
||||||
<package id="System.Diagnostics.DiagnosticSource" version="9.0.8" targetFramework="net48" />
|
<package id="System.Diagnostics.DiagnosticSource" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="System.Formats.Asn1" version="9.0.8" targetFramework="net48" />
|
<package id="System.Formats.Asn1" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="System.Memory" version="4.6.3" targetFramework="net48" />
|
<package id="System.Memory" version="4.6.3" targetFramework="net48" />
|
||||||
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net48" />
|
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net48" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net48" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net48" />
|
||||||
<package id="System.Security.Cryptography.Pkcs" version="9.0.8" targetFramework="net48" />
|
<package id="System.Security.Cryptography.Pkcs" version="9.0.9" targetFramework="net48" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net48" />
|
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net48" />
|
||||||
<package id="System.ValueTuple" version="4.6.1" targetFramework="net48" />
|
<package id="System.ValueTuple" version="4.6.1" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -23,9 +23,7 @@ namespace SendNSWMessageService
|
|||||||
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
|
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
System.Net.ServicePointManager.ServerCertificateValidationCallback += (object _, System.Security.Cryptography.X509Certificates.X509Certificate ____,
|
System.Net.ServicePointManager.ServerCertificateValidationCallback += (_, ____, __, ___) =>
|
||||||
System.Security.Cryptography.X509Certificates.X509Chain __,
|
|
||||||
System.Net.Security.SslPolicyErrors ___) =>
|
|
||||||
{
|
{
|
||||||
return true; // **** Immer OK weil wir nur mit einem dedizierten Endpoint reden..
|
return true; // **** Immer OK weil wir nur mit einem dedizierten Endpoint reden..
|
||||||
};
|
};
|
||||||
|
|||||||
@ -40,8 +40,8 @@
|
|||||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\log4net.3.0.3\lib\net462\log4net.dll</HintPath>
|
<HintPath>..\packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="log4net" version="3.0.3" targetFramework="net48" />
|
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -40,8 +40,8 @@
|
|||||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\log4net.3.0.3\lib\net462\log4net.dll</HintPath>
|
<HintPath>..\packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
@ -52,8 +52,8 @@
|
|||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="WinSCPnet, Version=1.15.0.15073, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf, processorArchitecture=MSIL">
|
<Reference Include="WinSCPnet, Version=1.16.0.16364, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\WinSCP.6.3.6\lib\net40\WinSCPnet.dll</HintPath>
|
<HintPath>..\packages\WinSCP.6.5.3\lib\net40\WinSCPnet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -93,12 +93,12 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\packages\WinSCP.6.3.6\build\WinSCP.targets" Condition="Exists('..\packages\WinSCP.6.3.6\build\WinSCP.targets')" />
|
<Import Project="..\packages\WinSCP.6.5.3\build\WinSCP.targets" Condition="Exists('..\packages\WinSCP.6.5.3\build\WinSCP.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\WinSCP.6.3.6\build\WinSCP.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinSCP.6.3.6\build\WinSCP.targets'))" />
|
<Error Condition="!Exists('..\packages\WinSCP.6.5.3\build\WinSCP.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinSCP.6.5.3\build\WinSCP.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="log4net" version="3.0.3" targetFramework="net48" />
|
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
||||||
<package id="WinSCP" version="6.3.6" targetFramework="net48" />
|
<package id="WinSCP" version="6.5.3" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
92
bsmd.database/EasyPeasy.cs
Normal file
92
bsmd.database/EasyPeasy.cs
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
// Copyright (c) 2024-present schick Informatik
|
||||||
|
// Description: Collection of classes for the customs XML upload app
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace bsmd.database.EasyPeasy
|
||||||
|
{
|
||||||
|
// Root: <proofRequest>
|
||||||
|
[XmlRoot("proofRequest")]
|
||||||
|
public class ProofRequest
|
||||||
|
{
|
||||||
|
public string DelegateIdentificationType { get; set; }
|
||||||
|
public string TraderIdentificationType { get; set; }
|
||||||
|
public string LRN { get; set; }
|
||||||
|
public string TraderIdentificationNumber { get; set; }
|
||||||
|
public string Country { get; set; }
|
||||||
|
|
||||||
|
public ProofInformationT2LT2LF ProofInformationT2LT2LF { get; set; }
|
||||||
|
|
||||||
|
public string DelegateIdentificationNumber { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProofInformationT2LT2LF
|
||||||
|
{
|
||||||
|
public string CompetentCustomsOffice { get; set; }
|
||||||
|
public string DeclarationType { get; set; }
|
||||||
|
public DateTime DeclarationDate { get; set; }
|
||||||
|
public decimal TotalGrossMassKg { get; set; }
|
||||||
|
public RequestedValidityOfTheProof RequestedValidityOfTheProof { get; set; }
|
||||||
|
public GoodsShipmentForT2LT2LF GoodsShipmentForT2LT2LF { get; set; }
|
||||||
|
public string RequestType { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RequestedValidityOfTheProof
|
||||||
|
{
|
||||||
|
public int NumberOfDays { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GoodsShipmentForT2LT2LF
|
||||||
|
{
|
||||||
|
public bool ContainerIndication { get; set; }
|
||||||
|
public LocationOfGoods LocationOfGoods { get; set; }
|
||||||
|
|
||||||
|
[XmlElement("GoodsItemsForT2LT2LF")]
|
||||||
|
public ObservableCollection<GoodsItemForT2LT2LF> GoodsItemsForT2LT2LF { get; set; } = new ObservableCollection<GoodsItemForT2LT2LF>();
|
||||||
|
|
||||||
|
public TransportDocuments TransportDocuments { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LocationOfGoods
|
||||||
|
{
|
||||||
|
public string TypeOfLocation { get; set; }
|
||||||
|
public string QualifierOfIdentification { get; set; }
|
||||||
|
public string UNLocode { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GoodsItemForT2LT2LF
|
||||||
|
{
|
||||||
|
public Commodity Commodity { get; set; } = new Commodity();
|
||||||
|
public int GoodsItemNumber { get; set; }
|
||||||
|
public string DescriptionOfGoods { get; set; }
|
||||||
|
public GoodsMeasure GoodsMeasure { get; set; } = new GoodsMeasure();
|
||||||
|
public Packaging Packaging { get; set; } = new Packaging();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Commodity
|
||||||
|
{
|
||||||
|
public string HarmonizedSystemSubHeadingCode { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GoodsMeasure
|
||||||
|
{
|
||||||
|
public decimal GrossMass { get; set; }
|
||||||
|
public decimal NetMass { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Packaging
|
||||||
|
{
|
||||||
|
public string ShippingMarks { get; set; }
|
||||||
|
public int NumberOfPackages { get; set; }
|
||||||
|
public string TypeOfPackages { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TransportDocuments
|
||||||
|
{
|
||||||
|
public string Type { get; set; }
|
||||||
|
public string ReferenceNumber { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -6,9 +6,6 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,37 +34,64 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public static void Enqueue(Message.NSWProvider provider, Message message)
|
public static void Enqueue(Message.NSWProvider provider, Message message)
|
||||||
{
|
{
|
||||||
|
// Validate inputs
|
||||||
|
if (message == null)
|
||||||
|
{
|
||||||
|
_log.ErrorFormat("Enqueue called with null message for provider {0}", provider);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!message.Id.HasValue)
|
||||||
|
{
|
||||||
|
_log.ErrorFormat("Enqueue called with message that has no Id assigned for provider {0}", provider);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_telemetry.ContainsKey(provider))
|
if (!_telemetry.ContainsKey(provider))
|
||||||
_telemetry.Add(provider, new Dictionary<Guid, MessageTelemetry>());
|
_telemetry.Add(provider, new Dictionary<Guid, MessageTelemetry>());
|
||||||
|
|
||||||
if (_telemetry[provider].ContainsKey(message.Id.Value))
|
Guid messageId = message.Id.Value;
|
||||||
|
|
||||||
|
if (_telemetry[provider].ContainsKey(messageId))
|
||||||
{
|
{
|
||||||
_telemetry[provider][message.Id.Value].NumTries++;
|
_telemetry[provider][messageId].NumTries++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageTelemetry mt = new MessageTelemetry();
|
MessageTelemetry mt = new MessageTelemetry();
|
||||||
mt.SendDate = DateTime.Now;
|
mt.SendDate = DateTime.Now;
|
||||||
mt.NumTries = 1;
|
mt.NumTries = 1;
|
||||||
_telemetry[provider][message.Id.Value] = mt;
|
_telemetry[provider][messageId] = mt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Dequeue(Message.NSWProvider provider, Message message)
|
public static void Dequeue(Message.NSWProvider provider, Message message)
|
||||||
{
|
{
|
||||||
|
if (message == null)
|
||||||
|
{
|
||||||
|
_log.ErrorFormat("Dequeue called with null message for provider {0}", provider);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!message.Id.HasValue)
|
||||||
|
{
|
||||||
|
_log.ErrorFormat("Dequeue called with message that has no Id assigned for provider {0}", provider);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_telemetry.ContainsKey(provider))
|
if (_telemetry.ContainsKey(provider))
|
||||||
{
|
{
|
||||||
if (_telemetry[provider].ContainsKey(message.Id.Value))
|
Guid messageId = message.Id.Value;
|
||||||
|
if (_telemetry[provider].ContainsKey(messageId))
|
||||||
{
|
{
|
||||||
MessageTelemetry mt = _telemetry[provider][message.Id.Value];
|
MessageTelemetry mt = _telemetry[provider][messageId];
|
||||||
_log.InfoFormat("[{0,10}][{1,8}][{2:00000}][{3:00}] ",provider, message.MessageNotificationClassDisplay, (DateTime.Now - mt.SendDate).TotalSeconds, mt.NumTries);
|
_log.InfoFormat("[{0,10}][{1,8}][{2:00000}][{3:00}] ", provider, message.MessageNotificationClassDisplay, (DateTime.Now - mt.SendDate).TotalSeconds, mt.NumTries);
|
||||||
_telemetry[provider].Remove(message.Id.Value);
|
_telemetry[provider].Remove(messageId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// this can happen if the service gets re-started and not all sent messages have yet been received
|
|
||||||
_log.WarnFormat("trying to deque a message from telemetry that we don't know about. Provider: {0} MessageId: {1}",
|
_log.WarnFormat("trying to deque a message from telemetry that we don't know about. Provider: {0} MessageId: {1}",
|
||||||
provider.ToString(), message.Id.Value);
|
provider.ToString(), messageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.2.11")]
|
[assembly: AssemblyInformationalVersion("7.2.12")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2025 schick Informatik")]
|
[assembly: AssemblyCopyright("Copyright © 2014-2025 schick Informatik")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("7.2.11.*")]
|
[assembly: AssemblyVersion("7.2.12.*")]
|
||||||
|
|
||||||
|
|||||||
@ -98,7 +98,7 @@ namespace bsmd.database
|
|||||||
public int CompareTo(object obj)
|
public int CompareTo(object obj)
|
||||||
{
|
{
|
||||||
if (obj is WasteDisposalServiceProvider_Template template)
|
if (obj is WasteDisposalServiceProvider_Template template)
|
||||||
this.Remark?.CompareTo(template.Remark ?? "");
|
return this.Remark?.CompareTo(template.Remark ?? "") ?? 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@
|
|||||||
<HintPath>..\ENI2\packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
<HintPath>..\ENI2\packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\ENI2\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
@ -119,6 +119,7 @@
|
|||||||
<Compile Include="Customer.cs" />
|
<Compile Include="Customer.cs" />
|
||||||
<Compile Include="DatabaseEntityAsync.cs" />
|
<Compile Include="DatabaseEntityAsync.cs" />
|
||||||
<Compile Include="DBManagerAsync.cs" />
|
<Compile Include="DBManagerAsync.cs" />
|
||||||
|
<Compile Include="EasyPeasy.cs" />
|
||||||
<Compile Include="Extensions.cs" />
|
<Compile Include="Extensions.cs" />
|
||||||
<Compile Include="HAZ.cs" />
|
<Compile Include="HAZ.cs" />
|
||||||
<Compile Include="HAZPosTemplate.cs" />
|
<Compile Include="HAZPosTemplate.cs" />
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -38,8 +38,8 @@
|
|||||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\log4net.3.0.3\lib\net462\log4net.dll</HintPath>
|
<HintPath>..\packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="log4net" version="3.0.3" targetFramework="net48" />
|
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -85,6 +85,18 @@ namespace bsmd.hisnord
|
|||||||
bool? retval;
|
bool? retval;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (core == null)
|
||||||
|
{
|
||||||
|
_log.ErrorFormat("CreateSendFile called with null core");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!core.Id.HasValue)
|
||||||
|
{
|
||||||
|
_log.ErrorFormat("CreateSendFile called with core that has no Id assigned");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
nsw _nsw = new nsw();
|
nsw _nsw = new nsw();
|
||||||
_nsw.conveyance = new conveyance();
|
_nsw.conveyance = new conveyance();
|
||||||
|
|
||||||
@ -121,8 +133,9 @@ namespace bsmd.hisnord
|
|||||||
_nsw.conveyance.owner_sender.contact.phone = rp.Phone;
|
_nsw.conveyance.owner_sender.contact.phone = rp.Phone;
|
||||||
_nsw.conveyance.owner_sender.contact.fax = rp.Fax;
|
_nsw.conveyance.owner_sender.contact.fax = rp.Fax;
|
||||||
|
|
||||||
_nsw.document_reference = core.Id.Value.ToString();
|
Guid coreId = core.Id.Value;
|
||||||
_nsw.conveyance.code = core.Id.ToString();
|
_nsw.document_reference = coreId.ToString();
|
||||||
|
_nsw.conveyance.code = coreId.ToString();
|
||||||
|
|
||||||
if (!core.VisitId.IsNullOrEmpty())
|
if (!core.VisitId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,8 +38,8 @@
|
|||||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\log4net.3.0.3\lib\net462\log4net.dll</HintPath>
|
<HintPath>..\packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="log4net" version="3.0.3" targetFramework="net48" />
|
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -38,8 +38,8 @@
|
|||||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="log4net, Version=3.0.3.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<Reference Include="log4net, Version=3.2.0.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\log4net.3.0.3\lib\net462\log4net.dll</HintPath>
|
<HintPath>..\packages\log4net.3.2.0\lib\net462\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="log4net" version="3.0.3" targetFramework="net48" />
|
<package id="log4net" version="3.2.0" targetFramework="net48" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -7,6 +7,7 @@ Acrylonitrile (ACN) ;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|||||||
Alcoholic beverages, n.o.s. (Wine);;;;; ;IBC;;;;;;;;x (Z);2;;;;
|
Alcoholic beverages, n.o.s. (Wine);;;;; ;IBC;;;;;;;;x (Z);2;;;;
|
||||||
Alkanes (C6-C9);S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (X);0;;;;
|
Alkanes (C6-C9);S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (X);0;;;;
|
||||||
n-Alkanens (C10+) ;;;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
n-Alkanens (C10+) ;;;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
||||||
|
Alumina (( = Aluminiumoxid) => ist nicht anzumelden als DG));;;;;;;;;;;;;;;;;;;
|
||||||
Alkylate;;;<60°C;2; ;MARPOL;;;;;;;;;;x;;6;
|
Alkylate;;;<60°C;2; ;MARPOL;;;;;;;;;;x;;6;
|
||||||
Alumina hydrate / Aluminiumhydroxid;;;;;;IMSBC;x;y;;A/B;;;;;;;;;
|
Alumina hydrate / Aluminiumhydroxid;;;;;;IMSBC;x;y;;A/B;;;;;;;;;
|
||||||
alpha-Methylstyrene ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
alpha-Methylstyrene ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
||||||
@ -75,7 +76,7 @@ Dolomitic quicklime;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|||||||
Eisen II Sulphat;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
Eisen II Sulphat;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
||||||
Eisensilikat granulat / Iron Silicate Granules;;;;;;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
Eisensilikat granulat / Iron Silicate Granules;;;;;;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
||||||
Energy Rich Fuel / Neste Renewable Diesel / NExBTL / HVO / Hydrotreated Vegetable Oils;;;>60°C;1;;;;;;;;;;;;;;;siehe Bemerkung NExBTL - Renewable Diesel
|
Energy Rich Fuel / Neste Renewable Diesel / NExBTL / HVO / Hydrotreated Vegetable Oils;;;>60°C;1;;;;;;;;;;;;;;;siehe Bemerkung NExBTL - Renewable Diesel
|
||||||
Ethyl acetate ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
Ethyl acetate ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
||||||
Ethanol / Ethyl alcohol / Grain alcohol / Drinking alcohol;;;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
Ethanol / Ethyl alcohol / Grain alcohol / Drinking alcohol;;;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
||||||
Ethylene glycol / (Mono-)Ethylenglycol / MEG / Glycol;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
Ethylene glycol / (Mono-)Ethylenglycol / MEG / Glycol;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
||||||
Ethyl tert-butyl ether / ETBE ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
Ethyl tert-butyl ether / ETBE ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
||||||
@ -91,7 +92,7 @@ Ferrochrom;;;;;;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|||||||
Ferrosilicochrom 40 / Ferrosilicon;;;;; ;IMSBC;x;;;B;1;1408;4.3;;;;;;
|
Ferrosilicochrom 40 / Ferrosilicon;;;;; ;IMSBC;x;;;B;1;1408;4.3;;;;;;
|
||||||
FERROUS METAL / BORINGS / SHAVINGS / TURNINGS / CUTTINGS;;;;; ;IMSBC;x;;;B;1;2793;4.2;;;;;;
|
FERROUS METAL / BORINGS / SHAVINGS / TURNINGS / CUTTINGS;;;;; ;IMSBC;x;;;B;1;2793;4.2;;;;;;
|
||||||
FERTILIZER POTASH (PINK GRANULATED MURIATE OF POTASH);;;;;;IMSBC;x;;;;;;;;;;;;
|
FERTILIZER POTASH (PINK GRANULATED MURIATE OF POTASH);;;;;;IMSBC;x;;;;;;;;;;;;
|
||||||
Fish Meal treated with Antioxidant;;;;; ;IMSBC;x;;;B;1;2216;9;;;;;;wenn Ladehafen Bremen dann Gruppe C und nicht anzumelden
|
Fish Meal - self-heating ;;;;; ;IMSBC;x;n;;B;1; ; ;;;;;;Dieses Gefahrgut wird OHNE MHB und OHNE IMO/UN Nummer abgesendet. Wenn Ladehafen Bremen dann Gruppe C und nicht anzumelden. (Stand 29.10.2025)
|
||||||
Fishoil;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
Fishoil;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
||||||
Fish Silage Protein Concentrate (containing 4% or less formic acid);P;0;NF;0;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
Fish Silage Protein Concentrate (containing 4% or less formic acid);P;0;NF;0;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
||||||
Fish protein concentrate (containing 4% or less formic acid);P;0;NF;0;Nein;IBC;;;;;;;;x (Z);2;;;;
|
Fish protein concentrate (containing 4% or less formic acid);P;0;NF;0;Nein;IBC;;;;;;;;x (Z);2;;;;
|
||||||
@ -110,6 +111,7 @@ Ground Colemanite;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|||||||
Gypsum / Gips;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
Gypsum / Gips;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
||||||
HCGO / Heavy Cycle Gas Oil;;;;; ;MARPOL;;;;;;;;;;x;;;
|
HCGO / Heavy Cycle Gas Oil;;;;; ;MARPOL;;;;;;;;;;x;;;
|
||||||
HFO ;;;;;;MARPOL;;;;;;;;;;x;;;
|
HFO ;;;;;;MARPOL;;;;;;;;;;x;;;
|
||||||
|
Hot roiled coils (HRC);;;;;;;;;;;;;;;;;;;Keine Anmeldung
|
||||||
Holzstämme / Wooden Poles;;;;; ;IMSBC;x;y;;B;1;;;;;;;;Nur wenn unter Deck, nur wenn in Loser Schüttung!
|
Holzstämme / Wooden Poles;;;;; ;IMSBC;x;y;;B;1;;;;;;;;Nur wenn unter Deck, nur wenn in Loser Schüttung!
|
||||||
Hydrochloric Acid;S/P;2;NF;0;Nein;IBC;;;;;;;;x (Z);2;;;NF;
|
Hydrochloric Acid;S/P;2;NF;0;Nein;IBC;;;;;;;;x (Z);2;;;NF;
|
||||||
Hydrocarbon Wax / PROWAX 312;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (X);0;;;;
|
Hydrocarbon Wax / PROWAX 312;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (X);0;;;;
|
||||||
@ -295,5 +297,4 @@ Wooden poles / Holzstämme;;;;; ;IMSBC;x;y;;B;1;;;;;;;;NUR UNTER DECK (in Luken)
|
|||||||
Xylenes / Ortho-Xylene / Para Xylene;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1; ;;;
|
Xylenes / Ortho-Xylene / Para Xylene;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1; ;;;
|
||||||
Zellulose / Cellulose / Wood pulp;;;;; ;;;;;;;;;;;;;;"Keine Anmeldung,
|
Zellulose / Cellulose / Wood pulp;;;;; ;;;;;;;;;;;;;;"Keine Anmeldung,
|
||||||
Nur falls Bulk-Ladung"
|
Nur falls Bulk-Ladung"
|
||||||
Zinc Concentrates / MRM BULK CONCENTRATES / Mineral Concentrates;;;;; ;IMSBC;x;;;A;0;3077;9;;;;;;"Nachfragen ob als Mineral Concentrates (3077/9) oder METAL SULPHIDE CONCENTRATES (MHB) (""Shippers declaration for solid bulk cargos"" anfordern oder auch ""Cargo information for solid bulk cargos"""
|
Zinc Concentrates / MRM BULK CONCENTRATES / Mineral Concentrates / METAL SULPHIDE CONCENTRATES;;;;; ;IMSBC;x;;;A;0;;;;;;;;Dieses Gefahrgut wird OHNE MHB und OHNE IMO/UN Nummer abgesendet. Eine gelbe Violation-Meldung aus dem NSW ist zu ignorieren
|
||||||
Zinc Concentrates / MRM BULK CONCENTRATES / METAL SULPHIDE CONCENTRATES;;;;; ;IMSBC;x;y;;A/B;2;;;;;;;;"Nachfragen ob als Mineral Concentrates (3077/9) oder METAL SULPHIDE CONCENTRATES (MHB) (""Shippers declaration for solid bulk cargos"" anfordern oder auch ""Cargo information for solid bulk cargos"""
|
|
||||||
|
|||||||
|
Binary file not shown.
@ -1,299 +0,0 @@
|
|||||||
Beschreibung;Gefahr;HAZARD_ENUM;FP;FP_ENUM;15.19?;Typ;IMSBC;MHB;IMSBC_MHB;Group;IMSBC_HAZ;UN-Nr.;IMO-Cl.;IBC;POLLUTION_CATEGORY_ENUM;MARPOL;IGC;FP_IBC;Bemerkung
|
|
||||||
1,3 Pentadiene / Piperylene;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Acetic acid ;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Acetic acid glacial;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Acetone ;;;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Acrylonitrile (ACN) ;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Alcoholic beverages, n.o.s. (Wine);;;;; ;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Alkanes (C6-C9);S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
n-Alkanens (C10+) ;;;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Alkylate;;;<60°C;2; ;MARPOL;;;;;;;;;;x;;6;
|
|
||||||
Alumina hydrate / Aluminiumhydroxid;;;;;;IMSBC;x;y;;A/B;;;;;;;;;
|
|
||||||
alpha-Methylstyrene ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Ammonia aqueous (28% or less);S/P;2;NF;0;Ja;IBC;;;;;;;;x (Y);1;;;NF;
|
|
||||||
Ammonia / Anhydrous / Ammoniak;;;;; ;IGC;;;;;;1005;2.3;;;;x;;
|
|
||||||
Ammoniak Liquid 24,5% ;S/P;2;;;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Ammonium Nitrate Fertilizer ;;;;; ;IMSBC;x;;;B;1;2067;5.1;;;;;;
|
|
||||||
Ammonium Nitrate with not more than 0,2% total;;;;; ;IMSBC;x;;;B;1;1942;5.1;;;;;;
|
|
||||||
Ammonium Polyphosphate Solution (APP) ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Ammonium Sulphate;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Ammonium nitrate solution (93% or less) ;S/P;2;NF;0;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Ammonium thiosulphate solution (60% or less);S/P;2;NF;0;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Aniline ;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Anthracene Oil;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Anthracite / Coal / Kohle;;;;; ;IMSBC;x;y;;A/B;2;;;;;;;;Gruppe: B (und A)
|
|
||||||
ATRES / RAT / Atmospheric Residues / Residues (petroleum) atmospheric (APS Bottoms Resid A);;;>60°C;1;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
AVGAS / Aviation Gasoline / Flugbenzin;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
BALED RDF;;;;;;IMSBC;x ;y;;B;1;;;;;;;;
|
|
||||||
Base Oil / Lubricating oil / SN150/ SN500 / SN900 / BS20 / NYTEX 4700 / T9 / T600 / T150 ANR / VISOM 4 / Ultra S4 / Bright Stock / QHVI4 / QHVI8 / VHVI-4 = DISTILLATES (PETROLEUM) / HYDROTREATED HEAVY PARAFFINIC,;;;>60°C;1; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Benzene / Benzol;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;-11;
|
|
||||||
Biodiesel / FAME - Fatty acid methyl esters;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Bitumen ;;;>60°C;1;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Blei in Blöcken / Lead Ingots;;;;;;;;;;;;;;;;;;; kein Gefahrgut! Aussage Herr Jnassen Rhenus Midgard Nordenham (tel. 21.07.2021)
|
|
||||||
Butan;;;;;;IGC;;;;;;1011;2.1;;;;x;;
|
|
||||||
Butene / Buthylen;;;;;;IGC;;;;;;1012;2.1;;;;x;;
|
|
||||||
Butyl acrylate (all isomers);S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Calcined clay / Kalzinierter Ton;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
C9 Petroleum Resin;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Calcium Ammonium Nitrate 27% N / CAN (in Big BAG);;;;; ;;;;;;;;;;;;;;Keine Anmeldung lt. Aussage von Wasserschutzpolizeit Hamburg
|
|
||||||
Calcium Ammonium Nitrate 27% N / CAN (in BULK);;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Calcium Chloride Solution;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
CARBON BLACK FEEDSTOCK / D8 / ANTHRACENE OIL;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;x;;;nach Sicherheitsdatenblatt fragen kann IBC oder Marpol sein
|
|
||||||
Carbon Black Oil Propylene Oxide;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Carbon Dioxide;;;;; ;IGC;;;;;;1013;2.2;;;;x;;
|
|
||||||
Caromax 28 ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Caustic potash / Potassium hydroxide solution / Kalilauge ;S/P;2;NF;0;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Caustic soda / Sodium hydroxide solution / Natronlauge;S/P;2;NF;0; Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
China Clay;;;;; ;;;;;;;;;;;;;;Keine Anmeldung lt. Aussage von Herrn Schlicht (S+B) in Absprache mit Wasserschutz
|
|
||||||
Clay / TON;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Coal / Kohle / Anthracite;;;;;;IMSBC;x;y;;A/B;2;;;;;;;;Gruppe: B (und A)
|
|
||||||
Coal Tar ,;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Coal Tar Pitch (Flüssig);S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Coal Tar Pitch / Steinkohlenteerpech (FEST);;;;;;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
Coconut oil ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
COKE BREEZE / Koksgrus;;;;; ;IMSBC;x;;;A;0;;;;;;;;
|
|
||||||
Used cooking oil (mit Triglycerides, C16-C18 and C18 unsaturated) ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Used cooking oil (wenn Triglycerides nicht ausdrücklich ausgewiesen) ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Copper concentrates ;;;;; ;IMSBC;x;;;A;0;3077;9;;;;;;
|
|
||||||
Copper concentrates (Metal Sulphide Concentrates);;;;; ;IMSBC;x;y;;A/B;2;;;;;;;;
|
|
||||||
Corn Oil , ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Creosete Oil ;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Crude Benzene and mixtures having 10% benzene or more ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Cumene / Isopropylbenzene ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (y);1;;;;
|
|
||||||
Cutterstock / Cutter;;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Cyclohexane;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
DDGS Pellets / Dried Distiller Grains with solubles;;;;;;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
DINP DIALKYL / Diisononylphthalat;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Distillate Hydrocrackers / DHC;;;;; ;MARPOL;;;;;;;;;;x;;;Bottoms Raw marterial for chemical industry Feedingstock for mineral oil industry
|
|
||||||
DIAMMONIUM PHOSPHATE / DAP;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
1,1- Dichloroethane;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
DIRECT REDUCED IRON;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
"Distillate / D10V / LVG / D8C / D10C / D10JUB / D 600 / D 700 / D 2000
|
|
||||||
";;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
DOLOMITE;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C, evtl. Ist auch Dolomitic quicklime gemeint, Nachfragen
|
|
||||||
Dolomitic quicklime;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
Eisen II Sulphat;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Eisensilikat granulat / Iron Silicate Granules;;;;;;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Energy Rich Fuel / Neste Renewable Diesel / NExBTL / HVO / Hydrotreated Vegetable Oils;;;>60°C;1;;;;;;;;;;;;;;;siehe Bemerkung NExBTL - Renewable Diesel
|
|
||||||
Ethyl acetate ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Ethanol / Ethyl alcohol / Grain alcohol / Drinking alcohol;;;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Ethylene glycol / (Mono-)Ethylenglycol / MEG / Glycol;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Ethyl tert-butyl ether / ETBE ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Ethylene;;;;; ;IGC;;;;;;1038;2.1;;;;X;;
|
|
||||||
ETHYLENE DICHLORIDE (ETD oder EDC) ;S/P;2;<60°C;2;Ja;IBC;;;;;;1184;;x (Y) ;;;;;
|
|
||||||
Etibor / BORAX / PENTAHYDRATE CRUDE;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
EXTRAIT / Vacuum gas oil;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Fatty acids, (C16+);P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
FAME / Fatty acid methyl esters / Biodiesel ,;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Feed Phosphate / Monocalcium Phosphate;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Ferroalloys / Ferro Silico Mangan / Ferrolegierung (unter 20 %);;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Ferrochrom;;;;;;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Ferrosilicochrom 40 / Ferrosilicon;;;;; ;IMSBC;x;;;B;1;1408;4.3;;;;;;
|
|
||||||
FERROUS METAL / BORINGS / SHAVINGS / TURNINGS / CUTTINGS;;;;; ;IMSBC;x;;;B;1;2793;4.2;;;;;;
|
|
||||||
FERTILIZER POTASH (PINK GRANULATED MURIATE OF POTASH);;;;;;IMSBC;x;;;;;;;;;;;;
|
|
||||||
Fish Meal treated with Antioxidant;;;;; ;IMSBC;x;;;B;1;2216;9;;;;;;wenn Ladehafen Bremen dann Gruppe C und nicht anzumelden
|
|
||||||
Fishoil;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Fish Silage Protein Concentrate (containing 4% or less formic acid);P;0;NF;0;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Fish protein concentrate (containing 4% or less formic acid);P;0;NF;0;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
FLUORSPAR / Flussspat;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
Fly Ash;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Formaldehyde solutions / Formalin ;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
FORMIC ACID (85% or less acid) , ;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
FORMIC ACID (over 85% acid) , ;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Foundry Coke / Gießereikoks /COKE;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Fraction C6 (containing benzene);S/P;2;>60°C;1;;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Gas Condensate;;;<60°C;2; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
GAS OIL / Light Cycle Oil;;;>60°C;1; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Gasoline blending stocks / Reformates / Gasoline blending stocks / polymer-fuel /Gasoline blending stocks / alkylates-fuel;;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Glycerine;S;1;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Ground Colemanite;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Gypsum / Gips;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
HCGO / Heavy Cycle Gas Oil;;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
HFO ;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Hot roiled coils (HRC);;;;;;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Holzstämme / Wooden Poles;;;;; ;IMSBC;x;y;;B;1;;;;;;;;Nur wenn unter Deck, nur wenn in Loser Schüttung!
|
|
||||||
Hydrochloric Acid;S/P;2;NF;0;Nein;IBC;;;;;;;;x (Z);2;;;NF;
|
|
||||||
Hydrocarbon Wax / PROWAX 312;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Hydro Cracker Bottoms ;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Hydrotreated Renewable Oil ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
IFO380 ;;;>60°C;1; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
ILMENITE CLAY / Ilmenit-Ton;;;;; ;IMSBC;x;;;;;;;;;;;;Anmerkung: Ilmenite für Nordenham= Ilmenit Sand - keine Anmeldung als GG
|
|
||||||
ILMENITE Concentrate;;;;;;IMSBC;x;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
IRON ORE / Eisenerz;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
IRON ORE / Eisenerz (FINES);;;;;;IMSBC;x;;;A;0;;;;;;;;x Kein MHB, ohne UN-/IMO-Nr. senden = geht nur im ENI (JGegis will eine Auswahl)
|
|
||||||
Iso- and cyclo-alkanes (C12+) / LIAV270 ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Iso- and cyclo-alkanes (C10-C11+) ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Isomerate ;;;<60°C;2;;MARPOL;;;;;;;;;;x ;;;
|
|
||||||
Isopentane / Pentane ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Isoprene ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
JET A1 / Normal Russian TS-1 / Kerosin / Kerosene;;;<60°C;2; ;MARPOL;;;;;;;;;;X;;;
|
|
||||||
Kalk ungeschlöscht / LIME UNSLAKED;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
Odourless Kerosene;;;>60°C;1;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Kokospalmenschalen;;;;;;IMSBC;x;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Lard / Schmalz;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
LCCS / Light Catalytically Cracked Spirit / Light Catalytically Cracked Naphtha;;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Lecithin ;;;;;;IBC;;;;;;;;x (OS);3;;;;
|
|
||||||
Lead Concentrate ;;;;; ;IMSBC;x;;;A;0;3077;9;;;;;;"Nachfragen ob als Mineral Concentrates (3077/9) oder METAL SULPHIDE CONCENTRATES (MHB) (""Shippers declaration for solid bulk cargos"" anfordern oder auch ""Cargo information for solid bulk cargos"""
|
|
||||||
Lead Concentrate (Metal Sulphide Concentrates);;;;; ;IMSBC;x;y;;A/B;2;;;;;;;;"Nachfragen ob als Mineral Concentrates (3077/9) oder METAL SULPHIDE CONCENTRATES (MHB) (""Shippers declaration for solid bulk cargos"" anfordern oder auch ""Cargo information for solid bulk cargos"""
|
|
||||||
Lead Ingots;;;;;;IBC;;;;;;;; ;;;;;Keine Anmeldung lt. Aussage Herr Jnassen Rhenus Midgard Nordenham (tel. 21.07.2021)
|
|
||||||
Light Vacuum Gas Oil / Petroleum / Petroleum Hydrocarbons;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Ligninsulphonic Acid / Sodium Salt Solution;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Ligno Sulphonate Sodium / Sulphite Lie (Lye) ;P;0;>60°C;1; ;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Lime ;;;;;;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
Limestone / Kalkstein;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Liquid petroleum paraffin, fraction of C14-C17 <2% aromatics);P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Lukoil / Crude Oil;;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Magnesium Chloride Solution;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Metal Sulphide Concentrates / Zink / Blei / Silber;;;;; ;IMSBC;x;y;;A/B;2;;;;;;;;
|
|
||||||
Methanol / Methyl Alcohol ;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Methyl Acrylate ;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Methyl Alcohol / Methanol ;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Methyl Isobutyl Ketone ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Methylendiphenylisocyanate / MDI / Polymethylene polyphenyl isocyanate ;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Methyl Methacrylate Monomer / MMM ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Methyl Tert-Butyl Ether / MTBE ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Mixed Fatty acid / MFA;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Mixed Xylene ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Molasses;;;NF;0; ;IBC;;;;;;;;x (OS);3;;;;Nicht anmeldepflichtig - Ausnahme: BREMEN (lt Auskunft von Herrn Kraft 09.01.2018)//FÜR BREMEN ANMELDEN ÜBER J GEGIS - an DBH - ohne Visit ID
|
|
||||||
Monoammonium Phosphate / MAP;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Monocalcium Phosphate / MCP / Futtermittel;;;;; ;IMSBC;x;y;;A/B;2;;;;;;;;Verpackt (IMDG) nicht anmeldepflichtig
|
|
||||||
Monoethylen Glycol / MEG;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Muriate of potash / Kaliumchlorid;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
n-Alkanes (C10+) / N-Paraffine / Paraffine Normal;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
N-Butanol / N-BUTYL ALCOHOL;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
N-paraffines / N-ALKANES (C10+);P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Naphtha ;;;<60°C;2;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Naphthalene / Molten;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Nepherlin Matrix 350 / Sand / Glas / Porzellan;;;;; ;;;;;;;;;;;;;;
|
|
||||||
NESSOL 40 (Noxious liquid, F, (6) n.o.s White Spirit);P;0;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Nessol D40 (Noxious liquid, F, (8) n.o.s. (siehe Noxious liquid…);P;0;<60°C;2;ja;IBC;;;;;;;; ;;;;;
|
|
||||||
Nessol D60 ( (contains Iso- und Cycloalkanes (C10-C11) (siehe Noxious liquid...);S/P;2;<60°C;2;Nein;IBC;;;;;;;; ;;;;;
|
|
||||||
Nessol D100 (contains Iso- und Cycloalkanes (C12+) ;S/P;2;<60°C;2;Nein;IBC;;;;;;;; ;;;;;
|
|
||||||
NExBTL / Renewable Diesel;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;>60;Risks: nicht zu finden in IBC-Code
|
|
||||||
Refinery NexTAME / Noxious liquid, F, (4) n.o.s. (trade name ...., contains ....) ;;;<60°C;2;Ja;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Nickelconzentrat ;;;;;;IMSBC;x;;;A;0;;;;;;;;
|
|
||||||
Nitric acid (70% and over) ;S/P;2;NF;0;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Nitric acid (less than 70%) ;S/P;2;NF;0;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Nonene / All Isomers;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;siehe auch Propylene Trimer
|
|
||||||
NON OXY EBOB / Gasoline;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Normal Russian TS-1 Kerosene;;;;;;MARPOL;;;;;;;;;;x;;>23;
|
|
||||||
"Noxious liquid, NF, (5) n.o.s. / Trade Name (Nexbase 3050;3020;3030,3043) / Containscontains Iso- and cyclo-alkanes ";P;0;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Noxious liquid, NF(5) n.o.s. LI 220 HF contains White Spirit, low ;P;0;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Noxious liquid, NF(5) n.o.s.(Solvesso 100, contains Alkyl (C3-C4) benzenes) ;P;0;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Noxious liquid, NF, (7) n.o.s. (Exxsol D80 , contains iso-and cycloalkanes(C12+));P;0;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Noxious liquid, NF, (7) n.o.s. ((EXXSOL D60 und auch Nessol D60, contains iso-and cycloalkanes (C10-C11));P;0;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Noxious liquid, F, (8) n.o.s. (NESSOL D40 contains Iso- and cycloalkanes (C10-C11)) ;P;0;<60°C;2;ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Noxious liquid, F, (11?) n.o.s. (ETHYLOL 95, contains Ethyl alcohol)) ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
NPK Fertilizer / Ammonium Nitrate Based Fertilizer (Non Hazardous);;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Nynas VR5000 / Bitumen;;;>60°C;1;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
NYTRO TAURUS / Insulating Oil;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Octene;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Odourless Kerosene D70 ;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Olivines / Mineralgemisch gehört Mineralklasse der „Silikate und Germanate“ ;;;;;;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Olive Stones (crushed) / Seed Cake / Oil Cake;;;;; ;IMSBC;x;;;B;1;1386;4.2;;;;;;
|
|
||||||
ORTHO-XYLENE ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Palm fatty acid distillate / PFAD;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Palmkernexpellers / pulverisierte Kernschalen;;;;;;;;;;;;;;;;;;;Keine Anmeldung lt. J.Müller Brake - siehe aber auch SEED CAKE
|
|
||||||
PALM KERNEL OIL / CPKO / Crude Palm Kernel Oil;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
PALM KERNEL STEARIN ;P;0;>60°C;1;Nein;;;;;;;;;;;;;;
|
|
||||||
PALM MID-FRACTION ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
PALM OIL ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
PALM OLEINE ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Palm stearin ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Palmitic Acid ;;;;; ;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
n-Paraffins (C10-C20) / N-ALKANES (C10+);P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Paraffin wax, highly-refined ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Paraffin wax, semi-refined ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
PARA XYLENE ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Pea Coke;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
PEAT MOSS / Torf;;;;; ;IMSBC;x;y;;A/B;2;;;;;;;;Für den Kielkanal nicht anmelden lt. Rücksprache UCA+Herrn Langbein/01.02.2016 => gültig für UCA/S+B
|
|
||||||
Peat (milled);;;;; ;;;;;;;;;;;;;;Keine Anmeldung lt. Herrn Schütte für NOK nicht anmelden/09.02.2021
|
|
||||||
Pentadiene / 1,3-Pentadiene;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Perchloroethylene ;S/P;2;NF;0;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
PETROLEUM COKE / calcined or uncalcined oder Calcined Coke / Petcoke;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
PGI / Propylene Glycol Industrial;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Phenol;S/P;2;>60°C;1;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Phosphoric Acid ;S/P;2;NF;0;Ja;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
PITCH / Pech;;;;; ;IMSBC;x;y;;B;1;;;;;;;;In Bulk/Pitch Verpackt (MSDS = Material Safetey Data Sheet anfordern)
|
|
||||||
PME / Biodiesel;;;;; ;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Polymethylene Polyphenyl Isocyanate ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Polyolefin (molecular weight 300+) ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Potash / Pottasche;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Potassium Hydroxide Solution / Caustic Potash / Kaliumhydroxidlösung;S/P;2;NF;0;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Propylbenzene / all isomers;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Propylene;;;;; ;IGC;;;;;;1077;2.2;;;;x;;
|
|
||||||
Propylene Dichloride / 1,2-DICHLOROPROPANE;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Propylene Glycol Monoalkyl Ether / DOWANOL PM;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Propylene Oxide; ;; ;; ;IGC;;;;;;1280;3;;;;x;;
|
|
||||||
Propylene Oxide;S/P;2;<60°C;2;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Propylene Tetramer ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Propylene Trimer ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Pyrolysis Fuel Oil;;;;; ;IBC;;;;;;;;?;;?;;;
|
|
||||||
Pyrolysis Gasoline containing benzene / Pygas /Aromatic hydrocarbons / C6-8 / Naphtha-Raffinate Pyrolyzate-derived ;S/P;2;<60°C;2;Nein;IBC;;;;;;;; x (Y) ;;;;;
|
|
||||||
Pyrite;;;;;;;;;;;;;;;;;;;"Achtung! Kann ""IMSBC: Gruppe C"" (also nicht anmeldepflichig sein) oder auch ""Gruppe: A"" bzw. ""Gruppe: A/B"" (somit Anmeldepflichtig)- beim Kunden nachfragen und ""Shippers declaration for solid bulk cargos"" oder es nennt sich auch ""Cargo information for solid bulk cargos"" anfordern"
|
|
||||||
Quicklime / Kalk ungelöscht / Lime / Burnt Lime / Un-slaked Lime / Building Lime / Calcia / Fat Lime / Chemical Lime / Fluxing Lime / Hard Burnt Lime / Soft Burnt Lime / Pebble Lime / Calcium Oxide / Calcium Monoxide / Calcined Limestone / Calcium oxide / CaO;;;;;;IMSBC;x;Y;;B;1;;;;;;;;
|
|
||||||
Rapeseed oil / Rapsöl;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Rape seed oil fatty acid methyl esters ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
BALED RDF;;;;;;IMSBC;x;y;;B;1;;;;;;;;beim KD/Schiff nach Blatt „Shipper's Declaration for Solid Bulk Cargos“ oder „Cargo Information for solid bulk cargos“„ fragen - 13.12.2021
|
|
||||||
Refinery NexTAME / Noxious liquid, F, (4) n.o.s. (trade name ...., contains ....);P;0;<60°C;2;Ja;IBC;;;;;;;;x (y);1;;;;
|
|
||||||
Reformate / Naphtha / Gas Oil / UMS / Unleaded mo gas / Motor Gas;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
RDF pellets / Refuse Derived Fuel;;;;; ;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Resin Oil / Distilled ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
RME 0,4MG/11 / FAME;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Sawn Timber / Schnittholz / Sägeholz;;;;; ;IMSBC;x;;;;;;;;;;;;nur wenn als Bulk (also keine Verpackung jeglicher Art (Drahtseile, Kunststoffbänder) und unter Deck
|
|
||||||
SEED Cake mit einem Ölgehalt von höchstens 1,5% und einem Feuchtigkeitsgehalt von höchstens 11% ///with not more than 1.5% oil and not more than 11% moisture.;;;;;;IMSBC;x;;;B;1;2217;4.2;;;;;;
|
|
||||||
SEED Cake containing vegetable oil a) durch mechanisches Pressen gewonnene Ölsaatenrückstände, die mehr als 10% Öl oder mehr als 20% Öl und Feuchtigkeit zusammen enthalten / (a) mechanically expelled seeds, containing more than 10% of oil or more than 20% of oil and moisture combined.);;;;;;IMSBC;x;;;B;1;1386;4.2;;;;;;
|
|
||||||
Shale Oil;;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Slack Wax / Petroleum / Hydrocarbon Wax;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Slop Water;;;;; ;;;;;;;;;;;;;;Keine Anmeldung lt. Johann/16.12.12
|
|
||||||
Slops;;;;; ;;;;;;;;;;;;;;
|
|
||||||
Slurry / Residues / Petroleum;;;;; ;MARPOL;;;;;;;;;;x ;;;
|
|
||||||
Small Arms = Waffen zur Schiffsausrüstung gehörig;;;;; ;;;;;;;;;;;;;;Keine Anmeldung lt. Aussage von Fr. Kauschmann/16.05.2013 (09:50 Uhr)
|
|
||||||
Solvent ;;;;;;;;;;;;;;;;;;;Sicherheitsdatenblatt anfordern!!!
|
|
||||||
Sodium hydroxide solution / Caustic soda / Natronlauge;S/P;2;NF;0;Ja;IBC;;;;;;;;x (Y);;;;;
|
|
||||||
Sodium Sulphate in Bulk;;;;; ;;;;;;;;;;;;;;Keine Anmeldung lt. Aussage von Herrn Illing Gefahrgutauskunfststelle Hamburg/14.02.14-10.25 Uhr
|
|
||||||
Soyabean meal / SBM / Sojabohnenmehl;;;;; ;IMSBC;x;y;;;;;;;;;;;"Kann Cat. A, B oder C sein (abhängig von der Zusammensetzung),
|
|
||||||
wenn keine genaue Angabe => Anfragen, ob anmledepflichtig oder nicht,
|
|
||||||
Wenn Port of Loading = Brake oder Hamburg => Cat. C und damit nicht anmeldepflichtig"
|
|
||||||
Soyabean Oil ,;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Soja protein concentrat / SPC;;;;;;;;;;;;;;;;;;;Keine Anmeldung
|
|
||||||
Steel Turnings;;;;; ;IMSBC;x;;;B;1;2793;4.2;;;;;;
|
|
||||||
Styrene Monomer ,;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Sulphur (molten) ;S;1;>60°C;1;Nein;IMSBC; ;;;;;;;x (Z);2;;;;
|
|
||||||
Sulphuric Acid;S/P;2;NF;0;Ja;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Sunflower Husk Pellets in bulk;;;;;;;;;;;;;;;;;;;Keine Anmeldung, Gruppe C - tel Aussage Hr. Meiners (J.Müller)
|
|
||||||
Sunflower Seed Oil ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Tall oil fatty acid / TOFA (resin acids less than 20%) ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Tall oil pitch ;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Tallow fatty acid;P;0;>60°C;1;Nein;IMSBC; ;;;;;;;x (Y);1;;;;
|
|
||||||
tert-Amyl ethyl ether / TAEE ;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
tert-Amyl methyl ether / TAME;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Toasted meals / geröstete Mehle;;;;; ;IMSBC;x;;;;;;;;;;;;Group: B oder C - beim KD nach Blatt „Shipper's Declaration for Solid Bulk Cargos“ oder „Cargo Information for solid bulk cargos“„ fragen
|
|
||||||
Toluene ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Transformer oil / Insulating oil (z.B. NS8);;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Turpentine (z. B. LI200) ;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
UMS / Gasoline;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Nynas Naphthenic / Tyre Oils;;;;; ;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Ultra-Low Sulphur Fuel Oil / ULSFO;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Urea Grain in bulk ;;;;; ;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
Urea Ammonium Nitrate solution / UAN (containing less than 1% free ammonia) ;S/P;2;NF;0;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Urea solution ;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Urea Grain in bulk;;;;;;;;;;;;;;;;;;;Keine Anmeldung, IMSBC Gruppe C
|
|
||||||
VGO / Vakuum Gas Öl / Schweres Vakuumgasöl / HVGO;;;<60°C;2; ;MARPOL;;;;;;3082;9;;;x;;;
|
|
||||||
Vegetable acid oils;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
Versene 100 / ETHYLENEDIAMINETETRAACETIC ACID NA4-SALT;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y);1;;;;
|
|
||||||
Versenex 80 / Diethylenetriaminepentaacetic acid / pentasodium salt solution;P;0;>60°C;1;Nein;IBC;;;;;;;;x (Z);2;;;;
|
|
||||||
Vinyl Acetate monomer;S/P;2;<60°C;2;Nein;IBC;;;;;;;;x (Y) ;;;;;
|
|
||||||
VISTAR HS / Distillates Petroleum;;;;;;MARPOL;;;;;;;;;;x;;;
|
|
||||||
Wash Oil / Creosote oil / METHYLNAPHTHALENE acenaphthene fraction;S/P;2;>60°C;1;Nein;IBC;;;;;;;;x (X);0;;;;
|
|
||||||
Washed Waelz Oxide / Zink / zinkhaltiger Staub;;;;;;IMSBC;x;;;A;0;;;;;;;;lt. Rhenus Midgard/Hr. Janssen
|
|
||||||
Wilfarin PA1698 RSPO (siehe Fatty acids, (C16+) );P;0;>60°C;1;Nein;;;;;;;;;;;;;;
|
|
||||||
WOOD PELLETS ;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
Wood pulp;;;;;;;;;;;;;;;;;;;nicht anmelden = Aussage J.Müller, kein DG
|
|
||||||
Wood pulp pellets ;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
WOODCHIPS ;;;;; ;IMSBC;x;y;;B;1;;;;;;;;
|
|
||||||
Wooden poles / Holzstämme;;;;; ;IMSBC;x;y;;B;1;;;;;;;;NUR UNTER DECK (in Luken) anzumeldem - DECKSLADUNG NICHT! (außer für Baltic Lloyd, Rostock - ALLES anmelden!) lt. Herrn Ronneberger
|
|
||||||
Xylenes / Ortho-Xylene / Para Xylene;P;0;<60°C;2;Nein;IBC;;;;;;;;x (Y);1; ;;;
|
|
||||||
Zellulose / Cellulose / Wood pulp;;;;; ;;;;;;;;;;;;;;"Keine Anmeldung,
|
|
||||||
Nur falls Bulk-Ladung"
|
|
||||||
Zinc Concentrates / MRM BULK CONCENTRATES / Mineral Concentrates / METAL SULPHIDE CONCENTRATES;;;;; ;IMSBC;x;;;A;0;;;;;;;;Dieses Gefahrgut wird OHNE MHB und OHNE IMO/UN Nummer abgesendet. Eine gelbe Violation-Meldung aus dem NSW ist zu ignorieren
|
|
||||||
|
Binary file not shown.
BIN
misc/db.sqlite
BIN
misc/db.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user