more fixes for import

This commit is contained in:
Daniel Schick 2023-11-16 16:58:51 +01:00
parent c22e9d8edd
commit 0fa6e13690
5 changed files with 26 additions and 29 deletions

View File

@ -36,7 +36,7 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>4</ApplicationRevision>
<ApplicationRevision>5</ApplicationRevision>
<ApplicationVersion>7.2.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>

View File

@ -740,11 +740,14 @@ 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 = reader.NormalizeNationality(reader.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16)));
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16)), out bool canceled);
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)));
pas.PassengerNationality = reader.NormalizeNationality(reader.ReadCellAsText("passenger departure", string.Format("H{0}", i + 16)));
pas.PassengerIdentityDocumentIssuingState = reader.NormalizeNationality(reader.ReadCellAsText("passenger departure", string.Format("O{0}", i + 16)));
pas.PassengerNationality = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("H{0}", i + 16)), out canceled);
if (canceled) return false;
pas.PassengerIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger departure", string.Format("O{0}", i + 16)), out canceled);
if (canceled) return false;
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger departure", string.Format("P{0}", i + 16));
@ -797,11 +800,14 @@ 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 = reader.NormalizeNationality(reader.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16)));
pas.PassengerCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16)), out bool canceled);
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)));
pas.PassengerNationality = reader.NormalizeNationality(reader.ReadCellAsText("passenger arrival", string.Format("H{0}", i + 16)));
pas.PassengerIdentityDocumentIssuingState = reader.NormalizeNationality(reader.ReadCellAsText("passenger arrival", string.Format("O{0}", i + 16)));
pas.PassengerNationality = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("H{0}", i + 16)), out canceled);
if(canceled) return false;
pas.PassengerIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("passenger arrival", string.Format("O{0}", i + 16)), out canceled);
if (!canceled) return false;
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger arrival", string.Format("P{0}", i + 16));
pas.EmergencyCare = reader.ReadCellAsText("passenger arrival", string.Format("Q{0}", i + 16));
@ -1178,7 +1184,8 @@ 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 = reader.NormalizeNationality(reader.ReadCellAsText("crew departure", string.Format("E{0}", i + 15)));
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew departure", string.Format("E{0}", i + 15)), out bool canceled);
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));
crew.CrewMemberGender = ParseGender(gender);
@ -1190,7 +1197,8 @@ namespace ENI2.Excel
crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType);
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew departure", string.Format("J{0}", i + 15));
crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew departure", string.Format("K{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = reader.NormalizeNationality(reader.ReadCellAsText("crew departure", string.Format("M{0}", i + 15)));
crew.CrewMemberIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew departure", string.Format("M{0}", i + 15)), out canceled);
if (canceled) return false;
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew departure", string.Format("N{0}", i + 15));
}
@ -1227,7 +1235,8 @@ 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 = reader.NormalizeNationality(reader.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15)));
crew.CrewMemberCountryOfBirth = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15)), out bool canceled);
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));
crew.CrewMemberGender = ParseGender(gender);
@ -1237,7 +1246,8 @@ namespace ENI2.Excel
crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType);
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew arrival", string.Format("J{0}", i + 15));
crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew arrival", string.Format("K{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = reader.NormalizeNationality(reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15)));
crew.CrewMemberIdentityDocumentIssuingState = ExcelUtil.ReadNationality(reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15)), out canceled);
if (canceled) return false;
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew arrival", string.Format("N{0}", i + 15));
crew.CrewMemberDuty = reader.ReadCellAsText("crew arrival", string.Format("L{0}", i + 15));

View File

@ -285,23 +285,6 @@ namespace ENI2.Excel
return val;
}
/// <summary>
/// if nationality is read somewhere else (Dakosy?) check if it is ok
/// </summary>
internal string NormalizeNationality(string nationString)
{
if (nationString == null) return null;
if (nationString.Length < 2) return "";
if(nationString.Length == 2) return nationString.ToUpper();
string isoCode = LocodeDB.CountryCodeFromName(nationString);
if (isoCode == null)
{
_log.ErrorFormat("Wrong ISO code {0}", nationString);
return "";
}
return isoCode;
}
internal byte? ReadHullConfiguration(string lookup)
{
string val = this.ReadText(lookup);

View File

@ -490,6 +490,8 @@ namespace bsmd.database
cmd.CommandText = query;
}
public override string Title => "CREWD";
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();

View File

@ -551,6 +551,8 @@ namespace bsmd.database
cmd.CommandText = query;
}
public override string Title => "PASD";
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();