defaults für POBA/POBD beim Excel import

This commit is contained in:
Daniel Schick 2022-12-09 08:02:52 +01:00
parent 652644bcb0
commit 177835440c

View File

@ -274,7 +274,7 @@ namespace ENI2.Excel
{ {
POBA poba = pobaMessage.Elements[0] as POBA; POBA poba = pobaMessage.Elements[0] as POBA;
bpol.StowawaysOnBoard = (poba.TotalStowawaysOnBoardUponArrival ?? 0) > 0; bpol.StowawaysOnBoard = (poba.TotalStowawaysOnBoardUponArrival ?? 0) > 0;
} }
bpol.DeleteElements(); bpol.DeleteElements();
@ -331,6 +331,9 @@ namespace ENI2.Excel
if (((poba.TotalPersonsOnBoardUponArrival ?? 0) == 0) && poba.IsNew) if (((poba.TotalPersonsOnBoardUponArrival ?? 0) == 0) && poba.IsNew)
return false; return false;
if (!poba.TotalPassengersOnBoardUponArrival.HasValue) poba.TotalPassengersOnBoardUponArrival = 0;
if (!poba.TotalStowawaysOnBoardUponArrival.HasValue) poba.TotalStowawaysOnBoardUponArrival = 0;
return true; return true;
} }
@ -339,7 +342,7 @@ namespace ENI2.Excel
#region POBD #region POBD
private static bool ScanPOBD(Message pobdMessage, ExcelReader reader) private static bool ScanPOBD(Message pobdMessage, ExcelReader reader)
{ {
if(pobdMessage.Elements.Count == 0) if(pobdMessage.Elements.Count == 0)
{ {
POBD newPobd = new POBD(); POBD newPobd = new POBD();
@ -352,6 +355,9 @@ namespace ENI2.Excel
if (((pobd.TotalPersonsOnBoardUponDeparture ?? 0) == 0) && pobd.IsNew) if (((pobd.TotalPersonsOnBoardUponDeparture ?? 0) == 0) && pobd.IsNew)
return false; return false;
if (!pobd.TotalPassengersOnBoardUponDeparture.HasValue) pobd.TotalPassengersOnBoardUponDeparture = 0;
if (!pobd.TotalStowawaysOnBoardUponDeparture.HasValue) pobd.TotalStowawaysOnBoardUponDeparture = 0;
return true; return true;
} }
@ -373,15 +379,15 @@ namespace ENI2.Excel
haza.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZA.DGOnBoard"); haza.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZA.DGOnBoard");
haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival"); haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival");
haza.DPGContactFamilyName = reader.ReadText("HAZA.DPGContactFamilyName"); haza.DPGContactFamilyName = reader.ReadText("HAZA.DPGContactFamilyName");
haza.DPGContactPhone = reader.ReadText("HAZA.DPGContactPhone"); haza.DPGContactPhone = reader.ReadText("HAZA.DPGContactPhone");
haza.MOUBaltic = reader.ReadBoolean("HAZA.MOUBaltic"); haza.MOUBaltic = reader.ReadBoolean("HAZA.MOUBaltic");
string shipClass = reader.ReadText("HAZA.INFShipClass"); string shipClass = reader.ReadText("HAZA.INFShipClass");
if(!shipClass.IsNullOrEmpty()) if(!shipClass.IsNullOrEmpty())
{ {
if (shipClass.Contains('1')) haza.INFShipClass = 0; if (shipClass.Contains('1')) haza.INFShipClass = 0;
if (shipClass.Contains('2')) haza.INFShipClass = 1; if (shipClass.Contains('2')) haza.INFShipClass = 1;
if (shipClass.Contains('3')) haza.INFShipClass = 2; if (shipClass.Contains('3')) haza.INFShipClass = 2;
} }
#region IMDG #region IMDG
@ -1140,7 +1146,7 @@ namespace ENI2.Excel
#region WAS #region WAS
private static bool ScanWAS(Message wasMessage, ExcelReader reader, bool isOldVersion) private static bool ScanWAS(Message wasMessage, ExcelReader reader, bool isOldVersion)
{ {
if (wasMessage.Elements.Count == 0) if (wasMessage.Elements.Count == 0)
{ {
WAS newWAS = new WAS(); WAS newWAS = new WAS();
@ -1198,7 +1204,7 @@ namespace ENI2.Excel
if (waste.WasteDescription.IsNullOrEmpty()) if (waste.WasteDescription.IsNullOrEmpty())
{ {
if ((reader.Mode == ExcelReader.CountryMode.DE) && waste.IsDashWasteCode) if ((reader.Mode == ExcelReader.CountryMode.DE) && waste.IsDashWasteCode)
{ {
waste.WasteDescription = "-"; waste.WasteDescription = "-";
} }
else if (reader.Mode == ExcelReader.CountryMode.DK) else if (reader.Mode == ExcelReader.CountryMode.DK)