From cacf9b6b1f15c5a06649cd951210a89a05a5b21f Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 13 Nov 2023 10:31:34 +0100 Subject: [PATCH] fixed some more minor validation / correction funcs --- ENI2/DetailRootControl.xaml.cs | 20 +++++++++++-------- .../BorderPoliceDetailControl.xaml.cs | 4 ++++ ENI2/ENI2.csproj | 2 +- ENI2/Excel/DakosyUtil.cs | 10 ++++++++++ ENI2/Excel/ExcelUtil.cs | 8 ++++++++ 5 files changed, 35 insertions(+), 9 deletions(-) diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index 5dba0f5e..640f47a0 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -829,17 +829,19 @@ namespace ENI2 if ((pasaMessage != null) && (pasaMessage.Elements.Count > 12)) { PAS firstPASA = pasaMessage.Elements[0] as PAS; - if(firstPASA.NotificationPAX ?? false) + if(!(firstPASA.NotificationPAX ?? false)) { - MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "PASA"); + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASA > 12)", null, Properties.Resources.textOverview, null, "PASA"); + vViolations.Add(mv); } if((crewaMessage != null) && (crewaMessage.Elements.Count > 0)) { CREW firstCREW = crewaMessage.Elements[0] as CREW; - if(firstCREW.NotificationPAX ?? false) + if(!(firstCREW.NotificationPAX ?? false)) { - MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "CREWA"); + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASA > 12)", null, Properties.Resources.textOverview, null, "CREWA"); + vViolations.Add(mv); } } } @@ -847,17 +849,19 @@ namespace ENI2 if((pasdMessage != null) && (pasdMessage.Elements.Count > 12)) { PASD firstPASD = pasdMessage.Elements[0] as PASD; - if(firstPASD.NotificationPAX ?? false) + if(!(firstPASD.NotificationPAX ?? false)) { - MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "PASD"); + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASD > 12)", null, Properties.Resources.textOverview, null, "PASD"); + vViolations.Add(mv); } if ((crewdMessage != null) && (crewdMessage.Elements.Count > 0)) { CREWD firstCREW = crewdMessage.Elements[0] as CREWD; - if(firstCREW?.NotificationPAX ?? false) + if(!(firstCREW.NotificationPAX ?? false)) { - MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "CREWD"); + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASD > 12)", null, Properties.Resources.textOverview, null, "CREWD"); + vViolations.Add(mv); } } } diff --git a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs index 77fa1277..4e6f56df 100644 --- a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs @@ -257,6 +257,7 @@ namespace ENI2.DetailViewControls this._pasMessage.Elements.Add(pasa); this.SublistElementChanged(Message.NotificationClass.PASA); } + this.CheckPASA(); } } @@ -274,6 +275,7 @@ namespace ENI2.DetailViewControls this._pasdMessage.Elements.Add(pasd); this.SublistElementChanged(Message.NotificationClass.PASD); } + this.CheckPASD(); } } @@ -291,6 +293,7 @@ namespace ENI2.DetailViewControls this._crewMessage.Elements.Add(crewa); this.SublistElementChanged(Message.NotificationClass.CREWA); } + this.CheckCREWA(); } } @@ -308,6 +311,7 @@ namespace ENI2.DetailViewControls this._crewdMessage.Elements.Add(crewd); this.SublistElementChanged(Message.NotificationClass.CREWD); } + this.CheckCREWD(); } } diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index ccb5bb72..cbaf28c7 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,7 +36,7 @@ 5.4.0.0 true publish.html - 1 + 3 7.2.0.%2a false true diff --git a/ENI2/Excel/DakosyUtil.cs b/ENI2/Excel/DakosyUtil.cs index 76ed248e..98487058 100644 --- a/ENI2/Excel/DakosyUtil.cs +++ b/ENI2/Excel/DakosyUtil.cs @@ -730,6 +730,10 @@ namespace ENI2.Excel pasdMessage.Elements.Add(pas); } + // these two are not working, since the lookup field is a combobox where reading text always yields empty string + // if there is time we should do the solution suggested in this question + // https://stackoverflow.com/questions/46752911/how-to-read-comboboxes-value-from-excel-using-c-sharp + pas.NotificationSchengen = reader.ReadCellAsBool("passenger departure", "C10"); pas.NotificationPAX = reader.ReadCellAsBool("passenger departure", "C11"); @@ -759,6 +763,9 @@ namespace ENI2.Excel pas.PassengerInTransit = reader.ReadCellAsBool("passenger departure", string.Format("N{0}", i + 16)); //} + if (pas.HasSchengenDetails) pas.NotificationSchengen = true; + if (pas.HasPAXDetails) pas.NotificationPAX = true; + result = true; } return result; @@ -813,6 +820,9 @@ namespace ENI2.Excel pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16)); //} + if (pas.HasSchengenDetails) pas.NotificationSchengen = true; + if (pas.HasPAXDetails) pas.NotificationPAX = true; + result = true; } return result; diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index 337452a9..80e01394 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -2136,6 +2136,7 @@ namespace ENI2.Excel if (crew.Effects.Length > 256) crew.Effects = crew.Effects.Substring(0, 256); + crew.NotificationSchengen = crew.HasSchengenDetails; Util.UIHelper.SetBusyState(); // dialog might reset busy state } @@ -2243,6 +2244,8 @@ namespace ENI2.Excel crewd.Effects = reader.ReadCellAsText("2. PORT", string.Format("C{0}", i + 142)); + crewd.NotificationSchengen = crewd.HasSchengenDetails; + Util.UIHelper.SetBusyState(); // dialog might reset busy state } } @@ -2361,6 +2364,9 @@ namespace ENI2.Excel pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 17)); pas.EmergencyContactNumber = reader.ReadCellAsText(sheetTitle, string.Format("S{0}", i + 17)); + // sie will es unbedingt ;-) + pas.NotificationSchengen = pas.HasSchengenDetails; + Util.UIHelper.SetBusyState(); // dialog might reset busy state } } @@ -2490,6 +2496,8 @@ namespace ENI2.Excel pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 18)); pas.EmergencyContactNumber = reader.ReadCellAsText(sheetTitle, string.Format("S{0}", i + 18)); + pas.NotificationSchengen = pas.HasSchengenDetails; + Util.UIHelper.SetBusyState(); // dialog might reset busy state } }