diff --git a/ENI-2/ENI2/ENI2/App.xaml.cs b/ENI-2/ENI2/ENI2/App.xaml.cs index ca028cc9..17208fc6 100644 --- a/ENI-2/ENI2/ENI2/App.xaml.cs +++ b/ENI-2/ENI2/ENI2/App.xaml.cs @@ -80,6 +80,7 @@ namespace ENI2 // Preload validation fields List vFields = bsmd.database.ValidationRule.ValidationFields; + RuleEngine.RegisterLocodeChecker(bsmd.ExcelReadService.LocodeDB.IsValidLocode); // Connect to locking service (if enabled) try diff --git a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs index 7bdec8b1..31f2df4a 100644 --- a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs @@ -26,14 +26,7 @@ namespace ENI2.Controls public LocodeControl() { InitializeComponent(); - } - - public enum LocodeMode - { - STANDARD, - NO_PORT_FLAG, - SSN - }; + } protected enum LocodeState { @@ -60,11 +53,11 @@ namespace ENI2.Controls string portName = null; switch (this.LocodeSource) { - case LocodeMode.NO_PORT_FLAG: + case RuleEngine.LocodeMode.NO_PORT_FLAG: portName = LocodeDB.LocationNameFromLocode(value); break; - case LocodeMode.STANDARD: + case RuleEngine.LocodeMode.STANDARD: portName = LocodeDB.PortNameFromLocode(value); break; - case LocodeMode.SSN: + case RuleEngine.LocodeMode.SSN: portName = LocalizedLookup.SSNPortNameFromLocode(value); break; } LocodeState locodeState = portName.IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK; @@ -89,7 +82,7 @@ namespace ENI2.Controls set { SetValue(LocodeValueProperty, value); } } - public LocodeMode LocodeSource { get; set; } + public RuleEngine.LocodeMode LocodeSource { get; set; } #region static methods @@ -137,11 +130,11 @@ namespace ENI2.Controls string portname = null; switch(this.LocodeSource) { - case LocodeMode.NO_PORT_FLAG: + case RuleEngine.LocodeMode.NO_PORT_FLAG: portname = LocodeDB.LocationNameFromLocode(directLocode); break; - case LocodeMode.STANDARD: + case RuleEngine.LocodeMode.STANDARD: portname = LocodeDB.PortNameFromLocode(directLocode); break; - case LocodeMode.SSN: + case RuleEngine.LocodeMode.SSN: portname = LocalizedLookup.SSNPortNameFromLocode(directLocode); break; } @@ -164,11 +157,11 @@ namespace ENI2.Controls switch(this.LocodeSource) { - case LocodeMode.NO_PORT_FLAG: + case RuleEngine.LocodeMode.NO_PORT_FLAG: locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString, false); break; - case LocodeMode.STANDARD: + case RuleEngine.LocodeMode.STANDARD: locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString); break; - case LocodeMode.SSN: + case RuleEngine.LocodeMode.SSN: locodeEntries = LocalizedLookup.SSNAllLocodesForCityNameAsEntries(lookupString); break; } locodeEntries.Sort(); diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 5c0f6c0a..442eee90 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -87,7 +87,9 @@ namespace ENI2 this.listBoxMessages.ItemsSource = this._listBoxList; _messages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(_core, DBManager.MessageLoad.ALL); - + List missingMessages = bsmd.database.Util.CreateMessagesForCore(_core, _messages, this.LockedBy); + _messages.AddRange(missingMessages); + BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock); Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0)); } @@ -377,7 +379,10 @@ namespace ENI2 if(messageError.NotificationClass == aMessage.MessageNotificationClassDisplay) { aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; + aMessage.ChangedBy = ""; aMessage.StatusInfo = string.Format("Validation error: {0}", messageError.ErrorText); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); + break; } } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs index a5257fb4..3e8f1104 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs @@ -78,6 +78,7 @@ namespace ENI2.DetailViewControls if (this._tiefdMessage == null) { this._tiefdMessage = this.Core.CreateMessage(Message.NotificationClass.TIEFD); + DBManager.Instance.Save(this._tiefdMessage); this.Messages.Add(this._tiefdMessage); } @@ -90,6 +91,7 @@ namespace ENI2.DetailViewControls tiefd.MessageCore = this.Core; tiefd.MessageHeader = this._tiefdMessage; _tiefdMessage.Elements.Add(tiefd); + DBManager.Instance.Save(tiefd); } this.tiefdGroupBox.DataContext = tiefd; diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index e67ed48e..d886db5a 100644 --- a/ENI-2/ENI2/ENI2/ENI2.csproj +++ b/ENI-2/ENI2/ENI2/ENI2.csproj @@ -35,8 +35,8 @@ 3.5.1.0 true publish.html - 1 - 3.8.10.%2a + 2 + 3.8.11.%2a false true true diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs index ac7bc136..3c0560f2 100644 --- a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs +++ b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs @@ -366,7 +366,7 @@ namespace ENI2 DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(closedDialog.Core); // Meldeklassen für neuen Anlauf erzeugen: - bsmd.database.Util.CreateMessagesForCore(closedDialog.Core, userEntity); + bsmd.database.Util.CreateMessagesForCore(closedDialog.Core, null, userEntity); this.AnmeldungenControl_MessageCoreSelected(closedDialog.Core); // in einem neuen Reiter öffnen } @@ -424,7 +424,7 @@ namespace ENI2 DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore); // Meldeklassen für neuen Anlauf erzeugen: - bsmd.database.Util.CreateMessagesForCore(newCore, userEntity); + bsmd.database.Util.CreateMessagesForCore(newCore, null, userEntity); this.AnmeldungenControl_MessageCoreSelected(newCore); // in einem neuen Reiter öffnen } } diff --git a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs index 6681e30d..9335b853 100644 --- a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs @@ -92,7 +92,8 @@ namespace ENI2 // suche auslösen - this.anmeldungen = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict, resultLimit); + this.anmeldungen = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict, resultLimit); + this.dataGrid.SelectedItem = null; BindingOperations.EnableCollectionSynchronization(this.anmeldungen, this.searchLock); // prevent sync lock exceptions (trat bei Sandra auf) diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index f508c58b..d2338e10 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/HIS-NORD/Gesprächsprotokoll NSW-Schnittstelle HIS-Nord - BSMD - 2017-12-01.docx b/nsw/HIS-NORD/Gesprächsprotokoll NSW-Schnittstelle HIS-Nord - BSMD - 2017-12-01.docx new file mode 100644 index 00000000..56ac9b37 Binary files /dev/null and b/nsw/HIS-NORD/Gesprächsprotokoll NSW-Schnittstelle HIS-Nord - BSMD - 2017-12-01.docx differ diff --git a/nsw/HIS-NORD/Statusabfrage_NSW.txt b/nsw/HIS-NORD/Statusabfrage_NSW.txt new file mode 100644 index 00000000..ac10430d --- /dev/null +++ b/nsw/HIS-NORD/Statusabfrage_NSW.txt @@ -0,0 +1,12 @@ +Referenzsystem (Testsystem) +login: BSMD-REF +password: Hd47%23fz9Bl48sxU%232 +format: xml +url: https://ref-app.his-nord.de/HIS-Service/StatusInfoNSW.jsp + + +Livesystem +login: BSMD-PROD +password: Po47#fr7V45jtU#4 +format: xml +url: https://www.his-nord.de/HIS-Service/StatusInfoNSW.jsp \ No newline at end of file diff --git a/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs b/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs index 9410e8b2..177021a2 100644 --- a/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs +++ b/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Data; using System.Data.SQLite; using bsmd.database; +using ENI2; namespace bsmd.ExcelReadService { @@ -57,6 +58,20 @@ namespace bsmd.ExcelReadService return result; } + public static bool IsValidLocode(string locode, RuleEngine.LocodeMode mode) + { + switch(mode) + { + case RuleEngine.LocodeMode.NO_PORT_FLAG: + return !LocodeDB.LocationNameFromLocode(locode).IsNullOrEmpty(); + case RuleEngine.LocodeMode.SSN: + return !LocalizedLookup.SSNPortNameFromLocode(locode).IsNullOrEmpty(); + default: + return !LocodeDB.PortNameFromLocode(locode).IsNullOrEmpty(); + } + } + + public static List AllLocodesForCityName(string city) { List results = new List(); diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs index 9a9cb1c0..43afabc1 100644 --- a/nsw/Source/bsmd.database/DBManager.cs +++ b/nsw/Source/bsmd.database/DBManager.cs @@ -339,19 +339,15 @@ namespace bsmd.database public string GetShipNameFromCore(MessageCore core) - { - foreach(Message message in this.GetMessagesForCore(core, MessageLoad.ALL)) + { + + Message statMessage = this.GetMessage(core, Message.NotificationClass.STAT); + + if ((statMessage != null) && (statMessage.Elements.Count > 0)) { - if (message.MessageNotificationClass == Message.NotificationClass.STAT) - { - if (message.Elements.Count > 0) - { - STAT stat = message.Elements[0] as STAT; - if (stat != null) - return stat.ShipName; - } - break; - } + STAT stat = statMessage.Elements[0] as STAT; + if (stat != null) + return stat.ShipName; } return null; } diff --git a/nsw/Source/bsmd.database/IMDGPosition.cs b/nsw/Source/bsmd.database/IMDGPosition.cs index 580c2967..165800dc 100644 --- a/nsw/Source/bsmd.database/IMDGPosition.cs +++ b/nsw/Source/bsmd.database/IMDGPosition.cs @@ -30,7 +30,7 @@ namespace bsmd.database public HAZ HAZ { get; set; } [ShowReport] - [Validation(ValidationCode.NOT_NULL)] + [Validation(ValidationCode.STRING_EXACT_LEN, 4)] [MaxLength(10)] [ENI2Validation] public string UNNumber { get; set; } @@ -437,11 +437,12 @@ namespace bsmd.database if (!this.NetQuantity_KGM.HasValue && !this.GrossQuantity_KGM.HasValue && !this.Volume_MTQ.HasValue) violations.Add(RuleEngine.CreateViolation(ValidationCode.V802, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA")); - if ((this.GeneralCargoIBC ?? false) && this.ContainerNumber.IsNullOrEmpty() && this.VehicleLicenseNumber.IsNullOrEmpty()) + if (!(this.GeneralCargoIBC ?? false) && this.ContainerNumber.IsNullOrEmpty() && this.VehicleLicenseNumber.IsNullOrEmpty()) violations.Add(RuleEngine.CreateViolation(ValidationCode.V808, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD": "HAZA")); if((this.NetQuantity_KGM.HasValue && this.NetQuantity_KGM.Value > 100000) || - (this.GrossQuantity_KGM.HasValue && this.GrossQuantity_KGM.Value > 100000)) + (this.GrossQuantity_KGM.HasValue && this.GrossQuantity_KGM.Value > 100000) || + (this.Volume_MTQ.HasValue && this.Volume_MTQ.Value > 100)) violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA")); foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList) diff --git a/nsw/Source/bsmd.database/NOA_NOD.cs b/nsw/Source/bsmd.database/NOA_NOD.cs index 33cb211d..832d010b 100644 --- a/nsw/Source/bsmd.database/NOA_NOD.cs +++ b/nsw/Source/bsmd.database/NOA_NOD.cs @@ -61,7 +61,7 @@ namespace bsmd.database public DateTime? ETDFromLastPort { get; set; } [ShowReport] - [Validation(ValidationCode.NOT_NULL)] + [Validation(ValidationCode.LOCODE_SSN)] [MaxLength(5)] [ENI2Validation] public string NextPort { get; set; } @@ -220,11 +220,11 @@ namespace bsmd.database { if(this.ETDFromPortOfCall.HasValue && this.ETAToPortOfCall.HasValue && (this.ETDFromPortOfCall < this.ETAToPortOfCall)) - errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromPortOfCall", this.ETDFromPortOfCall.ToString(), this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromPortOfCall", this.ETDFromPortOfCall.ToString(), this.Title, null, this.Tablename)); if(this.CallPurposes.IsNullOrEmpty()) { - errors.Add(RuleEngine.CreateError(ValidationCode.LIST_EMPTY, null, "CallPurpose", this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.LIST_EMPTY, "CallPurposes", "CallPurpose", this.Title, null, this.Tablename)); } } @@ -232,24 +232,24 @@ namespace bsmd.database { if (this.ETDFromKielCanal.HasValue && this.ETAToKielCanal.HasValue && (this.ETDFromKielCanal < this.ETAToKielCanal)) - errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromKielCanal", this.ETDFromKielCanal.ToString(), this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromKielCanal", this.ETDFromKielCanal.ToString(), this.Title, null, this.Tablename)); } if((this.LastPort != null) && !this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETDFromLastPort", null, this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETDFromLastPort", null, this.Title, null, this.Tablename)); if((this.LastPort != null) && this.LastPort.Equals("ZZUKN") && this.ETDFromLastPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETDFromLastPort", null, this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETDFromLastPort", null, this.Title, null, this.Tablename)); if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue && this.ETAToNextPort < ETDFromPortOfCall) - errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETAToNextPort", null, this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETAToNextPort", null, this.Title, null, this.Tablename)); if ((this.NextPort != null) && !this.NextPort.Equals("ZZUKN") && !this.ETAToNextPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETAToNextPort", null, this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETAToNextPort", null, this.Title, null, this.Tablename)); if((this.NextPort != null) && this.NextPort.Equals("ZZUKN") && this.ETAToNextPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETAToNextPort", null, this.Title, this.Tablename)); + errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETAToNextPort", null, this.Title, null, this.Tablename)); } diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 923b2e0c..476319fe 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.8.10")] +[assembly: AssemblyInformationalVersion("3.8.11")] [assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index e2cf4434..e2d1f92d 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("3.8.10.*")] +[assembly: AssemblyVersion("3.8.11.*")] diff --git a/nsw/Source/bsmd.database/RuleEngine.cs b/nsw/Source/bsmd.database/RuleEngine.cs index 6fc91834..af60e9c0 100644 --- a/nsw/Source/bsmd.database/RuleEngine.cs +++ b/nsw/Source/bsmd.database/RuleEngine.cs @@ -96,9 +96,19 @@ namespace bsmd.database #endregion + public enum LocodeMode + { + STANDARD, + NO_PORT_FLAG, + SSN + }; + + public delegate bool LocodeValidHandler(string locode, LocodeMode mode); + private static ILog log = LogManager.GetLogger(typeof(RuleEngine)); private static Dictionary errorTextList = null; private static Dictionary violationTextList = null; + private static LocodeValidHandler _locodeChecker = null; private Dictionary> errorDict = new Dictionary>(); private Dictionary> violationDict = new Dictionary>(); @@ -116,6 +126,8 @@ namespace bsmd.database #region public static property validation + public static void RegisterLocodeChecker(LocodeValidHandler handler) { _locodeChecker = handler; } + /// /// Test function checks decorated properties on an entity for errors (only errors, violations cannot /// happen here) @@ -185,6 +197,27 @@ namespace bsmd.database { Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}"); if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + if (_locodeChecker != null) + if (!_locodeChecker(value, LocodeMode.STANDARD)) + errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + } + break; + case ValidationCode.LOCODE_NOPORT: + { + Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}"); + if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + if (_locodeChecker != null) + if (!_locodeChecker(value, LocodeMode.NO_PORT_FLAG)) + errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + } + break; + case ValidationCode.LOCODE_SSN: + { + Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}"); + if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + if (_locodeChecker != null) + if (!_locodeChecker(value, LocodeMode.SSN)) + errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); } break; case ValidationCode.LOCODE_GER: @@ -227,8 +260,11 @@ namespace bsmd.database break; case ValidationCode.STRING_EXACT_LEN: { - if (value.Length != maxlen) - errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + if (!value.IsNullOrEmpty()) + { + if (value.Length != maxlen) + errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + } } break; case ValidationCode.STRING_MAXLEN: diff --git a/nsw/Source/bsmd.database/STAT.cs b/nsw/Source/bsmd.database/STAT.cs index 9630b7fa..8ef5652e 100644 --- a/nsw/Source/bsmd.database/STAT.cs +++ b/nsw/Source/bsmd.database/STAT.cs @@ -68,7 +68,7 @@ namespace bsmd.database public int? GrossTonnage { get; set; } [ShowReport] - [Validation(ValidationCode.LOCODE)] + [Validation(ValidationCode.LOCODE_NOPORT)] [MaxLength(5)] [ENI2Validation] public string PortOfRegistry { get; set; } @@ -115,7 +115,7 @@ namespace bsmd.database public string ISMCompanyName { get; set; } [ShowReport] - //[Validation(ValidationCode.STRING_EXACT_LEN, 7)] + [Validation(ValidationCode.STRING_EXACT_LEN, 7)] [MaxLength(10)] [ENI2Validation] public string ISMCompanyId { get; set; } diff --git a/nsw/Source/bsmd.database/Util.cs b/nsw/Source/bsmd.database/Util.cs index 4d16eaf2..c0002acd 100644 --- a/nsw/Source/bsmd.database/Util.cs +++ b/nsw/Source/bsmd.database/Util.cs @@ -118,10 +118,18 @@ namespace bsmd.database /// /// Hilfsfunktion für "manuelle" Anlage eines Schiffsanlaufs. Die Objekte sind bereits gespeichert. + /// Es werden nur noch nicht vorhandene Meldeklassen erzeugt /// - public static List CreateMessagesForCore(MessageCore core, ReportingParty user = null) + public static List CreateMessagesForCore(MessageCore core, List existingMessages, ReportingParty user = null) { List result = new List(); + Dictionary messageDict = new Dictionary(); + if(!existingMessages.IsNullOrEmpty()) + { + foreach (Message aMessage in existingMessages) + messageDict.Add(aMessage.MessageNotificationClass, aMessage); + } + bool isDE, isDK; if((core != null) && (core.PoC != null)) { @@ -130,6 +138,8 @@ namespace bsmd.database foreach (Message.NotificationClass notificationClass in Enum.GetValues(typeof(Message.NotificationClass))) { + if (messageDict.ContainsKey(notificationClass)) continue; + if(isDE) { if ((notificationClass == Message.NotificationClass.CREWD) || @@ -167,7 +177,6 @@ namespace bsmd.database { ((MDH)classElement).SetBoolsToFalse(); } - } DBManager.Instance.Save(message); diff --git a/nsw/Source/bsmd.database/ValidationAttribute.cs b/nsw/Source/bsmd.database/ValidationAttribute.cs index 09b23eb7..f6e4f17c 100644 --- a/nsw/Source/bsmd.database/ValidationAttribute.cs +++ b/nsw/Source/bsmd.database/ValidationAttribute.cs @@ -32,6 +32,8 @@ namespace bsmd.database LIST_EMPTY, IMPLAUSIBLE, IMPLAUSIBLE_ZZUKN, + LOCODE_NOPORT, + LOCODE_SSN, POSITION_COUNT = 22, STRING_UNNUMBER = 23, STRING_IMOCLASS = 24, diff --git a/nsw/Source/bsmd.dbh/Properties/Settings.Designer.cs b/nsw/Source/bsmd.dbh/Properties/Settings.Designer.cs index 58d2ac28..6f7a9b5d 100644 --- a/nsw/Source/bsmd.dbh/Properties/Settings.Designer.cs +++ b/nsw/Source/bsmd.dbh/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,8 +12,8 @@ namespace bsmd.dbh.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/nsw/Source/bsmd.dbh/bsmd.dbh.csproj b/nsw/Source/bsmd.dbh/bsmd.dbh.csproj index f75007b7..c0239abe 100644 --- a/nsw/Source/bsmd.dbh/bsmd.dbh.csproj +++ b/nsw/Source/bsmd.dbh/bsmd.dbh.csproj @@ -92,7 +92,7 @@ - SettingsSingleFileGenerator + PublicSettingsSingleFileGenerator Settings.Designer.cs diff --git a/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs b/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs index 9e393807..9cbc6cdd 100644 --- a/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs +++ b/nsw/Source/bsmd.hisnord/Properties/Settings.Designer.cs @@ -13,7 +13,7 @@ namespace bsmd.hisnord.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/nsw/Source/bsmd.hisnord/Request.cs b/nsw/Source/bsmd.hisnord/Request.cs index ae768534..b3814462 100644 --- a/nsw/Source/bsmd.hisnord/Request.cs +++ b/nsw/Source/bsmd.hisnord/Request.cs @@ -959,7 +959,8 @@ namespace bsmd.hisnord if (s2s.ShipToShipActivityTypeCode.HasValue) hn_lastactivity.ShipToShipActivityType = s2s.ShipToShipActivityTypeCode.Value.ToString(); - hn_lastactivity.ShipToShipActivitySecurityMattersToReportOf = s2s.ShipToShipActivitySecurityMattersToReport; + if(!s2s.ShipToShipActivitySecurityMattersToReport.IsNullOrEmpty()) + hn_lastactivity.ShipToShipActivitySecurityMattersToReportOf = s2s.ShipToShipActivitySecurityMattersToReport; secItemNames.Add(ItemsChoiceType4.ShipToShipActivities); secItems.Add(hn_lastactivity); @@ -1789,7 +1790,8 @@ namespace bsmd.hisnord pi.Name = marpolPosition.Name; if (marpolPosition.FlashpointInformation.HasValue) pi.FlashpointInformation = (flashpointinfotype)marpolPosition.FlashpointInformation.Value; - pi.Flashpoint_CEL = marpolPosition.Flashpoint_CEL; + if(!marpolPosition.Flashpoint_CEL.IsNullOrEmpty()) + pi.Flashpoint_CEL = marpolPosition.Flashpoint_CEL; if (marpolPosition.Quantity_KGM.HasValue) pi.Quantity_KGM = (float)marpolPosition.Quantity_KGM.Value; pi.StowagePosition = marpolPosition.StowagePosition; diff --git a/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj b/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj index b6030315..3f164053 100644 --- a/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj +++ b/nsw/Source/bsmd.hisnord/bsmd.hisnord.csproj @@ -85,7 +85,7 @@ - SettingsSingleFileGenerator + PublicSettingsSingleFileGenerator Settings.Designer.cs diff --git a/nsw/Source/bsmd.status/Properties/Settings.Designer.cs b/nsw/Source/bsmd.status/Properties/Settings.Designer.cs index 2bdc0409..2165f2d3 100644 --- a/nsw/Source/bsmd.status/Properties/Settings.Designer.cs +++ b/nsw/Source/bsmd.status/Properties/Settings.Designer.cs @@ -13,7 +13,7 @@ namespace bsmd.status.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/nsw/Source/bsmd.status/bsmd.status.csproj b/nsw/Source/bsmd.status/bsmd.status.csproj index 87466675..bfb15ccb 100644 --- a/nsw/Source/bsmd.status/bsmd.status.csproj +++ b/nsw/Source/bsmd.status/bsmd.status.csproj @@ -67,6 +67,7 @@ True Settings.settings + @@ -84,7 +85,7 @@ - SettingsSingleFileGenerator + PublicSettingsSingleFileGenerator Settings.Designer.cs