diff --git a/ENI2/Controls/ClosableTabItem.cs b/ENI2/Controls/ClosableTabItem.cs
index 07a332ca..93a6cd34 100644
--- a/ENI2/Controls/ClosableTabItem.cs
+++ b/ENI2/Controls/ClosableTabItem.cs
@@ -8,6 +8,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
+using System.Windows.Threading;
namespace ENI2.Controls
{
@@ -161,8 +162,9 @@ namespace ENI2.Controls
}
if (!abort)
{
- var tabControl = Parent as ItemsControl;
- tabControl.Items.Remove(this);
+ var tabControl = Parent as TabControl;
+ tabControl.SelectedItem = null;
+ _ = Dispatcher.BeginInvoke(new Action(() => tabControl.Items.Remove(this)), DispatcherPriority.Background);
}
};
dockPanel.Children.Add(closeButton);
diff --git a/ENI2/DetailBaseControl.cs b/ENI2/DetailBaseControl.cs
index 88b5c7dc..c3641a15 100644
--- a/ENI2/DetailBaseControl.cs
+++ b/ENI2/DetailBaseControl.cs
@@ -70,7 +70,7 @@ namespace ENI2
///
/// Damit kann ein Listenelement eine Validierung der gesamten Anmeldung auslösen (inkl. Highlighting) (auf Knopfdruck)
///
- public event Action RequestValidate;
+ public event Action RequestValidate;
///
/// Alle Meldeklassen die auf "zu versenden" stehen werden validiert und falls die Validierung scheitert auf "SUSPEND" gestellt
@@ -160,9 +160,9 @@ namespace ENI2
this.RequestReload?.Invoke(coreId);
}
- protected virtual void OnRequestValidate()
+ protected virtual void OnRequestValidate(bool showDialog)
{
- this.RequestValidate?.Invoke();
+ this.RequestValidate?.Invoke(showDialog);
}
protected virtual void OnRequestSendValidation()
diff --git a/ENI2/DetailRootControl.xaml b/ENI2/DetailRootControl.xaml
index d5e5dffe..8de72598 100644
--- a/ENI2/DetailRootControl.xaml
+++ b/ENI2/DetailRootControl.xaml
@@ -15,7 +15,7 @@
-
+
diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs
index 93c28cde..a108449e 100644
--- a/ENI2/DetailRootControl.xaml.cs
+++ b/ENI2/DetailRootControl.xaml.cs
@@ -189,6 +189,7 @@ namespace ENI2
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text11DangerousCargoDeparture, MessageGroupControlType = typeof(DangerousCargoControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text12ATAATD, MessageGroupControlType = typeof(ATAControl), ImagePath = "Resources/clock.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.text13WasteReceipts, MessageGroupControlType = typeof(WasteReceiptsControl), ImagePath = "Resources/garbage.png" });
+ this.leftColumnDefinition.Width = new GridLength(260);
}
this.listBoxMessages.ItemsSource = this._listBoxList;
@@ -657,7 +658,7 @@ namespace ENI2
private void ShortCutValidate(object sender, ExecutedRoutedEventArgs e)
{
- this.DetailControl_RequestValidate();
+ this.DetailControl_RequestValidate(true);
}
private void DetailControl_RequestReload(Guid id)
@@ -770,9 +771,9 @@ namespace ENI2
}
}
- private void DetailControl_RequestValidate()
+ private void DetailControl_RequestValidate(bool showDialog)
{
- this.Validate(true, out _, out _);
+ this.Validate(showDialog, out _, out _);
}
private void Validate(bool showMessages, out List vViolations, out List vErrors)
@@ -793,6 +794,15 @@ namespace ENI2
List violations = new List();
ruleEngine.ValidateMessage(aMessage, out errors, out violations);
+ if (errors.Count > 0)
+ aMessage.ErrorCount = errors.Count;
+ else
+ aMessage.ErrorCount = null;
+ if (violations.Count > 0)
+ aMessage.ViolationCount = violations.Count;
+ else
+ aMessage.ViolationCount = null;
+
string messageGroup = this.MessageGroupForMessage(aMessage);
if (messageGroup != null)
@@ -1266,7 +1276,7 @@ namespace ENI2
this._violationListDialog.BringUp();
}
_violationListDialog.Violations = vViolations;
- }
+ }
if((vErrors.Count == 0) && (vViolations.Count == 0))
{
@@ -1278,7 +1288,7 @@ namespace ENI2
private void _errorListDialog_RefreshClicked()
{
- DetailControl_RequestValidate();
+ DetailControl_RequestValidate(true);
}
private void _errorListDialog_ErrorSelected(DatabaseEntity obj)
diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI2/DetailViewControls/OverViewDetailControl.xaml
index 931a9414..9df80aea 100644
--- a/ENI2/DetailViewControls/OverViewDetailControl.xaml
+++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml
@@ -11,7 +11,7 @@
xmlns:data="clr-namespace:bsmd.database;assembly=bsmd.database"
xmlns:local="clr-namespace:ENI2.DetailViewControls"
mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="800">
+ d:DesignHeight="768" d:DesignWidth="1024">
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -222,29 +381,29 @@
+
+
+
+
+
+
+
+
+
+
+ -->
+
+
+
+
+
+
+
+
+
+
+ -->
@@ -257,6 +416,7 @@
+
@@ -269,41 +429,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
index e1d4ca77..25ddadc5 100644
--- a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs
@@ -22,6 +22,7 @@ using System.Diagnostics;
using System.ComponentModel;
using static bsmd.database.Message;
using PdfSharp.Fonts;
+using System.Linq;
namespace ENI2.DetailViewControls
{
@@ -30,6 +31,9 @@ namespace ENI2.DetailViewControls
///
public partial class OverViewDetailControl : DetailBaseControl
{
+
+ #region Fields
+
private Message _message = null;
private Message _ataMessage;
private Message _atdMessage;
@@ -39,12 +43,20 @@ namespace ENI2.DetailViewControls
private readonly object _collectionLock = new object();
// private MessageSendStatusDialog mssd = null;
+ #endregion
+
+ #region Construction
+
public OverViewDetailControl()
{
InitializeComponent();
this.Loaded += OverViewDetailControl_Loaded;
}
+ #endregion
+
+ #region Initialize
+
private void OverViewDetailControl_Loaded(object sender, RoutedEventArgs e)
{
// die Controls nach Änderungen monitoren
@@ -53,7 +65,7 @@ namespace ENI2.DetailViewControls
this.textBoxDisplayId.TextChanged += CoreTextBox_TextChanged;
this.textBoxIMO.TextChanged += CoreTextBox_TextChanged;
this.textBoxENI.TextChanged += CoreTextBox_TextChanged;
- this.locodePoC.PropertyChanged += CoreLocode_LocodeChanged;
+ this.locodePoC.PropertyChanged += CoreLocode_LocodeChanged;
this.RegisterDateTimePickerChange(this.dateTimePickerATA, Message.NotificationClass.ATA);
this.RegisterDateTimePickerChange(this.dateTimePickerATD, Message.NotificationClass.ATD);
@@ -61,18 +73,6 @@ namespace ENI2.DetailViewControls
this.RegisterDateTimePickerChange(this.dateTimePickerETD, Message.NotificationClass.NOA_NOD);
}
- private void CoreLocode_LocodeChanged(object sender, PropertyChangedEventArgs e)
- {
- this.OnNotificationClassChanged(null);
- }
-
- private void CoreTextBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- this.OnNotificationClassChanged(null);
- }
-
- #region Initialize
-
public override void Initialize()
{
bool iAmAdmin = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin;
@@ -317,7 +317,9 @@ namespace ENI2.DetailViewControls
BindingOperations.EnableCollectionSynchronization(this.Messages, _collectionLock);
this.dataGridMessages.ItemsSource = this.Messages;
-
+
+ this.OnRequestValidate(false);
+
base.Initialize(); // wenn Meldeklassen erst bei der Init. erzeugt werden, fehlen die Handler, die hier erneut festgelegt werden
this._initialized = true;
}
@@ -432,44 +434,50 @@ namespace ENI2.DetailViewControls
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmSend, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
- bool somethingsNotSaved = false;
- foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
+ this.SendMessages(this.dataGridMessages.SelectedItems.Cast());
+ }
+ }
+
+ private void SendMessages(IEnumerable messages)
+ {
+ bool somethingsNotSaved = false;
+
+ foreach (Message selectedMessage in messages)
+ {
+ if (selectedMessage.IsDirty) somethingsNotSaved = true;
+ }
+
+ if (somethingsNotSaved)
+ {
+ if (MessageBox.Show(Properties.Resources.textUnsavedChangesSendAnyWay, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
+ return;
+ }
+
+ List watchList = new List();
+ foreach (Message selectedMessage in messages)
+ {
+ if (selectedMessage.Reset) selectedMessage.Reset = false; // "nochmal" Versenden ist möglich
+ selectedMessage.InternalStatus = Message.BSMDStatus.TOSEND;
+ string userName = "?";
+ if (App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
{
- if (selectedMessage.IsDirty) somethingsNotSaved = true;
+ userName = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].Logon;
}
+ selectedMessage.ChangedBy = string.Format("{0} at {1} (Send)", userName, DateTime.Now);
+ selectedMessage.StatusInfo = string.Format(Properties.Resources.textMessageSentAt, DateTime.Now);
+ DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
+ watchList.Add(selectedMessage);
+ }
- if(somethingsNotSaved)
- {
- if (MessageBox.Show(Properties.Resources.textUnsavedChangesSendAnyWay, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
- return;
- }
+ // komplette Anmeldung auf "zu versenden" stellen
+ this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
+ this.Core.DefaultReportingPartyId = App.UserId;
- List watchList = new List();
- foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
- {
- if (selectedMessage.Reset) selectedMessage.Reset = false; // "nochmal" Versenden ist möglich
- selectedMessage.InternalStatus = Message.BSMDStatus.TOSEND;
- string userName = "?";
- if (App.UserId.HasValue && DBManager.Instance.GetReportingPartyDict().ContainsKey(App.UserId.Value))
- {
- userName = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].Logon;
- }
- selectedMessage.ChangedBy = string.Format("{0} at {1} (Send)", userName, DateTime.Now);
- selectedMessage.StatusInfo = string.Format(Properties.Resources.textMessageSentAt, DateTime.Now);
- DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
- watchList.Add(selectedMessage);
- }
+ DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core); // löst auch den Watchdog aus
+ this.OnRequestSendValidation();
+ this.dataGridMessages.Items.Refresh();
- // komplette Anmeldung auf "zu versenden" stellen
- this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
- this.Core.DefaultReportingPartyId = App.UserId;
-
- DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core); // löst auch den Watchdog aus
- this.OnRequestSendValidation();
- this.dataGridMessages.Items.Refresh();
-
-
- /*
+ /*
if (this.mssd == null)
{
this.mssd = new MessageSendStatusDialog(this.Core);
@@ -489,7 +497,6 @@ namespace ENI2.DetailViewControls
this.mssd.Activate(); // bring to foreground
this.mssd.AddMessages(watchList);
*/
- }
}
private void contextResetMessage(object sender, RoutedEventArgs e)
@@ -623,6 +630,16 @@ namespace ENI2.DetailViewControls
#region event handler
+ private void CoreLocode_LocodeChanged(object sender, PropertyChangedEventArgs e)
+ {
+ this.OnNotificationClassChanged(null);
+ }
+
+ private void CoreTextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ this.OnNotificationClassChanged(null);
+ }
+
private void _checkStatusTimer_Elapsed(object sender, ElapsedEventArgs e)
{
bool? statusFlag = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreQueryStatusFlag(this.Core.Id.Value);
@@ -731,7 +748,7 @@ namespace ENI2.DetailViewControls
private void buttonValidate_Click(object sender, RoutedEventArgs e)
{
- this.OnRequestValidate();
+ this.OnRequestValidate(true);
}
///
@@ -761,7 +778,7 @@ namespace ENI2.DetailViewControls
this.OnRequestReload(this.Core.Id.Value);
// validate all selected import classes (Finger with "selection")
- this.OnRequestValidate();
+ this.OnRequestValidate(true);
}
else
@@ -815,7 +832,56 @@ namespace ENI2.DetailViewControls
}
}
- #endregion
-
+ private void buttonSendAll_Click(object sender, RoutedEventArgs e)
+ {
+ SelectImportClassesDialog sicd = new SelectImportClassesDialog();
+ List readyToSendMessages = new List();
+
+ foreach (Message message in this.Messages)
+ {
+ // Evaluate a number of criteria for messages that should not be preselected for sending
+ if (((message.ViolationCount ?? 0) > 0) || ((message.ErrorCount ?? 0) > 0)) continue; // these need more work
+ if (Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0)) continue; // avoid suspend on empty list classes
+ if ((message.MessageNotificationClass == Message.NotificationClass.HAZA) && !XtraSendLogic.ShouldSendMessage(message)) continue;
+ if ((message.MessageNotificationClass == Message.NotificationClass.HAZD) && !XtraSendLogic.ShouldSendMessage(message)) continue;
+ if (message.MessageNotificationClass == Message.NotificationClass.BPOL)
+ {
+ if (message.Elements.Count > 0)
+ {
+ if (message.Elements[0] is BPOL bpol)
+ {
+ if (bpol.PortOfItineraries.Count == 0) continue;
+ }
+ }
+ }
+ readyToSendMessages.Add(message.MessageNotificationClass);
+ }
+
+ sicd.Messages = this.Messages;
+ sicd.PreselectedClasses.AddRange(readyToSendMessages);
+ sicd.IsTransit = this.Core.IsTransit;
+ sicd.IsImportMode = false;
+
+ if ((sicd.ShowDialog() ?? false) && (sicd.SelectedClasses.Count > 0))
+ {
+ // now send all selected messages
+ List toSendMessages = new List();
+ foreach(NotificationClass notificationClass in sicd.SelectedClasses)
+ {
+ Message selectedMessage = this.Messages.Find(x => x.MessageNotificationClass == notificationClass);
+ if (selectedMessage != null)
+ {
+ toSendMessages.Add(selectedMessage);
+ }
+ }
+ if (toSendMessages.Count > 0)
+ {
+ this.SendMessages(toSendMessages);
+ }
+ }
+ }
+
+ #endregion
+
}
}
diff --git a/ENI2/DetailViewControls/PortCallDetailControl.xaml b/ENI2/DetailViewControls/PortCallDetailControl.xaml
index 75e598c0..4758f600 100644
--- a/ENI2/DetailViewControls/PortCallDetailControl.xaml
+++ b/ENI2/DetailViewControls/PortCallDetailControl.xaml
@@ -12,7 +12,7 @@
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
-
+
@@ -92,8 +92,9 @@
-
-
+
+
+
@@ -104,10 +105,11 @@
-
+
-
+
+
diff --git a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs
index a0f18f0a..53d29001 100644
--- a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs
@@ -25,6 +25,7 @@ namespace ENI2.DetailViewControls
private NOA_NOD _noa_nod;
private AGNT _agnt;
+ private WAS _was;
private static List _agntTemplates = null;
private AGNT_Template _currentTemplate;
private AGNT_Template _undoTemplate;
@@ -95,6 +96,16 @@ namespace ENI2.DetailViewControls
_agnt = new AGNT();
this.ControlMessages.Add(aMessage);
}
+
+ if(aMessage.MessageNotificationClass == Message.NotificationClass.WAS)
+ {
+ if (aMessage.Elements.Count > 0)
+ _was = aMessage.Elements[0] as WAS;
+ else
+ _was = new WAS();
+ this.ControlMessages.Add(aMessage);
+ }
+
}
this.dateTimePicker_ETAToKielCanal.IsEnabled = this.Core.IsTransit;
@@ -123,6 +134,8 @@ namespace ENI2.DetailViewControls
this.dateTimePicker_ETDFromLastPort.DataContext = _noa_nod;
this.dateTimePicker_ETDFromPortOfCall.DataContext = _noa_nod;
+ this.textBox_WasteDisposalServiceProvider.DataContext = _was;
+
this.checkBox_IsAnchored.IsEnabled = this.Core.IsDK;
if(_agntTemplates == null)
@@ -337,6 +350,9 @@ namespace ENI2.DetailViewControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._undoTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
}
@@ -345,6 +361,13 @@ namespace ENI2.DetailViewControls
{
if (this._currentTemplate == null) return;
+ // confirm overwrite of waste disposal service provider
+ if (this.textBox_WasteDisposalServiceProvider.Text.Length > 0)
+ {
+ string message = string.Format(Properties.Resources.textConfirmWSDPOverwrite, this.textBox_WasteDisposalServiceProvider.Text, this._currentTemplate.WasteDisposalServiceProviderName);
+ if (MessageBox.Show(message, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No) { return; }
+ }
+
this._undoTemplate = createFromCurrentText(null, null);
this.textBox_AgentCity.Text = this._currentTemplate.AgentCity;
@@ -356,7 +379,7 @@ namespace ENI2.DetailViewControls
this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail;
this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFax.Text = this._currentTemplate.AgentFax;
- this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_AgentFax.GetBindingExpression (TextBox.TextProperty).UpdateSource();
this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName;
this.textBox_AgentFirstName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName;
@@ -367,6 +390,9 @@ namespace ENI2.DetailViewControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = false;
@@ -392,11 +418,12 @@ namespace ENI2.DetailViewControls
at.AgentPhone = this.textBox_AgentPhone.Text;
at.AgentPostalCode = this.textBox_AgentPostalCode.Text;
at.AgentStreetAndNumber = textBox_AgentStreetAndNumber.Text;
+ at.WasteDisposalServiceProviderName = textBox_WasteDisposalServiceProvider.Text;
return at;
}
#endregion
-
+
}
}
diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml b/ENI2/DetailViewControls/WasteDetailControl.xaml
index 53bfa5f4..dcfe0b54 100644
--- a/ENI2/DetailViewControls/WasteDetailControl.xaml
+++ b/ENI2/DetailViewControls/WasteDetailControl.xaml
@@ -35,7 +35,6 @@
-
@@ -56,38 +55,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
index 696c94c8..a30426d9 100644
--- a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
@@ -13,8 +13,6 @@ using ExcelDataReader;
using System.IO;
using System;
using Microsoft.Win32;
-using System.Diagnostics;
-using System.Threading.Tasks;
namespace ENI2.DetailViewControls
{
@@ -24,14 +22,14 @@ namespace ENI2.DetailViewControls
public partial class WasteDetailControl : DetailBaseControl
{
+ #region Fields
+
private Message _wasMessage;
private WAS _was;
private Message _wasRcptMessage;
private WAS_RCPT _selectedWAS_RCPT;
- private static List _wsdpTemplates = null;
- private WasteDisposalServiceProvider_Template _currentTemplate;
- private string _undoTemplate;
+ #endregion
public WasteDetailControl()
{
@@ -46,7 +44,7 @@ namespace ENI2.DetailViewControls
this.RegisterLocodeChange(this.locodeCtrlNextWastePort, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxAccurateCorrectDetails, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxValidExemption, Message.NotificationClass.WAS);
- this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
+ this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
this.dataGridWasteReceived.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); };
}
@@ -77,7 +75,7 @@ namespace ENI2.DetailViewControls
WasteCapacity_MTQ = 0,
WasteDescription = "",
WasteDisposalAmount_MTQ = 0,
- WasteDisposalPort = "ZZUKN"
+ WasteDisposalPort = "ZZUKN"
};
this._was.Waste.Add(newWaste);
}
@@ -123,7 +121,7 @@ namespace ENI2.DetailViewControls
was.MessageCore = this.Core;
was.MessageHeader = this._wasMessage;
_wasMessage.Elements.Add(was);
- }
+ }
else
{
// remove "old" Waste Entries from display (not deleted in the DB!)
@@ -131,14 +129,14 @@ namespace ENI2.DetailViewControls
{
if (was.Waste[i].WasteType > 999)
was.Waste.RemoveAt(i);
- }
+ }
}
this.wasGroupBox.DataContext = was;
this._was = was;
this.dataGridWaste.Initialize();
- this.dataGridWaste.ItemsSource = was.Waste;
+ this.dataGridWaste.ItemsSource = was.Waste;
this.dataGridWaste.AddingNewItem += DataGridWaste_AddingNewItem;
this.dataGridWaste.EditRequested += DataGridWaste_EditRequested;
this.dataGridWaste.DeleteRequested += DataGridWaste_DeleteRequested;
@@ -177,14 +175,6 @@ namespace ENI2.DetailViewControls
#endregion
- #region init WSDP provider
-
- await InitTemplates();
-
- this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
-
- #endregion
-
}
public override int SelectedTabIndex
@@ -223,11 +213,11 @@ namespace ENI2.DetailViewControls
this.dataGridWasteReceipt.Items.Refresh();
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
- this.dataGridWasteReceived.ItemsSource = null;
+ this.dataGridWasteReceived.ItemsSource = null;
dataGridWasteReceipt_SelectionChanged(this, null);
}
- await InitTemplates(); // templates might have changed in the dialog
+
}
private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj)
@@ -269,11 +259,11 @@ namespace ENI2.DetailViewControls
if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
}
- this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
+ this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.dataGridWasteReceipt.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
dataGridWasteReceipt_SelectionChanged(this, null);
- await InitTemplates(); // templates might have changed in the dialog
+
}
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
@@ -425,7 +415,7 @@ namespace ENI2.DetailViewControls
{
// are you sure dialog is in base class
_was.Waste.Remove(waste);
- DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste);
+ DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste);
DatabaseEntity.ResetIdentifiers(new List(_was.Waste));
this.SublistElementChanged(Message.NotificationClass.WAS);
this.dataGridWaste.Items.Refresh();
@@ -483,7 +473,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.wasGroupBox, HighlightService.HighlightStyle.VIOLATION, this._wasMessage);
}
- #endregion
+ #endregion
#region Excel file import
@@ -500,7 +490,7 @@ namespace ENI2.DetailViewControls
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
@@ -527,7 +517,7 @@ namespace ENI2.DetailViewControls
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))
@@ -591,102 +581,7 @@ namespace ENI2.DetailViewControls
}
- #endregion
-
- #region Waste disposal Service Provider templates event handler
-
- private async Task InitTemplates()
- {
- _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
- _wsdpTemplates.Sort();
- this.comboBox_WSDPTemplate.ItemsSource = null;
- this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
- Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
- }
-
- private void comboBox_WSDPTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- Trace.WriteLine("WSDP combo selection changed");
- if(this.comboBox_WSDPTemplate.SelectedItem is WasteDisposalServiceProvider_Template wdsp_t)
- {
- this.textBoxTemplateTitle.Text = wdsp_t.Remark;
- this.buttonDeleteTemplate.IsEnabled = true;
- this._currentTemplate = wdsp_t;
- this._undoTemplate = this.textBoxWasteDisposalServiceProviders.Text.Trim();
- this.buttonUndoTemplate.IsEnabled = this._undoTemplate.Length > 0;
- this.textBoxWasteDisposalServiceProviders.Text = wdsp_t.WasteDisposalServiceProviderName;
- }
- }
-
- private async void buttonSaveTemplate_Click(object sender, RoutedEventArgs e)
- {
- string currentWSDPProviderName = this.textBoxWasteDisposalServiceProviders.Text.Trim();
- string currentRemark = this.textBoxTemplateTitle.Text.Trim();
-
- if ((currentWSDPProviderName.Length == 0) || (currentRemark.Length == 0)) return;
-
- WasteDisposalServiceProvider_Template existingTemplate = null;
- foreach(WasteDisposalServiceProvider_Template wdsp_template in _wsdpTemplates)
- {
- // bei gefundenem Match wird ggf. der Remark überschrieben
- if (wdsp_template.Remark.Equals(currentRemark))
- {
- existingTemplate = wdsp_template;
- break;
- }
- }
-
- if(existingTemplate != null)
- {
- if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
- return;
-
- existingTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
- await DBManagerAsync.SaveAsync(existingTemplate);
- return;
- }
-
- WasteDisposalServiceProvider_Template newTemplate = new WasteDisposalServiceProvider_Template();
- newTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
- newTemplate.Remark = currentRemark;
- await DBManagerAsync.SaveAsync(newTemplate);
-
- comboBox_WSDPTemplate.ItemsSource = null;
- _wsdpTemplates.Add(newTemplate);
- _wsdpTemplates.Sort();
- comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
- MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
- }
-
- private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e)
- {
- if(_currentTemplate != null)
- {
- if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
- {
- this.comboBox_WSDPTemplate.SelectedItem = null;
- this.comboBox_WSDPTemplate.ItemsSource = null;
- DBManager.Instance.Delete(_currentTemplate);
- _wsdpTemplates.Remove(_currentTemplate);
- this.textBoxTemplateTitle.Text = null;
- this.buttonDeleteTemplate.IsEnabled = false;
- this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
- }
- }
- }
-
- private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
- {
- if(this._undoTemplate != null)
- {
- this.textBoxWasteDisposalServiceProviders.Text = this._undoTemplate;
- this.buttonUndoTemplate.IsEnabled = false;
- this._undoTemplate = null;
- this.comboBox_WSDPTemplate.SelectedItem = null;
- }
- }
-
- #endregion
+ #endregion
#region Copy WAS to WAS_RCPT handler
@@ -694,7 +589,7 @@ namespace ENI2.DetailViewControls
{
if (_selectedWAS_RCPT == null) return;
- if(MessageBox.Show(Properties.Resources.textCopyToWASConfirmation, Properties.Resources.textConfirmation,
+ if(MessageBox.Show(Properties.Resources.textCopyToWASConfirmation, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach(Waste waste in _was.Waste)
diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj
index 2461208b..56182127 100644
--- a/ENI2/ENI2.csproj
+++ b/ENI2/ENI2.csproj
@@ -36,8 +36,8 @@
5.4.0.0
true
publish.html
- 2
- 7.2.9.2
+ 8
+ 7.2.10.8
false
true
true
@@ -140,29 +140,29 @@
packages\log4net.3.1.0\lib\net462\log4net.dll
-
- packages\Microsoft.Bcl.AsyncInterfaces.9.0.6\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
+
+ packages\Microsoft.Bcl.AsyncInterfaces.9.0.7\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
-
- packages\Microsoft.Bcl.Cryptography.9.0.6\lib\net462\Microsoft.Bcl.Cryptography.dll
+
+ packages\Microsoft.Bcl.Cryptography.9.0.7\lib\net462\Microsoft.Bcl.Cryptography.dll
-
- packages\Microsoft.Extensions.DependencyInjection.9.0.6\lib\net462\Microsoft.Extensions.DependencyInjection.dll
+
+ packages\Microsoft.Extensions.DependencyInjection.9.0.7\lib\net462\Microsoft.Extensions.DependencyInjection.dll
-
- packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.6\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll
+
+ packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.7\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll
-
- packages\Microsoft.Extensions.Logging.9.0.6\lib\net462\Microsoft.Extensions.Logging.dll
+
+ packages\Microsoft.Extensions.Logging.9.0.7\lib\net462\Microsoft.Extensions.Logging.dll
-
- packages\Microsoft.Extensions.Logging.Abstractions.9.0.6\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll
+
+ packages\Microsoft.Extensions.Logging.Abstractions.9.0.7\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll
-
- packages\Microsoft.Extensions.Options.9.0.6\lib\net462\Microsoft.Extensions.Options.dll
+
+ packages\Microsoft.Extensions.Options.9.0.7\lib\net462\Microsoft.Extensions.Options.dll
-
- packages\Microsoft.Extensions.Primitives.9.0.6\lib\net462\Microsoft.Extensions.Primitives.dll
+
+ packages\Microsoft.Extensions.Primitives.9.0.7\lib\net462\Microsoft.Extensions.Primitives.dll
packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll
@@ -214,12 +214,12 @@
packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll
-
- packages\System.Diagnostics.DiagnosticSource.9.0.6\lib\net462\System.Diagnostics.DiagnosticSource.dll
+
+ packages\System.Diagnostics.DiagnosticSource.9.0.7\lib\net462\System.Diagnostics.DiagnosticSource.dll
-
- packages\System.Formats.Asn1.9.0.6\lib\net462\System.Formats.Asn1.dll
+
+ packages\System.Formats.Asn1.9.0.7\lib\net462\System.Formats.Asn1.dll
@@ -234,8 +234,8 @@
-
- packages\System.Security.Cryptography.Pkcs.9.0.6\lib\net462\System.Security.Cryptography.Pkcs.dll
+
+ packages\System.Security.Cryptography.Pkcs.9.0.7\lib\net462\System.Security.Cryptography.Pkcs.dll
diff --git a/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs b/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs
index aac2580f..ab678232 100644
--- a/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs
+++ b/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs
@@ -45,7 +45,7 @@ namespace ENI2.EditControls
OKClicked += EditWasteReceiptDialog_OKClicked;
this.AddVisible = true;
- _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
+ _wsdpTemplates = await DBManagerAsync.GetWasteDisposalServiceProviderTemplatesAsync();
_wsdpTemplates.Sort();
Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
diff --git a/ENI2/EditControls/SelectImportClassesDialog.xaml b/ENI2/EditControls/SelectImportClassesDialog.xaml
index 19885b45..cb8d30e5 100644
--- a/ENI2/EditControls/SelectImportClassesDialog.xaml
+++ b/ENI2/EditControls/SelectImportClassesDialog.xaml
@@ -8,7 +8,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
- Title="{x:Static p:Resources.textSelectImportClasses}" Height="600" Width="250" Background="AliceBlue">
+ Title="{x:Static p:Resources.textSelectImportClasses}" Height="660" Width="250" Background="AliceBlue">
diff --git a/ENI2/EditControls/SelectImportClassesDialog.xaml.cs b/ENI2/EditControls/SelectImportClassesDialog.xaml.cs
index a513bd93..50b9deff 100644
--- a/ENI2/EditControls/SelectImportClassesDialog.xaml.cs
+++ b/ENI2/EditControls/SelectImportClassesDialog.xaml.cs
@@ -1,14 +1,13 @@
// Copyright (c) 2017-today schick Informatik
-// Description: Select classes for import
+// Description: Select classes for import via Excel or for sending them once completed
// Returns: Array of selected classes as property
+using bsmd.database;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
-using bsmd.database;
-
namespace ENI2.EditControls
{
///
@@ -17,7 +16,8 @@ namespace ENI2.EditControls
public partial class SelectImportClassesDialog : ENI2.Controls.EditWindowBase
{
private readonly List _selectClasses = new List();
- private readonly List _selectedClasses = new List();
+ private readonly List _selectedClasses = new List();
+ private readonly List _preselectedClasses = new List();
public SelectImportClassesDialog()
{
@@ -25,33 +25,61 @@ namespace ENI2.EditControls
this.Loaded += SelectImportClassesDialog_Loaded;
}
+ ///
+ /// List of all message classes that are available for selection
+ ///
public List SelectedClasses
{
get { return _selectedClasses; }
}
+ ///
+ /// Classes that should be checked already when the dialog is opened (relevant for send mode)
+ ///
+ public List PreselectedClasses
+ {
+ get { return _preselectedClasses; }
+ }
+
///
/// These messages are needed to derive message classes from, already sorted in the right manner
///
public List Messages { get; set; }
+ ///
+ /// Flag to reduce selection amount in case of transit
+ ///
public bool IsTransit { get; set; }
+ ///
+ /// Flag if dialog is used in import mode (default true). Set false for send all mode.
+ ///
+ public bool IsImportMode { get; set; } = true;
+
private void SelectImportClassesDialog_Loaded(object sender, RoutedEventArgs e)
{
-
- foreach(Message aMessage in this.Messages)
+
+
+ foreach (Message aMessage in this.Messages)
{
+ // these are of no interest
if ((aMessage.MessageNotificationClass == Message.NotificationClass.VISIT) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) ||
+ (aMessage.MessageNotificationClass == Message.NotificationClass.STO))
+ continue;
+
+ // these are neither imported nor sent by the Send all function
+
+ if ((aMessage.MessageNotificationClass == Message.NotificationClass.ATA) ||
+ (aMessage.MessageNotificationClass == Message.NotificationClass.ATD))
+ continue;
+
+
+ // filter out messages not relevant for transit
+ if (IsTransit && (
(aMessage.MessageNotificationClass == Message.NotificationClass.ATA) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.ATD) ||
- (aMessage.MessageNotificationClass == Message.NotificationClass.STO)
- ) continue;
-
- if (IsTransit &&
- ((aMessage.MessageNotificationClass == Message.NotificationClass.BKRD) ||
- (aMessage.MessageNotificationClass == Message.NotificationClass.BPOL) ||
+ (aMessage.MessageNotificationClass == Message.NotificationClass.BKRD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.INFO) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.LADG) ||
@@ -62,15 +90,16 @@ namespace ENI2.EditControls
(aMessage.MessageNotificationClass == Message.NotificationClass.TOWD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.WAS) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.WAS_RCPT)
- )) continue;
+ )) continue;
SelectClass sc = new SelectClass();
- sc.Name = Enum.GetName(typeof(bsmd.database.Message.NotificationClass), aMessage.MessageNotificationClass);
+ sc.Name = Enum.GetName(typeof(Message.NotificationClass), aMessage.MessageNotificationClass);
sc.Class = aMessage.MessageNotificationClass;
- sc.IsSelected = false;
+ sc.IsSelected = this._preselectedClasses.Contains(sc.Class);
_selectClasses.Add(sc);
}
+
this.checkListBoxClasses.ItemsSource = _selectClasses;
this.OKClicked += SelectImportClassesDialog_OKClicked;
}
@@ -97,7 +126,7 @@ namespace ENI2.EditControls
OnPropertyChanged("IsSelected");
}
}
-
+
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
diff --git a/ENI2/Excel/ExcelReader.cs b/ENI2/Excel/ExcelReader.cs
index b170c136..8e32e24f 100644
--- a/ENI2/Excel/ExcelReader.cs
+++ b/ENI2/Excel/ExcelReader.cs
@@ -128,7 +128,7 @@ namespace ENI2.Excel
if (portName.IsNullOrEmpty())
{
_log.WarnFormat("unknown Locode {0}", val);
- val = "";
+ val = null;
}
}
return val;
diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs
index c31e6e6b..73dc9b96 100644
--- a/ENI2/Excel/ExcelUtil.cs
+++ b/ENI2/Excel/ExcelUtil.cs
@@ -1239,7 +1239,8 @@ namespace ENI2.Excel
{
if ((reader.Mode == ExcelReader.CountryMode.DE) && waste.IsDashWasteCode)
{
- waste.WasteDescription = "-";
+ // waste.WasteDescription = "-";
+ // NOP
}
else if (reader.Mode == ExcelReader.CountryMode.DK)
{
@@ -1279,18 +1280,19 @@ namespace ENI2.Excel
if (waste.WasteType == 2309) waste.WasteType = 507;
if (waste.WasteType == 3000) waste.WasteType = 401;
- waste.WasteDisposalAmount_MTQ = reader.ReadNumberDefaultZero(wasteAmount);
- waste.WasteCapacity_MTQ = reader.ReadNumberDefaultZero(wasteCapacity);
- waste.WasteAmountRetained_MTQ = reader.ReadNumberDefaultZero(wasteRetained);
+ waste.WasteDisposalAmount_MTQ = reader.ReadNumber(wasteAmount);
+ if (!waste.WasteDisposalAmount_MTQ.HasValue && reader.ReadText(wasteAmount).IsNullOrEmpty()) waste.WasteDisposalAmount_MTQ = 0;
+ waste.WasteCapacity_MTQ = reader.ReadNumber(wasteCapacity);
+ if (!waste.WasteCapacity_MTQ.HasValue && reader.ReadText(wasteCapacity).IsNullOrEmpty()) waste.WasteCapacity_MTQ = 0;
+ waste.WasteAmountRetained_MTQ = reader.ReadNumber(wasteRetained);
+ if (!waste.WasteAmountRetained_MTQ.HasValue && reader.ReadText(wasteRetained).IsNullOrEmpty()) waste.WasteAmountRetained_MTQ = 0;
waste.WasteDisposalPort = reader.ReadSSNLocode(wastePort); // aka RemainingWasteDisposalPort
- if (waste.WasteDisposalPort.IsNullOrEmpty())
- {
- waste.WasteDisposalPort = "ZZUKN";
- }
+ if ((waste.WasteDisposalPort == null) && reader.ReadText(wastePort).IsNullOrEmpty()) waste.WasteDisposalPort = "ZZUKN";
- waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumberDefaultZero(amountGen);
+ waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumber(amountGen);
+ if (!waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue && reader.ReadText(amountGen).IsNullOrEmpty()) waste.WasteAmountGeneratedTillNextPort_MTQ = 0;
if (!waste.WasteType.HasValue || (waste.WasteType > 999))
{
@@ -1298,7 +1300,8 @@ namespace ENI2.Excel
}
}
- was.AddMissingWaste();
+ was.AddMissingWaste(false);
+
return true;
}
@@ -1368,7 +1371,7 @@ namespace ENI2.Excel
wr.WasteCode.Equals("204") || wr.WasteCode.Equals("510") || wr.WasteCode.Equals("511"))
wr.WasteDescription = "-";
}
- wr.AmountWasteReceived_MTQ = reader.ReadNumber(wAmount) ?? (double?)0; // Default ist 0, nicht nix ;-)
+ wr.AmountWasteReceived_MTQ = reader.ReadNumber(wAmount); // ?? (double?)0; // Default ist 0, nicht nix ;-) // Update: wir wollen doch einen Fehler
}
// only add message when an identification number was given
@@ -1418,10 +1421,10 @@ namespace ENI2.Excel
int i = 1;
foreach (LastTenPortFacilitiesCalled ltpfc in sec.LastTenPortFacilitesCalled)
{
- if (!(mdh.GetSublistElementWithIdentifier((i + 1).ToString()) is PortOfCallLast30Days poc30d))
+ if (!(mdh.GetSublistElementWithIdentifier((i).ToString()) is PortOfCallLast30Days poc30d))
{
poc30d = new PortOfCallLast30Days();
- poc30d.Identifier = (i + 1).ToString();
+ poc30d.Identifier = (i).ToString();
poc30d.MDH = mdh;
mdh.PortOfCallLast30Days.Add(poc30d);
}
@@ -1435,64 +1438,66 @@ namespace ENI2.Excel
}
else // "normal mode", aus den Zellen lesen
{
- // POC last 30 days
- for (int i = 0; i < mdh.NumberOfExcelRows; i++)
+
+ string sheetTitle = "1. VOYAGE";
+ // 4.8.25: Changed this area to work like reading from a Dakosy Sheet (by values in rows, not cell names)
+ if (reader.HasWorksheetNamed(sheetTitle))
{
- string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
- string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
- string locode = string.Format("MDH.PortOfCallLast30DaysLocode_{0}", i + 1);
- string crewJoined = string.Format("MDH.PortOfCallLast30DaysCrewMembersJoined_{0}", i + 1);
- string crewName = string.Format("MDH.PortOfCallLast30DaysCrewJoinedShipName_{0}", i + 1);
- string depDate = string.Format("MDH.PortOfCallLast30DaysDateOfDeparture_{0}", i + 1);
- if (!(mdh.GetSublistElementWithIdentifier((i + 1).ToString()) is PortOfCallLast30Days poc30d))
- {
- poc30d = new PortOfCallLast30Days();
- poc30d.Identifier = (i + 1).ToString();
- poc30d.MDH = mdh;
- mdh.PortOfCallLast30Days.Add(poc30d);
- }
+ // POC last 30 days
+ for (int i = 0; i < mdh.NumberOfExcelRows; i++)
+ {
- string pName = reader.ReadText(portName);
- string pCountry = reader.ReadText(portCountry);
-
- poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
- poc30d.PortOfCallLast30DaysLocode = reader.ReadLoCode(locode);
-
- // Verbesserungsvorschlag Jul/21: CrewMembersJoined Häkchen abhängig von den Namen in der Spalte
- bool? PortOfCallLast30DaysCrewMembersJoinedFlag = reader.ReadBoolean(crewJoined);
-
- string crewNameString = reader.ReadText(crewName);
- poc30d.PortOfCallLast30DaysCrewMembersJoined = !crewNameString.IsNullOrEmpty();
-
- // 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))
- poc30d.PortOfCallLast30DaysCrewMembersJoined = true;
-
- if (!crewNameString.IsNullOrEmpty() && (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false))
- {
- // try different separators
- string[] crew = crewNameString.Split(';');
- if (crew.Length == 1)
- crew = crewNameString.Split(',');
-
- for (int j = 0; j < crew.Length; j++)
+ if (!(mdh.GetSublistElementWithIdentifier((i + 1).ToString()) is PortOfCallLast30Days poc30d))
{
- if (!(poc30d.GetSublistElementWithIdentifier((j + 1).ToString()) is PortOfCallLast30DaysCrewJoinedShip poc30dCrew))
- {
- poc30dCrew = new PortOfCallLast30DaysCrewJoinedShip();
- poc30dCrew.Identifier = (j + 1).ToString();
- poc30dCrew.PortOfCallLast30Days = poc30d;
- poc30d.CrewJoinedShip.Add(poc30dCrew);
- }
-
- poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
+ poc30d = new PortOfCallLast30Days();
+ poc30d.Identifier = (i + 1).ToString();
+ poc30d.MDH = mdh;
+ mdh.PortOfCallLast30Days.Add(poc30d);
}
- }
- // Leer/def. Zeilen entfernen
- if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
- mdh.PortOfCallLast30Days.Remove(poc30d);
+ string pName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", 82 + i));
+ string pCountry = reader.ReadCellAsText(sheetTitle, string.Format("E{0}", 82 + i));
+
+ poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadCellAsDateTime(sheetTitle, string.Format("G{0}", 82 + i));
+ poc30d.PortOfCallLast30DaysLocode = reader.ReadCellAsText(sheetTitle, string.Format("F{0}", 82 + i));
+ if (LocodeDB.PortNameFromLocode(poc30d.PortOfCallLast30DaysLocode).IsNullOrEmpty()) poc30d.PortOfCallLast30DaysLocode = "";
+
+ // Verbesserungsvorschlag Jul/21: CrewMembersJoined Häkchen abhängig von den Namen in der Spalte
+ bool? PortOfCallLast30DaysCrewMembersJoinedFlag = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", 82 + i));
+
+ string crewNameString = reader.ReadCellAsText(sheetTitle, string.Format("I{0}", 82 + i));
+ poc30d.PortOfCallLast30DaysCrewMembersJoined = !crewNameString.IsNullOrEmpty();
+
+ // 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))
+ poc30d.PortOfCallLast30DaysCrewMembersJoined = true;
+
+ if (!crewNameString.IsNullOrEmpty() && (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false))
+ {
+ // try different separators
+ string[] crew = crewNameString.Split(';');
+ if (crew.Length == 1)
+ crew = crewNameString.Split(',');
+
+ for (int j = 0; j < crew.Length; j++)
+ {
+ if (!(poc30d.GetSublistElementWithIdentifier((j + 1).ToString()) is PortOfCallLast30DaysCrewJoinedShip poc30dCrew))
+ {
+ poc30dCrew = new PortOfCallLast30DaysCrewJoinedShip();
+ poc30dCrew.Identifier = (j + 1).ToString();
+ poc30dCrew.PortOfCallLast30Days = poc30d;
+ poc30d.CrewJoinedShip.Add(poc30dCrew);
+ }
+
+ poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
+ }
+ }
+
+ // Leer/def. Zeilen entfernen
+ if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode.IsNullOrEmpty()))
+ mdh.PortOfCallLast30Days.Remove(poc30d);
+ }
}
}
@@ -1605,7 +1610,10 @@ namespace ENI2.Excel
}
SEC sec = secMessage.Elements[0] as SEC;
- ScanMessage(sec, reader);
+
+ ((ISublistContainer)sec).DeleteElements();
+
+ ScanMessage(sec, reader);
reader.ReadBoolean("SEC.AreMatterToReport"); // das berücksichtigen wir derzeit nicht in der DB (implizit)
@@ -1655,97 +1663,89 @@ namespace ENI2.Excel
if (!sec.KielCanalPassagePlannedIncomming.HasValue && !sec.KielCanalPassagePlannedOutgoing.HasValue)
sec.KielCanalPassagePlanned = false;
- // Last10PortFacilitesCalled
- for (int i = 1; i <= 10; i++)
- {
- string portName = string.Format("SEC.PortFacilityPortName_{0}", i);
- string portCountry = string.Format("SEC.PortFacilityPortCountry_{0}", i);
- string portLocode = string.Format("SEC.PortFacilityPortLoCode_{0}", i);
- string portDateOfArrival = string.Format("SEC.PortFacilityDateOfArrival_{0}", i);
- string portDateOfDeparture = string.Format("SEC.PortFacilityDateOfDeparture_{0}", i);
- string portShipSecLevel = string.Format("SEC.PortFacilityShipSecurityLevel_{0}", i);
- string portGISISCode = string.Format("SEC.PortFacilityGISISCode_{0}", i);
- string portSecMatters = string.Format("SEC.PortFacilitySecurityMattersToReport_{0}", i);
+
- if (!(sec.GetPortFacilityWithIdentifier(i.ToString()) is LastTenPortFacilitiesCalled l10fc))
- {
- l10fc = new LastTenPortFacilitiesCalled();
- l10fc.Identifier = i.ToString();
- l10fc.SEC = sec;
- sec.LastTenPortFacilitesCalled.Add(l10fc);
+ string sheetTitle = "1. VOYAGE";
+ // 4.8.25: Changed this area to work like reading from a Dakosy Sheet (by values in rows, not cell names)
+ if (reader.HasWorksheetNamed(sheetTitle))
+ {
+ // Last10PortFacilitesCalled
+ for (int i = 0; i < 10; i++)
+ {
+
+ if (!(sec.GetPortFacilityWithIdentifier((i + 1).ToString()) is LastTenPortFacilitiesCalled l10fc))
+ {
+ l10fc = new LastTenPortFacilitiesCalled();
+ l10fc.Identifier = (i + 1).ToString();
+ l10fc.SEC = sec;
+ sec.LastTenPortFacilitesCalled.Add(l10fc);
+ }
+
+ l10fc.PortFacilityPortName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", 54 + i), 99);
+ l10fc.PortFacilityPortCountry = reader.ReadCellAsText(sheetTitle, string.Format("E{0}", 54 + i), 99);
+ l10fc.PortFacilityPortLoCode = reader.ReadCellAsText(sheetTitle, string.Format("F{0}", 54 + i), 5);
+ if (LocodeDB.PortNameFromLocode(l10fc.PortFacilityPortLoCode).IsNullOrEmpty()) l10fc.PortFacilityPortLoCode = "";
+ l10fc.PortFacilityDateOfArrival = reader.ReadCellAsDateTime(sheetTitle, string.Format("G{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);
+ if (!sLevel.IsNullOrEmpty())
+ {
+ if (sLevel.Contains('1')) l10fc.PortFacilityShipSecurityLevel = 1;
+ if (sLevel.Contains('2')) l10fc.PortFacilityShipSecurityLevel = 2;
+ if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
+ }
+
+ l10fc.PortFacilityGISISCode = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", 54 + i), 4);
+
+ if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
+ 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);
+
+ // keinen "leeren" Hafen anlegen, wenn der Eintrag leer war (trifft anscheinend bei Neubauten zu, siehe E-Mail Christin vom 20./22.6.17
+ if (l10fc.PortFacilityPortName.IsNullOrEmpty() && l10fc.PortFacilityPortLoCode.IsNullOrEmpty() && l10fc.PortFacilityPortCountry.IsNullOrEmpty())
+ sec.LastTenPortFacilitesCalled.Remove(l10fc);
}
- l10fc.PortFacilityPortName = reader.ReadText(portName);
- l10fc.PortFacilityPortCountry = reader.ReadText(portCountry);
- l10fc.PortFacilityPortLoCode = reader.ReadLoCode(portLocode);
- l10fc.PortFacilityDateOfArrival = reader.ReadDate(portDateOfArrival);
- l10fc.PortFacilityDateOfDeparture = reader.ReadDate(portDateOfDeparture);
+ // Ship2ShipActivities
+ for (int i = 0; i < 10; i++)
+ {
- string sLevel = reader.ReadText(portShipSecLevel);
- if (!sLevel.IsNullOrEmpty())
- {
- if (sLevel.Contains('1')) l10fc.PortFacilityShipSecurityLevel = 1;
- if (sLevel.Contains('2')) l10fc.PortFacilityShipSecurityLevel = 2;
- if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
+ if (!(sec.GetShipToShipWithIdentifier((i + 1).ToString()) is ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2sActivity))
+ {
+ s2sActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
+ s2sActivity.Identifier = (i + 1).ToString();
+ s2sActivity.SEC = sec;
+ sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(s2sActivity);
+ }
+
+ s2sActivity.ShipToShipActivityLocationName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", 68 + i), 255);
+ if (s2sActivity.ShipToShipActivityLocationName.IsNullOrEmpty())
+ {
+ sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Remove(s2sActivity);
+ continue;
+ }
+
+ s2sActivity.ShipToShipActivityLocationLoCode = reader.ReadCellAsText(sheetTitle, string.Format("E{0}", 68 + i), 5);
+ if (LocodeDB.PortNameFromLocode(s2sActivity.ShipToShipActivityLocationLoCode).IsNullOrEmpty()) s2sActivity.ShipToShipActivityLocationLoCode = "";
+
+ s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = (int?) reader.ReadCellAsDecimal(sheetTitle, string.Format("F{0}", 68 + i));
+ // keine "0" (d.h. fehlerhafte Koordinaten) ins ANSW übergeben falls im Sheet nichts ist aber der Reader das aus irgendeinem Grund liest
+ if (s2sActivity.ShipToShipActivityLocationCoordinatesLatitude == 0)
+ s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = null;
+ s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = (int?)reader.ReadCellAsDecimal(sheetTitle, string.Format("G{0}", 68 + i));
+ if (s2sActivity.ShipToShipActivityLocationCoordinatesLongitude == 0)
+ s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = null;
+ s2sActivity.ShipToShipActivityDateFrom = reader.ReadCellAsDateTime(sheetTitle, string.Format("H{0}", 68 + i));
+ s2sActivity.ShipToShipActivityDateTo = reader.ReadCellAsDateTime(sheetTitle, string.Format("I{0}", 68 + i));
+ s2sActivity.ShipToShipActivityTypeCode = (int?)reader.ReadCellAsDecimal(sheetTitle, string.Format("J{0}", 68 + i));
+ s2sActivity.ShipToShipActivitySecurityMattersToReport = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", 68 + i), 255);
}
-
- l10fc.PortFacilityGISISCode = reader.ReadTextNoWhitespace(portGISISCode);
-
- if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
- l10fc.PortFacilityGISISCode = "0000";
- if (l10fc.PortFacilityGISISCode?.Length < 4)
- {
- while (l10fc.PortFacilityGISISCode.Length < 4) l10fc.PortFacilityGISISCode = "0" + l10fc.PortFacilityGISISCode;
- }
-
- l10fc.PortFacilitySecurityMattersToReport = reader.ReadText(portSecMatters);
-
- // keinen "leeren" Hafen anlegen, wenn der Eintrag leer war (trifft anscheinend bei Neubauten zu, siehe E-Mail Christin vom 20./22.6.17
- if (l10fc.PortFacilityPortName.IsNullOrEmpty() && l10fc.PortFacilityPortLoCode.IsNullOrEmpty() && l10fc.PortFacilityPortCountry.IsNullOrEmpty())
- sec.LastTenPortFacilitesCalled.Remove(l10fc);
- }
-
- // Ship2ShipActivities
- for (int i = 1; i <= 10; i++)
- {
- string s2sName = string.Format("SEC.ShipToShipActivityLocationName_{0}", i);
- string s2sLocode = string.Format("SEC.ShipToShipActivityLocationLoCode_{0}", i);
- string s2sLatitude = string.Format("SEC.ShipToShipActivityLocationCoordinatesLatitude_{0}", i);
- string s2sLongitude = string.Format("SEC.ShipToShipActivityLocationCoordinatesLongitude_{0}", i);
- string s2sFromDate = string.Format("SEC.ShipToShipActivityDateFrom_{0}", i);
- string s2sToDate = string.Format("SEC.ShipToShipActivityDateTo_{0}", i);
- string s2sSec = string.Format("SEC.ShipToShipActivitySecurityMattersToReport_{0}", i);
- string s2sActivityString = string.Format("SEC.ShipToShipActivityType_{0}", i);
-
-
- if (!(sec.GetShipToShipWithIdentifier(i.ToString()) is ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2sActivity))
- {
- s2sActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled();
- s2sActivity.Identifier = i.ToString();
- s2sActivity.SEC = sec;
- sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(s2sActivity);
- }
-
- s2sActivity.ShipToShipActivityLocationName = reader.ReadText(s2sName);
- if (s2sActivity.ShipToShipActivityLocationName.IsNullOrEmpty())
- {
- sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Remove(s2sActivity);
- continue;
- }
-
- s2sActivity.ShipToShipActivityLocationLoCode = reader.ReadLoCode(s2sLocode);
- s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = (int?)reader.ReadNumber(s2sLatitude);
- // keine "0" (d.h. fehlerhafte Koordinaten) ins ANSW übergeben falls im Sheet nichts ist aber der Reader das aus irgendeinem Grund liest
- if (s2sActivity.ShipToShipActivityLocationCoordinatesLatitude == 0)
- s2sActivity.ShipToShipActivityLocationCoordinatesLatitude = null;
- s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = (int?)reader.ReadNumber(s2sLongitude);
- if (s2sActivity.ShipToShipActivityLocationCoordinatesLongitude == 0)
- s2sActivity.ShipToShipActivityLocationCoordinatesLongitude = null;
- s2sActivity.ShipToShipActivityDateFrom = reader.ReadDate(s2sFromDate);
- s2sActivity.ShipToShipActivityDateTo = reader.ReadDate(s2sToDate);
- s2sActivity.ShipToShipActivityTypeCode = (int?)reader.ReadNumber(s2sActivityString);
- reader.ReadShip2ShipActivityType(s2sActivityString); // 24.8.21 nicht Code dem Klartext zuordnen, nur das Feld kolorieren
- s2sActivity.ShipToShipActivitySecurityMattersToReport = reader.ReadText(s2sSec);
}
return true;
diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs
index 86c7a834..d9489957 100644
--- a/ENI2/Properties/Resources.Designer.cs
+++ b/ENI2/Properties/Resources.Designer.cs
@@ -2173,6 +2173,20 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to The existing value for the waste disposal service provider will be overwritten.
+ ///
+ ///Current entry: {0}
+ ///New entry: {1}
+ ///
+ ///Proceed?.
+ ///
+ public static string textConfirmWSDPOverwrite {
+ get {
+ return ResourceManager.GetString("textConfirmWSDPOverwrite", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Construction characteristics.
///
@@ -2947,6 +2961,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to ENI-Status.
+ ///
+ public static string textENIStatus {
+ get {
+ return ResourceManager.GetString("textENIStatus", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to entries.
///
@@ -4324,6 +4347,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to NSW-Status.
+ ///
+ public static string textNSWStatus {
+ get {
+ return ResourceManager.GetString("textNSWStatus", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Number of deaths.
///
@@ -5288,7 +5320,7 @@ namespace ENI2.Properties {
}
///
- /// Looks up a localized string similar to Select classes to import.
+ /// Looks up a localized string similar to Select message classes.
///
public static string textSelectImportClasses {
get {
@@ -5305,6 +5337,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Send all.
+ ///
+ public static string textSendAll {
+ get {
+ return ResourceManager.GetString("textSendAll", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Send date.
///
@@ -6340,6 +6381,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Waste disposal service provider.
+ ///
+ public static string textWasteDisposalServiceProvider {
+ get {
+ return ResourceManager.GetString("textWasteDisposalServiceProvider", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Waste disposal service providers.
///
diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx
index 89059ac3..9bbac0e5 100644
--- a/ENI2/Properties/Resources.resx
+++ b/ENI2/Properties/Resources.resx
@@ -1757,7 +1757,7 @@
Select all
- Select classes to import
+ Select message classes
Select none
@@ -2245,4 +2245,24 @@
..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ Waste disposal service provider
+
+
+ Send all
+
+
+ ENI-Status
+
+
+ NSW-Status
+
+
+ The existing value for the waste disposal service provider will be overwritten.
+
+Current entry: {0}
+New entry: {1}
+
+Proceed?
+
\ No newline at end of file
diff --git a/ENI2/SheetDisplayControls/PortControl.xaml b/ENI2/SheetDisplayControls/PortControl.xaml
index 44a96aea..d5101c92 100644
--- a/ENI2/SheetDisplayControls/PortControl.xaml
+++ b/ENI2/SheetDisplayControls/PortControl.xaml
@@ -88,13 +88,14 @@
-
+
+
@@ -125,20 +126,18 @@
+
-
+
-
+
+
@@ -148,18 +147,23 @@
-
-
-
+
@@ -312,7 +317,7 @@
-
+
@@ -338,7 +343,7 @@
-
+
@@ -347,39 +352,13 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/ENI2/SheetDisplayControls/PortControl.xaml.cs b/ENI2/SheetDisplayControls/PortControl.xaml.cs
index 99d6cabc..4770b831 100644
--- a/ENI2/SheetDisplayControls/PortControl.xaml.cs
+++ b/ENI2/SheetDisplayControls/PortControl.xaml.cs
@@ -128,6 +128,7 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentPhone.DataContext = this._agnt;
this.textBox_AgentPostalCode.DataContext = this._agnt;
this.textBox_AgentStreetAndNumber.DataContext = this._agnt;
+ this.textBox_WasteDisposalServiceProvider.DataContext = this._was;
if (_agntTemplates == null)
{
_agntTemplates = await DBManagerAsync.GetAGNTTemplatesAsync(); // inital full load
@@ -338,6 +339,14 @@ namespace ENI2.SheetDisplayControls
{
if (this._currentTemplate == null) return;
+ // confirm overwrite of waste disposal service provider
+ if (this.textBox_WasteDisposalServiceProvider.Text.Length > 0)
+ {
+ string message = string.Format(Properties.Resources.textConfirmWSDPOverwrite, this.textBox_WasteDisposalServiceProvider.Text, this._currentTemplate.WasteDisposalServiceProviderName);
+ if (MessageBox.Show(message, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No)
+ == MessageBoxResult.No) { return; }
+ }
+
this._undoTemplate = createFromCurrentText(null, null);
this.textBox_AgentCity.Text = this._currentTemplate.AgentCity;
@@ -349,7 +358,7 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail;
this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFax.Text = this._currentTemplate.AgentFax;
- this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_AgentFax.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName;
this.textBox_AgentFirstName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName;
@@ -360,6 +369,9 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = false;
@@ -447,6 +459,9 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._undoTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
}
@@ -468,6 +483,7 @@ namespace ENI2.SheetDisplayControls
at.AgentPhone = this.textBox_AgentPhone.Text;
at.AgentPostalCode = this.textBox_AgentPostalCode.Text;
at.AgentStreetAndNumber = textBox_AgentStreetAndNumber.Text;
+ at.WasteDisposalServiceProviderName = textBox_WasteDisposalServiceProvider.Text;
return at;
}
@@ -723,7 +739,7 @@ namespace ENI2.SheetDisplayControls
private async Task InitTemplates()
{
- _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
+ _wsdpTemplates = await DBManagerAsync.GetWasteDisposalServiceProviderTemplatesAsync();
_wsdpTemplates.Sort();
this.comboBox_WSDPTemplate.ItemsSource = null;
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
diff --git a/ENI2/Themes/Generic.xaml b/ENI2/Themes/Generic.xaml
index e1dfe63a..94ed407a 100644
--- a/ENI2/Themes/Generic.xaml
+++ b/ENI2/Themes/Generic.xaml
@@ -66,7 +66,7 @@
-