Fixed Dakosy import and CREWD delete from grid bug reports

This commit is contained in:
Daniel Schick 2023-11-16 11:39:59 +01:00
parent c70e4700c3
commit a8c8ce080e
4 changed files with 84 additions and 53 deletions

View File

@ -883,7 +883,7 @@ namespace ENI2.DetailViewControls
if (obj is CREWD crewd)
{
// are you sure dialog is in base class
_crewMessage.Elements.Remove(crewd);
_crewdMessage.Elements.Remove(crewd);
DBManager.Instance.Delete(crewd);
}
}

View File

@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using bsmd.database;
namespace ENI2.Excel
@ -740,34 +740,36 @@ 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.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16));
pas.PassengerCountryOfBirth = reader.NormalizeNationality(reader.ReadCellAsText("passenger departure", string.Format("E{0}", i + 16)));
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.ReadCellAsText("passenger departure", string.Format("H{0}", i + 16));
pas.PassengerIdentityDocumentIssuingState = reader.ReadCellAsText("passenger departure", string.Format("O{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.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger departure", string.Format("P{0}", i + 16));
//if (pas.NotificationPAX ?? false)
//{
pas.EmergencyCare = reader.ReadCellAsText("passenger departure", string.Format("Q{0}", i + 16));
pas.EmergencyContactNumber = reader.ReadCellAsText("passenger departure", string.Format("R{0}", i + 16));
//}
//if (pas.NotificationSchengen ?? false)
//{
pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger departure", string.Format("I{0}", i + 16)));
pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger departure", string.Format("J{0}", i + 16));
pas.PassengerVisaNumber = reader.ReadCellAsText("passenger departure", string.Format("K{0}", i + 16));
pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger departure", string.Format("L{0}", i + 16));
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;
result = true;
}
if(pasdMessage.Elements.Count >= 12)
{
foreach (PASD pasd in pasdMessage.Elements.Cast<PASD>())
pasd.NotificationPAX = true;
}
return result;
}
@ -797,34 +799,36 @@ 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.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16));
pas.PassengerCountryOfBirth = reader.NormalizeNationality(reader.ReadCellAsText("passenger arrival", string.Format("E{0}", i + 16)));
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.ReadCellAsText("passenger arrival", string.Format("H{0}", i + 16));
pas.PassengerIdentityDocumentIssuingState = reader.ReadCellAsText("passenger arrival", string.Format("O{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.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger arrival", string.Format("P{0}", i + 16));
//if(pas.NotificationPAX ?? false)
//{
pas.EmergencyCare = reader.ReadCellAsText("passenger arrival", string.Format("Q{0}", i + 16));
pas.EmergencyContactNumber = reader.ReadCellAsText("passenger arrival", string.Format("R{0}", i + 16));
//}
//if(pas.NotificationSchengen ?? false)
//{
pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger arrival", string.Format("I{0}", i + 16)));
pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger arrival", string.Format("J{0}", i + 16));
pas.PassengerVisaNumber = reader.ReadCellAsText("passenger arrival", string.Format("K{0}", i + 16));
pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger arrival", string.Format("L{0}", i + 16));
pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger arrival", string.Format("M{0}", i + 16));
pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16));
//}
if (pas.HasSchengenDetails) pas.NotificationSchengen = true;
if (pas.HasPAXDetails) pas.NotificationPAX = true;
result = true;
}
if (pasMessage.Elements.Count >= 12)
{
foreach (PAS pasa in pasMessage.Elements.Cast<PAS>())
pasa.NotificationPAX = true;
}
return result;
}
@ -1177,7 +1181,7 @@ 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.ReadCellAsText("crew departure", string.Format("E{0}", i + 15));
crew.CrewMemberCountryOfBirth = reader.NormalizeNationality(reader.ReadCellAsText("crew departure", string.Format("E{0}", i + 15)));
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);
@ -1189,7 +1193,7 @@ 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.ReadCellAsText("crew departure", string.Format("M{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = reader.NormalizeNationality(reader.ReadCellAsText("crew departure", string.Format("M{0}", i + 15)));
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew departure", string.Format("N{0}", i + 15));
}
@ -1226,21 +1230,18 @@ 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.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15));
crew.CrewMemberCountryOfBirth = reader.NormalizeNationality(reader.ReadCellAsText("crew arrival", string.Format("E{0}", i + 15)));
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);
crew.CrewMemberNationality = reader.ReadCellAsText("crew arrival", string.Format("H{0}", i + 15));
//if(crew.NotificationSchengen ?? false)
//{
string idDocType = reader.ReadCellAsText("crew arrival", string.Format("I{0}", i + 15));
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.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = reader.NormalizeNationality(reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15)));
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,6 +285,23 @@ 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

@ -2369,6 +2369,12 @@ namespace ENI2.Excel
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
if(newPasList.Count >= 12)
{
foreach (PAS pas in newPasList)
pas.NotificationPAX = true;
}
}
else
{
@ -2500,11 +2506,18 @@ namespace ENI2.Excel
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
if (newPasList.Count >= 12)
{
foreach (PASD pasd in newPasList.Cast<PASD>())
pasd.NotificationPAX = true;
}
}
DBManager.Instance.DeleteAllPASForMessage(pasMessage.Id);
pasMessage.Elements.Clear();
foreach (PASD pas in newPasList)
foreach (PASD pas in newPasList.Cast<PASD>())
pasMessage.Elements.Add(pas);
return true;