Compare commits
3 Commits
develop
...
feature/7.
| Author | SHA1 | Date | |
|---|---|---|---|
| fbf595ffd4 | |||
| 96a311ba18 | |||
| f07bd3fb62 |
@ -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-10.0.0.0" newVersion="10.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
@ -121,7 +121,7 @@
|
|||||||
</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-10.0.0.0" newVersion="10.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
@ -129,11 +129,11 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="DocumentFormat.OpenXml.Framework" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
<assemblyIdentity name="DocumentFormat.OpenXml.Framework" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
<assemblyIdentity name="DocumentFormat.OpenXml" publicKeyToken="8fb06cb64d019a17" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-3.4.1.0" newVersion="3.4.1.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Bcl.HashCode" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="Microsoft.Bcl.HashCode" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
|||||||
113
ENI2/Controls/WASExemptionsControl.xaml
Normal file
113
ENI2/Controls/WASExemptionsControl.xaml
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<UserControl x:Class="ENI2.Controls.WASExemptionsControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ENI2.Controls"
|
||||||
|
xmlns:util="clr-namespace:ENI2.Util"
|
||||||
|
xmlns:p="clr-namespace:ENI2.Properties"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Grid.Row="0" Content="{x:Static p:Resources.textWASExemptions}" />
|
||||||
|
<GroupBox Name="groupBoxRP" Header="" Grid.Row="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="40" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="40" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="50" />
|
||||||
|
<ColumnDefinition Width="30" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="140" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button x:Name="buttonSave" Grid.Column="6" Margin="2" Content="Save all changes" Click="buttonSave_Click" />
|
||||||
|
<Button x:Name="buttonDeleteExpired" Grid.Column="7" Margin="2" Content="Delete expired" Click="buttonDeleteExpired_Click" />
|
||||||
|
<Button x:Name="buttonAdd" Grid.Column="8" Margin="2" Content="Add new" Click="buttonAdd_Click" />
|
||||||
|
<Button x:Name="buttonImport" Grid.Column="9" Margin="2" Content="{x:Static p:Resources.textImportFromExcel}" Click="buttonImport_Click" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridWASExemptions" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
|
SelectionMode="Extended" AutoGenerateColumns="False" CellEditEnding="dataGridWASExemptions_CellEditEnding" CanUserAddRows="False"
|
||||||
|
MouseDoubleClick="dataGridWASExemptions_MouseDoubleClick" BeginningEdit="dataGridWASExemptions_BeginningEdit">
|
||||||
|
<local:ENIDataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ValidUntil, Converter={util:ExpiryStateConverter}}" Value="Expired">
|
||||||
|
<Setter Property="Background" Value="LightGray" />
|
||||||
|
<Setter Property="Foreground" Value="Gray" />
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding ValidUntil, Converter={util:ExpiryStateConverter}}" Value="ExpiringSoon">
|
||||||
|
<Setter Property="Background" Value="LightYellow" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</local:ENIDataGrid.RowStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn x:Name="columnIMO" Header="IMO" IsReadOnly="False">
|
||||||
|
<DataGridTextColumn.Binding>
|
||||||
|
<Binding Path="IMO" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<util:RequiredStringValidationRule />
|
||||||
|
<util:StringValidationRule MaxLength="7" />
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</DataGridTextColumn.Binding>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn x:Name="columnShipName" Header="Ship name" IsReadOnly="False">
|
||||||
|
<DataGridTextColumn.Binding>
|
||||||
|
<Binding Path="ShipName" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<util:StringValidationRule MaxLength="100" />
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</DataGridTextColumn.Binding>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn x:Name="columnPort" Header="Port" IsReadOnly="False">
|
||||||
|
<DataGridTextColumn.Binding>
|
||||||
|
<Binding Path="Port" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<util:RequiredStringValidationRule />
|
||||||
|
<util:StringValidationRule MaxLength="5" />
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</DataGridTextColumn.Binding>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn x:Name="columnValidUntil" Header="ValidUntil" IsReadOnly="False">
|
||||||
|
<DataGridTextColumn.Binding>
|
||||||
|
<Binding Path="ValidUntil" Mode="TwoWay" StringFormat="{}{0:d}" UpdateSourceTrigger="PropertyChanged">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<util:RequiredDateValidationRule />
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</DataGridTextColumn.Binding>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
<DataGridTextColumn x:Name="columnRemarks" Header="Remarks" IsReadOnly="False" Width="*">
|
||||||
|
<DataGridTextColumn.Binding>
|
||||||
|
<Binding Path="Remarks" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<util:StringValidationRule MaxLength="255" />
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</DataGridTextColumn.Binding>
|
||||||
|
</DataGridTextColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</local:ENIDataGrid>
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
262
ENI2/Controls/WASExemptionsControl.xaml.cs
Normal file
262
ENI2/Controls/WASExemptionsControl.xaml.cs
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
using bsmd.database;
|
||||||
|
using ENI2.Excel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace ENI2.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for WASExemptionsControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class WASExemptionsControl : UserControl
|
||||||
|
{
|
||||||
|
private DataGridColumn _editColumn;
|
||||||
|
private object _editOriginalValue;
|
||||||
|
|
||||||
|
public WASExemptionsControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.dataGridWASExemptions.ItemsSource = WASExemption.Exemptions;
|
||||||
|
var view = CollectionViewSource.GetDefaultView(WASExemption.Exemptions);
|
||||||
|
view.SortDescriptions.Add(new SortDescription(nameof(WASExemption.ShipName), ListSortDirection.Ascending));
|
||||||
|
_ = WASExemption.EnsureLoadedAsync();
|
||||||
|
|
||||||
|
this.dataGridWASExemptions.ContextMenu = new ContextMenu();
|
||||||
|
MenuItem addItem = new MenuItem
|
||||||
|
{
|
||||||
|
Header = Properties.Resources.textAdd,
|
||||||
|
Icon = new System.Windows.Controls.Image { Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) }
|
||||||
|
};
|
||||||
|
addItem.Click += AddItem_Click;
|
||||||
|
this.dataGridWASExemptions.ContextMenu.Items.Add(addItem);
|
||||||
|
|
||||||
|
MenuItem delItem = new MenuItem
|
||||||
|
{
|
||||||
|
Header = Properties.Resources.textDelete,
|
||||||
|
Icon = new System.Windows.Controls.Image { Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) }
|
||||||
|
};
|
||||||
|
delItem.Click += DelItem_Click;
|
||||||
|
this.dataGridWASExemptions.ContextMenu.Items.Add(delItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_ = SaveExemptionsAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonImport_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var imported = ExcelLocalImportHelper.ImportWASExemptions();
|
||||||
|
int skipped = 0;
|
||||||
|
foreach (var exemption in imported)
|
||||||
|
{
|
||||||
|
if (IsDuplicateIMOAndPort(exemption, exemption.IMO, exemption.Port))
|
||||||
|
{
|
||||||
|
skipped++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
WASExemption.Exemptions.Add(exemption);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skipped > 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{skipped} duplicate rows were skipped (same IMO and Port).",
|
||||||
|
Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
AddNewExemption();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void buttonDeleteExpired_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Delete all expired exemptions?", Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) != MessageBoxResult.Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DateTime today = DateTime.Today;
|
||||||
|
var toRemove = new List<WASExemption>();
|
||||||
|
|
||||||
|
foreach (var exemption in WASExemption.Exemptions)
|
||||||
|
{
|
||||||
|
if (exemption.ValidUntil.Date < today)
|
||||||
|
{
|
||||||
|
int result = await DBManagerAsync.DeleteAsync(exemption);
|
||||||
|
if (result == 1 || exemption.IsNew)
|
||||||
|
{
|
||||||
|
toRemove.Add(exemption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var exemption in toRemove)
|
||||||
|
{
|
||||||
|
WASExemption.Exemptions.Remove(exemption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridWASExemptions_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Row?.Item is WASExemption exemption)
|
||||||
|
{
|
||||||
|
if (e.Column == columnIMO || e.Column == columnPort)
|
||||||
|
{
|
||||||
|
string newValue = (e.EditingElement as TextBox)?.Text?.Trim();
|
||||||
|
string imo = e.Column == columnIMO ? newValue : exemption.IMO?.Trim();
|
||||||
|
string port = e.Column == columnPort ? newValue : exemption.Port?.Trim();
|
||||||
|
|
||||||
|
if (!imo.IsNullOrEmpty() && !port.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
if (IsDuplicateIMOAndPort(exemption, imo, port))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Duplicate entry detected. IMO can only appear once per Port.",
|
||||||
|
Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
if (e.EditingElement is TextBox tb)
|
||||||
|
{
|
||||||
|
tb.Text = _editOriginalValue as string ?? "";
|
||||||
|
}
|
||||||
|
e.Cancel = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exemption.IsDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridWASExemptions_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
|
||||||
|
{
|
||||||
|
_editColumn = e.Column;
|
||||||
|
if (e.Row?.Item is WASExemption exemption)
|
||||||
|
{
|
||||||
|
if (e.Column == columnIMO)
|
||||||
|
_editOriginalValue = exemption.IMO;
|
||||||
|
else if (e.Column == columnPort)
|
||||||
|
_editOriginalValue = exemption.Port;
|
||||||
|
else
|
||||||
|
_editOriginalValue = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridWASExemptions_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
AddNewExemption();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void DelItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.dataGridWASExemptions.SelectedItems.Count > 0)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Are you sure to delete the selected values?", Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) ==
|
||||||
|
MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
var selectedItems = new List<WASExemption>();
|
||||||
|
foreach (WASExemption was in this.dataGridWASExemptions.SelectedItems)
|
||||||
|
selectedItems.Add(was);
|
||||||
|
|
||||||
|
foreach (WASExemption was in selectedItems)
|
||||||
|
{
|
||||||
|
int result = await DBManagerAsync.DeleteAsync(was);
|
||||||
|
if (result == 1 || was.IsNew)
|
||||||
|
{
|
||||||
|
WASExemption.Exemptions.Remove(was);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddNewExemption()
|
||||||
|
{
|
||||||
|
var exemption = new WASExemption
|
||||||
|
{
|
||||||
|
ValidUntil = DateTime.Today,
|
||||||
|
IsDirty = true
|
||||||
|
};
|
||||||
|
WASExemption.Exemptions.Add(exemption);
|
||||||
|
this.dataGridWASExemptions.SelectedItem = exemption;
|
||||||
|
this.dataGridWASExemptions.ScrollIntoView(exemption);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveExemptionsAsync()
|
||||||
|
{
|
||||||
|
int totalSaves = 0;
|
||||||
|
var invalids = new List<WASExemption>();
|
||||||
|
|
||||||
|
foreach (var exemption in WASExemption.Exemptions)
|
||||||
|
{
|
||||||
|
if (exemption.IsNew || exemption.IsDirty)
|
||||||
|
{
|
||||||
|
if (!IsValid(exemption))
|
||||||
|
{
|
||||||
|
invalids.Add(exemption);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
totalSaves += await DBManagerAsync.SaveAsync(exemption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (invalids.Count > 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Some rows are missing required fields (IMO, Port, ValidUntil) and were not saved.",
|
||||||
|
Properties.Resources.textCaptionError,
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalSaves > 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{totalSaves} WAS exemptions saved", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsValid(WASExemption exemption)
|
||||||
|
{
|
||||||
|
if (exemption == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (exemption.IMO.IsNullOrEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (exemption.Port.IsNullOrEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (exemption.ValidUntil == default(DateTime))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsDuplicateIMOAndPort(WASExemption current, string imo, string port)
|
||||||
|
{
|
||||||
|
if (imo.IsNullOrEmpty() || port.IsNullOrEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
string imoKey = imo.Trim();
|
||||||
|
string portKey = port.Trim();
|
||||||
|
|
||||||
|
return WASExemption.Exemptions.Any(x =>
|
||||||
|
!ReferenceEquals(x, current) &&
|
||||||
|
!x.IMO.IsNullOrEmpty() &&
|
||||||
|
!x.Port.IsNullOrEmpty() &&
|
||||||
|
string.Equals(x.IMO.Trim(), imoKey, StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
string.Equals(x.Port.Trim(), portKey, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1231,7 +1231,7 @@ namespace ENI2
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region WAS special max capa rules regarding next port
|
#region WAS special max capa rules regarding next port + exemption list
|
||||||
|
|
||||||
{
|
{
|
||||||
string wasMessageGroup = this.MessageGroupForMessage(wasMessage);
|
string wasMessageGroup = this.MessageGroupForMessage(wasMessage);
|
||||||
@ -1242,6 +1242,40 @@ namespace ENI2
|
|||||||
NOA_NOD noa_nod = noanodMessage.Elements[0] as NOA_NOD;
|
NOA_NOD noa_nod = noanodMessage.Elements[0] as NOA_NOD;
|
||||||
WAS was = wasMessage.Elements[0] as WAS;
|
WAS was = wasMessage.Elements[0] as WAS;
|
||||||
|
|
||||||
|
bool shipHasCurrentExemption = false;
|
||||||
|
|
||||||
|
DateTime eta_actual = DateTime.Now;
|
||||||
|
if(this.Core.IsTransit && noa_nod.ETAToKielCanal.HasValue)
|
||||||
|
eta_actual = noa_nod.ETAToKielCanal.Value.Date;
|
||||||
|
else if(!this.Core.IsTransit && noa_nod.ETAToPortOfCall.HasValue)
|
||||||
|
eta_actual = noa_nod.ETAToPortOfCall.Value.Date;
|
||||||
|
|
||||||
|
foreach (WASExemption we in WASExemption.Exemptions)
|
||||||
|
{
|
||||||
|
if(we.IMO.Equals(this.Core.IMO) && we.Port.Equals(this.Core.PoC))
|
||||||
|
{
|
||||||
|
if(we.ValidUntil.Date.AddDays(1) > eta_actual)
|
||||||
|
{
|
||||||
|
shipHasCurrentExemption = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(was.WasteDisposalValidExemption ?? false) && shipHasCurrentExemption)
|
||||||
|
{
|
||||||
|
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Note: Valid waste exemption noted", null, "Waste", null, "WAS");
|
||||||
|
mv.MessageGroupName = wasMessageGroup;
|
||||||
|
vViolations.Add(mv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((was.WasteDisposalValidExemption ?? false) && !shipHasCurrentExemption)
|
||||||
|
{
|
||||||
|
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Note: No valid waste exemption noted. Please check", null, "Waste", null, "WAS");
|
||||||
|
mv.MessageGroupName = wasMessageGroup;
|
||||||
|
vViolations.Add(mv);
|
||||||
|
}
|
||||||
|
|
||||||
bool isSpecialNextPort = RuleEngine.IsSpecialNextPort(noa_nod.NextPort);
|
bool isSpecialNextPort = RuleEngine.IsSpecialNextPort(noa_nod.NextPort);
|
||||||
|
|
||||||
if (isSpecialNextPort)
|
if (isSpecialNextPort)
|
||||||
|
|||||||
115
ENI2/ENI2.csproj
115
ENI2/ENI2.csproj
@ -37,7 +37,7 @@
|
|||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>publish.html</WebPage>
|
<WebPage>publish.html</WebPage>
|
||||||
<ApplicationRevision>2</ApplicationRevision>
|
<ApplicationRevision>2</ApplicationRevision>
|
||||||
<ApplicationVersion>7.2.14.2</ApplicationVersion>
|
<ApplicationVersion>7.2.15.0</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@ -140,11 +140,11 @@
|
|||||||
<Reference Include="ClosedXML.Parser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1d5f7376574c51ec, processorArchitecture=MSIL">
|
<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>
|
<HintPath>packages\ClosedXML.Parser.2.0.0\lib\netstandard2.0\ClosedXML.Parser.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DocumentFormat.OpenXml, Version=3.3.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
<Reference Include="DocumentFormat.OpenXml, Version=3.4.1.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\DocumentFormat.OpenXml.3.3.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
|
<HintPath>packages\DocumentFormat.OpenXml.3.4.1\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DocumentFormat.OpenXml.Framework, Version=3.3.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
<Reference Include="DocumentFormat.OpenXml.Framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\DocumentFormat.OpenXml.Framework.3.3.0\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath>
|
<HintPath>packages\DocumentFormat.OpenXml.Framework.3.4.1\lib\net46\DocumentFormat.OpenXml.Framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
|
<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>
|
<HintPath>packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll</HintPath>
|
||||||
@ -152,68 +152,68 @@
|
|||||||
<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=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.10.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.10.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.Cryptography, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.Cryptography, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Bcl.Cryptography.10.0.0\lib\net462\Microsoft.Bcl.Cryptography.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.Cryptography.10.0.2\lib\net462\Microsoft.Bcl.Cryptography.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.HashCode, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.HashCode, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll</HintPath>
|
<HintPath>packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.DependencyInjection.10.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.DependencyInjection.10.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Logging.10.0.0\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Logging.10.0.2\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.10.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Options, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Options, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Options.10.0.0\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Options.10.0.2\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Primitives, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Extensions.Primitives.10.0.0\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
<HintPath>packages\Microsoft.Extensions.Primitives.10.0.2\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MigraDoc.DocumentObjectModel, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="MigraDoc.DocumentObjectModel, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp-MigraDoc.6.2.3\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll</HintPath>
|
<HintPath>packages\PDFsharp-MigraDoc.6.2.4\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MigraDoc.Rendering, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="MigraDoc.Rendering, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp-MigraDoc.6.2.3\lib\netstandard2.0\MigraDoc.Rendering.dll</HintPath>
|
<HintPath>packages\PDFsharp-MigraDoc.6.2.4\lib\netstandard2.0\MigraDoc.Rendering.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MigraDoc.RtfRendering, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="MigraDoc.RtfRendering, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp-MigraDoc.6.2.3\lib\netstandard2.0\MigraDoc.RtfRendering.dll</HintPath>
|
<HintPath>packages\PDFsharp-MigraDoc.6.2.4\lib\netstandard2.0\MigraDoc.RtfRendering.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.BarCodes, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.BarCodes, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.BarCodes.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.BarCodes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Charting, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Charting, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.Charting.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.Charting.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Cryptography, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Cryptography, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.Cryptography.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.Cryptography.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Quality, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Quality, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.Quality.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.Quality.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Shared, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Shared, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.Shared.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.Shared.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.Snippets, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.Snippets, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.Snippets.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.Snippets.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.System, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.System, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.System.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.System.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PdfSharp.WPFonts, Version=6.2.3.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
<Reference Include="PdfSharp.WPFonts, Version=6.2.4.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PDFsharp.6.2.3\lib\netstandard2.0\PdfSharp.WPFonts.dll</HintPath>
|
<HintPath>packages\PDFsharp.6.2.4\lib\netstandard2.0\PdfSharp.WPFonts.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RBush, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c77e27b81f4d0187, processorArchitecture=MSIL">
|
<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>
|
<HintPath>packages\RBush.Signed.4.0.0\lib\net47\RBush.dll</HintPath>
|
||||||
@ -231,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=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Diagnostics.DiagnosticSource.10.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
<HintPath>packages\System.Diagnostics.DiagnosticSource.10.0.2\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Formats.Asn1, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Formats.Asn1, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Formats.Asn1.10.0.0\lib\net462\System.Formats.Asn1.dll</HintPath>
|
<HintPath>packages\System.Formats.Asn1.10.0.2\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">
|
||||||
@ -251,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=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Security.Cryptography.Pkcs, Version=10.0.0.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\System.Security.Cryptography.Pkcs.10.0.0\lib\net462\System.Security.Cryptography.Pkcs.dll</HintPath>
|
<HintPath>packages\System.Security.Cryptography.Pkcs.10.0.2\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" />
|
||||||
@ -261,6 +261,7 @@
|
|||||||
<HintPath>packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@ -329,6 +330,9 @@
|
|||||||
<Compile Include="Controls\ValueMappingsControl.xaml.cs">
|
<Compile Include="Controls\ValueMappingsControl.xaml.cs">
|
||||||
<DependentUpon>ValueMappingsControl.xaml</DependentUpon>
|
<DependentUpon>ValueMappingsControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\WASExemptionsControl.xaml.cs">
|
||||||
|
<DependentUpon>WASExemptionsControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="EditControls\ChangePasswordDialog.xaml.cs">
|
<Compile Include="EditControls\ChangePasswordDialog.xaml.cs">
|
||||||
<DependentUpon>ChangePasswordDialog.xaml</DependentUpon>
|
<DependentUpon>ChangePasswordDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -585,11 +589,14 @@
|
|||||||
<Compile Include="Util\EnumToCollectionConverter.cs" />
|
<Compile Include="Util\EnumToCollectionConverter.cs" />
|
||||||
<Compile Include="Util\ExpandableListConverter.cs" />
|
<Compile Include="Util\ExpandableListConverter.cs" />
|
||||||
<Compile Include="Util\Extensions.cs" />
|
<Compile Include="Util\Extensions.cs" />
|
||||||
|
<Compile Include="Util\ExpiryStateConverter.cs" />
|
||||||
<Compile Include="Util\GlobalStructures.cs" />
|
<Compile Include="Util\GlobalStructures.cs" />
|
||||||
<Compile Include="Util\HighlightService.cs" />
|
<Compile Include="Util\HighlightService.cs" />
|
||||||
<Compile Include="Util\InverseBooleanConverter.cs" />
|
<Compile Include="Util\InverseBooleanConverter.cs" />
|
||||||
<Compile Include="Util\NullImageConverter.cs" />
|
<Compile Include="Util\NullImageConverter.cs" />
|
||||||
<Compile Include="Util\NumberValidationRule.cs" />
|
<Compile Include="Util\NumberValidationRule.cs" />
|
||||||
|
<Compile Include="Util\RequiredDateValidationRule.cs" />
|
||||||
|
<Compile Include="Util\RequiredStringValidationRule.cs" />
|
||||||
<Compile Include="Util\SettingBindingExtension.cs" />
|
<Compile Include="Util\SettingBindingExtension.cs" />
|
||||||
<Compile Include="Util\StringValidationRule.cs" />
|
<Compile Include="Util\StringValidationRule.cs" />
|
||||||
<Compile Include="Util\TrimStringConverter.cs" />
|
<Compile Include="Util\TrimStringConverter.cs" />
|
||||||
@ -645,6 +652,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Controls\WASExemptionsControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="ControlTemplates.xaml">
|
<Page Include="ControlTemplates.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -1025,7 +1036,7 @@
|
|||||||
<Resource Include="Resources\trafficlight_off.png" />
|
<Resource Include="Resources\trafficlight_off.png" />
|
||||||
<Resource Include="Resources\trafficlight_red.png" />
|
<Resource Include="Resources\trafficlight_red.png" />
|
||||||
<Resource Include="Resources\trafficlight_yellow.png" />
|
<Resource Include="Resources\trafficlight_yellow.png" />
|
||||||
<None Include="Resources\user_edit.png" />
|
<Resource Include="Resources\user_edit.png" />
|
||||||
<Resource Include="Resources\delete2.png" />
|
<Resource Include="Resources\delete2.png" />
|
||||||
<None Include="Resources\mail_new.png" />
|
<None Include="Resources\mail_new.png" />
|
||||||
<Resource Include="Resources\document_view.png" />
|
<Resource Include="Resources\document_view.png" />
|
||||||
|
|||||||
@ -329,5 +329,81 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region WAS Exemptions Import from Excel
|
||||||
|
|
||||||
|
public static List<WASExemption> ImportWASExemptions()
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog
|
||||||
|
{
|
||||||
|
Filter = "Excel Files|*.xls;*.xlsx"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ofd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||||
|
using (var workbook = new XLWorkbook(stream))
|
||||||
|
{
|
||||||
|
var worksheet = workbook.Worksheet(1);
|
||||||
|
var range = worksheet.RangeUsed();
|
||||||
|
var rows = range.RowsUsed().Skip(1); // first row is header
|
||||||
|
int columnCount = range.ColumnCount();
|
||||||
|
|
||||||
|
if (columnCount < 5)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Sheet must have at least 5 Columns of data");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<WASExemption> exemptions = new List<WASExemption>();
|
||||||
|
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty() && row.Cell(3).IsEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
WASExemption was = new WASExemption();
|
||||||
|
|
||||||
|
if (!row.Cell(1).IsEmpty())
|
||||||
|
was.IMO = Truncate(row.Cell(1).GetString().Trim(), 7);
|
||||||
|
if (!row.Cell(2).IsEmpty())
|
||||||
|
was.ShipName = Truncate(row.Cell(2).GetString().Trim(), 100);
|
||||||
|
if (!row.Cell(3).IsEmpty())
|
||||||
|
was.Port = Truncate(row.Cell(3).GetString().Trim(), 5);
|
||||||
|
|
||||||
|
if (!row.Cell(4).IsEmpty())
|
||||||
|
was.ValidUntil = row.Cell(4).GetDateTime();
|
||||||
|
else
|
||||||
|
throw new InvalidDataException($"Missing ValidUntil value in row {row.RowNumber()}");
|
||||||
|
|
||||||
|
if (!row.Cell(5).IsEmpty())
|
||||||
|
was.Remarks = Truncate(row.Cell(5).GetString().Trim(), 255);
|
||||||
|
|
||||||
|
was.IsDirty = true;
|
||||||
|
exemptions.Add(was);
|
||||||
|
}
|
||||||
|
|
||||||
|
return exemptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError,
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<WASExemption>();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private static string Truncate(string value, int maxLength)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
return null;
|
||||||
|
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,18 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem x:Name="menuItemNotifications" Header="{x:Static p:Resources.textNotifications}" Click="radioButton_Click" Background="LightBlue"/>
|
<MenuItem x:Name="menuItemNotifications" Header="{x:Static p:Resources.textNotifications}" Click="radioButton_Click" Background="LightBlue"/>
|
||||||
<MenuItem x:Name="menuItemStatus" Header="{x:Static p:Resources.textServerStatus}" Click="radioButton_Click" />
|
<MenuItem x:Name="menuItemStatus" Header="{x:Static p:Resources.textServerStatus}" Click="radioButton_Click" />
|
||||||
<MenuItem x:Name="menuItemUserAdministration" Header="{x:Static p:Resources.textUserAdministration}" Click="radioButton_Click" Visibility="Hidden"/>
|
<MenuItem x:Name="menuItemAdmin" Header="_Admin" Visibility="Hidden">
|
||||||
|
<MenuItem x:Name="menuItemUserAdministration" Header="{x:Static p:Resources.textUserAdministration}" Click="radioButton_Click">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Image Source="Resources/user_edit.png" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem x:Name="menuItemWASExemptions" Header="{x:Static p:Resources.textWASExemptions}" Click="radioButton_Click">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<Image Source="Resources/garbage.png" />
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
<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="menuItemEasyPeasy" Header="{x:Static p:Resources.textEasyPeasy}" Click="radioButton_Click" Visibility="Hidden" />
|
||||||
|
|||||||
@ -40,6 +40,7 @@ namespace ENI2
|
|||||||
private readonly SucheControl sucheControl;
|
private readonly SucheControl sucheControl;
|
||||||
private CompareExcelDialog compareExcelDialog;
|
private CompareExcelDialog compareExcelDialog;
|
||||||
private EasyPeasyControl easyPeasyControl;
|
private EasyPeasyControl easyPeasyControl;
|
||||||
|
private WASExemptionsControl wasExemptionsControl;
|
||||||
|
|
||||||
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);
|
||||||
@ -284,12 +285,12 @@ namespace ENI2
|
|||||||
_selectedMenuItem = mi;
|
_selectedMenuItem = mi;
|
||||||
_selectedMenuItem.Background = Brushes.LightBlue;
|
_selectedMenuItem.Background = Brushes.LightBlue;
|
||||||
|
|
||||||
if(sender == this.menuItemNotifications)
|
if (sender == this.menuItemNotifications)
|
||||||
{
|
{
|
||||||
this.rootContainer.Children.Add(this.mainFrame);
|
this.rootContainer.Children.Add(this.mainFrame);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(sender == this.menuItemUserAdministration)
|
else if (sender == this.menuItemUserAdministration)
|
||||||
{
|
{
|
||||||
if (this.rpControl == null)
|
if (this.rpControl == null)
|
||||||
{
|
{
|
||||||
@ -299,7 +300,7 @@ namespace ENI2
|
|||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(this.rpControl);
|
this.rootContainer.Children.Add(this.rpControl);
|
||||||
}
|
}
|
||||||
else if(sender == this.menuItemMaersk)
|
else if (sender == this.menuItemMaersk)
|
||||||
{
|
{
|
||||||
if (this.moControl == null)
|
if (this.moControl == null)
|
||||||
{
|
{
|
||||||
@ -309,30 +310,38 @@ namespace ENI2
|
|||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(moControl);
|
this.rootContainer.Children.Add(moControl);
|
||||||
}
|
}
|
||||||
else if(sender == this.menuItemStatus)
|
else if (sender == this.menuItemStatus)
|
||||||
{
|
{
|
||||||
if(this.statusControl == null)
|
if (this.statusControl == null)
|
||||||
{
|
{
|
||||||
this.statusControl = new ServerStatusControl();
|
this.statusControl = new ServerStatusControl();
|
||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(this.statusControl);
|
this.rootContainer.Children.Add(this.statusControl);
|
||||||
}
|
}
|
||||||
else if(sender == this.menuItemValueMappings)
|
else if (sender == this.menuItemValueMappings)
|
||||||
{
|
{
|
||||||
if(this.vmControl == null)
|
if (this.vmControl == null)
|
||||||
{
|
{
|
||||||
this.vmControl = new ValueMappingsControl();
|
this.vmControl = new ValueMappingsControl();
|
||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(this.vmControl);
|
this.rootContainer.Children.Add(this.vmControl);
|
||||||
}
|
}
|
||||||
else if(sender == this.menuItemEasyPeasy)
|
else if (sender == this.menuItemEasyPeasy)
|
||||||
{
|
{
|
||||||
if(this.easyPeasyControl == null)
|
if (this.easyPeasyControl == null)
|
||||||
{
|
{
|
||||||
this.easyPeasyControl = new EasyPeasyControl();
|
this.easyPeasyControl = new EasyPeasyControl();
|
||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(this.easyPeasyControl);
|
this.rootContainer.Children.Add(this.easyPeasyControl);
|
||||||
}
|
}
|
||||||
|
else if (sender == this.menuItemWASExemptions)
|
||||||
|
{
|
||||||
|
if(this.wasExemptionsControl == null)
|
||||||
|
{
|
||||||
|
this.wasExemptionsControl = new WASExemptionsControl();
|
||||||
|
}
|
||||||
|
this.rootContainer.Children.Add(this.wasExemptionsControl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCompareSheets_Click(object sender, RoutedEventArgs ev)
|
private void buttonCompareSheets_Click(object sender, RoutedEventArgs ev)
|
||||||
@ -704,7 +713,7 @@ namespace ENI2
|
|||||||
this.menuItemEasyPeasy.Visibility = Visibility.Visible;
|
this.menuItemEasyPeasy.Visibility = Visibility.Visible;
|
||||||
if (this.userEntity.IsAdmin)
|
if (this.userEntity.IsAdmin)
|
||||||
{
|
{
|
||||||
this.menuItemUserAdministration.Visibility = Visibility.Visible;
|
this.menuItemAdmin.Visibility = Visibility.Visible;
|
||||||
this.sucheControl.AdminMode = true;
|
this.sucheControl.AdminMode = true;
|
||||||
}
|
}
|
||||||
this.menuItemValueMappings.Visibility = this.userEntity.IsEditor ? Visibility.Visible : Visibility.Hidden;
|
this.menuItemValueMappings.Visibility = this.userEntity.IsEditor ? Visibility.Visible : Visibility.Hidden;
|
||||||
@ -763,8 +772,8 @@ namespace ENI2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
ENI2/Properties/Resources.Designer.cs
generated
9
ENI2/Properties/Resources.Designer.cs
generated
@ -6327,6 +6327,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to WAS exemptions.
|
||||||
|
/// </summary>
|
||||||
|
public static string textWASExemptions {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textWASExemptions", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Waste.
|
/// Looks up a localized string similar to Waste.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2268,4 +2268,7 @@ Proceed?</value>
|
|||||||
<data name="textEasyPeasy" xml:space="preserve">
|
<data name="textEasyPeasy" xml:space="preserve">
|
||||||
<value>Easy Peasy 🍋</value>
|
<value>Easy Peasy 🍋</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textWASExemptions" xml:space="preserve">
|
||||||
|
<value>WAS exemptions</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
43
ENI2/Util/ExpiryStateConverter.cs
Normal file
43
ENI2/Util/ExpiryStateConverter.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
|
||||||
|
namespace ENI2.Util
|
||||||
|
{
|
||||||
|
public class ExpiryStateConverter : MarkupExtension, IValueConverter
|
||||||
|
{
|
||||||
|
private static ExpiryStateConverter _converter;
|
||||||
|
|
||||||
|
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
if (_converter == null)
|
||||||
|
{
|
||||||
|
_converter = new ExpiryStateConverter();
|
||||||
|
}
|
||||||
|
return _converter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (!(value is DateTime dt))
|
||||||
|
return "Unknown";
|
||||||
|
|
||||||
|
DateTime today = DateTime.Today;
|
||||||
|
DateTime validUntil = dt.Date;
|
||||||
|
|
||||||
|
if (validUntil < today)
|
||||||
|
return "Expired";
|
||||||
|
|
||||||
|
if (validUntil <= today.AddMonths(1))
|
||||||
|
return "ExpiringSoon";
|
||||||
|
|
||||||
|
return "Ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
ENI2/Util/RequiredDateValidationRule.cs
Normal file
28
ENI2/Util/RequiredDateValidationRule.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace ENI2.Util
|
||||||
|
{
|
||||||
|
public class RequiredDateValidationRule : ValidationRule
|
||||||
|
{
|
||||||
|
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
return new ValidationResult(false, "Date is required");
|
||||||
|
|
||||||
|
if (value is DateTime dt)
|
||||||
|
{
|
||||||
|
if (dt == default(DateTime))
|
||||||
|
return new ValidationResult(false, "Date is required");
|
||||||
|
}
|
||||||
|
else if (value is string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(text))
|
||||||
|
return new ValidationResult(false, "Date is required");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ValidationResult.ValidResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
ENI2/Util/RequiredStringValidationRule.cs
Normal file
22
ENI2/Util/RequiredStringValidationRule.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace ENI2.Util
|
||||||
|
{
|
||||||
|
public class RequiredStringValidationRule : ValidationRule
|
||||||
|
{
|
||||||
|
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
return new ValidationResult(false, "Value is required");
|
||||||
|
|
||||||
|
if (value is string text)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(text))
|
||||||
|
return new ValidationResult(false, "Value is required");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ValidationResult.ValidResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,33 +2,33 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="ClosedXML" version="0.105.0" targetFramework="net48" />
|
<package id="ClosedXML" version="0.105.0" targetFramework="net48" />
|
||||||
<package id="ClosedXML.Parser" version="2.0.0" 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" version="3.4.1" targetFramework="net481" />
|
||||||
<package id="DocumentFormat.OpenXml.Framework" version="3.3.0" targetFramework="net481" />
|
<package id="DocumentFormat.OpenXml.Framework" version="3.4.1" targetFramework="net481" />
|
||||||
<package id="ExcelNumberFormat" version="1.1.0" targetFramework="net48" />
|
<package id="ExcelNumberFormat" version="1.1.0" targetFramework="net48" />
|
||||||
<package id="Extended.Wpf.Toolkit" version="5.0.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="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="Microsoft.Bcl.Cryptography" version="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Bcl.Cryptography" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net481" />
|
<package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net481" />
|
||||||
<package id="Microsoft.Extensions.DependencyInjection" version="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Extensions.DependencyInjection" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="Microsoft.Extensions.Logging" version="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Extensions.Logging" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Extensions.Logging.Abstractions" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="Microsoft.Extensions.Options" version="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Extensions.Options" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="Microsoft.Extensions.Primitives" version="10.0.0" targetFramework="net481" />
|
<package id="Microsoft.Extensions.Primitives" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="PDFsharp" version="6.2.3" targetFramework="net481" />
|
<package id="PDFsharp" version="6.2.4" targetFramework="net481" />
|
||||||
<package id="PDFsharp-MigraDoc" version="6.2.3" targetFramework="net481" />
|
<package id="PDFsharp-MigraDoc" version="6.2.4" targetFramework="net481" />
|
||||||
<package id="RBush.Signed" version="4.0.0" targetFramework="net48" />
|
<package id="RBush.Signed" version="4.0.0" targetFramework="net48" />
|
||||||
<package id="SixLabors.Fonts" version="1.0.0" targetFramework="net481" />
|
<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="10.0.0" targetFramework="net481" />
|
<package id="System.Diagnostics.DiagnosticSource" version="10.0.2" targetFramework="net481" />
|
||||||
<package id="System.Formats.Asn1" version="10.0.0" targetFramework="net481" />
|
<package id="System.Formats.Asn1" version="10.0.2" targetFramework="net481" />
|
||||||
<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="10.0.0" targetFramework="net481" />
|
<package id="System.Security.Cryptography.Pkcs" version="10.0.2" targetFramework="net481" />
|
||||||
<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>
|
||||||
18
SQL/Update_To_7.2.15.sql
Normal file
18
SQL/Update_To_7.2.15.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
PRINT N'Creating [dbo].[WASExemption] if missing...';
|
||||||
|
GO
|
||||||
|
IF OBJECT_ID(N'dbo.WASExemption', N'U') IS NULL
|
||||||
|
BEGIN
|
||||||
|
CREATE TABLE [dbo].[WASExemption] (
|
||||||
|
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||||
|
[IMO] NCHAR (7) NOT NULL,
|
||||||
|
[ShipName] NVARCHAR (100) NULL,
|
||||||
|
[Port] NCHAR (5) NOT NULL,
|
||||||
|
[ValidUntil] DATETIME NOT NULL,
|
||||||
|
[Remarks] NVARCHAR (255) NULL,
|
||||||
|
PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||||
|
);
|
||||||
|
PRINT N'Table [dbo].[WASExemption] created.';
|
||||||
|
END
|
||||||
|
GO
|
||||||
@ -103,6 +103,15 @@ namespace bsmd.database
|
|||||||
return (await vm.LoadListAsync(reader)).ConvertAll(x => (ValueMapping)x);
|
return (await vm.LoadListAsync(reader)).ConvertAll(x => (ValueMapping)x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<List<WASExemption>> LoadWASExemptionsAsync()
|
||||||
|
{
|
||||||
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
WASExemption was = new WASExemption();
|
||||||
|
was.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
|
||||||
|
SqlDataReader reader = await PerformCommandAsync(cmd);
|
||||||
|
return (await was.LoadListAsync(reader)).ConvertAll(x => (WASExemption)x);
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<List<AGNT_Template>> GetAGNTTemplatesAsync()
|
public static async Task<List<AGNT_Template>> GetAGNTTemplatesAsync()
|
||||||
{
|
{
|
||||||
SqlCommand cmd = new SqlCommand();
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
|||||||
@ -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.14")]
|
[assembly: AssemblyInformationalVersion("7.2.15")]
|
||||||
[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.14.*")]
|
[assembly: AssemblyVersion("7.2.15.*")]
|
||||||
|
|
||||||
|
|||||||
186
bsmd.database/WASExemption.cs
Normal file
186
bsmd.database/WASExemption.cs
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
// Copyright (c) 2026-present schick Informatik
|
||||||
|
// Description: WAS Exemption entries
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
public class WASExemption : DatabaseEntityAsync, IComparable
|
||||||
|
{
|
||||||
|
#region Construction
|
||||||
|
|
||||||
|
public WASExemption()
|
||||||
|
{
|
||||||
|
this.tablename = "[dbo].[WASExemption]";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
private static ObservableCollection<WASExemption> _exemptions;
|
||||||
|
private static Task _loadTask;
|
||||||
|
|
||||||
|
public static ObservableCollection<WASExemption> Exemptions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_exemptions == null)
|
||||||
|
{
|
||||||
|
_exemptions = new ObservableCollection<WASExemption>();
|
||||||
|
_ = EnsureLoadedAsync();
|
||||||
|
}
|
||||||
|
return _exemptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[MaxLength(7)]
|
||||||
|
public string IMO { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(100)]
|
||||||
|
public string ShipName { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(5)]
|
||||||
|
public string Port { get; set; }
|
||||||
|
|
||||||
|
public DateTime ValidUntil { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(255)]
|
||||||
|
public string Remarks { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Static loading
|
||||||
|
|
||||||
|
public static async Task EnsureLoadedAsync()
|
||||||
|
{
|
||||||
|
if (_exemptions == null)
|
||||||
|
{
|
||||||
|
_exemptions = new ObservableCollection<WASExemption>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_loadTask != null)
|
||||||
|
{
|
||||||
|
await _loadTask;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_loadTask = LoadInternalAsync();
|
||||||
|
await _loadTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task LoadInternalAsync()
|
||||||
|
{
|
||||||
|
var exemptions = await DBManagerAsync.LoadWASExemptionsAsync();
|
||||||
|
_exemptions.Clear();
|
||||||
|
foreach (var exemption in exemptions)
|
||||||
|
{
|
||||||
|
_exemptions.Add(exemption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DatabaseEntity implementation
|
||||||
|
|
||||||
|
public override void PrepareSave(IDbCommand cmd)
|
||||||
|
{
|
||||||
|
SqlCommand scmd = cmd as SqlCommand;
|
||||||
|
|
||||||
|
if (this.IMO != null) scmd.Parameters.AddWithValue("@P1", this.IMO);
|
||||||
|
else scmd.Parameters.AddWithValue("@P1", DBNull.Value);
|
||||||
|
if (this.ShipName != null) scmd.Parameters.AddWithValue("@P2", this.ShipName);
|
||||||
|
else scmd.Parameters.AddWithValue("@P2", DBNull.Value);
|
||||||
|
if (this.Port != null) scmd.Parameters.AddWithValue("@P3", this.Port);
|
||||||
|
else scmd.Parameters.AddWithValue("@P3", DBNull.Value);
|
||||||
|
scmd.Parameters.AddWithValue("@P4", this.ValidUntil);
|
||||||
|
if (this.Remarks != null) scmd.Parameters.AddWithValue("@P5", this.Remarks);
|
||||||
|
else scmd.Parameters.AddWithValue("@P5", DBNull.Value);
|
||||||
|
|
||||||
|
if (this.IsNew)
|
||||||
|
{
|
||||||
|
this.CreateId();
|
||||||
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
|
cmd.CommandText = string.Format(
|
||||||
|
"INSERT INTO {0} (Id, IMO, ShipName, Port, ValidUntil, Remarks) VALUES (@ID, @P1, @P2, @P3, @P4, @P5)",
|
||||||
|
this.Tablename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd.CommandText = string.Format(
|
||||||
|
"UPDATE {0} SET IMO = @P1, ShipName = @P2, Port = @P3, ValidUntil = @P4, Remarks = @P5 WHERE Id = @ID",
|
||||||
|
this.Tablename);
|
||||||
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
|
{
|
||||||
|
string query = string.Format("SELECT Id, IMO, ShipName, Port, ValidUntil, Remarks FROM {0}", this.Tablename);
|
||||||
|
|
||||||
|
switch (filter)
|
||||||
|
{
|
||||||
|
case Message.LoadFilter.ALL:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cmd.CommandText = query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
||||||
|
{
|
||||||
|
List<DatabaseEntity> result = new List<DatabaseEntity>();
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
WASExemption was = new WASExemption();
|
||||||
|
was.id = reader.GetGuid(0);
|
||||||
|
if (!reader.IsDBNull(1)) was.IMO = reader.GetString(1);
|
||||||
|
if (!reader.IsDBNull(2)) was.ShipName = reader.GetString(2);
|
||||||
|
if (!reader.IsDBNull(3)) was.Port = reader.GetString(3);
|
||||||
|
if (!reader.IsDBNull(4)) was.ValidUntil = reader.GetDateTime(4);
|
||||||
|
if (!reader.IsDBNull(5)) was.Remarks = reader.GetString(5);
|
||||||
|
|
||||||
|
result.Add(was);
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DatabaseEntityAsync ReadRowFromReader(IDataReader reader)
|
||||||
|
{
|
||||||
|
WASExemption was = null;
|
||||||
|
if (reader != null)
|
||||||
|
{
|
||||||
|
was = new WASExemption();
|
||||||
|
was.id = reader.GetGuid(0);
|
||||||
|
if (!reader.IsDBNull(1)) was.IMO = reader.GetString(1);
|
||||||
|
if (!reader.IsDBNull(2)) was.ShipName = reader.GetString(2);
|
||||||
|
if (!reader.IsDBNull(3)) was.Port = reader.GetString(3);
|
||||||
|
if (!reader.IsDBNull(4)) was.ValidUntil = reader.GetDateTime(4);
|
||||||
|
if (!reader.IsDBNull(5)) was.Remarks = reader.GetString(5);
|
||||||
|
}
|
||||||
|
return was;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is WASExemption exemption)
|
||||||
|
{
|
||||||
|
return this.ShipName?.CompareTo(exemption.ShipName ?? "") ?? 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -194,6 +194,7 @@
|
|||||||
<Compile Include="ValidationRule.cs" />
|
<Compile Include="ValidationRule.cs" />
|
||||||
<Compile Include="ValueMapping.cs" />
|
<Compile Include="ValueMapping.cs" />
|
||||||
<Compile Include="WAS.cs" />
|
<Compile Include="WAS.cs" />
|
||||||
|
<Compile Include="WASExemption.cs" />
|
||||||
<Compile Include="Waste.cs" />
|
<Compile Include="Waste.cs" />
|
||||||
<Compile Include="WasteDisposalServiceProvider.cs" />
|
<Compile Include="WasteDisposalServiceProvider.cs" />
|
||||||
<Compile Include="WasteDisposalServiceProvider_Template.cs" />
|
<Compile Include="WasteDisposalServiceProvider_Template.cs" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user