CREWD und PASD wird jetzt auch im alten Format richtig gelesen

This commit is contained in:
Daniel Schick 2024-03-07 08:03:29 +01:00
parent 0adc7ab5c4
commit b2af44895b
2 changed files with 70 additions and 14 deletions

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>7.2.2.1</ApplicationVersion>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>7.2.2.2</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -2257,7 +2257,7 @@ namespace ENI2.Excel
{
for (int i = 0; i < 5000; i++)
{
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 13));
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 14));
if (lastName.IsNullOrEmpty()) break;
if (!(crewdMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREWD crewd))
@ -2273,24 +2273,24 @@ namespace ENI2.Excel
crewd.NotificationPAX = false;
crewd.CrewMemberLastName = lastName;
crewd.CrewMemberFirstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 13));
crewd.CrewMemberFirstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 14));
crewd.CrewMemberGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 13)), out bool canceled);
crewd.CrewMemberGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 14)), out bool canceled);
if (canceled) return true;
crewd.CrewMemberDuty = reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 13));
crewd.CrewMemberNationality = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("F{0}", i + 13)), out canceled);
crewd.CrewMemberDuty = reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 14));
crewd.CrewMemberNationality = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("F{0}", i + 14)), out canceled);
if (canceled) return true;
crewd.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 13));
crewd.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("I{0}", i + 13));
crewd.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 14));
crewd.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("I{0}", i + 14));
crewd.CrewMemberIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 13)), out canceled);
crewd.CrewMemberIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 14)), out canceled);
if (canceled) return true;
crewd.CrewMemberIdentityDocumentIssuingState = "XX";
crewd.CrewMemberIdentityDocumentExpiryDate = new DateTime(2100, 12, 31);
crewd.CrewMemberIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 13));
crewd.CrewMemberVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("L{0}", i + 13));
crewd.CrewMemberIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 14));
crewd.CrewMemberVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("L{0}", i + 14));
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
@ -2521,6 +2521,62 @@ namespace ENI2.Excel
pasd.NotificationPAX = mustPAX;
}
}
else
{
sheetTitle = "8. PAX - Departure"; // altes Excel Format
if (reader.HasWorksheetNamed(sheetTitle))
{
for (int i = 0; i < 5000; i++)
{
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 14));
string firstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 14));
if (lastName.IsNullOrEmpty() && firstName.IsNullOrEmpty()) break; // finish after reading last row
PASD pas = new PASD();
pas.Identifier = (i + 1).ToString();
pas.MessageHeader = pasMessage;
pas.IsDeparture = true;
newPasList.Add(pas);
pas.NotificationSchengen = true;
pas.NotificationPAX = false;
pas.PassengerLastName = lastName;
pas.PassengerFirstName = firstName;
pas.PassengerNationality = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("F{0}", i + 14)), out bool canceled);
if (canceled) return true;
pas.PassengerGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 14)), out canceled);
if (canceled) return true;
pas.PassengerPortOfEmbarkation = ReadLocode(reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 14)), out canceled);
if (canceled) return true;
pas.PassengerPortOfDisembarkation = ReadLocode(reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 14)), out canceled);
if (canceled) return true;
pas.PassengerInTransit = reader.ReadCellAsBool(sheetTitle, string.Format("I{0}", i + 14));
pas.PassengerPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 14));
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("K{0}", i + 14));
pas.PassengerDateOfBirth = dateOfBirth;
pas.PassengerIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("L{0}", i + 14)), out canceled);
if (canceled) return true;
pas.PassengerIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("M{0}", i + 14));
pas.PassengerIdentityDocumentExpiryDate = new DateTime(2100, 12, 31);
pas.PassengerIdentityDocumentIssuingState = "XX";
pas.PassengerVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("N{0}", i + 14));
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
}
else
{
return false;
}
}
DBManager.Instance.DeleteAllPASForMessage(pasMessage.Id);
pasMessage.Elements.Clear();