Version 3.8.11.1:

Korrekturen zum Go-Live, hauptsächlich bei der (statischen) Validierung
This commit is contained in:
Daniel Schick 2017-12-03 10:26:51 +00:00
parent 88b18d3bf1
commit 7be0296cba
27 changed files with 142 additions and 66 deletions

View File

@ -80,6 +80,7 @@ namespace ENI2
// Preload validation fields // Preload validation fields
List<ValidationField> vFields = bsmd.database.ValidationRule.ValidationFields; List<ValidationField> vFields = bsmd.database.ValidationRule.ValidationFields;
RuleEngine.RegisterLocodeChecker(bsmd.ExcelReadService.LocodeDB.IsValidLocode);
// Connect to locking service (if enabled) // Connect to locking service (if enabled)
try try

View File

@ -26,14 +26,7 @@ namespace ENI2.Controls
public LocodeControl() public LocodeControl()
{ {
InitializeComponent(); InitializeComponent();
} }
public enum LocodeMode
{
STANDARD,
NO_PORT_FLAG,
SSN
};
protected enum LocodeState protected enum LocodeState
{ {
@ -60,11 +53,11 @@ namespace ENI2.Controls
string portName = null; string portName = null;
switch (this.LocodeSource) switch (this.LocodeSource)
{ {
case LocodeMode.NO_PORT_FLAG: case RuleEngine.LocodeMode.NO_PORT_FLAG:
portName = LocodeDB.LocationNameFromLocode(value); break; portName = LocodeDB.LocationNameFromLocode(value); break;
case LocodeMode.STANDARD: case RuleEngine.LocodeMode.STANDARD:
portName = LocodeDB.PortNameFromLocode(value); break; portName = LocodeDB.PortNameFromLocode(value); break;
case LocodeMode.SSN: case RuleEngine.LocodeMode.SSN:
portName = LocalizedLookup.SSNPortNameFromLocode(value); break; portName = LocalizedLookup.SSNPortNameFromLocode(value); break;
} }
LocodeState locodeState = portName.IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK; LocodeState locodeState = portName.IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK;
@ -89,7 +82,7 @@ namespace ENI2.Controls
set { SetValue(LocodeValueProperty, value); } set { SetValue(LocodeValueProperty, value); }
} }
public LocodeMode LocodeSource { get; set; } public RuleEngine.LocodeMode LocodeSource { get; set; }
#region static methods #region static methods
@ -137,11 +130,11 @@ namespace ENI2.Controls
string portname = null; string portname = null;
switch(this.LocodeSource) switch(this.LocodeSource)
{ {
case LocodeMode.NO_PORT_FLAG: case RuleEngine.LocodeMode.NO_PORT_FLAG:
portname = LocodeDB.LocationNameFromLocode(directLocode); break; portname = LocodeDB.LocationNameFromLocode(directLocode); break;
case LocodeMode.STANDARD: case RuleEngine.LocodeMode.STANDARD:
portname = LocodeDB.PortNameFromLocode(directLocode); break; portname = LocodeDB.PortNameFromLocode(directLocode); break;
case LocodeMode.SSN: case RuleEngine.LocodeMode.SSN:
portname = LocalizedLookup.SSNPortNameFromLocode(directLocode); break; portname = LocalizedLookup.SSNPortNameFromLocode(directLocode); break;
} }
@ -164,11 +157,11 @@ namespace ENI2.Controls
switch(this.LocodeSource) switch(this.LocodeSource)
{ {
case LocodeMode.NO_PORT_FLAG: case RuleEngine.LocodeMode.NO_PORT_FLAG:
locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString, false); break; locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString, false); break;
case LocodeMode.STANDARD: case RuleEngine.LocodeMode.STANDARD:
locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString); break; locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(lookupString); break;
case LocodeMode.SSN: case RuleEngine.LocodeMode.SSN:
locodeEntries = LocalizedLookup.SSNAllLocodesForCityNameAsEntries(lookupString); break; locodeEntries = LocalizedLookup.SSNAllLocodesForCityNameAsEntries(lookupString); break;
} }
locodeEntries.Sort(); locodeEntries.Sort();

View File

@ -87,7 +87,9 @@ namespace ENI2
this.listBoxMessages.ItemsSource = this._listBoxList; this.listBoxMessages.ItemsSource = this._listBoxList;
_messages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(_core, DBManager.MessageLoad.ALL); _messages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(_core, DBManager.MessageLoad.ALL);
List<Message> missingMessages = bsmd.database.Util.CreateMessagesForCore(_core, _messages, this.LockedBy);
_messages.AddRange(missingMessages);
BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock); BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock);
Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0)); Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0));
} }
@ -377,7 +379,10 @@ namespace ENI2
if(messageError.NotificationClass == aMessage.MessageNotificationClassDisplay) if(messageError.NotificationClass == aMessage.MessageNotificationClassDisplay)
{ {
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = "";
aMessage.StatusInfo = string.Format("Validation error: {0}", messageError.ErrorText); aMessage.StatusInfo = string.Format("Validation error: {0}", messageError.ErrorText);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
break;
} }
} }
} }

View File

@ -78,6 +78,7 @@ namespace ENI2.DetailViewControls
if (this._tiefdMessage == null) if (this._tiefdMessage == null)
{ {
this._tiefdMessage = this.Core.CreateMessage(Message.NotificationClass.TIEFD); this._tiefdMessage = this.Core.CreateMessage(Message.NotificationClass.TIEFD);
DBManager.Instance.Save(this._tiefdMessage);
this.Messages.Add(this._tiefdMessage); this.Messages.Add(this._tiefdMessage);
} }
@ -90,6 +91,7 @@ namespace ENI2.DetailViewControls
tiefd.MessageCore = this.Core; tiefd.MessageCore = this.Core;
tiefd.MessageHeader = this._tiefdMessage; tiefd.MessageHeader = this._tiefdMessage;
_tiefdMessage.Elements.Add(tiefd); _tiefdMessage.Elements.Add(tiefd);
DBManager.Instance.Save(tiefd);
} }
this.tiefdGroupBox.DataContext = tiefd; this.tiefdGroupBox.DataContext = tiefd;

View File

@ -35,8 +35,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion> <MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>1</ApplicationRevision> <ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>3.8.10.%2a</ApplicationVersion> <ApplicationVersion>3.8.11.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -366,7 +366,7 @@ namespace ENI2
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(closedDialog.Core); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(closedDialog.Core);
// Meldeklassen für neuen Anlauf erzeugen: // 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 this.AnmeldungenControl_MessageCoreSelected(closedDialog.Core); // in einem neuen Reiter öffnen
} }
@ -424,7 +424,7 @@ namespace ENI2
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore);
// Meldeklassen für neuen Anlauf erzeugen: // 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 this.AnmeldungenControl_MessageCoreSelected(newCore); // in einem neuen Reiter öffnen
} }
} }

View File

@ -92,7 +92,8 @@ namespace ENI2
// suche auslösen // 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) BindingOperations.EnableCollectionSynchronization(this.anmeldungen, this.searchLock); // prevent sync lock exceptions (trat bei Sandra auf)

Binary file not shown.

View File

@ -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

View File

@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SQLite; using System.Data.SQLite;
using bsmd.database; using bsmd.database;
using ENI2;
namespace bsmd.ExcelReadService namespace bsmd.ExcelReadService
{ {
@ -57,6 +58,20 @@ namespace bsmd.ExcelReadService
return result; 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<string> AllLocodesForCityName(string city) public static List<string> AllLocodesForCityName(string city)
{ {
List<string> results = new List<string>(); List<string> results = new List<string>();

View File

@ -339,19 +339,15 @@ namespace bsmd.database
public string GetShipNameFromCore(MessageCore core) 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) STAT stat = statMessage.Elements[0] as STAT;
{ if (stat != null)
if (message.Elements.Count > 0) return stat.ShipName;
{
STAT stat = message.Elements[0] as STAT;
if (stat != null)
return stat.ShipName;
}
break;
}
} }
return null; return null;
} }

View File

@ -30,7 +30,7 @@ namespace bsmd.database
public HAZ HAZ { get; set; } public HAZ HAZ { get; set; }
[ShowReport] [ShowReport]
[Validation(ValidationCode.NOT_NULL)] [Validation(ValidationCode.STRING_EXACT_LEN, 4)]
[MaxLength(10)] [MaxLength(10)]
[ENI2Validation] [ENI2Validation]
public string UNNumber { get; set; } 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) 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")); 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")); 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) || 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")); violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList) foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList)

View File

@ -61,7 +61,7 @@ namespace bsmd.database
public DateTime? ETDFromLastPort { get; set; } public DateTime? ETDFromLastPort { get; set; }
[ShowReport] [ShowReport]
[Validation(ValidationCode.NOT_NULL)] [Validation(ValidationCode.LOCODE_SSN)]
[MaxLength(5)] [MaxLength(5)]
[ENI2Validation] [ENI2Validation]
public string NextPort { get; set; } public string NextPort { get; set; }
@ -220,11 +220,11 @@ namespace bsmd.database
{ {
if(this.ETDFromPortOfCall.HasValue && this.ETAToPortOfCall.HasValue && if(this.ETDFromPortOfCall.HasValue && this.ETAToPortOfCall.HasValue &&
(this.ETDFromPortOfCall < this.ETAToPortOfCall)) (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()) 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 && if (this.ETDFromKielCanal.HasValue && this.ETAToKielCanal.HasValue &&
(this.ETDFromKielCanal < this.ETAToKielCanal)) (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) 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) 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 && if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue &&
this.ETAToNextPort < ETDFromPortOfCall) 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) 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) 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));
} }

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")] [assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("3.8.10")] [assembly: AssemblyInformationalVersion("3.8.11")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")] [assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.8.10.*")] [assembly: AssemblyVersion("3.8.11.*")]

View File

@ -96,9 +96,19 @@ namespace bsmd.database
#endregion #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 ILog log = LogManager.GetLogger(typeof(RuleEngine));
private static Dictionary<int, string> errorTextList = null; private static Dictionary<int, string> errorTextList = null;
private static Dictionary<int, string> violationTextList = null; private static Dictionary<int, string> violationTextList = null;
private static LocodeValidHandler _locodeChecker = null;
private Dictionary<DatabaseEntity, List<MessageError>> errorDict = new Dictionary<DatabaseEntity, List<MessageError>>(); private Dictionary<DatabaseEntity, List<MessageError>> errorDict = new Dictionary<DatabaseEntity, List<MessageError>>();
private Dictionary<DatabaseEntity, List<MessageViolation>> violationDict = new Dictionary<DatabaseEntity, List<MessageViolation>>(); private Dictionary<DatabaseEntity, List<MessageViolation>> violationDict = new Dictionary<DatabaseEntity, List<MessageViolation>>();
@ -116,6 +126,8 @@ namespace bsmd.database
#region public static property validation #region public static property validation
public static void RegisterLocodeChecker(LocodeValidHandler handler) { _locodeChecker = handler; }
/// <summary> /// <summary>
/// Test function checks decorated properties on an entity for errors (only errors, violations cannot /// Test function checks decorated properties on an entity for errors (only errors, violations cannot
/// happen here) /// happen here)
@ -185,6 +197,27 @@ namespace bsmd.database
{ {
Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}"); 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 (!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; break;
case ValidationCode.LOCODE_GER: case ValidationCode.LOCODE_GER:
@ -227,8 +260,11 @@ namespace bsmd.database
break; break;
case ValidationCode.STRING_EXACT_LEN: case ValidationCode.STRING_EXACT_LEN:
{ {
if (value.Length != maxlen) if (!value.IsNullOrEmpty())
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); {
if (value.Length != maxlen)
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
}
} }
break; break;
case ValidationCode.STRING_MAXLEN: case ValidationCode.STRING_MAXLEN:

View File

@ -68,7 +68,7 @@ namespace bsmd.database
public int? GrossTonnage { get; set; } public int? GrossTonnage { get; set; }
[ShowReport] [ShowReport]
[Validation(ValidationCode.LOCODE)] [Validation(ValidationCode.LOCODE_NOPORT)]
[MaxLength(5)] [MaxLength(5)]
[ENI2Validation] [ENI2Validation]
public string PortOfRegistry { get; set; } public string PortOfRegistry { get; set; }
@ -115,7 +115,7 @@ namespace bsmd.database
public string ISMCompanyName { get; set; } public string ISMCompanyName { get; set; }
[ShowReport] [ShowReport]
//[Validation(ValidationCode.STRING_EXACT_LEN, 7)] [Validation(ValidationCode.STRING_EXACT_LEN, 7)]
[MaxLength(10)] [MaxLength(10)]
[ENI2Validation] [ENI2Validation]
public string ISMCompanyId { get; set; } public string ISMCompanyId { get; set; }

View File

@ -118,10 +118,18 @@ namespace bsmd.database
/// <summary> /// <summary>
/// Hilfsfunktion für "manuelle" Anlage eines Schiffsanlaufs. Die Objekte sind bereits gespeichert. /// Hilfsfunktion für "manuelle" Anlage eines Schiffsanlaufs. Die Objekte sind bereits gespeichert.
/// Es werden nur noch nicht vorhandene Meldeklassen erzeugt
/// </summary> /// </summary>
public static List<Message> CreateMessagesForCore(MessageCore core, ReportingParty user = null) public static List<Message> CreateMessagesForCore(MessageCore core, List<Message> existingMessages, ReportingParty user = null)
{ {
List<Message> result = new List<Message>(); List<Message> result = new List<Message>();
Dictionary<Message.NotificationClass, Message> messageDict = new Dictionary<Message.NotificationClass, Message>();
if(!existingMessages.IsNullOrEmpty())
{
foreach (Message aMessage in existingMessages)
messageDict.Add(aMessage.MessageNotificationClass, aMessage);
}
bool isDE, isDK; bool isDE, isDK;
if((core != null) && (core.PoC != null)) if((core != null) && (core.PoC != null))
{ {
@ -130,6 +138,8 @@ namespace bsmd.database
foreach (Message.NotificationClass notificationClass in Enum.GetValues(typeof(Message.NotificationClass))) foreach (Message.NotificationClass notificationClass in Enum.GetValues(typeof(Message.NotificationClass)))
{ {
if (messageDict.ContainsKey(notificationClass)) continue;
if(isDE) if(isDE)
{ {
if ((notificationClass == Message.NotificationClass.CREWD) || if ((notificationClass == Message.NotificationClass.CREWD) ||
@ -167,7 +177,6 @@ namespace bsmd.database
{ {
((MDH)classElement).SetBoolsToFalse(); ((MDH)classElement).SetBoolsToFalse();
} }
} }
DBManager.Instance.Save(message); DBManager.Instance.Save(message);

View File

@ -32,6 +32,8 @@ namespace bsmd.database
LIST_EMPTY, LIST_EMPTY,
IMPLAUSIBLE, IMPLAUSIBLE,
IMPLAUSIBLE_ZZUKN, IMPLAUSIBLE_ZZUKN,
LOCODE_NOPORT,
LOCODE_SSN,
POSITION_COUNT = 22, POSITION_COUNT = 22,
STRING_UNNUMBER = 23, STRING_UNNUMBER = 23,
STRING_IMOCLASS = 24, STRING_IMOCLASS = 24,

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 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 // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -12,8 +12,8 @@ namespace bsmd.dbh.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] [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()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -92,7 +92,7 @@
</None> </None>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
<None Include="Web References\DBHWebReference\answ-osis-extern.wsdl" /> <None Include="Web References\DBHWebReference\answ-osis-extern.wsdl" />

View File

@ -13,7 +13,7 @@ namespace bsmd.hisnord.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] [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()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -959,7 +959,8 @@ namespace bsmd.hisnord
if (s2s.ShipToShipActivityTypeCode.HasValue) if (s2s.ShipToShipActivityTypeCode.HasValue)
hn_lastactivity.ShipToShipActivityType = s2s.ShipToShipActivityTypeCode.Value.ToString(); 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); secItemNames.Add(ItemsChoiceType4.ShipToShipActivities);
secItems.Add(hn_lastactivity); secItems.Add(hn_lastactivity);
@ -1789,7 +1790,8 @@ namespace bsmd.hisnord
pi.Name = marpolPosition.Name; pi.Name = marpolPosition.Name;
if (marpolPosition.FlashpointInformation.HasValue) if (marpolPosition.FlashpointInformation.HasValue)
pi.FlashpointInformation = (flashpointinfotype)marpolPosition.FlashpointInformation.Value; 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) if (marpolPosition.Quantity_KGM.HasValue)
pi.Quantity_KGM = (float)marpolPosition.Quantity_KGM.Value; pi.Quantity_KGM = (float)marpolPosition.Quantity_KGM.Value;
pi.StowagePosition = marpolPosition.StowagePosition; pi.StowagePosition = marpolPosition.StowagePosition;

View File

@ -85,7 +85,7 @@
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
</ItemGroup> </ItemGroup>

View File

@ -13,7 +13,7 @@ namespace bsmd.status.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] [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()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -67,6 +67,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
</Compile> </Compile>
<Compile Include="Settings.cs" />
<Compile Include="Status.cs" /> <Compile Include="Status.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
@ -84,7 +85,7 @@
<None Include="bsmd.status.licenseheader" /> <None Include="bsmd.status.licenseheader" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
</ItemGroup> </ItemGroup>