fixed a late error for PAX/Schengen settings during Excel import

This commit is contained in:
Daniel Schick 2023-11-30 16:40:08 +02:00
parent 8ea5efe7cc
commit a00cb9a791
3 changed files with 54 additions and 43 deletions

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>7</ApplicationRevision>
<ApplicationVersion>7.2.0.7</ApplicationVersion>
<ApplicationRevision>9</ApplicationRevision>
<ApplicationVersion>7.2.0.9</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -735,7 +735,7 @@ namespace ENI2.Excel
// https://stackoverflow.com/questions/46752911/how-to-read-comboboxes-value-from-excel-using-c-sharp
pas.NotificationSchengen = reader.ReadCellAsBool("passenger departure", "C10");
pas.NotificationPAX = reader.ReadCellAsBool("passenger departure", "C11");
pas.NotificationPAX = reader.ReadCellAsBool("passenger departure", "C11") ?? false;
pas.PassengerLastName = lastName;
pas.PassengerFirstName = reader.ReadCellAsText("passenger departure", string.Format("C{0}", i + 16));
@ -761,16 +761,18 @@ namespace ENI2.Excel
pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger departure", string.Format("M{0}", i + 16));
pas.PassengerInTransit = reader.ReadCellAsBool("passenger departure", string.Format("N{0}", i + 16));
if (pas.HasSchengenDetails) pas.NotificationSchengen = true;
if (pas.HasPAXDetails) pas.NotificationPAX = true;
// if (pas.HasSchengenDetails) pas.NotificationSchengen = true;
// if (pas.HasPAXDetails) pas.NotificationPAX = true;
result = true;
}
bool mustPAX = pasdMessage.Elements.Count >= 12;
foreach (PASD pasd in pasdMessage.Elements.Cast<PASD>())
pasd.NotificationPAX = mustPAX;
bool mustPAX = pasdMessage.Elements.Count >= 12;
if (mustPAX)
{
foreach (PASD pasd in pasdMessage.Elements.Cast<PASD>())
pasd.NotificationPAX = mustPAX;
}
return result;
}
@ -795,7 +797,7 @@ namespace ENI2.Excel
}
pas.NotificationSchengen = reader.ReadCellAsBool("passenger arrival", "C10");
pas.NotificationPAX = reader.ReadCellAsBool("passenger arrival", "C11");
pas.NotificationPAX = reader.ReadCellAsBool("passenger arrival", "C11") ?? false;
pas.PassengerLastName = lastName;
pas.PassengerFirstName = reader.ReadCellAsText("passenger arrival", string.Format("C{0}", i + 16));
@ -821,16 +823,18 @@ namespace ENI2.Excel
pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16));
if (pas.HasSchengenDetails) pas.NotificationSchengen = true;
if (pas.HasPAXDetails) pas.NotificationPAX = true;
// if (pas.HasSchengenDetails) pas.NotificationSchengen = true;
// if (pas.HasPAXDetails) pas.NotificationPAX = true;
result = true;
}
bool mustPAX = pasMessage.Elements.Count >= 12;
foreach (PAS pasa in pasMessage.Elements.Cast<PAS>())
pasa.NotificationPAX = mustPAX;
if (mustPAX)
{
foreach (PAS pasa in pasMessage.Elements.Cast<PAS>())
pasa.NotificationPAX = mustPAX;
}
return result;
}
@ -1212,7 +1216,7 @@ namespace ENI2.Excel
#endregion
#region CREW
#region CREWA
private static bool ScanCREW(Message crewMessage, ExcelReader reader)
{
@ -1231,7 +1235,7 @@ namespace ENI2.Excel
}
crew.NotificationSchengen = reader.ReadCellAsBool("crew arrival", "C10");
crew.NotificationPAX = reader.ReadCellAsBool("crew arrival", "C11");
crew.NotificationPAX = reader.ReadCellAsBool("crew arrival", "C11") ?? false;
crew.CrewMemberLastName = lastName;
crew.CrewMemberFirstName = reader.ReadCellAsText("crew arrival", string.Format("C{0}", i + 15));

View File

@ -2076,7 +2076,7 @@ namespace ENI2.Excel
#endregion LADG
#region CREW
#region CREWA
private static bool ScanCREW(Message crewMessage, ExcelReader reader, bool isOldVersion)
{
@ -2086,7 +2086,7 @@ namespace ENI2.Excel
// 5.9.22: Changed this area to work like reading from a Dakosy Sheet (by values in rows, not cell names)
if (reader.HasWorksheetNamed(sheetTitle))
{
bool? notificationSchengen = reader.ReadBoolean("CREW.NotificationSchengen");
// bool? notificationSchengen = reader.ReadBoolean("CREW.NotificationSchengen");
bool? notificationPax = reader.ReadBoolean("CREW.NotificationPAX");
for (int i = 0; i < 5000; i++)
@ -2103,8 +2103,8 @@ namespace ENI2.Excel
crewMessage.Elements.Add(crew);
}
crew.NotificationSchengen = notificationSchengen;
crew.NotificationPAX = notificationPax;
crew.NotificationSchengen = true;
crew.NotificationPAX = notificationPax ?? false;
crew.CrewMemberLastName = lastName;
crew.CrewMemberFirstName = firstName;
@ -2136,7 +2136,7 @@ namespace ENI2.Excel
if (crew.Effects.Length > 256)
crew.Effects = crew.Effects.Substring(0, 256);
crew.NotificationSchengen = crew.HasSchengenDetails;
// crew.NotificationSchengen = crew.HasSchengenDetails;
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
@ -2192,6 +2192,10 @@ namespace ENI2.Excel
return true;
}
#endregion
#region CREWD
private static bool ScanCREWD(Message crewdMessage, ExcelReader reader)
{
crewdMessage.DeleteElements();
@ -2199,7 +2203,7 @@ namespace ENI2.Excel
// CREW DEPARTURE
if (reader.HasWorksheetNamed(sheetTitle))
{
bool? notificationSchengen = reader.ReadBoolean("CREWD.NotificationSchengen");
// bool? notificationSchengen = reader.ReadBoolean("CREWD.NotificationSchengen");
bool? notificationPax = reader.ReadBoolean("CREWD.NotificationPAX");
for (int i = 0; i < 5000; i++)
@ -2216,8 +2220,8 @@ namespace ENI2.Excel
crewdMessage.Elements.Add(crewd);
}
crewd.NotificationSchengen = notificationSchengen;
crewd.NotificationPAX = notificationPax;
crewd.NotificationSchengen = true;
crewd.NotificationPAX = notificationPax ?? false;
crewd.CrewMemberLastName = lastName;
crewd.CrewMemberFirstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 18));
@ -2244,7 +2248,7 @@ namespace ENI2.Excel
crewd.Effects = reader.ReadCellAsText("2. PORT", string.Format("C{0}", i + 142));
crewd.NotificationSchengen = crewd.HasSchengenDetails;
// crewd.NotificationSchengen = crewd.HasSchengenDetails;
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
@ -2312,7 +2316,7 @@ namespace ENI2.Excel
if (reader.HasWorksheetNamed(sheetTitle))
{
bool? notificationSchengen = reader.ReadBoolean("PAS.NotificationSchengen");
// bool? notificationSchengen = reader.ReadBoolean("PAS.NotificationSchengen");
bool? notificationPax = reader.ReadBoolean("PAS.NotificationPAX");
for (int i = 0; i < 5000; i++)
@ -2326,8 +2330,8 @@ namespace ENI2.Excel
pas.MessageHeader = pasMessage;
newPasList.Add(pas);
pas.NotificationSchengen = notificationSchengen;
pas.NotificationPAX = notificationPax;
pas.NotificationSchengen = true;
pas.NotificationPAX = notificationPax ?? false;
pas.PassengerLastName = lastName;
pas.PassengerFirstName = firstName;
@ -2363,17 +2367,18 @@ namespace ENI2.Excel
pas.PassengerVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("Q{0}", i + 17));
pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 17));
pas.EmergencyContactNumber = reader.ReadCellAsText(sheetTitle, string.Format("S{0}", i + 17));
// sie will es unbedingt ;-)
pas.NotificationSchengen = pas.HasSchengenDetails;
// pas.NotificationSchengen = pas.HasSchengenDetails;
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
bool mustPAX = newPasList.Count >= 12;
foreach (PAS pasa in newPasList.Cast<PAS>())
pasa.NotificationPAX = mustPAX;
if (mustPAX)
{
foreach (PAS pasa in newPasList.Cast<PAS>())
pasa.NotificationPAX = mustPAX;
}
}
else
{
@ -2448,8 +2453,8 @@ namespace ENI2.Excel
if (reader.HasWorksheetNamed(sheetTitle))
{
bool? notificationSchengen = reader.ReadBoolean("PAS.NotificationSchengen");
bool? notificationPax = reader.ReadBoolean("PAS.NotificationPAX");
// bool? notificationSchengen = reader.ReadBoolean("PAS.NotificationSchengen");
bool? notificationPax = reader.ReadBoolean("PASD.NotificationPAX");
for (int i = 0; i < 5000; i++)
{
@ -2463,8 +2468,8 @@ namespace ENI2.Excel
pas.IsDeparture = true;
newPasList.Add(pas);
pas.NotificationSchengen = notificationSchengen;
pas.NotificationPAX = notificationPax;
pas.NotificationSchengen = true;
pas.NotificationPAX = notificationPax ?? false;
pas.PassengerLastName = lastName;
pas.PassengerFirstName = firstName;
@ -2501,15 +2506,17 @@ namespace ENI2.Excel
pas.EmergencyCare = reader.ReadCellAsText(sheetTitle, string.Format("R{0}", i + 18));
pas.EmergencyContactNumber = reader.ReadCellAsText(sheetTitle, string.Format("S{0}", i + 18));
pas.NotificationSchengen = pas.HasSchengenDetails;
// pas.NotificationSchengen = pas.HasSchengenDetails;
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
bool mustPAX = newPasList.Count >= 12;
foreach (PASD pasd in newPasList.Cast<PASD>())
pasd.NotificationPAX = mustPAX;
if (mustPAX)
{
foreach (PASD pasd in newPasList.Cast<PASD>())
pasd.NotificationPAX = mustPAX;
}
}
DBManager.Instance.DeleteAllPASForMessage(pasMessage.Id);