Merge branch 'release/eni_7.2.3'

This commit is contained in:
Daniel Schick 2024-08-11 09:32:15 +02:00
commit 1c5fdd885b
40 changed files with 490 additions and 201 deletions

View File

@ -14,7 +14,7 @@ namespace ENI2.Controls
{ {
[TemplatePart(Name = "buttonRefresh", Type = typeof(Button))] [TemplatePart(Name = "buttonRefresh", Type = typeof(Button))]
[TemplatePart(Name = "buttonClose", Type = typeof(Button))] [TemplatePart(Name = "buttonClose", Type = typeof(Button))]
public class StatusWindowBase : Window public class StatusWindowBase : Window
{ {
@ -36,13 +36,22 @@ namespace ENI2.Controls
closeButton.Click += (s, e) => { if (this.IsModal()) DialogResult = true; CloseClicked?.Invoke(); this.Close(); }; closeButton.Click += (s, e) => { if (this.IsModal()) DialogResult = true; CloseClicked?.Invoke(); this.Close(); };
refreshButton.Click += (s, e) => { RefreshClicked?.Invoke(); }; refreshButton.Click += (s, e) => { RefreshClicked?.Invoke(); };
SettingBindingExtension stBinding = new SettingBindingExtension("W2Top"); string topProperty = "W2Top";
string leftProperty = "W2Left";
if(this.GetType().Name == "ViolationListDialog")
{
topProperty = "W3Top";
leftProperty = "W3Left";
}
SettingBindingExtension stBinding = new SettingBindingExtension(topProperty);
this.SetBinding(Window.TopProperty, stBinding); this.SetBinding(Window.TopProperty, stBinding);
SettingBindingExtension slBinding = new SettingBindingExtension("W2Left"); SettingBindingExtension slBinding = new SettingBindingExtension(leftProperty);
this.SetBinding (Window.LeftProperty, slBinding); this.SetBinding (Window.LeftProperty, slBinding);
}; };
} }
public bool RefreshVisible public bool RefreshVisible
{ {

View File

@ -31,7 +31,7 @@ namespace ENI2
private readonly List<MessageGroup> _listBoxList = new List<MessageGroup>(); private readonly List<MessageGroup> _listBoxList = new List<MessageGroup>();
private List<Message> _messages; private List<Message> _messages;
private readonly Dictionary<string, DetailBaseControl> controlCache = new Dictionary<string, DetailBaseControl>(); private readonly Dictionary<string, DetailBaseControl> controlCache = new Dictionary<string, DetailBaseControl>();
// private readonly Dictionary<Message.NotificationClass, string> messageClassControlDict = new Dictionary<Message.NotificationClass, string>(); // private readonly Dictionary<Message.NotificationClass, string> messageClassControlDict = new Dictionary<Message.NotificationClass, string>();
private readonly object messageListLock = new object(); private readonly object messageListLock = new object();
private readonly HighlightService highlightService = new HighlightService(); private readonly HighlightService highlightService = new HighlightService();
@ -65,7 +65,7 @@ namespace ENI2
get get
{ {
// Bedingung: // Bedingung:
// wenn in einer Meldeklasse zwar Daten vorhanden sind, eingespielt durch Excel import oder // wenn in einer Meldeklasse zwar Daten vorhanden sind, eingespielt durch Excel import oder
// Handeingabe, diese aber NICHT gesendet wurden. // Handeingabe, diese aber NICHT gesendet wurden.
// TODO: Hier wird noch ein Flag benötigt, dass die erfolgte Anzeige des Warndialogs speichert // TODO: Hier wird noch ein Flag benötigt, dass die erfolgte Anzeige des Warndialogs speichert
List<string> result = new List<string>(); List<string> result = new List<string>();
@ -74,7 +74,7 @@ namespace ENI2
{ {
if (((aMessage.InternalStatus == Message.BSMDStatus.UPDATED) || if (((aMessage.InternalStatus == Message.BSMDStatus.UPDATED) ||
(aMessage.InternalStatus == Message.BSMDStatus.SAVED)) && // || (aMessage.InternalStatus == Message.BSMDStatus.SAVED)) && // ||
// (aMessage.InternalStatus == Message.BSMDStatus.EXCEL)) && // (aMessage.InternalStatus == Message.BSMDStatus.EXCEL)) &&
!aMessage.UnsentMessageWarningShown) !aMessage.UnsentMessageWarningShown)
{ {
aMessage.UnsentMessageWarningShown = true; aMessage.UnsentMessageWarningShown = true;
@ -82,7 +82,7 @@ namespace ENI2
result.Add(aMessage.MessageNotificationClassDisplay); result.Add(aMessage.MessageNotificationClassDisplay);
} }
} }
return result; return result;
} }
} }
@ -108,26 +108,40 @@ namespace ENI2
} }
} }
public bool HasCriticalInfoMissing(out string messageText) public bool HasCriticalInfoMissing(out string messageText, string locode)
{ {
messageText = ""; messageText = "";
// Hier haben wir Logik für Spezialfälle, z.B. dass für BRE und BRV bestimmte Meldeklassen gesendet werden *müssen* // Hier haben wir Logik für Spezialfälle, z.B. dass für BRE und BRV bestimmte Meldeklassen gesendet werden *müssen*
if(this.Core.PoC.Equals("DEBRV") || this.Core.PoC.Equals("DEBRE")) switch (locode)
{ {
foreach(Message aMessage in _messages) case "DEBRV":
{ case "DEBRE":
if((aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "NOA_NOD"; return true; } {
if ((aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "AGNT"; return true; } foreach (Message aMessage in _messages)
if ((aMessage.MessageNotificationClass == Message.NotificationClass.INFO) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "INFO"; return true; } {
if ((aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SEC"; return true; } if ((aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "NOA_NOD"; return true; }
if ((aMessage.MessageNotificationClass == Message.NotificationClass.TIEFA) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "TIEFA"; return true; } if ((aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "AGNT"; return true; }
} if ((aMessage.MessageNotificationClass == Message.NotificationClass.INFO) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "INFO"; return true; }
} if ((aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SEC"; return true; }
if ((aMessage.MessageNotificationClass == Message.NotificationClass.TIEFA) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "TIEFA"; return true; }
}
}
break;
case "DEHAM":
foreach (Message aMessage in _messages)
{
if ((aMessage.MessageNotificationClass == Message.NotificationClass.SERV) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SERV"; return true; }
}
break;
default:
break;
}
return false; return false;
} }
#endregion #endregion
#region Construction #region Construction
@ -139,7 +153,7 @@ namespace ENI2
shipNameLabel.Text = aCore.Shipname; shipNameLabel.Text = aCore.Shipname;
shipEMailLabel.Text = aCore.HerbergEmailContactReportingVessel; shipEMailLabel.Text = aCore.HerbergEmailContactReportingVessel;
displayIdLabel.Text = aCore.DisplayId; displayIdLabel.Text = aCore.DisplayId;
// Listbox befüllen // Listbox befüllen
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" });
@ -152,7 +166,7 @@ namespace ENI2
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textMDH, MessageGroupControlType = typeof(MaritimeHealthDeclarationDetailControl), ImagePath = "Resources/medical_bag.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textMDH, MessageGroupControlType = typeof(MaritimeHealthDeclarationDetailControl), ImagePath = "Resources/medical_bag.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDepartureNotification, MessageGroupControlType = typeof(DepartureNotificationDetailControl), ImagePath = "Resources/arrow_up_right_green.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDepartureNotification, MessageGroupControlType = typeof(DepartureNotificationDetailControl), ImagePath = "Resources/arrow_up_right_green.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textShipData, MessageGroupControlType = typeof(ShipDataDetailControl), ImagePath = "Resources/containership.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textShipData, MessageGroupControlType = typeof(ShipDataDetailControl), ImagePath = "Resources/containership.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textBorderPolice, MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textBorderPolice, MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGArrival, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGArrival, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGDeparture, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGDeparture, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" });
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" });
@ -263,7 +277,7 @@ namespace ENI2
detailControl.SetEnabled(isEnabled); detailControl.SetEnabled(isEnabled);
if (!isEnabled && (detailControl is OverViewDetailControl control) && !(Core.Cancelled ?? false)) if (!isEnabled && (detailControl is OverViewDetailControl control) && !(Core.Cancelled ?? false))
control.ShowLockedBy(this.LockedBy); control.ShowLockedBy(this.LockedBy);
controlCache.Add(mg.MessageGroupName, detailControl); controlCache.Add(mg.MessageGroupName, detailControl);
this.buttonSave.Visibility = Visibility.Hidden; this.buttonSave.Visibility = Visibility.Hidden;
@ -297,7 +311,7 @@ namespace ENI2
MessageCore newCore = new MessageCore(); MessageCore newCore = new MessageCore();
cdd.NewCore = newCore; cdd.NewCore = newCore;
cdd.OldCore = this.Core; cdd.OldCore = this.Core;
cdd.Closed += (senderDialog, closeArgs) => cdd.Closed += (senderDialog, closeArgs) =>
{ {
CopyDeclarationDialog closedDialog = senderDialog as CopyDeclarationDialog; CopyDeclarationDialog closedDialog = senderDialog as CopyDeclarationDialog;
@ -330,19 +344,19 @@ namespace ENI2
if(existingCore != null) if(existingCore != null)
{ {
if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists, if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists,
MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
{ {
List<Message> existingMessages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(existingCore, DBManager.MessageLoad.ALL); List<Message> existingMessages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(existingCore, DBManager.MessageLoad.ALL);
foreach(Message existingMessage in existingMessages) foreach(Message existingMessage in existingMessages)
{ {
if((existingMessage.InternalStatus == Message.BSMDStatus.SENT) && if((existingMessage.InternalStatus == Message.BSMDStatus.SENT) &&
(existingMessage.MessageNotificationClass != Message.NotificationClass.VISIT) && (existingMessage.MessageNotificationClass != Message.NotificationClass.VISIT) &&
(existingMessage.MessageNotificationClass != Message.NotificationClass.TRANSIT)) (existingMessage.MessageNotificationClass != Message.NotificationClass.TRANSIT))
{ {
MessageBox.Show(Properties.Resources.textMessagesAlreadySent, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Stop); MessageBox.Show(Properties.Resources.textMessagesAlreadySent, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Stop);
return; return;
} }
} }
// delete all existing data of core // delete all existing data of core
@ -356,7 +370,7 @@ namespace ENI2
// Bearbeitungsinformationen für bestehende ID-Beantragung beibehalten, falls bereits vorhanden // Bearbeitungsinformationen für bestehende ID-Beantragung beibehalten, falls bereits vorhanden
if(existingCore.IsTransit && if(existingCore.IsTransit &&
(existingMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) && (existingMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) &&
(existingMessage.InternalStatus == Message.BSMDStatus.CONFIRMED)) (existingMessage.InternalStatus == Message.BSMDStatus.CONFIRMED))
{ {
skipCopyTransit = true; skipCopyTransit = true;
@ -388,7 +402,7 @@ namespace ENI2
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore);
// Meldeklassen für neuen Anlauf erzeugen // Meldeklassen für neuen Anlauf erzeugen
List<Message> newMessages = new List<Message>(); List<Message> newMessages = new List<Message>();
foreach (Message oldMessage in this._messages) foreach (Message oldMessage in this._messages)
{ {
@ -416,6 +430,7 @@ namespace ENI2
newMessage.SaveElements(); newMessage.SaveElements();
} }
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).LoadXtraData(newCore); // reload data from DB and set all rel properites
this.OnOpenNewCoreRequested(newCore); this.OnOpenNewCoreRequested(newCore);
} }
}; };
@ -426,7 +441,7 @@ namespace ENI2
{ {
this.LockedByOtherUser = true; // fake flag this.LockedByOtherUser = true; // fake flag
// clear existing controls // clear existing controls
this.detailView.Children.Clear(); this.detailView.Children.Clear();
this.controlCache.Clear(); this.controlCache.Clear();
@ -443,7 +458,7 @@ namespace ENI2
private void buttonSave_Click(object sender, RoutedEventArgs e) private void buttonSave_Click(object sender, RoutedEventArgs e)
{ {
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation, MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question); MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes) if (result == MessageBoxResult.Yes)
{ {
@ -494,7 +509,7 @@ namespace ENI2
if(message.MessageNotificationClass == Message.NotificationClass.ATA) if(message.MessageNotificationClass == Message.NotificationClass.ATA)
{ {
DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl; DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl;
// ggf. hat sich die Ticketnr geändert.. // ggf. hat sich die Ticketnr geändert..
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
} }
@ -511,7 +526,7 @@ namespace ENI2
private void buttonSaveAll_Click(object sender, RoutedEventArgs e) private void buttonSaveAll_Click(object sender, RoutedEventArgs e)
{ {
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation, MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question); MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes) if (result == MessageBoxResult.Yes)
{ {
@ -707,16 +722,16 @@ namespace ENI2
{ {
vViolations = new List<MessageViolation>(); vViolations = new List<MessageViolation>();
vErrors = new List<MessageError>(); vErrors = new List<MessageError>();
// TODO: clear highlighting // TODO: clear highlighting
Util.UIHelper.SetBusyState(); Util.UIHelper.SetBusyState();
RuleEngine ruleEngine = new RuleEngine(); RuleEngine ruleEngine = new RuleEngine();
foreach (Message aMessage in _messages) foreach (Message aMessage in _messages)
{ {
if (!aMessage.EvaluateForValidation(this.Core.IsTransit)) continue; if (!aMessage.EvaluateForValidation(this.Core.IsTransit)) continue;
List<MessageError> errors = new List<MessageError>(); List<MessageError> errors = new List<MessageError>();
List<MessageViolation> violations = new List<MessageViolation>(); List<MessageViolation> violations = new List<MessageViolation>();
ruleEngine.ValidateMessage(aMessage, out errors, out violations); ruleEngine.ValidateMessage(aMessage, out errors, out violations);
@ -748,6 +763,7 @@ namespace ENI2
Message mdhMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.MDH); Message mdhMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.MDH);
Message was_rcptMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS_RCPT); Message was_rcptMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS_RCPT);
Message wasMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS); Message wasMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS);
Message servMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.SERV);
#region CREW / PAS Count Plausibility #region CREW / PAS Count Plausibility
@ -791,7 +807,7 @@ namespace ENI2
#region CREW/PAS Schengen Plausibility #region CREW/PAS Schengen Plausibility
// Wir können davon ausgehen, dass bei allen Unterelementen die Flags gleich gesetzt sind. Das wird im Import und BorderPoliceDetailControl sichergestellt. // Wir können davon ausgehen, dass bei allen Unterelementen die Flags gleich gesetzt sind. Das wird im Import und BorderPoliceDetailControl sichergestellt.
if(crewaMessage.Elements.Count > 0) if(crewaMessage.Elements.Count > 0)
{ {
@ -800,7 +816,7 @@ namespace ENI2
if (!((crewaFirst.NotificationPAX ?? false) || crewaIsSchengen)) // mindestens eins der beiden if (!((crewaFirst.NotificationPAX ?? false) || crewaIsSchengen)) // mindestens eins der beiden
{ {
vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWA")); ; vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWA")); ;
} }
} }
if (crewdMessage != null) if (crewdMessage != null)
@ -812,7 +828,7 @@ namespace ENI2
if (!((crewdFirst.NotificationPAX ?? false) || crewdIsSchengen)) // mindestens eins der beiden if (!((crewdFirst.NotificationPAX ?? false) || crewdIsSchengen)) // mindestens eins der beiden
{ {
vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWD")); ; vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWD")); ;
} }
} }
} }
@ -824,7 +840,7 @@ namespace ENI2
if (!(pasIsPAX || pasIsSchengen)) // mindestens eins der beiden if (!(pasIsPAX || pasIsSchengen)) // mindestens eins der beiden
{ {
vErrors.Add(RuleEngine.CreateError (ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASA")); vErrors.Add(RuleEngine.CreateError (ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASA"));
} }
} }
if (pasdMessage != null) if (pasdMessage != null)
@ -837,7 +853,7 @@ namespace ENI2
if (!(pasdIsPAX || pasdIsSchengen)) // mindestens eins der beiden if (!(pasdIsPAX || pasdIsSchengen)) // mindestens eins der beiden
{ {
vErrors.Add(RuleEngine.CreateError(ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASD")); vErrors.Add(RuleEngine.CreateError(ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASD"));
} }
} }
} }
@ -853,7 +869,7 @@ namespace ENI2
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASA > 12)", null, Properties.Resources.textOverview, null, "PASA"); MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASA > 12)", null, Properties.Resources.textOverview, null, "PASA");
vViolations.Add(mv); vViolations.Add(mv);
} }
if((crewaMessage != null) && (crewaMessage.Elements.Count > 0)) if((crewaMessage != null) && (crewaMessage.Elements.Count > 0))
{ {
CREW firstCREW = crewaMessage.Elements[0] as CREW; CREW firstCREW = crewaMessage.Elements[0] as CREW;
@ -895,8 +911,8 @@ namespace ENI2
crewaMessage.ViolationList.Remove(mv); crewaMessage.ViolationList.Remove(mv);
} }
if(crewdMessage != null) if(crewdMessage != null)
{ {
MessageViolation mvd = crewdMessage.ViolationList.Find((x) => x.PropertyName.Equals("Effects") && (x.ViolationCode == (int)ValidationCode.TRUNCATE)); MessageViolation mvd = crewdMessage.ViolationList.Find((x) => x.PropertyName.Equals("Effects") && (x.ViolationCode == (int)ValidationCode.TRUNCATE));
if ((mvd != null) && !Core.IsDK) if ((mvd != null) && !Core.IsDK)
crewdMessage.ViolationList.Remove(mvd); crewdMessage.ViolationList.Remove(mvd);
@ -1041,7 +1057,7 @@ namespace ENI2
{ {
if (poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && !poc30d.PortOfCallLast30DaysLocode.IsNullOrEmpty()) if (poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && !poc30d.PortOfCallLast30DaysLocode.IsNullOrEmpty())
{ {
if((poc30d.PortOfCallLast30DaysDateOfDeparture.Value.Date == l10c.PortFacilityDateOfDeparture.Value.Date) && if((poc30d.PortOfCallLast30DaysDateOfDeparture.Value.Date == l10c.PortFacilityDateOfDeparture.Value.Date) &&
poc30d.PortOfCallLast30DaysLocode.Equals(l10c.PortFacilityPortLoCode, StringComparison.OrdinalIgnoreCase)) poc30d.PortOfCallLast30DaysLocode.Equals(l10c.PortFacilityPortLoCode, StringComparison.OrdinalIgnoreCase))
{ {
matchIsFound = true; matchIsFound = true;
@ -1085,6 +1101,22 @@ namespace ENI2
#endregion #endregion
#region SERV existence for DEHAM / DEBRE / DEBRV
if ((!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEHAM")) || this.Core.PoC.Equals("DEHAM") ||
(!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEBRE")) || this.Core.PoC.Equals("DEBRE") ||
(!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEBRV")) || this.Core.PoC.Equals("DEBRV"))
{
if (servMessage.Elements.Count == 0)
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.LIST_EMPTY, "No entry for SERV found", null, "SERV service provider", null, "SERV");
mv.MessageGroupName = Properties.Resources.textPortNotification;
vViolations.Add(mv);
}
}
#endregion
#endregion #endregion
foreach (MessageError me in vErrors) foreach (MessageError me in vErrors)
@ -1136,8 +1168,8 @@ namespace ENI2
this._errorListDialog.Loaded += (o, e) => this._errorListDialog.RefreshVisible = true; this._errorListDialog.Loaded += (o, e) => this._errorListDialog.RefreshVisible = true;
this._errorListDialog.ErrorSelected += _errorListDialog_ErrorSelected; this._errorListDialog.ErrorSelected += _errorListDialog_ErrorSelected;
this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked; this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
this._errorListDialog.Show(); this._errorListDialog.Show();
} }
else else
{ {
this._errorListDialog.BringUp(); this._errorListDialog.BringUp();
@ -1149,12 +1181,12 @@ namespace ENI2
{ {
if(this._violationListDialog == null) if(this._violationListDialog == null)
{ {
this._violationListDialog = new ViolationListDialog(); this._violationListDialog = new ViolationListDialog();
this._violationListDialog.Closed += (o, e) => this._violationListDialog = null; this._violationListDialog.Closed += (o, e) => this._violationListDialog = null;
this._violationListDialog.Loaded += (o, e) => this._violationListDialog.RefreshVisible = true; this._violationListDialog.Loaded += (o, e) => this._violationListDialog.RefreshVisible = true;
this._violationListDialog.ViolationSelected += _errorListDialog_ErrorSelected; this._violationListDialog.ViolationSelected += _errorListDialog_ErrorSelected;
this._violationListDialog.RefreshClicked += _errorListDialog_RefreshClicked; this._violationListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
this._violationListDialog.Show(); this._violationListDialog.Show();
} }
else else
{ {

View File

@ -173,12 +173,12 @@ namespace ENI2.DetailViewControls
#region datagrid LADG #region datagrid LADG
private void DataGridLADG_CreateRequested() private void DataGridLADG_CreateRequested()
{ {
EditLADGDialog eld = new EditLADGDialog(); EditLADGDialog eld = new EditLADGDialog();
eld.LADG = new LADG(); eld.LADG = new LADG();
eld.LADG.MessageHeader = _ladgMessage; eld.LADG.MessageHeader = _ladgMessage;
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
eld.Core = this.Core; eld.Core = this.Core;
eld.AddClicked += () => eld.AddClicked += () =>
{ {
@ -186,7 +186,7 @@ namespace ENI2.DetailViewControls
if (!this._ladgMessage.Elements.Contains(eld.LADG)) if (!this._ladgMessage.Elements.Contains(eld.LADG))
this._ladgMessage.Elements.Add(eld.LADG); this._ladgMessage.Elements.Add(eld.LADG);
this.dataGridLADG.Items.Refresh(); this.dataGridLADG.Items.Refresh();
eld.LADG = new LADG(); eld.LADG = new LADG();
eld.LADG.MessageHeader = _ladgMessage; eld.LADG.MessageHeader = _ladgMessage;
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
@ -195,7 +195,7 @@ namespace ENI2.DetailViewControls
if (eld.ShowDialog() ?? false) if (eld.ShowDialog() ?? false)
{ {
if(!_ladgMessage.Elements.Contains(eld.LADG)) if(!_ladgMessage.Elements.Contains(eld.LADG))
_ladgMessage.Elements.Add(eld.LADG); _ladgMessage.Elements.Add(eld.LADG);
this.dataGridLADG.Items.Refresh(); this.dataGridLADG.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.LADG); this.SublistElementChanged(Message.NotificationClass.LADG);
@ -231,7 +231,7 @@ namespace ENI2.DetailViewControls
this.dataGridLADG.Items.Refresh(); this.dataGridLADG.Items.Refresh();
eld.LADG = new LADG(); eld.LADG = new LADG();
eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements);
eld.LADG.MessageHeader = _ladgMessage; eld.LADG.MessageHeader = _ladgMessage;
this.SublistElementChanged(Message.NotificationClass.LADG); this.SublistElementChanged(Message.NotificationClass.LADG);
}; };
@ -256,7 +256,7 @@ namespace ENI2.DetailViewControls
#region datagrid SERV #region datagrid SERV
private void DataGridSERV_CreateRequested() private void DataGridSERV_CreateRequested()
{ {
EditSERVDialog esd = new EditSERVDialog(); EditSERVDialog esd = new EditSERVDialog();
esd.SERV = new SERV(); esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
@ -266,7 +266,7 @@ namespace ENI2.DetailViewControls
{ {
esd.CopyValuesToEntity(); esd.CopyValuesToEntity();
if(!_servMessage.Elements.Contains(esd.SERV)) if(!_servMessage.Elements.Contains(esd.SERV))
_servMessage.Elements.Add(esd.SERV); _servMessage.Elements.Add(esd.SERV);
this.dataGridSERV.Items.Refresh(); this.dataGridSERV.Items.Refresh();
esd.SERV = new SERV(); esd.SERV = new SERV();
esd.SERV.MessageHeader = _servMessage; esd.SERV.MessageHeader = _servMessage;
@ -297,7 +297,7 @@ namespace ENI2.DetailViewControls
} }
private void DataGridSERV_EditRequested(DatabaseEntity obj) private void DataGridSERV_EditRequested(DatabaseEntity obj)
{ {
EditSERVDialog esd = new EditSERVDialog(); EditSERVDialog esd = new EditSERVDialog();
esd.SERV = obj as SERV; esd.SERV = obj as SERV;
@ -309,7 +309,7 @@ namespace ENI2.DetailViewControls
this.dataGridSERV.Items.Refresh(); this.dataGridSERV.Items.Refresh();
esd.SERV = new SERV(); esd.SERV = new SERV();
esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
esd.SERV.MessageHeader = _servMessage; esd.SERV.MessageHeader = _servMessage;
this.SublistElementChanged(Message.NotificationClass.SERV); this.SublistElementChanged(Message.NotificationClass.SERV);
}; };
@ -334,7 +334,7 @@ namespace ENI2.DetailViewControls
public override void HighlightErrorMessageContainer() public override void HighlightErrorMessageContainer()
{ {
if (this._nameMessage.HasErrors) if (this._nameMessage.HasErrors)
HighlightService.HighlightControl(this.nameGroupBox, HighlightService.HighlightStyle.ERROR, this._nameMessage); HighlightService.HighlightControl(this.nameGroupBox, HighlightService.HighlightStyle.ERROR, this._nameMessage);
if (this._infoMessage.HasErrors) if (this._infoMessage.HasErrors)
HighlightService.HighlightControl(this.infoGroupBox, HighlightService.HighlightStyle.ERROR, this._infoMessage); HighlightService.HighlightControl(this.infoGroupBox, HighlightService.HighlightStyle.ERROR, this._infoMessage);
@ -400,7 +400,7 @@ namespace ENI2.DetailViewControls
DBManager.Instance.Save(this.Core); DBManager.Instance.Save(this.Core);
} }
} }
} }
#endregion #endregion
@ -419,14 +419,14 @@ namespace ENI2.DetailViewControls
{ {
SERV newServ = new SERV(); SERV newServ = new SERV();
newServ.ServiceBeneficiary = "Maersk A/S, Esplanaden 50, DK-1263 Copenhagen K, VAT-ID: DK53139655"; newServ.ServiceBeneficiary = "Maersk A/S, Esplanaden 50, DK-1263 Copenhagen K, VAT-ID: DK53139655";
newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co.KG, Ericusspitze 2-4, 20457 Hamburg"; newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co.KG, Johanniswall 7, 20095 Hamburg";
newServ.ServiceName = "Maersk BHV"; newServ.ServiceName = "Maersk BHV";
newServ.MessageHeader = this._servMessage; newServ.MessageHeader = this._servMessage;
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
this._servMessage.Elements.Add(newServ); this._servMessage.Elements.Add(newServ);
this.dataGridSERV.Items.Refresh(); this.dataGridSERV.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.SERV); this.SublistElementChanged(Message.NotificationClass.SERV);
} }
} }
private void CheckServiceEntrySeaGoBHV() private void CheckServiceEntrySeaGoBHV()
@ -442,7 +442,7 @@ namespace ENI2.DetailViewControls
{ {
SERV newServ = new SERV(); SERV newServ = new SERV();
newServ.ServiceBeneficiary = "Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655"; newServ.ServiceBeneficiary = "Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655";
newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co. KG on behalf of Sealand Europe A/S, Ericusspitze 2-4, 20457 Hamburg"; newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co. KG on behalf of Sealand Europe A/S, Johanniswall 7, 20095 Hamburg";
newServ.ServiceName = "SeaGo BHV"; newServ.ServiceName = "SeaGo BHV";
newServ.MessageHeader = this._servMessage; newServ.MessageHeader = this._servMessage;
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
@ -480,7 +480,7 @@ namespace ENI2.DetailViewControls
bool found = false; bool found = false;
foreach (SERV serv in this._servMessage.Elements) foreach (SERV serv in this._servMessage.Elements)
{ {
if (serv.ServiceName.Equals("FCT JUNGE")) if (serv.ServiceName.Equals("Fct Junge - Hamburg"))
found = true; found = true;
} }
@ -503,7 +503,7 @@ namespace ENI2.DetailViewControls
bool found = false; bool found = false;
foreach (SERV serv in this._servMessage.Elements) foreach (SERV serv in this._servMessage.Elements)
{ {
if (serv.ServiceName.Equals("ELBE BULK")) if (serv.ServiceName.Equals("Elbe Bulk Schiffe - Hamburg"))
found = true; found = true;
} }
@ -523,15 +523,18 @@ namespace ENI2.DetailViewControls
private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e) private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e)
{ {
SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC); if (portAreas != null)
if(spad.ShowDialog() ?? false)
{ {
if(spad.SelectedArea != null) SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC);
if (spad.ShowDialog() ?? false)
{ {
if (portAreas.ContainsKey(spad.SelectedArea)) if (spad.SelectedArea != null)
{ {
var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea); if (portAreas.ContainsKey(spad.SelectedArea))
this.comboBoxPortArea.SelectedItem = pair; {
var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea);
this.comboBoxPortArea.SelectedItem = pair;
}
} }
} }
} }

View File

@ -185,12 +185,8 @@ namespace ENI2.DetailViewControls
#region init WSDP provider #region init WSDP provider
if(_wsdpTemplates == null) InitTemplates();
{
_wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
_wsdpTemplates.Sort();
Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
}
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates; this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
#endregion #endregion
@ -230,6 +226,7 @@ namespace ENI2.DetailViewControls
this.dataGridWasteReceived.ItemsSource = null; this.dataGridWasteReceived.ItemsSource = null;
dataGridWasteReceipt_SelectionChanged(this, null); dataGridWasteReceipt_SelectionChanged(this, null);
} }
InitTemplates(); // templates might have changed in the dialog
} }
private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj) private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj)
@ -275,6 +272,7 @@ namespace ENI2.DetailViewControls
this.dataGridWasteReceipt.Items.Refresh(); this.dataGridWasteReceipt.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
dataGridWasteReceipt_SelectionChanged(this, null); dataGridWasteReceipt_SelectionChanged(this, null);
InitTemplates(); // templates might have changed in the dialog
} }
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e) private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
@ -601,6 +599,15 @@ namespace ENI2.DetailViewControls
#region Waste disposal Service Provider templates event handler #region Waste disposal Service Provider templates event handler
private async void 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) private void comboBox_WSDPTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
Trace.WriteLine("WSDP combo selection changed"); Trace.WriteLine("WSDP combo selection changed");

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion> <MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>8</ApplicationRevision> <ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>7.2.2.8</ApplicationVersion> <ApplicationVersion>7.2.3.3</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
@ -460,9 +460,6 @@
<Compile Include="Util\UIHelper.cs" /> <Compile Include="Util\UIHelper.cs" />
<Compile Include="Util\UtcToLocalDateTimeConverter.cs" /> <Compile Include="Util\UtcToLocalDateTimeConverter.cs" />
<Compile Include="Util\ValidationContext.cs" /> <Compile Include="Util\ValidationContext.cs" />
<Compile Include="VorgaengeControl.xaml.cs">
<DependentUpon>VorgaengeControl.xaml</DependentUpon>
</Compile>
<Compile Include="WindowPlacement.cs" /> <Compile Include="WindowPlacement.cs" />
<Page Include="AnmeldungenControl.xaml"> <Page Include="AnmeldungenControl.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -759,10 +756,6 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="VorgaengeControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">

View File

@ -14,6 +14,7 @@
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="56" /> <RowDefinition Height="56" />
<RowDefinition Height="28" /> <RowDefinition Height="28" />
<RowDefinition Height="28" /> <RowDefinition Height="28" />
@ -30,16 +31,48 @@
<Label Name="labelIdentificationNumber" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textIdentificationNumber}" /> <Label Name="labelIdentificationNumber" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textIdentificationNumber}" />
<Label Name="labelPortReceptionFacilityName" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityName}" /> <Label Name="labelPortReceptionFacilityName" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityName}" />
<Label Name="labelPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityProviderName}" /> <Label Name="labelPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityProviderName}" />
<Label Name="labelTreatmentFacilityProvider" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textTreatmentFacilityProviderDisplay}" /> <Label Name="labelTemplate" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textAgentTemplate}" />
<Label Name="labelWasteDeliveryDateFrom" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateFrom}" /> <Label Name="labelTreatmentFacilityProvider" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textTreatmentFacilityProviderDisplay}" />
<Label Name="labelWasteDeliveryDateTo" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateTo}" /> <Label Name="labelWasteDeliveryDateFrom" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateFrom}" />
<Label Name="labelWasteDeliveryDateTo" Grid.Row="6" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateTo}" />
<TextBox Name="textIdentificationNumber" Grid.Row="0" Grid.Column="1" Width="auto" MaxLength="20" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/> <TextBox Name="textIdentificationNumber" Grid.Row="0" Grid.Column="1" Width="auto" MaxLength="20" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxPortReceptionFacilityName" Grid.Row="1" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/> <TextBox Name="textBoxPortReceptionFacilityName" Grid.Row="1" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/> <TextBox Name="textBoxPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" Margin="2" VerticalContentAlignment="Center"/>
<TextBox Name="textBoxTreatmentFacilityProvider" Grid.Row="3" Grid.Column="1" Height="56" VerticalContentAlignment="Top" Margin="2"/> <Grid Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="1" Name="gridTemplateControls" Visibility="Visible">
<xctk:DateTimePicker Grid.Row="4" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/> <Grid.ColumnDefinitions>
<xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/> <ColumnDefinition Width=".5*"/>
<ColumnDefinition Width=".5*"/>
<!-- Name -->
<ColumnDefinition Width="26"/>
<!-- Save button -->
<ColumnDefinition Width="26"/>
<!-- Delete button -->
<ColumnDefinition Width="52"/>
<!-- Undo button -->
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Name="comboBox_WSDPTemplate" Margin="2" SelectedValuePath="Id" DisplayMemberPath="Remark" SelectionChanged="comboBox_WSDPTemplate_SelectionChanged" />
<TextBox Grid.Column="1" Margin="2" Name="textBoxTemplateTitle" VerticalContentAlignment="Center"/>
<Button Name="buttonSaveTemplate" Grid.Column="2" Grid.Row="0" Margin="2" Click="buttonSaveTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Save template">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/floppy_disk_blue.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonDeleteTemplate" Grid.Column="3" Grid.Row="0" Margin="2" Click="buttonDeleteTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Delete template" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/delete.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
<Button Name="buttonUndoTemplate" Grid.Column="4" Grid.Row="0" Margin="22,2,2,2" Click="buttonUndoTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Undo last overwrite" IsEnabled="False">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/undo.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
</Grid>
<TextBox Name="textBoxTreatmentFacilityProvider" Grid.Row="4" Grid.Column="1" Height="56" VerticalContentAlignment="Top" Margin="2"/>
<xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Row="6" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<!--Button x:Name="buttonAddEntries" Grid.Column="1" Grid.Row="7" Margin="2" Click="buttonAddEntries_Click" Width="170" Content="Add waste received entries" HorizontalAlignment="Left"/--> <!--Button x:Name="buttonAddEntries" Grid.Column="1" Grid.Row="7" Margin="2" Click="buttonAddEntries_Click" Width="170" Content="Add waste received entries" HorizontalAlignment="Left"/-->

View File

@ -3,6 +3,8 @@
// //
using System; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows; using System.Windows;
using bsmd.database; using bsmd.database;
@ -15,6 +17,13 @@ namespace ENI2.EditControls
/// </summary> /// </summary>
public partial class EditWasteReceiptDialog : EditWindowBase public partial class EditWasteReceiptDialog : EditWindowBase
{ {
// TODO: "unstatic" the templates and take care they are synchronized between controls
private List<WasteDisposalServiceProvider_Template> _wsdpTemplates = null;
private WasteDisposalServiceProvider_Template _currentTemplate;
private string _undoTemplate;
public EditWasteReceiptDialog() public EditWasteReceiptDialog()
{ {
InitializeComponent(); InitializeComponent();
@ -24,7 +33,7 @@ namespace ENI2.EditControls
public WAS_RCPT WAS_RCPT { get; set; } public WAS_RCPT WAS_RCPT { get; set; }
private void EditWasteReceiptDialog_Loaded(object sender, RoutedEventArgs e) private async void EditWasteReceiptDialog_Loaded(object sender, RoutedEventArgs e)
{ {
this.textIdentificationNumber.Text = this.WAS_RCPT.IdentificationNumber; this.textIdentificationNumber.Text = this.WAS_RCPT.IdentificationNumber;
this.textBoxPortReceptionFacilityName.Text = this.WAS_RCPT.PortReceptionFacilityName; this.textBoxPortReceptionFacilityName.Text = this.WAS_RCPT.PortReceptionFacilityName;
@ -35,6 +44,12 @@ namespace ENI2.EditControls
OKClicked += EditWasteReceiptDialog_OKClicked; OKClicked += EditWasteReceiptDialog_OKClicked;
this.AddVisible = true; this.AddVisible = true;
_wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
_wsdpTemplates.Sort();
Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
} }
public void CopyValuesToEntity() public void CopyValuesToEntity()
{ {
@ -52,10 +67,87 @@ namespace ENI2.EditControls
this.CopyValuesToEntity(); this.CopyValuesToEntity();
} }
private void comboBox_WSDPTemplate_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
// private void buttonAddEntries_Click(object sender, RoutedEventArgs e) {
// { Trace.WriteLine("WSDP combo selection changed");
// this.WAS_RCPT.AddMissingWasteReceived(); 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.textBoxPortReceptionFacilityProviderName.Text.Trim();
this.buttonUndoTemplate.IsEnabled = this._undoTemplate.Length > 0;
this.textBoxPortReceptionFacilityProviderName.Text = wdsp_t.WasteDisposalServiceProviderName;
}
}
private async void buttonSaveTemplate_Click(object sender, RoutedEventArgs e)
{
string currentWSDPProviderName = this.textBoxPortReceptionFacilityProviderName.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.textBoxPortReceptionFacilityProviderName.Text = this._undoTemplate;
this.buttonUndoTemplate.IsEnabled = false;
this._undoTemplate = null;
this.comboBox_WSDPTemplate.SelectedItem = null;
}
}
} }
} }

View File

@ -2147,7 +2147,7 @@ namespace ENI2.Excel
if (canceled) return true; if (canceled) return true;
if (crew.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty() && isOldVersion) if (crew.CrewMemberIdentityDocumentIssuingState.IsNullOrEmpty() && isOldVersion)
crew.CrewMemberIdentityDocumentIssuingState = "XX"; crew.CrewMemberIdentityDocumentIssuingState = "XX";
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("N{0}", i + 18)); crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("N{0}", i + 18)) ?? (DateTime?)new DateTime(2100, 12, 31);
if (!crew.CrewMemberIdentityDocumentExpiryDate.HasValue && isOldVersion) if (!crew.CrewMemberIdentityDocumentExpiryDate.HasValue && isOldVersion)
crew.CrewMemberIdentityDocumentExpiryDate = new DateTime(2100, 12, 31); crew.CrewMemberIdentityDocumentExpiryDate = new DateTime(2100, 12, 31);
@ -2227,7 +2227,8 @@ namespace ENI2.Excel
for (int i = 0; i < 5000; i++) for (int i = 0; i < 5000; i++)
{ {
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 18), 100); string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 18), 100);
if (lastName.IsNullOrEmpty()) break; string firstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 18), 100);
if (lastName.IsNullOrEmpty() && firstName.IsNullOrEmpty()) break;
if (!(crewdMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREWD crewd)) if (!(crewdMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREWD crewd))
{ {
@ -2241,7 +2242,7 @@ namespace ENI2.Excel
crewd.NotificationSchengen = true; crewd.NotificationSchengen = true;
crewd.NotificationPAX = notificationPax ?? false; crewd.NotificationPAX = notificationPax ?? false;
crewd.CrewMemberLastName = lastName; crewd.CrewMemberLastName = lastName;
crewd.CrewMemberFirstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 18), 100); crewd.CrewMemberFirstName = firstName;
crewd.CrewMemberGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 18)), out bool canceled); crewd.CrewMemberGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 18)), out bool canceled);
if (canceled) return true; if (canceled) return true;
@ -2522,7 +2523,7 @@ namespace ENI2.Excel
if (canceled) return true; if (canceled) return true;
pas.PassengerIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("N{0}", i + 18), 100); pas.PassengerIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("N{0}", i + 18), 100);
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("P{0}", i + 18)) ?? (DateTime?)new DateTime(2100, 12, 31); pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime(sheetTitle, string.Format("P{0}", i + 18)) ?? (DateTime?)new DateTime(2100, 12, 31); ;
pas.PassengerVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("Q{0}", i + 18), 100); pas.PassengerVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("Q{0}", i + 18), 100);
pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 18), 255); pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 18), 255);

View File

@ -10,9 +10,9 @@
xmlns:util="clr-namespace:ENI2.Util" xmlns:util="clr-namespace:ENI2.Util"
xmlns:local="clr-namespace:ENI2" xmlns:local="clr-namespace:ENI2"
mc:Ignorable="d" mc:Ignorable="d"
Title="ENI 2" Title="ENI 2"
Height="{util:SettingBinding Height}" Width="{util:SettingBinding Width}" Height="{util:SettingBinding Height}" Width="{util:SettingBinding Width}"
Icon="Resources/logo_schwarz.ico" Loaded="Window_Loaded" Closing="Window_Closing" Icon="Resources/logo_schwarz.ico" Loaded="Window_Loaded" Closing="Window_Closing"
SourceInitialized="Window_SourceInitialized"> SourceInitialized="Window_SourceInitialized">
<Window.CommandBindings> <Window.CommandBindings>

View File

@ -218,15 +218,26 @@ namespace ENI2
// Dez.22: Special case for BRE/BRV: Warning if some messages are not "confirmed" // Dez.22: Special case for BRE/BRV: Warning if some messages are not "confirmed"
if(drc.Core.PoC.Equals("DEBRE")||drc.Core.PoC.Equals("DEBRV")) if(drc.Core.PoC.Equals("DEBRE")||drc.Core.PoC.Equals("DEBRV"))
{ {
if(drc.HasCriticalInfoMissing(out string missingClass)) if(drc.HasCriticalInfoMissing(out string missingClass, drc.Core.PoC))
{ {
_log.WarnFormat("set close warning because at least {0} is missing from BRE/BRV arrival", missingClass); // _log.WarnFormat("set close warning because at least {0} is missing from BRE/BRV/HAM arrival", missingClass);
if (MessageBox.Show(string.Format(Properties.Resources.textSpecialCaseBREBRV, missingClass), Properties.Resources.textConfirmation, MessageBoxButton.YesNo, if (MessageBox.Show(string.Format(Properties.Resources.textSpecialCaseBREBRV, missingClass), Properties.Resources.textConfirmation, MessageBoxButton.YesNo,
MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No) MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
e.Cancel = true; e.Cancel = true;
} }
} }
// Jul.24: Special case HAM extended (from above)
if (drc.Core.PoC.Equals("DEHAM"))
{
if (drc.HasCriticalInfoMissing(out string missingClass, drc.Core.PoC))
{
if (MessageBox.Show(string.Format(Properties.Resources.textSpecialCaseDEHAM, missingClass), Properties.Resources.textConfirmation, MessageBoxButton.YesNo,
MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
e.Cancel = true;
}
}
if (!e.Cancel) if (!e.Cancel)
{ {
if (lockedCores.ContainsKey(tabItem)) if (lockedCores.ContainsKey(tabItem))

View File

@ -4674,7 +4674,7 @@ namespace ENI2.Properties {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to At least one of NOA_NOD, AGNT, INFO, SEC, TIEFA hasn&apos;t been sent for DEBRE/DEBRV: ({0}) Close anyway?. /// Looks up a localized string similar to At least one of NOA_NOD, AGNT, INFO, SEC, TIEFA, SERV hasn&apos;t been sent for DEBRE/DEBRV/DEHAM: ({0}) Close anyway?.
/// </summary> /// </summary>
public static string textSpecialCaseBREBRV { public static string textSpecialCaseBREBRV {
get { get {
@ -4682,6 +4682,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to {0} has not been sent for DEHAM. Close anyway?.
/// </summary>
public static string textSpecialCaseDEHAM {
get {
return ResourceManager.GetString("textSpecialCaseDEHAM", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Special requirements. /// Looks up a localized string similar to Special requirements.
/// </summary> /// </summary>

View File

@ -1859,7 +1859,7 @@
<value>Search NST2007 list</value> <value>Search NST2007 list</value>
</data> </data>
<data name="textSpecialCaseBREBRV" xml:space="preserve"> <data name="textSpecialCaseBREBRV" xml:space="preserve">
<value>At least one of NOA_NOD, AGNT, INFO, SEC, TIEFA hasn't been sent for DEBRE/DEBRV: ({0}) Close anyway?</value> <value>At least one of NOA_NOD, AGNT, INFO, SEC, TIEFA, SERV hasn't been sent for DEBRE/DEBRV/DEHAM: ({0}) Close anyway?</value>
</data> </data>
<data name="about" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="about" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\about.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\about.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -1900,4 +1900,7 @@
<data name="textCopyToPASD" xml:space="preserve"> <data name="textCopyToPASD" xml:space="preserve">
<value>Copy to PASD</value> <value>Copy to PASD</value>
</data> </data>
<data name="textSpecialCaseDEHAM" xml:space="preserve">
<value>{0} has not been sent for DEHAM. Close anyway?</value>
</data>
</root> </root>

View File

@ -12,7 +12,7 @@ namespace ENI2.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@ -161,5 +161,29 @@ namespace ENI2.Properties {
this["W2Top"] = value; this["W2Top"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public string W3Left {
get {
return ((string)(this["W3Left"]));
}
set {
this["W3Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public string W3Top {
get {
return ((string)(this["W3Top"]));
}
set {
this["W3Top"] = value;
}
}
} }
} }

View File

@ -41,5 +41,11 @@
<Setting Name="W2Top" Type="System.String" Scope="User"> <Setting Name="W2Top" Type="System.String" Scope="User">
<Value Profile="(Default)">0</Value> <Value Profile="(Default)">0</Value>
</Setting> </Setting>
<Setting Name="W3Left" Type="System.String" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="W3Top" Type="System.String" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -1,13 +0,0 @@
<UserControl x:Class="ENI2.VorgaengeControl"
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"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Background="#FF9EF0E8">
<Label x:Name="label" Content="Platzhalter für Vorgänge" HorizontalAlignment="Left" Margin="49,128,0,0" VerticalAlignment="Top"/>
</Grid>
</UserControl>

View File

@ -1,29 +0,0 @@
// Copyright (c) 2017 Informatibüro Daniel Schick
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ENI2
{
/// <summary>
/// Interaction logic for VorgaengeControl.xaml
/// </summary>
public partial class VorgaengeControl : UserControl
{
public VorgaengeControl()
{
InitializeComponent();
}
}
}

View File

@ -10,22 +10,26 @@ from collections import deque
# get the current working directory # get the current working directory
abspath = os.path.abspath(__file__) abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath) # dname = os.path.dirname(abspath)
dname = "E:\\temp\\telemetry"
outputFileName = dname + "\\" + 'output.csv' outputFileNameDBH = dname + "\\" + 'output_dbh.csv'
outputFileNameHISNORD = dname + "\\" + 'output_hisnord.csv'
# open the output file # open the output files
outputFile = open(outputFileName, 'w') outputFileDBH = open(outputFileNameDBH, 'w')
outputFileHISNORD = open(outputFileNameHISNORD, 'w')
# write the header # write the header
outputFile.write('Receive time, Duration\n') outputFileDBH.write('Receive time, Duration, Message class, Attempts\n')
outputFileHISNORD.write('Receive time, Duration, message class, Attemps\n')
# open the log files # open the log files
q = deque() q = deque()
for i in range(0, 10): for i in range(10, -1, -1):
logFileName = dname + "\\" + 'log-NSWMessageService.txt.' + str(i) logFileName = dname + "\\" + 'log-NSWMessageService.txt.' + str(i)
logFile = open(logFileName, 'r') logFile = open(logFileName, 'r')
@ -38,6 +42,8 @@ for i in range(0, 10):
# get substring of the date # get substring of the date
dateString = line[0:19] dateString = line[0:19]
# kept old code for reference, but it does nothing
if "Upload of" in line: if "Upload of" in line:
# add the dateString to the queue # add the dateString to the queue
q.appendleft(dateString) q.appendleft(dateString)
@ -54,9 +60,21 @@ for i in range(0, 10):
# calculate the duration # calculate the duration
duration = currentdate - lastdate duration = currentdate - lastdate
outputFile.write(dateString + "," + str(duration.seconds) + "\n")
# outputFile.write(dateString + "," + str(duration.seconds) + "\n")
if "MessageTelemetry" in line:
his = line[72:81].strip()
msg_class = line[83:91].strip()
duration = line[93:98]
tries = line[100:102]
if his == 'DUDR':
outputFileHISNORD.write(dateString + "," + duration + "," + msg_class + "," + tries + "\n")
elif his == 'DBH':
outputFileDBH.write(dateString + "," + duration + "," + msg_class + "," + tries + "\n")
# close the log file # close the log file
logFile.close() logFile.close()
outputFile.close() outputFileDBH.close()
outputFileHISNORD.close()

View File

@ -40,8 +40,8 @@
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="log4net" version="2.0.15" targetFramework="net48" /> <package id="log4net" version="2.0.16" targetFramework="net48" />
</packages> </packages>

View File

@ -40,8 +40,8 @@
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
@ -52,8 +52,8 @@
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="WinSCPnet, Version=1.14.0.13797, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf, processorArchitecture=MSIL"> <Reference Include="WinSCPnet, Version=1.15.0.14890, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf, processorArchitecture=MSIL">
<HintPath>..\packages\WinSCP.6.1.2\lib\net40\WinSCPnet.dll</HintPath> <HintPath>..\packages\WinSCP.6.3.2\lib\net40\WinSCPnet.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -93,12 +93,12 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\WinSCP.6.1.2\build\WinSCP.targets" Condition="Exists('..\packages\WinSCP.6.1.2\build\WinSCP.targets')" /> <Import Project="..\packages\WinSCP.6.3.2\build\WinSCP.targets" Condition="Exists('..\packages\WinSCP.6.3.2\build\WinSCP.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\packages\WinSCP.6.1.2\build\WinSCP.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinSCP.6.1.2\build\WinSCP.targets'))" /> <Error Condition="!Exists('..\packages\WinSCP.6.3.2\build\WinSCP.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WinSCP.6.3.2\build\WinSCP.targets'))" />
</Target> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="log4net" version="2.0.15" targetFramework="net48" /> <package id="log4net" version="2.0.16" targetFramework="net48" />
<package id="WinSCP" version="6.1.2" targetFramework="net48" /> <package id="WinSCP" version="6.3.2" targetFramework="net48" />
</packages> </packages>

View File

@ -295,12 +295,7 @@ namespace bsmd.database
List<MessageCore> result = new List<MessageCore>(); List<MessageCore> result = new List<MessageCore>();
foreach (MessageCore core in cores.Cast<MessageCore>()) foreach (MessageCore core in cores.Cast<MessageCore>())
{ {
this.LoadCustomer(core); LoadXtraData(core);
this.LoadSTATShipName(core);
this.LoadETA_ETD(core);
this.LoadATA(core);
this.LoadATD(core);
this.LoadNumberSent(core);
result.Add(core); result.Add(core);
} }
@ -310,6 +305,16 @@ namespace bsmd.database
return result; return result;
} }
public void LoadXtraData(MessageCore core)
{
this.LoadCustomer(core);
this.LoadSTATShipName(core);
this.LoadETA_ETD(core);
this.LoadATA(core);
this.LoadATD(core);
this.LoadNumberSent(core);
}
/// <summary> /// <summary>
/// Lädt MessageCore (=Schiffsanlauf) einer EU-NOAD Nachricht vom Fleettracker / Herberg /// Lädt MessageCore (=Schiffsanlauf) einer EU-NOAD Nachricht vom Fleettracker / Herberg
/// </summary> /// </summary>

View File

@ -0,0 +1,75 @@
// Copyright (c) 2024-present schick Informatik
// Description: The purpose of telemetry is to record message transmission times (and failures)
using System;
using System.Collections.Generic;
using log4net;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bsmd.database
{
public class MessageTelemetry
{
#region Fields
private static readonly Dictionary<Message.NSWProvider, Dictionary<Guid, MessageTelemetry>> _telemetry = new Dictionary<Message.NSWProvider, Dictionary<Guid, MessageTelemetry>>();
private static readonly ILog _log = LogManager.GetLogger(typeof(MessageTelemetry));
#endregion
#region Properties
public DateTime SendDate { get; private set; }
public int NumTries { get; set; }
#endregion
#region public static methods
public static void Enqueue(Message.NSWProvider provider, Message message)
{
if (!_telemetry.ContainsKey(provider))
_telemetry.Add(provider, new Dictionary<Guid, MessageTelemetry>());
if (_telemetry[provider].ContainsKey(message.Id.Value))
{
_telemetry[provider][message.Id.Value].NumTries++;
}
else
{
MessageTelemetry mt = new MessageTelemetry();
mt.SendDate = DateTime.Now;
mt.NumTries = 1;
_telemetry[provider][message.Id.Value] = mt;
}
}
public static void Dequeue(Message.NSWProvider provider, Message message)
{
if (_telemetry.ContainsKey(provider))
{
if (_telemetry[provider].ContainsKey(message.Id.Value))
{
MessageTelemetry mt = _telemetry[provider][message.Id.Value];
_log.InfoFormat("[{0,10}][{1,8}][{2:00000}][{3:00}] ",provider, message.MessageNotificationClassDisplay, (DateTime.Now - mt.SendDate).TotalSeconds, mt.NumTries);
_telemetry[provider].Remove(message.Id.Value);
}
else
{
_log.ErrorFormat("trying to deque a message from telemetry that we don't know about. Provider: {0} MessageId: {1}",
provider.ToString(), message.Id.Value);
}
}
}
#endregion
}
}

View File

@ -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.2")] [assembly: AssemblyInformationalVersion("7.2.3")]
[assembly: AssemblyCopyright("Copyright © 2014-2024 schick Informatik")] [assembly: AssemblyCopyright("Copyright © 2014-2024 schick Informatik")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("7.2.2.*")] [assembly: AssemblyVersion("7.2.3.*")]

View File

@ -131,6 +131,7 @@
<Compile Include="MaerskData.cs" /> <Compile Include="MaerskData.cs" />
<Compile Include="MARPOL_Annex_I_Position.cs" /> <Compile Include="MARPOL_Annex_I_Position.cs" />
<Compile Include="MessageHistory.cs" /> <Compile Include="MessageHistory.cs" />
<Compile Include="MessageTelemetry.cs" />
<Compile Include="NoTypeConverterJsonConverter.cs" /> <Compile Include="NoTypeConverterJsonConverter.cs" />
<Compile Include="PortArea.cs" /> <Compile Include="PortArea.cs" />
<Compile Include="Properties\AssemblyProductInfo.cs" /> <Compile Include="Properties\AssemblyProductInfo.cs" />

View File

@ -1,11 +1,11 @@
extensions: designer.cs generated.cs extensions: designer.cs generated.cs
extensions: .cs .cpp .h extensions: .cs .cpp .h
// Copyright (c) 2023-present schick Informatik // Copyright (c) 2024-present schick Informatik
// Description: // Description:
extensions: .aspx .ascx extensions: .aspx .ascx
<%-- <%--
Copyright (c) 2023-present schick Informatik Copyright (c) 2024-present schick Informatik
--%> --%>
extensions: .vb extensions: .vb
'Sample license text. 'Sample license text.

View File

@ -114,6 +114,9 @@ namespace bsmd.dbh
#region send and receive files (SFTP) #region send and receive files (SFTP)
/// <summary>
/// this method handles the transmission of files by SFTP
/// </summary>
public static void SendAndReceive() public static void SendAndReceive()
{ {
// sent unsent messages in output folder // sent unsent messages in output folder

View File

@ -1832,6 +1832,8 @@ namespace bsmd.dbh
serializer.Serialize(tw, root); serializer.Serialize(tw, root);
} }
MessageTelemetry.Enqueue(Message.NSWProvider.DBH, message);
return filePath; return filePath;
} }
catch(Exception ex) catch(Exception ex)

View File

@ -1,16 +1,12 @@
// Copyright (c) 2020-present schick Informatik // Copyright (c) 2020-present schick Informatik
// Description: Verarbeitung von empfangenen Rückmeldungen // Description: Verarbeitung von empfangenen Rückmeldungen
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Serialization;
using log4net;
using bsmd.database; using bsmd.database;
using log4net;
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
namespace bsmd.dbh namespace bsmd.dbh
{ {
@ -80,6 +76,8 @@ namespace bsmd.dbh
return result; return result;
} }
MessageTelemetry.Dequeue(Message.NSWProvider.DBH, sentMessage);
switch(root.Type) switch(root.Type)
{ {
case Response.RootType.VISIT: case Response.RootType.VISIT:

View File

@ -38,8 +38,8 @@
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="log4net" version="2.0.15" targetFramework="net48" /> <package id="log4net" version="2.0.16" targetFramework="net48" />
</packages> </packages>

View File

@ -1822,6 +1822,8 @@ namespace bsmd.hisnord
retval = true; retval = true;
MessageTelemetry.Enqueue(Message.NSWProvider.DUDR, message);
#endregion #endregion
} }

View File

@ -88,6 +88,7 @@ namespace bsmd.hisnord
refMessage.InternalStatus = Message.BSMDStatus.SEND_FAILED; refMessage.InternalStatus = Message.BSMDStatus.SEND_FAILED;
systemError.MessageHeaderId = refMessage.Id; systemError.MessageHeaderId = refMessage.Id;
DBManager.Instance.Save(refMessage); DBManager.Instance.Save(refMessage);
MessageTelemetry.Dequeue(Message.NSWProvider.DUDR, refMessage);
} }
} }
else else
@ -101,6 +102,7 @@ namespace bsmd.hisnord
refMessage.InternalStatus = Message.BSMDStatus.SEND_FAILED; refMessage.InternalStatus = Message.BSMDStatus.SEND_FAILED;
systemError.MessageHeaderId = refMessage.Id; systemError.MessageHeaderId = refMessage.Id;
DBManager.Instance.Save(refMessage); DBManager.Instance.Save(refMessage);
MessageTelemetry.Dequeue(Message.NSWProvider.DUDR, refMessage);
} }
} }
} }
@ -253,6 +255,8 @@ namespace bsmd.hisnord
DBManager.Instance.Save(aMessage); DBManager.Instance.Save(aMessage);
MessageTelemetry.Dequeue(Message.NSWProvider.DUDR, aMessage);
#endregion #endregion
} }

View File

@ -38,8 +38,8 @@
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="log4net" version="2.0.15" targetFramework="net48" /> <package id="log4net" version="2.0.16" targetFramework="net48" />
</packages> </packages>

View File

@ -38,8 +38,8 @@
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.16.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath> <HintPath>..\packages\log4net.2.0.16\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="log4net" version="2.0.15" targetFramework="net48" /> <package id="log4net" version="2.0.16" targetFramework="net48" />
</packages> </packages>

Binary file not shown.

View File

@ -4,7 +4,7 @@
2) Prüfen ob das ENI App logo richtig ist 2) Prüfen ob das ENI App logo richtig ist
3) VS: Publish: Folder Location und Url richtig auswählen 3) VS: Publish: Folder Location und Url richtig auswählen
4) Signing: "Sign the ClickOnce manifests": Hier für Prod das Zertifikat 4) Signing: "Sign the ClickOnce manifests": Hier für Prod das Zertifikat
Schiffsmelder CA auswählen, das am 02/24 abläuft. Schiffsmelder CA auswählen, das am 11.2.25 abläuft.
Auswahl über "Select from Store.." Auswahl über "Select from Store.."