fixed validation even with some missing strings in the database
This commit is contained in:
parent
c97b9a72f5
commit
9ffbd23cb7
@ -36,7 +36,7 @@
|
|||||||
<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>2</ApplicationRevision>
|
<ApplicationRevision>3</ApplicationRevision>
|
||||||
<ApplicationVersion>7.11.0.%2a</ApplicationVersion>
|
<ApplicationVersion>7.11.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
|
|||||||
@ -543,6 +543,7 @@ namespace bsmd.database
|
|||||||
foreach(IGCPosition igc in this.IGCPositions)
|
foreach(IGCPosition igc in this.IGCPositions)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(igc, errors, violations);
|
RuleEngine.ValidateProperties(igc, errors, violations);
|
||||||
|
igc.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(IMSBCPosition imsbc in this.IMSBCPositions)
|
foreach(IMSBCPosition imsbc in this.IMSBCPositions)
|
||||||
|
|||||||
@ -203,11 +203,10 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!this.UNNumber.IsNullOrEmpty() && !unNumberRegex.IsMatch(this.UNNumber))
|
if (!this.UNNumber.IsNullOrEmpty() && !unNumberRegex.IsMatch(this.UNNumber))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "UNNumber", this.UNNumber, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "UNNumber", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
|
|
||||||
if (!this.IMOClass.IsNullOrEmpty() && !imoClassRegex.IsMatch(this.IMOClass))
|
if (!this.IMOClass.IsNullOrEmpty() && !imoClassRegex.IsMatch(this.IMOClass))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "IMOClass", this.IMOClass, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "IMOClass", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace bsmd.database
|
|||||||
#region static Regex
|
#region static Regex
|
||||||
|
|
||||||
private static Regex imoClassRegex = new Regex(@"^[1-9]{1}(\.[1-9]{1}([A-Z]{1})?)?$");
|
private static Regex imoClassRegex = new Regex(@"^[1-9]{1}(\.[1-9]{1}([A-Z]{1})?)?$");
|
||||||
private static Regex unNumberRegex = new Regex(@"^[0 - 9]{4}$");
|
private static Regex unNumberRegex = new Regex(@"^[0-9]{4}$");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -238,19 +238,23 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
if(!MHB ?? false)
|
if(!MHB ?? false)
|
||||||
{
|
{
|
||||||
if(this.UNNumber.IsNullOrEmpty() || !unNumberRegex.IsMatch(this.UNNumber))
|
if(this.UNNumber.IsNullOrEmpty())
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V803, "UNNumber", this.UNNumber, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V803, "UNNumber", this.UNNumber, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
|
|
||||||
if (this.IMOClass.IsNullOrEmpty() || !imoClassRegex.IsMatch(this.IMOClass))
|
if (this.IMOClass.IsNullOrEmpty())
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V803, "IMOClass", this.IMOClass, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V803, "IMOClass", this.IMOClass, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.UNNumber.IsNullOrEmpty() && !unNumberRegex.IsMatch(this.UNNumber))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "UNNumber", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
|
|
||||||
|
if(!this.IMOClass.IsNullOrEmpty() && !imoClassRegex.IsMatch(this.IMOClass))
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "IMOClass", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
|
|
||||||
if (!this.IMOHazardClass.HasValue)
|
if (!this.IMOHazardClass.HasValue)
|
||||||
{
|
{
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V810, "Hazards", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V810, "Hazards", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user