Error correction fixes

This commit is contained in:
Daniel Schick 2025-10-22 09:48:29 +02:00
parent 8bbf7e9cc9
commit 3735735ef7
3 changed files with 23 additions and 27 deletions

View File

@ -69,6 +69,9 @@ namespace ENI2.DetailViewControls
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
// WAS
this.RegisterTextboxChange(this.textBox_WasteDisposalServiceProvider, Message.NotificationClass.WAS);
this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor; this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor; this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
} }
@ -253,7 +256,7 @@ namespace ENI2.DetailViewControls
} }
} }
#endregion #endregion
#region AGNT templates combo #region AGNT templates combo
@ -281,7 +284,7 @@ namespace ENI2.DetailViewControls
DBManager.Instance.Delete(_currentTemplate); DBManager.Instance.Delete(_currentTemplate);
_agntTemplates.Remove(_currentTemplate); _agntTemplates.Remove(_currentTemplate);
this.textBoxTemplateTitle.Text = null; this.textBoxTemplateTitle.Text = null;
this.buttonDeleteTemplate.IsEnabled = false; this.buttonDeleteTemplate.IsEnabled = false;
this.comboBox_AgentTemplate.ItemsSource = _agntTemplates; this.comboBox_AgentTemplate.ItemsSource = _agntTemplates;
this.buttonSetTemplate.IsEnabled = false; this.buttonSetTemplate.IsEnabled = false;
} }
@ -352,7 +355,6 @@ namespace ENI2.DetailViewControls
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName; this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
} }
@ -379,7 +381,7 @@ namespace ENI2.DetailViewControls
this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail; this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail;
this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFax.Text = this._currentTemplate.AgentFax; this.textBox_AgentFax.Text = this._currentTemplate.AgentFax;
this.textBox_AgentFax.GetBindingExpression (TextBox.TextProperty).UpdateSource(); this.textBox_AgentFax.GetBindingExpression (TextBox.TextProperty).UpdateSource();
this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName; this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName;
this.textBox_AgentFirstName.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentFirstName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName; this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName;
@ -390,11 +392,10 @@ namespace ENI2.DetailViewControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber; this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
if ((this._currentTemplate.WasteDisposalServiceProviderName ?? "") != this.textBox_WasteDisposalServiceProvider.Text) if ((this._currentTemplate.WasteDisposalServiceProviderName ?? "").Trim() != (this.textBox_WasteDisposalServiceProvider.Text ?? "").Trim())
{ {
this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName; this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.SublistElementChanged(Message.NotificationClass.WAS);
} }
this.buttonUndoTemplate.IsEnabled = true; this.buttonUndoTemplate.IsEnabled = true;
@ -409,7 +410,7 @@ namespace ENI2.DetailViewControls
AGNT_Template at = new AGNT_Template(); AGNT_Template at = new AGNT_Template();
if (existingTemplate != null) if (existingTemplate != null)
at = existingTemplate; at = existingTemplate;
at.AgentTitle = title; at.AgentTitle = title;
at.AgentCity = this.textBox_AgentCity.Text; at.AgentCity = this.textBox_AgentCity.Text;
at.AgentCompanyName = this.textBox_AgentCompanyName.Text; at.AgentCompanyName = this.textBox_AgentCompanyName.Text;
@ -427,6 +428,6 @@ namespace ENI2.DetailViewControls
} }
#endregion #endregion
} }
} }

View File

@ -15,6 +15,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ENI2.Excel namespace ENI2.Excel
@ -1699,14 +1700,9 @@ namespace ENI2.Excel
if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3; if (sLevel.Contains('3')) l10fc.PortFacilityShipSecurityLevel = 3;
} }
l10fc.PortFacilityGISISCode = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", 54 + i), 4); string s = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", 54 + i), 4);
// All invalid codes become "0000", Oct/25
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0") l10fc.PortFacilityGISISCode = (s != null) && Regex.IsMatch(s.Trim(), @"^\d{4}$") ? s.Trim() : "0000";
l10fc.PortFacilityGISISCode = "0000";
if (l10fc.PortFacilityGISISCode?.Length < 4)
{
while (l10fc.PortFacilityGISISCode.Length < 4) l10fc.PortFacilityGISISCode = "0" + l10fc.PortFacilityGISISCode;
}
l10fc.PortFacilitySecurityMattersToReport = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", 54 + i), 255); l10fc.PortFacilitySecurityMattersToReport = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", 54 + i), 255);

View File

@ -32,7 +32,7 @@ namespace ENI2.SheetDisplayControls
private AGNT _agnt; private AGNT _agnt;
private SEC _sec; private SEC _sec;
private WAS _was; private WAS _was;
private Message _stoMessage; private Message _stoMessage;
private Dictionary<string, string> portAreas = null; private Dictionary<string, string> portAreas = null;
@ -43,7 +43,7 @@ namespace ENI2.SheetDisplayControls
private static List<SERV_Template> _servTemplates = null; private static List<SERV_Template> _servTemplates = null;
private SERV_Template _currentSERVTemplate; private SERV_Template _currentSERVTemplate;
private static List<WasteDisposalServiceProvider_Template> _wsdpTemplates = null; private static List<WasteDisposalServiceProvider_Template> _wsdpTemplates = null;
private WasteDisposalServiceProvider_Template _currentWSDPTemplate; private WasteDisposalServiceProvider_Template _currentWSDPTemplate;
private string _undoWSDPTemplate; private string _undoWSDPTemplate;
@ -81,11 +81,11 @@ namespace ENI2.SheetDisplayControls
{ {
base.Initialize(); base.Initialize();
foreach (Message aMessage in this.Messages) foreach (Message aMessage in this.Messages)
{ {
if (aMessage.MessageNotificationClass == Message.NotificationClass.LADG) { this._ladgMessage = aMessage; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.LADG) { this._ladgMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.SERV) { this._servMessage = aMessage; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.SERV) { this._servMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) { this._noa_nod = aMessage.Elements[0] as NOA_NOD; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) { this._noa_nod = aMessage.Elements[0] as NOA_NOD; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) { this._sec = aMessage.Elements[0] as SEC; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) { this._sec = aMessage.Elements[0] as SEC; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.INFO) { this._info = aMessage.Elements[0] as INFO; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.INFO) { this._info = aMessage.Elements[0] as INFO; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.PRE72H) { this._pre72H = aMessage.Elements[0] as PRE72H; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.PRE72H) { this._pre72H = aMessage.Elements[0] as PRE72H; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) { this._agnt = aMessage.Elements[0] as AGNT; this.ControlMessages.Add(aMessage); } if (aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) { this._agnt = aMessage.Elements[0] as AGNT; this.ControlMessages.Add(aMessage); }
@ -105,7 +105,7 @@ namespace ENI2.SheetDisplayControls
this.dataGridCallPurposes.AddingNewItem += DataGridCallPurposes_AddingNewItem; this.dataGridCallPurposes.AddingNewItem += DataGridCallPurposes_AddingNewItem;
this.dataGridCallPurposes.CreateRequested += DataGridCallPurposes_CreateRequested; this.dataGridCallPurposes.CreateRequested += DataGridCallPurposes_CreateRequested;
this.dataGridCallPurposes.DeleteRequested += DataGridCallPurposes_DeleteRequested; this.dataGridCallPurposes.DeleteRequested += DataGridCallPurposes_DeleteRequested;
portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC); portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC);
this.comboBoxPortArea.ItemsSource = portAreas; this.comboBoxPortArea.ItemsSource = portAreas;
this.comboBoxPortArea.DataContext = this._info; this.comboBoxPortArea.DataContext = this._info;
@ -264,6 +264,7 @@ namespace ENI2.SheetDisplayControls
this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentPostalCode, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentStreetAndNumber, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT); this.RegisterTextboxChange(this.textBox_AgentCountry, Message.NotificationClass.AGNT);
this.RegisterTextboxChange(this.textBox_WasteDisposalServiceProvider, Message.NotificationClass.WAS);
this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor; this.buttonSaveTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor; this.buttonDeleteTemplate.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor;
@ -283,7 +284,7 @@ namespace ENI2.SheetDisplayControls
this.RegisterLocodeChange(this.locodeCtrlNextWastePort, Message.NotificationClass.WAS); this.RegisterLocodeChange(this.locodeCtrlNextWastePort, Message.NotificationClass.WAS);
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS); this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS); this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
} }
private void CheckBoxValidExemption_Checked(object sender, RoutedEventArgs e) private void CheckBoxValidExemption_Checked(object sender, RoutedEventArgs e)
@ -367,11 +368,10 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber; this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
if (this._currentTemplate.WasteDisposalServiceProviderName != this.textBox_WasteDisposalServiceProvider.Text) if ((this._currentTemplate.WasteDisposalServiceProviderName ?? "").Trim() != (this.textBox_WasteDisposalServiceProvider.Text ?? "").Trim())
{ {
this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName; this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.SublistElementChanged(Message.NotificationClass.WAS);
} }
this.buttonUndoTemplate.IsEnabled = true; this.buttonUndoTemplate.IsEnabled = true;
@ -462,7 +462,6 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName; this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource(); this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
} }
@ -613,7 +612,7 @@ namespace ENI2.SheetDisplayControls
stream.Close(); stream.Close();
} }
} }
#endregion #endregion
@ -732,7 +731,7 @@ namespace ENI2.SheetDisplayControls
this.dataGridSERV.Items.Refresh(); this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV); this.SublistElementChanged(Message.NotificationClass.SERV);
} }
} }
#endregion #endregion