Compare commits

...

5 Commits

13 changed files with 71 additions and 59 deletions

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>7.2.6.0</ApplicationVersion>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>7.2.6.2</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@ -85,13 +85,13 @@
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<ManifestCertificateThumbprint>FE53D3ADE2DCE4BD171A899FF41D43E63FEA7639</ManifestCertificateThumbprint>
<ManifestCertificateThumbprint>C5FD306818D481FBECE3B2E74D7A912F515191E0</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>ENI2_6_TemporaryKey.pfx</ManifestKeyFile>
<ManifestKeyFile>ENI2_7_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug 64|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
@ -851,6 +851,7 @@
<None Include="ENI2_4_TemporaryKey.pfx" />
<None Include="ENI2_5_TemporaryKey.pfx" />
<None Include="ENI2_6_TemporaryKey.pfx" />
<None Include="ENI2_7_TemporaryKey.pfx" />
<None Include="Service References\LockingServiceReference\ENI2.LockingServiceReference.CoreLock.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
@ -1083,7 +1084,7 @@
<SignToolPath Condition="'$(SignToolPath)' == '' And '$(SignToolPathBase)' != ''">$(SignToolPathBase)$(Platform)\</SignToolPath>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>"$(SignToolPath)signtool.exe" sign /f $(ProjectDir)\ENI2_6_TemporaryKey.pfx /p FgrMFUWsTVGQeb6L6i0e /fd SHA256 $(TargetPath)</PostBuildEvent>
<PostBuildEvent>"$(SignToolPath)signtool.exe" sign /f $(ProjectDir)\ENI2_7_TemporaryKey.pfx /p FgrMFUWsTVGQeb6L6i0e /fd SHA256 $(TargetPath)</PostBuildEvent>
</PropertyGroup>
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Binary file not shown.

View File

@ -740,7 +740,7 @@ namespace ENI2.Excel
pas.PassengerLastName = lastName;
pas.PassengerFirstName = reader.ReadCellAsText("passenger departure", string.Format("C{0}", i + 16));
pas.PassengerPlaceOfBirth = reader.ReadCellAsText("passenger departure", string.Format("D{0}", i + 16));
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16)), out bool canceled);
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16)), out bool canceled, false);
if (canceled) return false;
pas.PassengerDateOfBirth = reader.ReadCellAsDateTime("passenger departure", string.Format("F{0}", i + 16));
pas.PassengerGender = ParseGender(reader.ReadCellAsText("passenger departure", string.Format("G{0}", i + 16)));
@ -802,7 +802,7 @@ namespace ENI2.Excel
pas.PassengerLastName = lastName;
pas.PassengerFirstName = reader.ReadCellAsText("passenger arrival", string.Format("C{0}", i + 16));
pas.PassengerPlaceOfBirth = reader.ReadCellAsText("passenger arrival", string.Format("D{0}", i + 16));
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16)), out bool canceled);
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16)), out bool canceled, false);
if (canceled) return false;
pas.PassengerDateOfBirth = reader.ReadCellAsDateTime("passenger arrival", string.Format("F{0}", i + 16));
pas.PassengerGender = ParseGender(reader.ReadCellAsText("passenger arrival", string.Format("G{0}", i + 16)));
@ -1207,7 +1207,7 @@ namespace ENI2.Excel
crew.CrewMemberLastName = lastName;
crew.CrewMemberFirstName = reader.ReadCellAsText("crew departure", string.Format("C{0}", i + 15));
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText("crew departure", string.Format("D{0}", i + 15));
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew departure", string.Format("E{0}", i + 15)), out bool canceled);
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew departure", string.Format("E{0}", i + 15)), out bool canceled, false);
if (canceled) return false;
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime("crew departure", string.Format("F{0}", i + 15));
string gender = reader.ReadCellAsText("crew departure", string.Format("G{0}", i + 15));
@ -1257,7 +1257,7 @@ namespace ENI2.Excel
crew.CrewMemberLastName = lastName;
crew.CrewMemberFirstName = reader.ReadCellAsText("crew arrival", string.Format("C{0}", i + 15));
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText("crew arrival", string.Format("D{0}", i + 15));
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15)), out bool canceled);
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15)), out bool canceled, false);
if (canceled) return false;
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime("crew arrival", string.Format("F{0}", i + 15));
string gender = reader.ReadCellAsText("crew arrival", string.Format("G{0}", i + 15));

View File

@ -2133,7 +2133,7 @@ namespace ENI2.Excel
crew.CrewMemberNationality = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 18)), out canceled);
if (canceled) return true;
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 18), 100);
crew.CrewMemberCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("I{0}", i + 18)), out _);
crew.CrewMemberCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("I{0}", i + 18)), out _, false);
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("J{0}", i + 18));
@ -2252,7 +2252,7 @@ namespace ENI2.Excel
crewd.CrewMemberNationality = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 18)), out canceled);
if (canceled) return true;
crewd.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 18), 100);
crewd.CrewMemberCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("I{0}", i + 18)), out _);
crewd.CrewMemberCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("I{0}", i + 18)), out _, false);
crewd.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("J{0}", i + 18));
crewd.CrewMemberIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 18)), out canceled);
@ -2374,7 +2374,7 @@ namespace ENI2.Excel
pas.PassengerInTransit = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", i + 17));
pas.PassengerPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 17), 100);
pas.PassengerCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 17)), out _);
pas.PassengerCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 17)), out _, false);
if (canceled) return true;
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("L{0}", i + 17));
@ -2515,7 +2515,7 @@ namespace ENI2.Excel
pas.PassengerInTransit = reader.ReadCellAsBool(sheetTitle, string.Format("H{0}", i + 18));
pas.PassengerPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 18), 100);
pas.PassengerCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 18)), out _);
pas.PassengerCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 18)), out _, false);
if (canceled) return true;
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("L{0}", i + 18));
@ -2848,12 +2848,12 @@ namespace ENI2.Excel
return result;
}
public static string ReadNationality(string nationality, out bool canceled)
public static string ReadNationality(string nationality, out bool canceled, bool setPlaceHolder = true)
{
string result = null;
canceled = false;
nationality = nationality.Trim();
if (nationality.IsNullOrEmpty())
if (nationality.IsNullOrEmpty() && setPlaceHolder)
{
result = "XX";
}
@ -2871,35 +2871,38 @@ namespace ENI2.Excel
}
else // we cannot find whatever this is..
{
FixImportDialog fid = new FixImportDialog();
fid.Value = nationality;
fid.ValueType = "Nationality";
fid.SelectionValues = CREW.NationalityDict;
if (fid.ShowDialog() ?? false)
if (setPlaceHolder) // only show import dialog if this is a required field..
{
if (!fid.SelectedValue.IsNullOrEmpty())
FixImportDialog fid = new FixImportDialog();
fid.Value = nationality;
fid.ValueType = "Nationality";
fid.SelectionValues = CREW.NationalityDict;
if (fid.ShowDialog() ?? false)
{
if(!ValueMapping.InvalidKeys[ValueMapping.MappingType.COUNTRY].Contains(nationality))
if (!fid.SelectedValue.IsNullOrEmpty())
{
string selectedValue = fid.SelectedValue;
Task<bool> createResult = Task.Run(async () => await ValueMapping.Create(ValueMapping.MappingType.COUNTRY, nationality, selectedValue));
if(!createResult.Result)
_log.WarnFormat("Error saving nationality value mapping {0} -> {1}", nationality, selectedValue);
if (!ValueMapping.InvalidKeys[ValueMapping.MappingType.COUNTRY].Contains(nationality))
{
string selectedValue = fid.SelectedValue;
Task<bool> createResult = Task.Run(async () => await ValueMapping.Create(ValueMapping.MappingType.COUNTRY, nationality, selectedValue));
if (!createResult.Result)
_log.WarnFormat("Error saving nationality value mapping {0} -> {1}", nationality, selectedValue);
}
else
{
// add temporary
ValueMapping vm = ValueMapping.Create(ValueMapping.MappingType.COUNTRY);
vm.Key = nationality;
vm.Value = fid.SelectedValue;
ValueMapping.Dicts[ValueMapping.MappingType.COUNTRY].Add(nationality, vm);
}
result = fid.SelectedValue.Substring(0, 2); // attention manual entry
}
else
{
// add temporary
ValueMapping vm = ValueMapping.Create(ValueMapping.MappingType.COUNTRY);
vm.Key = nationality;
vm.Value = fid.SelectedValue;
ValueMapping.Dicts[ValueMapping.MappingType.COUNTRY].Add(nationality, vm);
}
result = fid.SelectedValue.Substring(0, 2); // attention manual entry
}
}
else
{
canceled = true;
else
{
canceled = true;
}
}
}

View File

@ -43,12 +43,11 @@ namespace bsmd.database
public string CrewMemberFirstName { get; set; }
[ShowReport]
[ReportDisplayName("Place of birth")]
[ReportDisplayName("Place of birth")]
[MaxLength(100)]
[ENI2Validation]
public string CrewMemberPlaceOfBirth { get; set; }
[Validation(ValidationCode.FLAG_CODE)]
[MaxLength(2)]
[ENI2Validation]
public string CrewMemberCountryOfBirth { get; set; }
@ -82,7 +81,7 @@ namespace bsmd.database
[MaxLength(2)]
[ENI2Validation]
public string CrewMemberNationality { get; set; }
[Validation(ValidationCode.NOT_NULL)]
[ENI2Validation]
public byte? CrewMemberIdentityDocumentType { get; set; }
@ -121,7 +120,7 @@ namespace bsmd.database
[MaxLength(2)]
[ENI2Validation]
public string CrewMemberIdentityDocumentIssuingState { get; set; }
[Validation(ValidationCode.PAST_DATE)]
[ENI2Validation]
public DateTime? CrewMemberIdentityDocumentExpiryDate { get; set; }
@ -324,12 +323,12 @@ namespace bsmd.database
}
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value > DateTime.Today))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value <= CLAMPMINDATE))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check date of birth", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
// NSW 7.2 rules
// NSW 7.2 rules
if((this.NotificationSchengen ?? false) && (!this.HasSchengenDetails))
{
@ -382,14 +381,14 @@ namespace bsmd.database
row[5] = crew.CrewMemberGender ?? (object)DBNull.Value;
if (crew.CrewMemberNationality?.Length == 2)
row[6] = crew.CrewMemberNationality;
else
else
row[6] = DBNull.Value;
row[7] = crew.CrewMemberIdentityDocumentType ?? (object)DBNull.Value;
row[8] = crew.CrewMemberIdentityDocumentId ?? (object)DBNull.Value;
row[9] = crew.CrewMemberVisaNumber ?? (object)DBNull.Value;
row[10] = crew.CrewMemberDuty ?? (object)DBNull.Value;
row[11] = crew.Identifier ?? (object)DBNull.Value;
row[12] = crew.IsDeparture;
row[12] = crew.IsDeparture;
if (crew.CrewMemberIdentityDocumentIssuingState?.Length == 2)
row[13] = crew.CrewMemberIdentityDocumentIssuingState;
else
@ -448,7 +447,7 @@ namespace bsmd.database
this.CrewMemberIdentityDocumentType = crew.CrewMemberIdentityDocumentType;
this.CrewMemberIdentityDocumentId = crew.CrewMemberIdentityDocumentId;
this.CrewMemberVisaNumber = crew.CrewMemberVisaNumber;
this.CrewMemberDuty = crew.CrewMemberDuty;
this.CrewMemberDuty = crew.CrewMemberDuty;
this.CrewMemberIdentityDocumentIssuingState = crew.CrewMemberIdentityDocumentIssuingState;
this.CrewMemberIdentityDocumentExpiryDate = crew.CrewMemberIdentityDocumentExpiryDate;
this.Effects = crew.Effects;
@ -462,7 +461,7 @@ namespace bsmd.database
public static CREW CreateCommon(List<CREW> crewList)
{
CREW crew = new CREW(); // template entity
CREW crew = new CREW(); // template entity
if(crewList.IsNullOrEmpty())
return crew;

View File

@ -266,6 +266,10 @@ namespace bsmd.database
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{
if(this.Quantity_KGM >= 1000000000)
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) &&
this.Flashpoint_CEL.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V804, "Flashpoint_CEL", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));

View File

@ -201,6 +201,9 @@ namespace bsmd.database
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{
if(this.Quantity_KGM >= 1000000000)
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
if (!this.UNNumber.IsNullOrEmpty() && !unNumberRegex.IsMatch(this.UNNumber))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "UNNumber", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));

View File

@ -499,7 +499,7 @@ namespace bsmd.database
if((this.NetQuantity_KGM >= 1000000000) ||
(this.GrossQuantity_KGM >= 1000000000) ||
(this.Volume_MTQ >= 1000000000))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList)

View File

@ -235,7 +235,10 @@ namespace bsmd.database
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{
if(!MHB ?? false)
if(this.Quantity_KGM >= 1000000000)
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
if (!MHB ?? false)
{
if(this.UNNumber.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V803, "UNNumber", this.UNNumber, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));

View File

@ -188,6 +188,9 @@ namespace bsmd.database
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{
if (this.Quantity_KGM >= 1000000000)
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) &&
this.Flashpoint_CEL.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V804, "Flashpoint_CEL", null, this.Title, this.Identifier,

View File

@ -149,8 +149,7 @@ namespace bsmd.database
[ENI2Validation]
public bool? NotificationPAX { get; set; }
[Validation(ValidationCode.FLAG_CODE)]
[MaxLength(2)]
[ENI2Validation]
public string PassengerCountryOfBirth { get; set; }

View File

@ -249,7 +249,7 @@ namespace bsmd.dbh.Request
{
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("7.2")]
[System.Xml.Serialization.XmlEnumAttribute("7.2.1")]
Item72,
}

View File

@ -4,9 +4,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using bsmd.database;
using log4net;
@ -26,7 +23,7 @@ namespace bsmd.dbh
{
Root root = new Root();
root.Version = RootVersion.Item72;
root.SourceDocumentVersion = "7.2";
root.SourceDocumentVersion = "7.2.1";
root.Timestamp = DateTime.Now;
string filenameComponent;