diff --git a/ENI2/App.xaml.cs b/ENI2/App.xaml.cs index b2ca4b37..d2304b61 100644 --- a/ENI2/App.xaml.cs +++ b/ENI2/App.xaml.cs @@ -72,6 +72,7 @@ namespace ENI2 Dictionary cargoHandlingDict = LocalizedLookup.getLADGCargoHandlingStrings(langKey); foreach (int key in cargoHandlingDict.Keys) LADG.CargoHandlingDict.Add(key, cargoHandlingDict[key]); + LADG.MVSHLocodes.AddRange(LocalizedLookup.getMVSHLocodes()); EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.PreviewKeyDownEvent, new KeyEventHandler(this.DatePicker_PreviewKeyDown)); CREW.NationalityDict = LocalizedLookup.getNationalities(); diff --git a/ENI2/LocalizedLookup.cs b/ENI2/LocalizedLookup.cs index cf521efc..4956f671 100644 --- a/ENI2/LocalizedLookup.cs +++ b/ENI2/LocalizedLookup.cs @@ -288,5 +288,21 @@ namespace ENI2 reader.Close(); return result; } + + public static List getMVSHLocodes() + { + List result = new List(); + + 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; + } } } diff --git a/bsmd.LockingService/bsmd.LockingService.csproj.user b/bsmd.LockingService/bsmd.LockingService.csproj.user index 3517ad61..afa33dd1 100644 --- a/bsmd.LockingService/bsmd.LockingService.csproj.user +++ b/bsmd.LockingService/bsmd.LockingService.csproj.user @@ -2,7 +2,7 @@ true - Release|Any CPU + Debug|Any CPU diff --git a/bsmd.database/LADG.cs b/bsmd.database/LADG.cs index e7f380e7..6753fb63 100644 --- a/bsmd.database/LADG.cs +++ b/bsmd.database/LADG.cs @@ -41,7 +41,7 @@ namespace bsmd.database { 65, "Wechselbrücken / -behälter" }, { 66, "Eisenbahngüterwagen" }, { 67, "Reisezugwagen und Triebwagen" } - }); + }); #endregion @@ -119,6 +119,8 @@ namespace bsmd.database public static Dictionary CargoHandlingDict { get; } = new Dictionary(); + public static List MVSHLocodes { get; } = new List(); + #endregion #region DatabaseEntity implementation @@ -212,7 +214,7 @@ namespace bsmd.database #endregion - #region Validation + #region Validation public override void Validate(List errors, List violations) { @@ -234,6 +236,15 @@ namespace bsmd.database 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 diff --git a/misc/db.sqlite b/misc/db.sqlite index 15570602..4bfc9c1a 100644 Binary files a/misc/db.sqlite and b/misc/db.sqlite differ