diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 99b37f39..6b9afb50 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -37,7 +37,7 @@ true publish.html 1 - 7.2.6.1 + 7.2.6.2 false true true diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index ab7ea69b..c31e6e6b 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -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 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 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; + } } } diff --git a/bsmd.database/CREW.cs b/bsmd.database/CREW.cs index b00a1804..f576d7b4 100644 --- a/bsmd.database/CREW.cs +++ b/bsmd.database/CREW.cs @@ -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 crewList) { - CREW crew = new CREW(); // template entity + CREW crew = new CREW(); // template entity if(crewList.IsNullOrEmpty()) return crew; diff --git a/bsmd.database/IBCPosition.cs b/bsmd.database/IBCPosition.cs index ebbb2bcf..2a9d73f6 100644 --- a/bsmd.database/IBCPosition.cs +++ b/bsmd.database/IBCPosition.cs @@ -268,7 +268,7 @@ namespace bsmd.database { if(this.Quantity_KGM >= 1000000000) - violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, 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")); if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) && this.Flashpoint_CEL.IsNullOrEmpty()) diff --git a/bsmd.database/IGCPosition.cs b/bsmd.database/IGCPosition.cs index b8a9d3ed..de9e39c7 100644 --- a/bsmd.database/IGCPosition.cs +++ b/bsmd.database/IGCPosition.cs @@ -202,7 +202,7 @@ namespace bsmd.database { if(this.Quantity_KGM >= 1000000000) - violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, 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")); 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")); diff --git a/bsmd.database/IMDGPosition.cs b/bsmd.database/IMDGPosition.cs index 7be07593..b4a8ba25 100644 --- a/bsmd.database/IMDGPosition.cs +++ b/bsmd.database/IMDGPosition.cs @@ -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.IMPLAUSIBLE, 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) diff --git a/bsmd.database/IMSBCPosition.cs b/bsmd.database/IMSBCPosition.cs index c171e455..a510b4a7 100644 --- a/bsmd.database/IMSBCPosition.cs +++ b/bsmd.database/IMSBCPosition.cs @@ -236,7 +236,7 @@ namespace bsmd.database public override void Validate(List errors, List violations) { if(this.Quantity_KGM >= 1000000000) - violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, 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")); if (!MHB ?? false) { diff --git a/bsmd.database/MARPOL_Annex_I_Position.cs b/bsmd.database/MARPOL_Annex_I_Position.cs index 7ef69943..252c0da8 100644 --- a/bsmd.database/MARPOL_Annex_I_Position.cs +++ b/bsmd.database/MARPOL_Annex_I_Position.cs @@ -189,7 +189,7 @@ namespace bsmd.database public override void Validate(List errors, List violations) { if (this.Quantity_KGM >= 1000000000) - violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, 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")); if (this.FlashpointInformation.HasValue && (this.FlashpointInformation.Value == 2) && this.Flashpoint_CEL.IsNullOrEmpty()) diff --git a/bsmd.database/PAS.cs b/bsmd.database/PAS.cs index 8fdba570..537fe711 100644 --- a/bsmd.database/PAS.cs +++ b/bsmd.database/PAS.cs @@ -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; }