Refactorings, Bugfix IdentityDocumentType, Testversion 6.9.14

This commit is contained in:
Daniel Schick 2022-01-22 11:03:38 +01:00
parent da95d5e800
commit 02f4c4397c
9 changed files with 36 additions and 59 deletions

View File

@ -37,7 +37,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>6.9.13.0</ApplicationVersion>
<ApplicationVersion>6.9.14.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -1253,10 +1253,7 @@ namespace ENI2.Excel
bool? PortOfCallLast30DaysCrewMembersJoinedFlag = reader.ReadBoolean(crewJoined);
string crewNameString = reader.ReadText(crewName);
if (!crewNameString.IsNullOrEmpty())
poc30d.PortOfCallLast30DaysCrewMembersJoined = true;
else
poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
poc30d.PortOfCallLast30DaysCrewMembersJoined = !crewNameString.IsNullOrEmpty();
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
{

View File

@ -374,7 +374,7 @@ namespace ENI2.Excel
WriteText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth);
if(crew.CrewMemberDateOfBirth.HasValue)
WriteDate(crewDateOfBirth, crew.CrewMemberDateOfBirth.Value);
WriteIdentityDocumentType(crewIdentDocType, crew.CrewMemberIdentityDocumentType);
WriteText(crewIdentDocType, crew.CrewMemberIdentityDocumentTypeDisplay);
WriteText(crewIdentDocId, crew.CrewMemberIdentityDocumentId);
WriteText(crewVisaNo, crew.CrewMemberVisaNumber);
}
@ -720,7 +720,7 @@ namespace ENI2.Excel
WriteText(pasPlaceOfBirth, pas.PassengerPlaceOfBirth);
if(pas.PassengerDateOfBirth.HasValue)
WriteDate(pasDateOfBirth, pas.PassengerDateOfBirth);
WriteIdentityDocumentType(pasIdentDocType, pas.PassengerIdentityDocumentType);
WriteText(pasIdentDocType, pas.PassengerIdentityDocumentTypeDisplay);
WriteText(pasIdentDocId, pas.PassengerIdentityDocumentId);
WriteText(pasVisaNo, pas.PassengerVisaNumber);
}
@ -1030,23 +1030,6 @@ namespace ENI2.Excel
#region write simple things
private void WriteIdentityDocumentType(string label, byte? docType)
{
if(docType.HasValue)
{
switch(docType.Value)
{
case 1: WriteText(label, "identity_card"); break;
case 2: WriteText(label, "passport"); break;
case 3: WriteText(label, "muster_book"); break;
case 4: WriteText(label, "picture_id"); break;
case 5: WriteText(label, "residential_permit"); break;
case 6: WriteText(label, "other_legal_identity_document"); break;
default: WriteText(label, "ic"); break;
}
}
}
private void WriteGender(string label, byte? gender)
{
if(gender.HasValue)

View File

@ -24,7 +24,7 @@ using System.Text;
namespace ENI2.Report
{
public class ReportDocument
public static class ReportDocument
{
private static Orientation _lastOrientation = Orientation.Portrait;
@ -37,11 +37,7 @@ namespace ENI2.Report
{
get
{
if(_cargoCodesNST == null)
{
_cargoCodesNST = LocalizedLookup.getCargoCodesNST();
}
return _cargoCodesNST;
return _cargoCodesNST ?? (_cargoCodesNST = LocalizedLookup.getCargoCodesNST());
}
}
@ -171,7 +167,7 @@ namespace ENI2.Report
style.ParagraphFormat.Font.Color = Colors.Blue;
}
static void DefineSingleStyle(Document doc)
private static void DefineSingleStyle(Document doc)
{
Style style = doc.Styles["Normal"];
style.Font.Name = "Verdana";
@ -213,7 +209,7 @@ namespace ENI2.Report
#region Label DB
static List<KeyValuePair<string, string>> ReplaceLabels(List<KeyValuePair<string, string>> messageText)
private static List<KeyValuePair<string, string>> ReplaceLabels(List<KeyValuePair<string, string>> messageText)
{
if (messageText == null) return null;
List<KeyValuePair<string, string>> result = new List<KeyValuePair<string, string>>();
@ -227,7 +223,7 @@ namespace ENI2.Report
return result;
}
static string ReplaceTitle(string title)
private static string ReplaceTitle(string title)
{
if (LabelStorage.CollectionLabelDict.ContainsKey(title))
return LabelStorage.CollectionLabelDict[title];
@ -375,7 +371,7 @@ namespace ENI2.Report
#region Einzelne Seite in Landscape für CREW Meldung
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.CREW))
if (message?.MessageNotificationClass == Message.NotificationClass.CREW)
{
// Landscape
if (_lastOrientation == Orientation.Portrait)
@ -400,7 +396,7 @@ namespace ENI2.Report
#region Einzelne Seite in Landscape für PAS Meldung
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.PAS))
if (message?.MessageNotificationClass == Message.NotificationClass.PAS)
{
// Landscape
if (_lastOrientation == Orientation.Portrait)
@ -425,7 +421,7 @@ namespace ENI2.Report
#region Einzelne Seite in Landscape für TOWA Meldung
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.TOWA))
if (message?.MessageNotificationClass == Message.NotificationClass.TOWA)
{
// Landscape
if (_lastOrientation == Orientation.Portrait)
@ -450,7 +446,7 @@ namespace ENI2.Report
#region Einzelne Seite in Landscape für TOWD Meldung
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.TOWD))
if (message?.MessageNotificationClass == Message.NotificationClass.TOWD)
{
// Landscape
if (_lastOrientation == Orientation.Portrait)
@ -516,7 +512,7 @@ namespace ENI2.Report
#region Spezialbehandlung WAS Meldung
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.WAS))
if (message?.MessageNotificationClass == Message.NotificationClass.WAS)
{
ReportDocument.CreateWASTable(document, message);
return;
@ -526,7 +522,7 @@ namespace ENI2.Report
#region NOA_NOD
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.NOA_NOD))
if (message?.MessageNotificationClass == Message.NotificationClass.NOA_NOD)
{
NOA_NOD noa_nod = message.Elements[0] as NOA_NOD;
@ -580,7 +576,7 @@ namespace ENI2.Report
#region BKRD
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.BKRD))
if (message?.MessageNotificationClass == Message.NotificationClass.BKRD)
{
ReportDocument.CreateBKRDTable(document, message);
return;
@ -590,7 +586,7 @@ namespace ENI2.Report
#region BKRA
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.BKRA))
if (message?.MessageNotificationClass == Message.NotificationClass.BKRA)
{
ReportDocument.CreateBKRATable(document, message);
return;
@ -600,7 +596,7 @@ namespace ENI2.Report
#region LADG
if((message != null) && (message.MessageNotificationClass == Message.NotificationClass.LADG))
if(message?.MessageNotificationClass == Message.NotificationClass.LADG)
{
ReportDocument.CreateLADGTable(document, message);
return;
@ -610,7 +606,7 @@ namespace ENI2.Report
#region SERV
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.SERV))
if (message?.MessageNotificationClass == Message.NotificationClass.SERV)
{
ReportDocument.CreateSERVTable(document, message);
return;
@ -623,7 +619,7 @@ namespace ENI2.Report
#region SEC
if((message != null) && (message.MessageNotificationClass == Message.NotificationClass.SEC))
if(message?.MessageNotificationClass == Message.NotificationClass.SEC)
{
ReportDocument.CreateLast10PortFacilitiesTable(document, message);
ReportDocument.CreateShip2ShipActivitiesTable(document, message);
@ -634,7 +630,7 @@ namespace ENI2.Report
#region BPOL
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.BPOL))
if (message?.MessageNotificationClass == Message.NotificationClass.BPOL)
{
ReportDocument.CreatePortOfItineraryTable(document, message);
}
@ -643,7 +639,7 @@ namespace ENI2.Report
#region MDH
if ((message != null) && (message.MessageNotificationClass == Message.NotificationClass.MDH))
if (message?.MessageNotificationClass == Message.NotificationClass.MDH)
{
ReportDocument.CreateSanitaryMeasuresTable(document, message);
ReportDocument.CreateInfectedAreaTable(document, message);
@ -819,7 +815,7 @@ namespace ENI2.Report
for (int i = 0; i < mdh.PortOfCallLast30Days.Count; i++)
{
Row row = table.AddRow();
ReportDocument.SetPoCLast30Days(((PortOfCallLast30Days) mdh.PortOfCallLast30Days[i]), row);
ReportDocument.SetPoCLast30Days((PortOfCallLast30Days) mdh.PortOfCallLast30Days[i], row);
}
}
}
@ -1014,7 +1010,7 @@ namespace ENI2.Report
for(int i=0;i<sec.LastTenPortFacilitesCalled.Count;i++) {
Row row = table.AddRow();
ReportDocument.SetLast10PortFacility((i + 1), ((LastTenPortFacilitiesCalled) sec.LastTenPortFacilitesCalled[i]), row);
ReportDocument.SetLast10PortFacility((i + 1), (LastTenPortFacilitiesCalled) sec.LastTenPortFacilitesCalled[i], row);
}
}
}
@ -1081,7 +1077,7 @@ namespace ENI2.Report
for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; i++)
{
Row row = table.AddRow();
ReportDocument.SetShip2ShipActivity((i + 1), ((ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i]), row);
ReportDocument.SetShip2ShipActivity((i + 1), (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i], row);
}
}
}
@ -1820,7 +1816,7 @@ namespace ENI2.Report
#region CallPurpose
static void CreateCallPurposeTable(Document document, Message message)
private static void CreateCallPurposeTable(Document document, Message message)
{
if (message.Elements[0] is NOA_NOD noa_nod && noa_nod.CallPurposes.Count > 0)
{
@ -2073,7 +2069,7 @@ namespace ENI2.Report
#region Document helper
static Table AddGrayTable(Document aDocument)
private static Table AddGrayTable(Document aDocument)
{
Table table = aDocument.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Center;

View File

@ -452,9 +452,9 @@ namespace bsmd.database
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"));
if((this.NetQuantity_KGM.HasValue && this.NetQuantity_KGM.Value > 100000) ||
(this.GrossQuantity_KGM.HasValue && this.GrossQuantity_KGM.Value > 100000) ||
(this.Volume_MTQ.HasValue && this.Volume_MTQ.Value > 100))
if((this.NetQuantity_KGM > 100000) ||
(this.GrossQuantity_KGM > 100000) ||
(this.Volume_MTQ > 100))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));

View File

@ -184,7 +184,7 @@ namespace bsmd.database
}
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.Parameters.AddWithValue("ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET PassengerLastName = @P2, PassengerFirstName = @P3, " +
"PassengerPlaceOfBirth = @P4, PassengerDateOfBirth = @P5, PassengerGender = @P6," +
"PassengerNationality = @P7, PassengerIdentityDocumentType = @P8, PassengerIdentityDocumentId = @P9, " +

View File

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

View File

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

View File

@ -61,8 +61,9 @@ namespace bsmd.database
case 1: return "Passport";
case 2: return "Muster book";
case 3: return "Picture ID";
case 4: return "Residantal permit";
default: return "Other legal identity document";
case 4: return "Residental permit";
case 5: return "Other legal identity document";
default: return "unknown";
}
}
else