diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
index 5abb4a01..8cf2dbe7 100644
--- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs
@@ -610,6 +610,33 @@ namespace ENI2
vViolations.AddRange(violations);
}
+ #region 12.11.18: ein paar neue komische globale Plausi-Prüfungen
+ Message crewMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREW);
+ Message pasMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.PAS);
+ Message pobaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.POBA);
+
+ if (pobaMessage.Elements.Count == 1)
+ {
+ POBA poba = pobaMessage.Elements[0] as POBA;
+
+ if (crewMessage.Elements.Count != poba.TotalCrewMembersOnBoardUponArrival)
+ {
+ MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBA crew member count different from CREW count!", null, "Crew count mismatch", null, "CREW");
+ mv.MessageGroupName = Properties.Resources.textOverview;
+ vViolations.Add(mv);
+ }
+
+ if(pasMessage.Elements.Count != poba.TotalPassengersOnBoardUponArrival)
+ {
+ MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "POBA passenger count different from PAS count!", null, "Passenger count mismatch", null, "PAS");
+ mv.MessageGroupName = Properties.Resources.textOverview;
+ vViolations.Add(mv);
+ }
+
+ }
+
+ #endregion
+
foreach (MessageError me in vErrors)
{
this.highlightService.HighlightError(me, this.GetContainerForMessageGroupName(me.MessageGroupName));
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml
index 0463b64d..97f26563 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml
@@ -56,7 +56,11 @@
-
+
+
+
+
+
@@ -83,7 +87,11 @@
-
+
+
+
+
+
diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
index 1d684669..55d8a118 100644
--- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
@@ -105,6 +105,8 @@ namespace ENI2.DetailViewControls
this.Messages.Add(this._crewMessage);
}
+ this.groupBoxCrewList.DataContext = this._crewMessage;
+
this.dataGridCrewList.Initialize();
this.dataGridCrewList.ItemsSource = this._crewMessage.Elements;
this.dataGridCrewList.AddingNewItem += DataGridCrewList_AddingNewItem;
@@ -123,6 +125,8 @@ namespace ENI2.DetailViewControls
this.Messages.Add(this._pasMessage);
}
+ this.groupBoxPassengerList.DataContext = this._pasMessage;
+
this.dataGridPassengerList.Initialize();
this.dataGridPassengerList.ItemsSource = this._pasMessage.Elements;
this.dataGridPassengerList.AddingNewItem += DataGridPassengerList_AddingNewItem;
diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj
index a76cd9b2..eb876703 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
- 5.0.19.%2a
+ 0
+ 5.1.0.%2a
false
true
true
diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
index c2332a1e..4d2a9c47 100644
--- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
+++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
@@ -1889,6 +1889,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to entries.
+ ///
+ public static string textEntries {
+ get {
+ return ResourceManager.GetString("textEntries", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Error code.
///
diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx
index f7ec3383..73e214f0 100644
--- a/ENI-2/ENI2/ENI2/Properties/Resources.resx
+++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx
@@ -1657,4 +1657,7 @@
HIS {0} of message {1} and current target {2} do not match: Reset aborted
+
+ entries
+
\ No newline at end of file
diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx
index 54ab7d05..47e2e7a6 100644
Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ
diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs b/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs
index d5b23615..dacb021f 100644
--- a/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs
+++ b/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs
@@ -218,12 +218,12 @@ namespace bsmd.ExcelReadService
string val = this.ReadText(lookup);
if (val != null)
{
- if (val.Equals("identity_card", StringComparison.CurrentCultureIgnoreCase)) result = 0;
- if (val.Equals("passport", StringComparison.CurrentCultureIgnoreCase)) result = 1;
- if (val.Equals("muster_book", StringComparison.CurrentCultureIgnoreCase)) result = 2;
- if (val.Equals("picture_id", StringComparison.CurrentCultureIgnoreCase)) result = 3;
- if (val.Equals("residental_permit", StringComparison.CurrentCultureIgnoreCase)) result = 4;
- if (val.Equals("other_legal_identity_document", StringComparison.CurrentCultureIgnoreCase)) result = 5;
+ if (val.Equals("identity_card", StringComparison.CurrentCultureIgnoreCase) || val.Equals("1")) result = 0;
+ if (val.Equals("passport", StringComparison.CurrentCultureIgnoreCase) || val.Equals("2")) result = 1;
+ if (val.Equals("muster_book", StringComparison.CurrentCultureIgnoreCase) || val.Equals("3")) result = 2;
+ if (val.Equals("picture_id", StringComparison.CurrentCultureIgnoreCase) || val.Equals("4")) result = 3;
+ if (val.Equals("residental_permit", StringComparison.CurrentCultureIgnoreCase) || val.Equals("5")) result = 4;
+ if (val.Equals("other_legal_identity_document", StringComparison.CurrentCultureIgnoreCase) || val.Equals("6")) result = 5;
if (val.Equals("ic", StringComparison.CurrentCultureIgnoreCase)) result = 0;
if (result == null)
@@ -260,6 +260,31 @@ namespace bsmd.ExcelReadService
return result;
}
+ internal byte? ReadGeneralDescriptionOfCargo(string lookup)
+ {
+ string val = this.ReadText(lookup);
+ byte? result = null;
+ if(val != null)
+ {
+ if (val.Contains("container", StringComparison.OrdinalIgnoreCase) || val.Equals("1")) result = 0;
+ if (val.Contains("vehicles", StringComparison.OrdinalIgnoreCase) || val.Equals("2")) result = 1;
+ if (val.Contains("convent", StringComparison.OrdinalIgnoreCase) || val.Equals("3")) result = 2;
+ if (val.Contains("dry", StringComparison.OrdinalIgnoreCase) || val.Equals("4")) result = 3;
+ if (val.Contains("liquid", StringComparison.OrdinalIgnoreCase) || val.Equals("5")) result = 4;
+ if (val.Contains("empty", StringComparison.OrdinalIgnoreCase) || val.Equals("6")) result = 5;
+
+ if (result == null)
+ this.Conf.ConfirmText(lookup, val, ReadState.WARN);
+ else
+ this.Conf.ConfirmText(lookup, val, ReadState.OK);
+ }
+ else
+ {
+ this.Conf.ConfirmText(lookup, null, ReadState.FAIL);
+ }
+ return result;
+ }
+
internal byte? ReadCargoHandlingType(string lookup)
{
string val = this.ReadText(lookup);
diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs
index 5d77a3bf..7143fd90 100644
--- a/nsw/Source/bsmd.ExcelReadService/Util.cs
+++ b/nsw/Source/bsmd.ExcelReadService/Util.cs
@@ -1759,19 +1759,7 @@ namespace bsmd.ExcelReadService
}
reader.Conf.ConfirmText("SEC.ISSCIssuerType", isscIssuerType, sec.ISSCIssuerType.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
-
- string genDescCargo = reader.ReadText("SEC.GeneralDescriptionOfCargo");
- if(genDescCargo != null)
- {
- if (genDescCargo.Contains("container", StringComparison.OrdinalIgnoreCase)) sec.GeneralDescriptionOfCargo = 0;
- if (genDescCargo.Contains("vehicles", StringComparison.OrdinalIgnoreCase)) sec.GeneralDescriptionOfCargo = 1;
- if (genDescCargo.Contains("convent", StringComparison.OrdinalIgnoreCase)) sec.GeneralDescriptionOfCargo = 2;
- if (genDescCargo.Contains("dry", StringComparison.OrdinalIgnoreCase)) sec.GeneralDescriptionOfCargo = 3;
- if (genDescCargo.Contains("liquid", StringComparison.OrdinalIgnoreCase)) sec.GeneralDescriptionOfCargo = 4;
- if (genDescCargo.Contains("empty", StringComparison.OrdinalIgnoreCase)) sec.GeneralDescriptionOfCargo = 5;
- }
-
- reader.Conf.ConfirmText("SEC.GeneralDescriptionOfCargo", genDescCargo, sec.GeneralDescriptionOfCargo.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
+ sec.GeneralDescriptionOfCargo = reader.ReadGeneralDescriptionOfCargo("SEC.GeneralDescriptionOfCargo");
bool? secKielArrival = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Arrival");
bool? secKielDeparture = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Departure");
diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs
index d69b7421..e3678f11 100644
--- a/nsw/Source/bsmd.database/DBManager.cs
+++ b/nsw/Source/bsmd.database/DBManager.cs
@@ -1073,7 +1073,7 @@ namespace bsmd.database
{
if (core == null) return;
SqlCommand cmd = new SqlCommand();
- cmd.CommandText = "SELECT STAT.ShipName FROM STAT JOIN MessageHeader ON STAT.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
+ cmd.CommandText = "SELECT STAT.ShipName, STAT.GrossTonnage FROM STAT JOIN MessageHeader ON STAT.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
cmd.Parameters.AddWithValue("@ID", core.Id);
SqlDataReader reader = this.PerformCommand(cmd);
if(reader.Read())
@@ -1082,6 +1082,11 @@ namespace bsmd.database
core.Shipname = "";
else
core.Shipname = reader.GetString(0);
+ if(!reader.IsDBNull(1))
+ {
+ int grossTonnage = reader.GetInt32(1);
+ core.IsSmallShip = grossTonnage < 500;
+ }
}
reader.Close();
}
diff --git a/nsw/Source/bsmd.database/MDH.cs b/nsw/Source/bsmd.database/MDH.cs
index 16583e4f..8dcaffef 100644
--- a/nsw/Source/bsmd.database/MDH.cs
+++ b/nsw/Source/bsmd.database/MDH.cs
@@ -116,6 +116,7 @@ namespace bsmd.database
[MaxLength(100)]
[ENI2Validation]
public string SanitaryMeasuresLocation { get; set; }
+
[ShowReport]
[LookupName("MDH.SanitaryMeasuresDate_1")]
[ENI2Validation]
@@ -549,6 +550,9 @@ namespace bsmd.database
if ((this.InfectedAreaVisited ?? false) && this.InfectedAreas.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V766, "Infected area date or port missing", null, this.Title, null, this.Tablename));
+ 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.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/MessageCore.cs b/nsw/Source/bsmd.database/MessageCore.cs
index 483e5c73..5f109574 100644
--- a/nsw/Source/bsmd.database/MessageCore.cs
+++ b/nsw/Source/bsmd.database/MessageCore.cs
@@ -19,10 +19,8 @@ namespace bsmd.database
private Guid? next;
private DateTime? created;
private DateTime? changed;
-
- private Guid? customerId;
private int? wetris_zz_56_datensatz_id;
- private static ILog _log = LogManager.GetLogger("MessageCore");
+ private static readonly ILog _log = LogManager.GetLogger("MessageCore");
private string _visitId;
private string _transitId;
@@ -215,7 +213,7 @@ namespace bsmd.database
public Customer Customer { get; set; }
- public Guid? CustomerId { get { return this.customerId; } set { this.customerId = value; } }
+ public Guid? CustomerId { get; set; }
public ReportStatusEnum ReportStatus { get; set; }
@@ -242,23 +240,32 @@ namespace bsmd.database
/// ENI-2 display prop
///
public string Shipname { get; set; }
+
///
/// ENI-2 display prop
///
public DateTime? ETA_NOA_NOD { get; set; }
+
///
/// ENI-2 display prop
///
public DateTime? ETD_NOA_NOD { get; set; }
+
///
/// ENI-2 display prop
///
public DateTime? ATA { get; set; }
+
///
/// ENI-2 display prop
///
public DateTime? ATD { get; set; }
+ ///
+ /// Validation flag (set from STAT, GrossTonnage < 500)
+ ///
+ public bool IsSmallShip { get; set; } = false;
+
///
/// Flag zeigt an ob ein Excelsheet erzeugt werden soll
///
@@ -325,7 +332,7 @@ namespace bsmd.database
else scmd.Parameters.AddWithValue("@P6", DBNull.Value);
if (this.ETA.HasValue) scmd.Parameters.AddWithValue("@P7", this.ETA);
else scmd.Parameters.AddWithValue("@P7", DBNull.Value);
- if (this.customerId.HasValue) scmd.Parameters.AddWithValue("@P8", this.customerId);
+ if (this.CustomerId.HasValue) scmd.Parameters.AddWithValue("@P8", this.CustomerId);
else scmd.Parameters.AddWithValue("@P8", DBNull.Value);
if (this.previous.HasValue) scmd.Parameters.AddWithValue("@P9", this.previous);
else scmd.Parameters.AddWithValue("@P9", DBNull.Value);
@@ -396,7 +403,7 @@ namespace bsmd.database
StringBuilder sb = new StringBuilder("SELECT ");
if (this.ResultLimit.HasValue && this.ResultLimit.Value > 0)
{
- sb.Append(string.Format("TOP {0} ", this.ResultLimit));
+ sb.AppendFormat("TOP {0} ", this.ResultLimit);
}
sb.AppendFormat("[{0}].[Id], [{0}].[VisitId], [{0}].[TransitId], [{0}].[IMO], [{0}].[ENI], [{0}].[PoC], [{0}].[Portname], " +
@@ -411,8 +418,7 @@ namespace bsmd.database
if(filter == Message.LoadFilter.SEARCH_CORE_FILTERS)
{
- Dictionary searchDict = criteria[0] as Dictionary;
- if (searchDict != null && (searchDict.Count > 0))
+ if (criteria[0] is Dictionary searchDict && (searchDict.Count > 0))
{
if (searchDict.ContainsKey(SearchFilterType.FILTER_ETA))
sb.Append(", NOA_NOD.ETAToPortOfCall, NOA_NOD.ETAToKielCanal");
@@ -508,8 +514,7 @@ namespace bsmd.database
// object ist jetzt ein dict aus filtertyp und filterparameter
bool moreThanOne = false;
- Dictionary searchDict = criteria[0] as Dictionary;
- if (searchDict != null && (searchDict.Count > 0))
+ if (criteria[0] is Dictionary searchDict && (searchDict.Count > 0))
{
if (searchDict.ContainsKey(SearchFilterType.FILTER_SHIPNAME))
{
@@ -517,7 +522,7 @@ namespace bsmd.database
sb.Append(" JOIN MessageHeader mh ON MessageCore.Id = mh.MessageCoreId JOIN STAT ON mh.Id = STAT.MessageHeaderId");
}
- if(searchDict.ContainsKey(SearchFilterType.FILTER_ETA))
+ if (searchDict.ContainsKey(SearchFilterType.FILTER_ETA))
{
// perform NOA_NOD join
sb.Append(" LEFT JOIN MessageHeader mh2 ON mh2.MessageCoreId = MessageCore.Id AND mh2.NotificationClass = 2 LEFT JOIN NOA_NOD ON NOA_NOD.MessageHeaderId = mh2.Id");
@@ -590,14 +595,14 @@ namespace bsmd.database
break;
case SearchFilterType.FILTER_TICKETNO:
{
- sb.Append(" TicketNo like @TICKETNO ");
+ sb.Append(" TicketNo like @TICKETNO ");
((SqlCommand)cmd).Parameters.AddWithValue("@TICKETNO", searchDict[key]);
break;
- }
+ }
}
if (!moreThanOne) moreThanOne = true;
}
- }
+ }
break;
}
case Message.LoadFilter.ALL:
@@ -621,7 +626,7 @@ namespace bsmd.database
if (!reader.IsDBNull(5)) core.PoC = reader.GetString(5);
if (!reader.IsDBNull(6)) core.Portname = reader.GetString(6);
if (!reader.IsDBNull(7)) core.ETA = reader.GetDateTime(7);
- if (!reader.IsDBNull(8)) core.customerId = reader.GetGuid(8);
+ if (!reader.IsDBNull(8)) core.CustomerId = reader.GetGuid(8);
if (!reader.IsDBNull(9)) core.previous = reader.GetGuid(9);
if (!reader.IsDBNull(10)) core.next = reader.GetGuid(10);
core.IsTransit = reader.GetBoolean(11);
@@ -706,9 +711,9 @@ namespace bsmd.database
public int CompareTo(object obj)
{
- if(obj is MessageCore)
+ if(obj is MessageCore messageCore)
{
- return Nullable.Compare(((MessageCore)obj).ETA_NOA_NOD, this.ETA_NOA_NOD);
+ return Nullable.Compare((messageCore).ETA_NOA_NOD, this.ETA_NOA_NOD);
}
return 0;
}
@@ -719,7 +724,7 @@ namespace bsmd.database
public bool Equals(MessageCore other)
{
- return null != other && Id == other.Id;
+ return other != null && Id == other.Id;
}
#endregion
diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs
index a8741a24..59d1dfc4 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("5.0.20")]
+[assembly: AssemblyInformationalVersion("5.1.0")]
[assembly: AssemblyCopyright("Copyright © 2014-2018 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 0f58f37b..c53cc7c0 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("5.0.20.*")]
+[assembly: AssemblyVersion("5.1.0.*")]
diff --git a/nsw/Source/bsmd.database/RuleEngine.cs b/nsw/Source/bsmd.database/RuleEngine.cs
index 1e91fe30..adbbbed4 100644
--- a/nsw/Source/bsmd.database/RuleEngine.cs
+++ b/nsw/Source/bsmd.database/RuleEngine.cs
@@ -21,7 +21,7 @@ namespace bsmd.database
#region german LOCODE's static definition
- private static List gerLocodeList = new List() {
+ private static readonly List gerLocodeList = new List() {
"DE001",
"DEAND",
"DEBDF",
@@ -107,15 +107,12 @@ namespace bsmd.database
public delegate bool LocodeValidHandler(string locode, LocodeMode mode);
public delegate bool PortAreaValidHandler(string locode, string portArea);
- private static ILog log = LogManager.GetLogger(typeof(RuleEngine));
+ private static readonly ILog log = LogManager.GetLogger(typeof(RuleEngine));
private static Dictionary errorTextList = null;
private static Dictionary violationTextList = null;
private static LocodeValidHandler _locodeChecker = null;
private static PortAreaValidHandler _portAreaChecker = null;
- private Dictionary> errorDict = new Dictionary>();
- private Dictionary> violationDict = new Dictionary>();
-
public RuleEngine()
{
if (RuleEngine.errorTextList == null)
@@ -124,8 +121,8 @@ namespace bsmd.database
RuleEngine.violationTextList = DBManager.Instance.LoadViolationTexts();
}
- public Dictionary> ErrorDict { get { return this.errorDict; } }
- public Dictionary> ViolationDict { get { return this.violationDict; } }
+ public Dictionary> ErrorDict { get; } = new Dictionary>();
+ public Dictionary> ViolationDict { get; } = new Dictionary>();
public static PortAreaValidHandler PortAreaChecker { get { return _portAreaChecker; } }
@@ -143,8 +140,8 @@ namespace bsmd.database
public static void ValidateProperties(DatabaseEntity entity, List errors, List violations)
{
string identifier = null;
- if (entity is ISublistElement)
- identifier = ((ISublistElement)entity).Identifier;
+ if (entity is ISublistElement sublistElement)
+ identifier = (sublistElement).Identifier;
Type objType = entity.GetType();
@@ -257,15 +254,13 @@ namespace bsmd.database
break;
case ValidationCode.INT_GT_ZERO:
{
- int intVal = 0;
- if (!Int32.TryParse(value, out intVal) || intVal <= 0)
+ if (!Int32.TryParse(value, out int intVal) || intVal <= 0)
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
}
break;
case ValidationCode.DOUBLE_GT_ZERO:
{
- double dVal = 0;
- if (!Double.TryParse(value, out dVal) || dVal <= 0)
+ if (!Double.TryParse(value, out double dVal) || dVal <= 0)
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
}
break;
@@ -316,19 +311,17 @@ namespace bsmd.database
break;
case ValidationCode.DRAUGHT_IMPLAUSIBLE:
{
- double dVal = 0;
- if (!Double.TryParse(value, out dVal) || dVal <= 0)
+ if (!Double.TryParse(value, out double dVal) || dVal <= 0)
errors.Add(RuleEngine.CreateError(ValidationCode.DOUBLE_GT_ZERO, property.Name, value, entity.Title, identifier, entity.Tablename));
else
if ((dVal < 20) || (dVal > 150))
- errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
+ errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
}
break;
case ValidationCode.TIME_IMPLAUSIBLE:
{
- DateTime aTime;
if (value.Length == 0) errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, property.Name, value, entity.Title, identifier, entity.Tablename));
- if (DateTime.TryParse(value, out aTime))
+ if (DateTime.TryParse(value, out DateTime aTime))
{
if ((aTime - DateTime.UtcNow).Minutes > 15)
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
@@ -341,7 +334,7 @@ namespace bsmd.database
{
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
}
- if(!value.IsNullOrEmpty() && !(value.Trim().Any(char.IsDigit))) // falls "-" oder keine Zahl enthalten, Fehler!
+ if(!value.IsNullOrEmpty() && !value.Trim().Any(char.IsDigit)) // falls "-" oder keine Zahl enthalten, Fehler!
{
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, property.Name, value, entity.Title, identifier, entity.Tablename));
}
@@ -349,7 +342,7 @@ namespace bsmd.database
}
case ValidationCode.VESSEL_TYPE:
{
- if((value.Length == 0) || ((STAT.VesselTypeDict != null) && !STAT.VesselTypeDict.ContainsKey(value)))
+ if((value.Length == 0) || (STAT.VesselTypeDict?.ContainsKey(value) == false))
{
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, property.Name, value, entity.Title, identifier, entity.Tablename));
}
@@ -361,14 +354,14 @@ namespace bsmd.database
break;
case ValidationCode.FRZ:
{
- Regex rgx = new Regex(@"^[A-Z,a-z,0-9]{4,7}$");
+ Regex rgx = new Regex("^[A-Z,a-z,0-9]{4,7}$");
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
break;
}
case ValidationCode.MMSI:
{
- Regex rgx = new Regex(@"^[0-9]{9}$");
+ Regex rgx = new Regex("^[0-9]{9}$");
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
break;
}
@@ -408,6 +401,7 @@ namespace bsmd.database
// individuelle Fehler nach Nachrichtenklasse prüfen
derivedEntity.MessageCore = aMessage.MessageCore; // some instance we need info from core (NOA / Transit)
if ((derivedEntity is LADG) && aMessage.MessageCore.IsTransit) continue; // kein error reporting für LADG bei Transit (CH, 1.2.16)
+ if ((derivedEntity is SEC) && aMessage.MessageCore.IsSmallShip) continue; // keine STAT Validierung für kleine Schiffe (CH, 1.11.18)
RuleEngine.ValidateProperties(derivedEntity, errors, violations);
derivedEntity.Validate(errors, violations);
}
@@ -425,14 +419,15 @@ namespace bsmd.database
List errors = new List();
List violations = new List();
- this.errorDict[entity] = errors;
- this.violationDict[entity] = violations;
+ this.ErrorDict[entity] = errors;
+ this.ViolationDict[entity] = violations;
foreach (DatabaseEntity derivedEntity in ((Message)entity).Elements)
{
// individuelle Fehler nach Nachrichtenklasse prüfen
derivedEntity.MessageCore = entity.MessageCore; // some instance we need info from core (NOA / Transit)
if ((derivedEntity is LADG) && entity.MessageCore.IsTransit) continue; // kein error reporting für LADG bei Transit (CH, 1.2.16)
+ if ((derivedEntity is SEC) && entity.MessageCore.IsSmallShip) continue; // keine STAT Validierung für kleine Schiffe (CH, 1.11.18)
RuleEngine.ValidateProperties(derivedEntity, errors, violations);
derivedEntity.Validate(errors, violations);
@@ -468,7 +463,7 @@ namespace bsmd.database
public static bool IsGermanLocode(string val)
{
- return (gerLocodeList.Contains(val.ToUpper()));
+ return gerLocodeList.Contains(val.ToUpper());
}
public static LocodeValidHandler LocodeChecker { get { return _locodeChecker; } }
@@ -511,7 +506,7 @@ namespace bsmd.database
return error;
}
- internal static MessageViolation CreateViolation(ValidationCode validationCode, string p,
+ public static MessageViolation CreateViolation(ValidationCode validationCode, string p,
string value, string entityName, string identifier = "", string notificationClass = "")
{
diff --git a/nsw/Source/bsmd.database/SEC.cs b/nsw/Source/bsmd.database/SEC.cs
index 551273a2..533e33c5 100644
--- a/nsw/Source/bsmd.database/SEC.cs
+++ b/nsw/Source/bsmd.database/SEC.cs
@@ -363,6 +363,9 @@ namespace bsmd.database
if ((!this.ValidISSCOnBoard ?? true) && this.ReasonsForNoValidISSC.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V702, "ReasonsForNoValidISSC", null, this.Title, null, this.Tablename));
+ if (this.ISSCDateOfExpiration.HasValue && (this.ISSCDateOfExpiration < DateTime.Now))
+ violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "ISSC Expiration date is in the past", null, this.Title, null, this.Tablename));
+
if ((this.LastTenPortFacilitesCalled.Count == 0) || (this.LastTenPortFacilitesCalled.Count > 10))
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "LastTenPortFacilitiesCalled", null, this.Title, null, this.Tablename));