Version 3.9.10
This commit is contained in:
parent
d45084d1f1
commit
8296296463
@ -81,6 +81,7 @@ namespace ENI2
|
||||
// Preload validation fields
|
||||
List<ValidationField> vFields = bsmd.database.ValidationRule.ValidationFields;
|
||||
RuleEngine.RegisterLocodeChecker(Util.GlobalStructures.IsValidLocode);
|
||||
RuleEngine.RegisterPortAreaChecker(LocalizedLookup.PortAreaExists);
|
||||
|
||||
// Connect to locking service (if enabled)
|
||||
try
|
||||
|
||||
@ -425,7 +425,7 @@ namespace ENI2.DetailViewControls
|
||||
if (!reader.IsDBNull(0)) crew.CrewMemberLastName = reader.GetString(0);
|
||||
if (!reader.IsDBNull(1)) crew.CrewMemberFirstName = reader.GetString(1);
|
||||
if (!reader.IsDBNull(2)) crew.CrewMemberGender = GlobalStructures.ParseGender(reader.GetString(2));
|
||||
if (!reader.IsDBNull(3)) crew.CrewMemberNationality = reader.GetString(3).Substring(0, 2);
|
||||
if (!reader.IsDBNull(3)) crew.CrewMemberNationality = reader.GetString(3).Substring(0, 2).ToUpper();
|
||||
if (!reader.IsDBNull(4)) crew.CrewMemberDuty = reader.GetString(4);
|
||||
if (!reader.IsDBNull(5)) crew.CrewMemberPlaceOfBirth = reader.GetString(5);
|
||||
if (!reader.IsDBNull(6))
|
||||
@ -498,7 +498,7 @@ namespace ENI2.DetailViewControls
|
||||
if (!reader.IsDBNull(0)) pas.PassengerLastName = reader.GetString(0);
|
||||
if (!reader.IsDBNull(1)) pas.PassengerFirstName = reader.GetString(1);
|
||||
if (!reader.IsDBNull(2)) pas.PassengerGender = GlobalStructures.ParseGender(reader.GetString(2));
|
||||
if (!reader.IsDBNull(3)) pas.PassengerNationality = reader.GetString(3).Substring(0, 2);
|
||||
if (!reader.IsDBNull(3)) pas.PassengerNationality = reader.GetString(3).Substring(0, 2).ToUpper();
|
||||
if (!reader.IsDBNull(4)) pas.PassengerPortOfEmbarkation = reader.GetString(4);
|
||||
if (LocodeDB.PortNameFromLocode(pas.PassengerPortOfEmbarkation) == null)
|
||||
pas.PassengerPortOfEmbarkation = null;
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>3.9.10.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
|
||||
@ -62,6 +62,14 @@ namespace ENI2
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool PortAreaExists(string locode, string portArea)
|
||||
{
|
||||
string query = string.Format("SELECT COUNT(*) FROM INFO_PortArea WHERE Locode = '{0}' AND Code = '{1}'", locode, portArea);
|
||||
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||
long numResults = (long) cmd.ExecuteScalar();
|
||||
return (numResults > 0);
|
||||
}
|
||||
|
||||
public static Dictionary<string, string> getNationalities()
|
||||
{
|
||||
Dictionary<string, string> result = new Dictionary<string, string>();
|
||||
|
||||
@ -210,6 +210,6 @@ namespace ENI2.Util
|
||||
return !LocodeDB.PortNameFromLocode(locode).IsNullOrEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -309,7 +309,10 @@ namespace bsmd.ExcelReadService
|
||||
}
|
||||
|
||||
if (val.Length == 2)
|
||||
{
|
||||
this.Conf.ConfirmText(lookup, val, ReadState.OK);
|
||||
val = val.ToUpper();
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
@ -190,7 +190,25 @@ namespace bsmd.database
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Validation
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
if ((PortArea.Length >= 2) && (PortArea.Length <= 4))
|
||||
{
|
||||
if ((RuleEngine.PortAreaChecker != null) && (this.MessageCore != null))
|
||||
if (!RuleEngine.PortAreaChecker(this.MessageCore.PoC, this.PortArea))
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "PortArea", this.PortArea, "INFO", "", this.Tablename));
|
||||
}
|
||||
else
|
||||
{
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.PORTAREA, "PortArea", this.PortArea, "INFO", "", this.Tablename));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ namespace bsmd.database
|
||||
//[Validation(ValidationCode.LOCODE)]
|
||||
//[ENI2Validation]
|
||||
[MaxLength(5)]
|
||||
public string PortFacilityGISICodeLocode { get; set; }
|
||||
public string PortFacilityGISISCodeLocode { get; set; }
|
||||
|
||||
public string Identifier { get; set; }
|
||||
|
||||
@ -96,7 +96,7 @@ namespace bsmd.database
|
||||
scmd.Parameters.AddWithNullableValue("@P7", this.PortFacilityShipSecurityLevel);
|
||||
scmd.Parameters.AddWithNullableValue("@P8", this.PortFacilitySecurityMattersToReport);
|
||||
scmd.Parameters.AddWithNullableValue("@P9", this.PortFacilityGISISCode);
|
||||
scmd.Parameters.AddWithNullableValue("@P10", this.PortFacilityGISICodeLocode);
|
||||
scmd.Parameters.AddWithNullableValue("@P10", this.PortFacilityGISISCodeLocode);
|
||||
scmd.Parameters.AddWithNullableValue("@P11", this.Identifier);
|
||||
|
||||
if (this.IsNew)
|
||||
@ -105,7 +105,7 @@ namespace bsmd.database
|
||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||
scmd.CommandText = string.Format("INSERT INTO {0} (Id, SEC_Id, PortFacilityPortName, PortFacilityPortCountry, " +
|
||||
"PortFacilityPortLoCode, PortFacilityDateOfArrival, PortFacilityDateOfDeparture, PortFacilityShipSecurityLevel, " +
|
||||
"PortFacilitySecurityMattersToReport, PortFacilityGISISCode, PortFacilityGISICodeLoCode, Identifier) VALUES " +
|
||||
"PortFacilitySecurityMattersToReport, PortFacilityGISISCode, PortFacilityGISISCodeLoCode, Identifier) VALUES " +
|
||||
"( @ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)", this.Tablename);
|
||||
}
|
||||
else
|
||||
@ -114,7 +114,7 @@ namespace bsmd.database
|
||||
scmd.CommandText = string.Format("UPDATE {0} SET PortFacilityPortName = @P2, PortFacilityPortCountry = @P3, " +
|
||||
"PortFacilityPortLoCode = @P4, PortFacilityDateOfArrival = @P5, PortFacilityDateOfDeparture = @P6," +
|
||||
"PortFacilityShipSecurityLevel = @P7, PortFacilitySecurityMattersToReport = @P8, PortFacilityGISISCode = @P9, " +
|
||||
"PortFacilityGISICodeLoCode = @P10, Identifier = @P11 WHERE Id = @ID", this.Tablename);
|
||||
"PortFacilityGISISCodeLoCode = @P10, Identifier = @P11 WHERE Id = @ID", this.Tablename);
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ namespace bsmd.database
|
||||
{
|
||||
string query = string.Format("SELECT Id, PortFacilityPortName, PortFacilityPortCountry, PortFacilityPortLoCode, " +
|
||||
"PortFacilityDateOfArrival, PortFacilityDateOfDeparture, PortFacilityShipSecurityLevel, PortFacilitySecurityMattersToReport, " +
|
||||
"PortFacilityGISISCode, PortFacilityGISICodeLoCode, Identifier FROM {0} ", this.Tablename);
|
||||
"PortFacilityGISISCode, PortFacilityGISISCodeLoCode, Identifier FROM {0} ", this.Tablename);
|
||||
|
||||
switch (filter)
|
||||
{
|
||||
@ -158,7 +158,7 @@ namespace bsmd.database
|
||||
if (!reader.IsDBNull(6)) ltpfc.PortFacilityShipSecurityLevel = reader.GetByte(6);
|
||||
if (!reader.IsDBNull(7)) ltpfc.PortFacilitySecurityMattersToReport = reader.GetString(7);
|
||||
if (!reader.IsDBNull(8)) ltpfc.PortFacilityGISISCode = reader.GetString(8);
|
||||
if (!reader.IsDBNull(9)) ltpfc.PortFacilityGISICodeLocode = reader.GetString(9);
|
||||
if (!reader.IsDBNull(9)) ltpfc.PortFacilityGISISCodeLocode = reader.GetString(9);
|
||||
if (!reader.IsDBNull(10)) ltpfc.Identifier = reader.GetString(10);
|
||||
result.Add(ltpfc);
|
||||
}
|
||||
|
||||
@ -91,7 +91,8 @@ namespace bsmd.database
|
||||
"DEWIS",
|
||||
"DE003",
|
||||
"DEWOL",
|
||||
"DEWYK"
|
||||
"DEWYK",
|
||||
"DEMAG"
|
||||
};
|
||||
|
||||
#endregion
|
||||
@ -104,11 +105,13 @@ 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 Dictionary<int, string> errorTextList = null;
|
||||
private static Dictionary<int, string> violationTextList = null;
|
||||
private static LocodeValidHandler _locodeChecker = null;
|
||||
private static PortAreaValidHandler _portAreaChecker = null;
|
||||
|
||||
private Dictionary<DatabaseEntity, List<MessageError>> errorDict = new Dictionary<DatabaseEntity, List<MessageError>>();
|
||||
private Dictionary<DatabaseEntity, List<MessageViolation>> violationDict = new Dictionary<DatabaseEntity, List<MessageViolation>>();
|
||||
@ -124,9 +127,12 @@ namespace bsmd.database
|
||||
public Dictionary<DatabaseEntity, List<MessageError>> ErrorDict { get { return this.errorDict; } }
|
||||
public Dictionary<DatabaseEntity, List<MessageViolation>> ViolationDict { get { return this.violationDict; } }
|
||||
|
||||
public static PortAreaValidHandler PortAreaChecker { get { return _portAreaChecker; } }
|
||||
|
||||
#region public static property validation
|
||||
|
||||
public static void RegisterLocodeChecker(LocodeValidHandler handler) { _locodeChecker = handler; }
|
||||
public static void RegisterPortAreaChecker(PortAreaValidHandler handler) { _portAreaChecker = handler; }
|
||||
|
||||
/// <summary>
|
||||
/// Test function checks decorated properties on an entity for errors (only errors, violations cannot
|
||||
@ -348,13 +354,7 @@ namespace bsmd.database
|
||||
case ValidationCode.NOT_NULL_MAX_LEN:
|
||||
if ((value.Length > maxlen) || (value.Length == 0))
|
||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||
break;
|
||||
case ValidationCode.PORTAREA:
|
||||
{
|
||||
if ((value.Length < 2) || (value.Length > 4))
|
||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ValidationCode.FRZ:
|
||||
{
|
||||
Regex rgx = new Regex(@"^[A-Z, a-z,0-9]{4,7}$");
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user