MV / SH Hafenliste der SQlite DB hinzugefügt

Dadurch ist es möglich, für die betreffenden Häfen eine zusätzliche
Validierung zu machen.
This commit is contained in:
Daniel Schick 2023-07-09 15:05:41 +02:00
parent 12e65a27e4
commit 1da414a782
5 changed files with 31 additions and 3 deletions

View File

@ -72,6 +72,7 @@ namespace ENI2
Dictionary<int, string> cargoHandlingDict = LocalizedLookup.getLADGCargoHandlingStrings(langKey); Dictionary<int, string> cargoHandlingDict = LocalizedLookup.getLADGCargoHandlingStrings(langKey);
foreach (int key in cargoHandlingDict.Keys) foreach (int key in cargoHandlingDict.Keys)
LADG.CargoHandlingDict.Add(key, cargoHandlingDict[key]); LADG.CargoHandlingDict.Add(key, cargoHandlingDict[key]);
LADG.MVSHLocodes.AddRange(LocalizedLookup.getMVSHLocodes());
EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.PreviewKeyDownEvent, new KeyEventHandler(this.DatePicker_PreviewKeyDown)); EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.PreviewKeyDownEvent, new KeyEventHandler(this.DatePicker_PreviewKeyDown));
CREW.NationalityDict = LocalizedLookup.getNationalities(); CREW.NationalityDict = LocalizedLookup.getNationalities();

View File

@ -288,5 +288,21 @@ namespace ENI2
reader.Close(); reader.Close();
return result; return result;
} }
public static List<string> getMVSHLocodes()
{
List<string> result = new List<string>();
string query = string.Format("SELECT locode from MVSH_ports");
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
if (reader.IsDBNull(0)) continue;
result.Add(reader.GetString(0));
}
reader.Close();
return result;
}
} }
} }

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<UseIISExpress>true</UseIISExpress> <UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress /> <Use64BitIISExpress />
<IISExpressSSLPort /> <IISExpressSSLPort />
<IISExpressAnonymousAuthentication /> <IISExpressAnonymousAuthentication />

View File

@ -41,7 +41,7 @@ namespace bsmd.database
{ 65, "Wechselbrücken / -behälter" }, { 65, "Wechselbrücken / -behälter" },
{ 66, "Eisenbahngüterwagen" }, { 66, "Eisenbahngüterwagen" },
{ 67, "Reisezugwagen und Triebwagen" } { 67, "Reisezugwagen und Triebwagen" }
}); });
#endregion #endregion
@ -119,6 +119,8 @@ namespace bsmd.database
public static Dictionary<int, string> CargoHandlingDict { get; } = new Dictionary<int, string>(); public static Dictionary<int, string> CargoHandlingDict { get; } = new Dictionary<int, string>();
public static List<string> MVSHLocodes { get; } = new List<string>();
#endregion #endregion
#region DatabaseEntity implementation #region DatabaseEntity implementation
@ -212,7 +214,7 @@ namespace bsmd.database
#endregion #endregion
#region Validation #region Validation
public override void Validate(List<MessageError> errors, List<MessageViolation> violations) public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{ {
@ -234,6 +236,15 @@ namespace bsmd.database
errors.Add(RuleEngine.CreateError(ValidationCode.LOCODE, "PortOfLoading", this.PortOfLoading, this.Title, this.Identifier, this.Tablename)); errors.Add(RuleEngine.CreateError(ValidationCode.LOCODE, "PortOfLoading", this.PortOfLoading, this.Title, this.Identifier, this.Tablename));
} }
if(LADG.MVSHLocodes.Contains(this.MessageCore.PoC))
{
if (this.CargoCodeNST_3.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "CargoCodeNST_3 empty", this.CargoCodeNST_3, this.Title, this.Identifier, this.Tablename));
if(!this.CargoLACode.HasValue)
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "CargoLACode empty", "not set", this.Title, this.Identifier, this.Tablename));
}
} }
#endregion #endregion

Binary file not shown.