diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index cd87bc18..860d073a 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,10 +26,12 @@ 1000 - http://192.168.2.24/LockingService/LockingService.svc + + http://heupferd/bsmd.LockingService/LockingService.svc - Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false + + Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 82e49694..cdb7db96 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -717,6 +717,17 @@ namespace ENI2 #endregion + #region IMO plausibility + + if (!this.Core.IMO.IsNullOrEmpty() && !bsmd.database.Util.IsIMOValid(this.Core.IMO)) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "IMO number does not follow the rules", null, "GLOBAL"); + mv.MessageGroupName = Properties.Resources.textOverview; + vViolations.Add(mv); + } + + #endregion + #endregion foreach (MessageError me in vErrors) diff --git a/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs index fcb92408..3a49b7e0 100644 --- a/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/NewWithIdDialog.xaml.cs @@ -95,6 +95,9 @@ namespace ENI2.EditControls private void doubleUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { this.CheckComplete(); + + if ((this.doubleUpDownIMO.Value > 1000000) && (!bsmd.database.Util.IsIMOValid(this.doubleUpDownIMO.Value.ToString()))) + MessageBox.Show("IMO has invalid format!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } private void comboBoxInitialHIS_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs index 48dc00f7..6bb819e0 100644 --- a/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/VisitIdDialog.xaml.cs @@ -82,6 +82,9 @@ namespace ENI2.EditControls bool hasValue = (doubleUpDownIMO.Value.HasValue && doubleUpDownIMO.Value > 0); doubleUpDownENI.IsReadOnly = hasValue; this.CheckComplete(); + + if ((this.doubleUpDownIMO.Value > 1000000) && (!bsmd.database.Util.IsIMOValid(this.doubleUpDownIMO.Value.ToString()))) + MessageBox.Show("IMO has invalid format!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } private void doubleUpDownENI_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) diff --git a/ENI-2/ENI2/ENI2/LocalizedLookup.cs b/ENI-2/ENI2/ENI2/LocalizedLookup.cs index 0a7d07fc..ca8c46a1 100644 --- a/ENI-2/ENI2/ENI2/LocalizedLookup.cs +++ b/ENI-2/ENI2/ENI2/LocalizedLookup.cs @@ -74,6 +74,7 @@ namespace ENI2 public static bool CheckNationality(string nationality) { + if (nationality.IsNullOrEmpty()) return false; if (_nationalities == null) _nationalities = getNationalities(); return _nationalities.ContainsKey(nationality); } diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index fa1f6d05..856fce24 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs index aa8c5c2d..0211f6f4 100644 --- a/nsw/Source/bsmd.database/DBManager.cs +++ b/nsw/Source/bsmd.database/DBManager.cs @@ -787,6 +787,7 @@ namespace bsmd.database if (entity is ISublistElement sublistElement) { string stringIdentifier = (sublistElement).Identifier; + if (stringIdentifier == null) return; Regex re = new Regex(@"\d+"); Match m = re.Match(stringIdentifier); if (m.Success) diff --git a/nsw/Source/bsmd.database/MDH.cs b/nsw/Source/bsmd.database/MDH.cs index af94aecc..af9e2df0 100644 --- a/nsw/Source/bsmd.database/MDH.cs +++ b/nsw/Source/bsmd.database/MDH.cs @@ -617,6 +617,9 @@ namespace bsmd.database if ((this.DateOfIssue.HasValue) && (this.DateOfIssue.Value < DateTime.Today.AddMonths(-6))) violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of issue might be too old", null, this.Title, null, this.Tablename)); + if ((this.DateOfIssue.HasValue) && (this.DateOfIssue.Value > DateTime.Today)) + violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of issue is in the future", null, this.Title, null, this.Tablename)); + if (this.PortOfCallLast30Days.Count == 0) { errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "Port of Call last 30 day list is EMPTY", null, this.Title, null, this.Tablename)); diff --git a/nsw/Source/bsmd.database/SEC.cs b/nsw/Source/bsmd.database/SEC.cs index 878f232a..78621a0a 100644 --- a/nsw/Source/bsmd.database/SEC.cs +++ b/nsw/Source/bsmd.database/SEC.cs @@ -409,6 +409,9 @@ namespace bsmd.database if ((this.LastTenPortFacilitesCalled.Count == 0) || (this.LastTenPortFacilitesCalled.Count > 10)) errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "LastTenPortFacilitiesCalled", null, this.Title, null, this.Tablename)); + if (!(this.ValidISSCOnBoard ?? false)) + violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "No valid security plan on board?", null, this.Title, null, this.Tablename)); + if(this.KielCanalPassagePlanned ?? false) { if(!KielCanalPassagePlannedIncomming.HasValue && !KielCanalPassagePlannedOutgoing.HasValue) diff --git a/nsw/Source/bsmd.database/STAT.cs b/nsw/Source/bsmd.database/STAT.cs index 4b352d2d..a77c82d3 100644 --- a/nsw/Source/bsmd.database/STAT.cs +++ b/nsw/Source/bsmd.database/STAT.cs @@ -319,6 +319,12 @@ namespace bsmd.database violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Beam valid?", null, this.Title, null, this.Tablename)); if (this.GrossTonnage.HasValue && ((this.GrossTonnage.Value < 50) || (this.GrossTonnage > 500000))) violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gross tonnage valid?", null, this.Title, null, this.Tablename)); + + if((this.PortOfRegistry.Length > 1) && (this.Flag.Length == 2)) + { + if (!this.PortOfRegistry.Substring(0, 2).Equals(this.Flag)) + violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Port of registration and flag do not match!", null, this.Title, null, this.Tablename)); + } } #endregion diff --git a/nsw/Source/bsmd.database/TOWA.cs b/nsw/Source/bsmd.database/TOWA.cs index 4cb74e38..c8d52d79 100644 --- a/nsw/Source/bsmd.database/TOWA.cs +++ b/nsw/Source/bsmd.database/TOWA.cs @@ -31,7 +31,7 @@ namespace bsmd.database public string TowageOnArrivalName { get; set; } [ShowReport] - [Validation(ValidationCode.FLAG_CODE)] + [Validation(ValidationCode.FLAG_CODE)] [MaxLength(2)] [ENI2Validation] public string TowageOnArrivalFlag { get; set; } diff --git a/nsw/Source/bsmd.database/TOWD.cs b/nsw/Source/bsmd.database/TOWD.cs index bdd91fca..05ce8206 100644 --- a/nsw/Source/bsmd.database/TOWD.cs +++ b/nsw/Source/bsmd.database/TOWD.cs @@ -32,6 +32,7 @@ namespace bsmd.database [ShowReport] [MaxLength(2)] + [Validation(ValidationCode.FLAG_CODE)] [ENI2Validation] public string TowageOnDepartureFlag { get; set; } diff --git a/nsw/Source/bsmd.database/Util.cs b/nsw/Source/bsmd.database/Util.cs index 434c4fbf..260f3167 100644 --- a/nsw/Source/bsmd.database/Util.cs +++ b/nsw/Source/bsmd.database/Util.cs @@ -250,12 +250,12 @@ namespace bsmd.database int sum = 0; for (int i = 0, multiplier = 7; i < 6; i++, multiplier--) { - sum += (Convert.ToInt32(actualIMO[i]) * multiplier); + sum += (Convert.ToInt32(actualIMO.Substring(i,1)) * multiplier); } int lastdigit = sum % 10; // letzte Stelle - if (Convert.ToInt32(actualIMO[6]) == lastdigit) + if (Convert.ToInt32(actualIMO.Substring(6,1)) == lastdigit) return true; } diff --git a/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs b/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs index 8ef2c266..2c3801a7 100644 --- a/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs +++ b/nsw/Source/bsmd.dbh.ResponseService/IResponseService.cs @@ -3,9 +3,8 @@ using System.Collections.Generic; using System.ServiceModel; namespace bsmd.dbh.ResponseService -{ - // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together. - [ServiceContract] +{ + [ServiceContract] public interface IResponseService { @@ -14,8 +13,8 @@ namespace bsmd.dbh.ResponseService /// Sicher ist Void, weniger sicher der Namen und der Name des Parameters. Dessen Type allerdings schon. /// [OperationContract(Action = "http://tempuri.org/IResponseService/NSWResponse")] - [XmlSerializerFormatAttribute()] - void Root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp, + [XmlSerializerFormatAttribute()] + void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp, string SenderReference, bsmd.dbh.response.RootType Type, bsmd.dbh.response.RootReportingClassesFull ReportingClassesFull, bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial, diff --git a/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs b/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs index 2dd81400..81036dd4 100644 --- a/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs +++ b/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs @@ -1,15 +1,18 @@ using System; +using System.ServiceModel; using log4net; using bsmd.database; namespace bsmd.dbh.ResponseService -{ +{ + + [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, ValidateMustUnderstand = false)] public class ResponseService : IResponseService { private readonly ILog _log = LogManager.GetLogger("dbh ResponseService"); - public void Root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp, + public void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp, string SenderReference, bsmd.dbh.response.RootType Type, bsmd.dbh.response.RootReportingClassesFull ReportingClassesFull, bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial, diff --git a/nsw/dbh/readme.md b/nsw/dbh/readme.md new file mode 100644 index 00000000..ef61be5d --- /dev/null +++ b/nsw/dbh/readme.md @@ -0,0 +1,45 @@ +# Erkenntnisse DBH Response + +Nach dem Server Umzug Aug/Sep. funktionierte der DBH Rückkanal nicht mehr. Mit NSW 3.0 gab es ohnehin schwere Probleme, so dass man den +Weg verlassen hat. In einem Termin in Bremen wurde nun die Reaktivierung besprochen. Ich habe es leider auf Anhieb nicht geschafft, den +Rückkanal wiederzubeleben, da alle Werte leer waren und offensichtlich das Parsing kaputt war. +Dabei habe ich festgestellt, dass DBH im Header die SOAP Header Attribute To: und Action: (von SOAP 1.1) verwendet in der Form: + +``` + + http://srv-04.bsmd.local/nswservice/dbh/ResponseService.svc + http://tempuri.org/IResponseService/NSWResponse + + +``` + +Es hat nur funktioniert, als ich diese beiden Attribute gelöscht habe. Nach langer Suche (kann ja nur serverseitig was ändern, wie dbh angeblich auf die "lowlevel" Themen keinen Einfluss hat) folgendes in der web.config eingetragen: + +``` + + + + + + + + + + + + + + + +``` +Der interessante Punkt ist dass man die messageVersion (entscheidet darüber, ob To/Action angenommen wird oder nicht, das ist das Addressing) nur angeben kann wenn man customBinding verwendet. + +Außerdem habe ich im Service die Klasse ResponseService mit folgenden Attributen dekoriert: + +``` +[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, ValidateMustUnderstand = false)] +``` + +Beim nächsten Versuch kamen die Attribute auf einmal nicht mehr mit (konnte man da doch was drehen, Herr Stöver?) und ich habe das Adressing wieder auskommentiert. + +Dieser ganze *Bullshit* ist nur eine Gedankenstütze \ No newline at end of file