From f4d2ba6291d0731954fb35d7ac8f7853d8685db7 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 7 Nov 2023 11:33:20 +0100 Subject: [PATCH] added global validation for PAX set for > 12 passengers --- ENI2/DetailRootControl.xaml.cs | 42 +++++++++++++++++++++++++++- bsmd.database/ValidationAttribute.cs | 1 + 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index 233d85b3..53b99a49 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -878,7 +878,47 @@ namespace ENI2 } } } - } + } + + #endregion + + #region 7.11.23 > 12 Passagiere in PASA oder PASD -> CREW* und PAS* muss NotificationPAX gesetzt haben + + if ((pasaMessage != null) && (pasaMessage.Elements.Count > 12)) + { + PAS firstPASA = pasaMessage.Elements[0] as PAS; + if(firstPASA.NotificationPAX ?? false) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "PASA"); + } + + if((crewaMessage != null) && (crewaMessage.Elements.Count > 0)) + { + CREW firstCREW = crewaMessage.Elements[0] as CREW; + if(firstCREW.NotificationPAX ?? false) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "CREWA"); + } + } + } + + if((pasdMessage != null) && (pasdMessage.Elements.Count > 12)) + { + PASD firstPASD = pasdMessage.Elements[0] as PASD; + if(firstPASD.NotificationPAX ?? false) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "PASD"); + } + + if ((crewdMessage != null) && (crewdMessage.Elements.Count > 0)) + { + CREWD firstCREW = crewdMessage.Elements[0] as CREWD; + if(firstCREW?.NotificationPAX ?? false) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set", null, "CREWD"); + } + } + } #endregion diff --git a/bsmd.database/ValidationAttribute.cs b/bsmd.database/ValidationAttribute.cs index 050ce2c8..7a22080c 100644 --- a/bsmd.database/ValidationAttribute.cs +++ b/bsmd.database/ValidationAttribute.cs @@ -51,6 +51,7 @@ namespace bsmd.database WORDOVERFLOW, VALUE_TOO_LARGE, PAST_DATE, + NO_PAX, V181 = 181, V182, E121 = 121,