diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj
index f3d60710..4893e7e9 100644
--- a/ENI2/ENI2.csproj
+++ b/ENI2/ENI2.csproj
@@ -214,6 +214,10 @@
LocodeControl.xaml
+
+
+
+
POListControl.xaml
diff --git a/ENI2/Import/ExcelUtil.cs b/ENI2/Import/ExcelUtil.cs
index a8c1e7ef..54b9d2fd 100644
--- a/ENI2/Import/ExcelUtil.cs
+++ b/ENI2/Import/ExcelUtil.cs
@@ -13,6 +13,7 @@ using System.Linq;
using System.Reflection;
using log4net;
using bsmd.database;
+using ENI2.Locode;
namespace ENI2.Import
{
@@ -20,7 +21,7 @@ namespace ENI2.Import
{
private static readonly ILog _log = LogManager.GetLogger(typeof(ExcelUtil));
- internal static bool ProcessSheet(ExcelReader reader, out string readMessage, MessageCore messageCore)
+ internal static bool ProcessSheet(ExcelReader reader, out string readMessage, MessageCore messageCore, List notificationClasses)
{
messageCore = ExcelUtil.LookupMessageCore(reader, out readMessage);
@@ -29,131 +30,61 @@ namespace ENI2.Import
// load messages if already present
List messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.ALL);
- // start parsing fields
- if (messageCore.IsTransit)
+ // parse selected classes
+
+ foreach(Message message in messages)
{
- // scan for transit messages
-
- ScanAGNT(messages, messageCore, reader);
-
- ScanNOA_NOD(messages, messageCore, reader);
-
- ScanSEC(messages, messageCore, reader);
-
- ScanPOBA(messages, messageCore, reader);
-
- ScanPOBD(messages, messageCore, reader);
-
- ScanTIEFA(messages, messageCore, reader);
-
- ScanBKRA(messages, messageCore, reader);
-
- ScanSTAT(messages, messageCore, reader);
-
- ScanMDH(messages, messageCore, reader);
-
- ScanCREW(messages, messageCore, reader);
-
- ScanPAS(messages, messageCore, reader);
-
- // BPOL wieder reingenommen nach RS mit CH (27.9.17)
- ScanBPOL(messages, messageCore, reader);
-
- ScanTOWA(messages, messageCore, reader);
-
- ScanHAZA(messages, messageCore, reader);
-
- ScanHAZD(messages, messageCore, reader);
-
- }
- else
- {
- // scan for visit messages
-
- ScanAGNT(messages, messageCore, reader);
-
- ScanNOA_NOD(messages, messageCore, reader);
-
- ScanATA(messages, messageCore, reader);
-
- ScanATD(messages, messageCore, reader);
-
- ScanSEC(messages, messageCore, reader);
-
- ScanPOBA(messages, messageCore, reader);
-
- ScanPOBD(messages, messageCore, reader);
-
- ScanNAME(messages, messageCore, reader);
-
- ScanTIEFA(messages, messageCore, reader);
-
- ScanTIEFD(messages, messageCore, reader);
-
- ScanBKRA(messages, messageCore, reader);
-
- ScanBKRD(messages, messageCore, reader);
-
- ScanSTAT(messages, messageCore, reader);
-
- ScanLADG(messages, messageCore, reader);
-
- ScanSTO(messages, messageCore, reader);
-
- ScanINFO(messages, messageCore, reader);
-
- ScanSERV(messages, messageCore, reader);
-
- ScanPRE72H(messages, messageCore, reader);
-
- ScanMDH(messages, messageCore, reader);
-
- ScanWAS(messages, messageCore, reader);
-
- ScanCREW(messages, messageCore, reader);
-
- ScanPAS(messages, messageCore, reader);
-
- ScanBPOL(messages, messageCore, reader);
-
- ScanTOWA(messages, messageCore, reader);
-
- ScanTOWD(messages, messageCore, reader);
-
- ScanHAZA(messages, messageCore, reader);
-
- ScanHAZD(messages, messageCore, reader);
+ if ((message.MessageNotificationClass == Message.NotificationClass.AGNT) && notificationClasses.Contains(Message.NotificationClass.AGNT))
+ { if(ScanAGNT(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.ATA) && notificationClasses.Contains(Message.NotificationClass.ATA))
+ { if (ScanATA(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.ATD) && notificationClasses.Contains(Message.NotificationClass.ATD))
+ { if (ScanATD(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.BKRA) && notificationClasses.Contains(Message.NotificationClass.BKRA))
+ { if (ScanBKRA(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.BKRD) && notificationClasses.Contains(Message.NotificationClass.BKRD))
+ { if (ScanBKRD(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.BPOL) && notificationClasses.Contains(Message.NotificationClass.BPOL))
+ { if (ScanBPOL(message, messages, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.CREW) && notificationClasses.Contains(Message.NotificationClass.CREW))
+ { if (ScanCREW(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.CREWD) && notificationClasses.Contains(Message.NotificationClass.CREWD))
+ { if (ScanCREWD(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.HAZA) && notificationClasses.Contains(Message.NotificationClass.HAZA))
+ { if (ScanHAZA(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.HAZD) && notificationClasses.Contains(Message.NotificationClass.HAZD))
+ { if (ScanHAZD(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.INFO) && notificationClasses.Contains(Message.NotificationClass.INFO))
+ { if (ScanINFO(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.LADG) && notificationClasses.Contains(Message.NotificationClass.LADG))
+ { if (ScanLADG(message, messageCore, reader)) SaveMessage(message); break; }
+ if ((message.MessageNotificationClass == Message.NotificationClass.MDH) && notificationClasses.Contains(Message.NotificationClass.MDH))
+ { if (ScanMDH(message, messages, messageCore, reader)) SaveMessage(message); break; }
}
- //string sheetVersion = reader.GetCell("Portcall", 2, 1) as string;
- //messageCore.SietasSheetVersion = sheetVersion;
-
- DBManager.Instance.Save(messageCore);
-
- // save all messages now
-
- foreach (Message message in messages)
- {
- message.CreatedBy = "EXCEL";
- if ((message.MessageNotificationClass == Message.NotificationClass.CREWD) || (message.MessageNotificationClass == Message.NotificationClass.CREWD) ||
- (message.MessageNotificationClass == Message.NotificationClass.STO))
- message.InternalStatus = Message.BSMDStatus.PREPARE;
- else
- message.InternalStatus = Message.BSMDStatus.EXCEL;
- message.UnsentMessageWarningShown = false;
- DBManager.Instance.Save(message);
- message.SaveElements();
- }
+ DBManager.Instance.Save(messageCore);
return true;
}
+ internal static void SaveMessage(Message message)
+ {
+ message.CreatedBy = "EXCEL";
+ if ((message.MessageNotificationClass == Message.NotificationClass.CREWD) || (message.MessageNotificationClass == Message.NotificationClass.CREWD) ||
+ (message.MessageNotificationClass == Message.NotificationClass.STO))
+ message.InternalStatus = Message.BSMDStatus.PREPARE;
+ else
+ message.InternalStatus = Message.BSMDStatus.EXCEL;
+ message.UnsentMessageWarningShown = false;
+ DBManager.Instance.Save(message);
+ message.SaveElements();
+ }
+
#region ATA
- private static void ScanATA(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message ataMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.ATA);
+ private static bool ScanATA(Message ataMessage, MessageCore messageCore, ExcelReader reader)
+ {
if (ataMessage.Elements.Count == 0)
{
ATA newATA = new ATA();
@@ -161,24 +92,22 @@ namespace ENI2.Import
ataMessage.Elements.Add(newATA);
}
ATA ata = ataMessage.Elements[0] as ATA;
- Util.ScanMessage(ata, reader);
+ ExcelUtil.ScanMessage(ata, reader);
if(!ata.ATAPortOfCall.HasValue)
{
reader.ReadDateTime("ATA.ATADatePortOfCall", "ATA.ATATimePortOfCall");
}
- if (!ata.ATAPortOfCall.HasValue && ataMessage.IsNew)
- messages.Remove(ataMessage);
+ return !(!ata.ATAPortOfCall.HasValue && ataMessage.IsNew);
}
#endregion
#region ATD
- private static void ScanATD(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message atdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.ATD);
+ private static bool ScanATD(Message atdMessage, MessageCore messageCore, ExcelReader reader)
+ {
if (atdMessage.Elements.Count == 0)
{
ATD newATD = new ATD();
@@ -186,15 +115,14 @@ namespace ENI2.Import
atdMessage.Elements.Add(newATD);
}
ATD atd = atdMessage.Elements[0] as ATD;
- Util.ScanMessage(atd, reader);
+ ExcelUtil.ScanMessage(atd, reader);
if (!atd.ATDPortOfCall.HasValue)
{
reader.ReadDateTime("ATD.ATDDatePortOfCall", "ATD.ATDTimePortOfCall");
}
- if (!atd.ATDPortOfCall.HasValue && atdMessage.IsNew)
- messages.Remove(atdMessage);
+ return !(!atd.ATDPortOfCall.HasValue && atdMessage.IsNew);
}
#endregion
@@ -264,10 +192,8 @@ namespace ENI2.Import
#region BPOL
- private static void ScanBPOL(List messages, MessageCore messageCore, ExcelReader reader)
- {
- // Die Verarbeitung dieser Nachricht aktuell nur für
- Message bpolMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BPOL);
+ private static bool ScanBPOL(Message bpolMessage, List messages, MessageCore messageCore, ExcelReader reader)
+ {
if (bpolMessage.Elements.Count == 0)
{
BPOL newBPOL = new BPOL();
@@ -276,10 +202,11 @@ namespace ENI2.Import
}
BPOL bpol = bpolMessage.Elements[0] as BPOL;
- Util.ScanMessage(bpol, reader);
+ ExcelUtil.ScanMessage(bpol, reader);
// 19.12.16: Einschleicher-Feld von Klasse POBA übernehmen (anderes ist nicht im Sheet!)
- Message pobaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.POBA);
+ // (1.12.21: bezweifle ob das so wie gedacht funktioniert..)
+ Message pobaMessage = ExcelUtil.GetMessageWithType(messages, messageCore, Message.NotificationClass.POBA);
if(pobaMessage.Elements.Count > 0)
{
POBA poba = pobaMessage.Elements[0] as POBA;
@@ -309,8 +236,7 @@ namespace ENI2.Import
bpol.PortOfItineraries.Add(poi);
}
- poi.PortOfItineraryName = bpolNameValue;
- reader.Conf.ConfirmText(bpolName, bpolNameValue, ExcelReader.ReadState.OK);
+ poi.PortOfItineraryName = bpolNameValue;
poi.PortOfItineraryLocode = bpolLocodeValue;
// falls nur Locode angegeben wurde, Portname aus Locode ermitteln
if(poi.PortOfItineraryName.IsNullOrEmpty() && !poi.PortOfItineraryLocode.IsNullOrEmpty() && (poi.PortOfItineraryLocode.Length == 5))
@@ -321,6 +247,7 @@ namespace ENI2.Import
poi.PortOfItineraryETA = reader.ReadDateTime(bpolETADate, bpolETATime);
}
}
+ return true;
}
#endregion
@@ -382,9 +309,9 @@ namespace ENI2.Import
#region HAZA
- private static void ScanHAZA(List messages, MessageCore messageCore, ExcelReader reader)
+ private static bool ScanHAZA(Message hazaMessage, MessageCore messageCore, ExcelReader reader)
{
- Message hazaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.HAZA);
+
if(hazaMessage.Elements.Count == 0)
{
HAZ newHaza = new HAZ();
@@ -393,30 +320,20 @@ namespace ENI2.Import
hazaMessage.Elements.Add(newHaza);
}
HAZ haza = hazaMessage.Elements[0] as HAZ;
- // haza.DeleteElements();
haza.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZA.DGOnBoard");
haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival");
- haza.DPGContactFamilyName = reader.ReadText("HAZA.DPGContactFamilyName");
- reader.Conf.ConfirmText("HAZA.DPGContactFamilyName", haza.DPGContactFamilyName, haza.DPGContactFamilyName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
- haza.DPGContactPhone = reader.ReadText("HAZA.DPGContactPhone");
- reader.Conf.ConfirmText("HAZA.DPGContactPhone", haza.DPGContactPhone, haza.DPGContactPhone.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
+ haza.DPGContactFamilyName = reader.ReadText("HAZA.DPGContactFamilyName");
+ haza.DPGContactPhone = reader.ReadText("HAZA.DPGContactPhone");
haza.MOUBaltic = reader.ReadBoolean("HAZA.MOUBaltic");
string shipClass = reader.ReadText("HAZA.INFShipClass");
- if(shipClass.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText("HAZA.INFShipClass", null, ExcelReader.ReadState.FAIL);
- }
- else
- {
+ if(!shipClass.IsNullOrEmpty())
+ {
if (shipClass.Contains('1')) haza.INFShipClass = 0;
if (shipClass.Contains('2')) haza.INFShipClass = 1;
- if (shipClass.Contains('3')) haza.INFShipClass = 2;
- // if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) haza.INFShipClass = 0; // "NONE" existiert nicht in der Enumeration!!
- reader.Conf.ConfirmText("HAZA.INFShipClass", shipClass, haza.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
+ if (shipClass.Contains('3')) haza.INFShipClass = 2;
}
-
- // IMDG
+
#region IMDG
for (int i = 1; i <= 10; i++)
@@ -442,8 +359,7 @@ namespace ENI2.Import
string unNumber = reader.ReadText(imdg_unno);
if(unNumber.IsNullOrEmpty()) // if unnumber is not set ignore this row
- {
- reader.Conf.ConfirmText(imdg_unno, null, ExcelReader.ReadState.WARN);
+ {
continue;
}
@@ -457,47 +373,29 @@ namespace ENI2.Import
haza.IMDGPositions.Add(imdgPosition);
}
- imdgPosition.UNNumber = unNumber;
- reader.Conf.ConfirmText(imdg_unno, unNumber, ExcelReader.ReadState.OK);
- imdgPosition.ProperShippingName = reader.ReadText(imdg_properShippingName);
- reader.Conf.ConfirmText(imdg_properShippingName, imdgPosition.ProperShippingName, imdgPosition.ProperShippingName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.IMOClass = reader.ReadText(imdg_imoClass);
- reader.Conf.ConfirmText(imdg_imoClass, imdgPosition.IMOClass, imdgPosition.IMOClass.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ imdgPosition.UNNumber = unNumber;
+ imdgPosition.ProperShippingName = reader.ReadText(imdg_properShippingName);
+ imdgPosition.IMOClass = reader.ReadText(imdg_imoClass);
imdgPosition.PackingGroup = reader.ReadPackingGroup(imdg_packingGroup);
imdgPosition.MarinePollutant = reader.ReadBoolean(imdg_marinePollutant);
- imdgPosition.Flashpoint_CEL = reader.ReadText(imdg_flashpoint);
- ExcelReader.ReadState aReadState = ExcelReader.ReadState.NONE;
- if (!imdgPosition.Flashpoint_CEL.IsNullOrEmpty())
- {
- if (imdgPosition.Flashpoint_CEL == "-")
- aReadState = ExcelReader.ReadState.FAIL;
- else
- aReadState = ExcelReader.ReadState.OK;
- }
- reader.Conf.ConfirmText(imdg_flashpoint, imdgPosition.Flashpoint_CEL, aReadState);
+ imdgPosition.Flashpoint_CEL = reader.ReadText(imdg_flashpoint);
imdgPosition.NumberOfPackages = (int?)reader.ReadNumber(imdg_numberOfPackages);
- imdgPosition.PackageType = reader.ReadText(imdg_packageType);
- reader.Conf.ConfirmText(imdg_packageType, imdgPosition.PackageType, imdgPosition.PackageType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ imdgPosition.PackageType = reader.ReadText(imdg_packageType);
imdgPosition.LimitedQuantities = reader.ReadBoolean(imdg_limitedQuantities);
imdgPosition.ExceptedQuantities = reader.ReadBoolean(imdg_exceptedQuantities);
imdgPosition.NetQuantity_KGM = reader.ReadNumber(imdg_netQuantity);
imdgPosition.GrossQuantity_KGM = reader.ReadNumber(imdg_grossQuantity);
- imdgPosition.VehicleLicenseNumber = reader.ReadText(imdg_number);
- reader.Conf.ConfirmText(imdg_number, imdgPosition.VehicleLicenseNumber, imdgPosition.VehicleLicenseNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
- imdgPosition.StowagePosition = reader.ReadText(imdg_stowagePosition);
- reader.Conf.ConfirmText(imdg_stowagePosition, imdgPosition.StowagePosition, imdgPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.PortOfLoading = reader.ReadText(imdg_portOfLoading);
- reader.Conf.ConfirmText(imdg_portOfLoading, imdgPosition.PortOfLoading, imdgPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.PortOfDischarge = reader.ReadText(imdg_portOfDischarge);
- reader.Conf.ConfirmText(imdg_portOfDischarge, imdgPosition.PortOfDischarge, imdgPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
- reader.Conf.ConfirmText(imdg_containerNumber, imdgPosition.ContainerNumber, imdgPosition.ContainerNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
+ imdgPosition.VehicleLicenseNumber = reader.ReadText(imdg_number);
+ imdgPosition.StowagePosition = reader.ReadText(imdg_stowagePosition);
+ imdgPosition.PortOfLoading = reader.ReadText(imdg_portOfLoading);
+ imdgPosition.PortOfDischarge = reader.ReadText(imdg_portOfDischarge);
+ imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
}
#endregion
#region IBC
- // IBC
+
for (int i = 1; i <= 5; i++)
{
string ibc_productName = string.Format("HAZA.IBC.ProductName_{0}", i);
@@ -509,11 +407,7 @@ namespace ENI2.Import
string ibc_portOfDischarge = string.Format("HAZA.IBC.PortOfDischarge_{0}", i);
string productName = reader.ReadText(ibc_productName);
- if(productName.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(ibc_productName, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (productName.IsNullOrEmpty()) continue;
string posIdent = string.Format("IBC-{0}", i);
IBCPosition ibcPosition = haza.GetIBCPositionWithIdentifier(posIdent);
@@ -526,7 +420,7 @@ namespace ENI2.Import
}
ibcPosition.ProductName = productName;
- reader.Conf.ConfirmText(ibc_productName, productName, ExcelReader.ReadState.OK);
+
string pollutionCategory = reader.ReadText(ibc_pollutionCategory);
if(!pollutionCategory.IsNullOrEmpty())
{
@@ -534,18 +428,13 @@ namespace ENI2.Import
if (pollutionCategory.Equals("Y", StringComparison.OrdinalIgnoreCase)) ibcPosition.PollutionCategory = 1;
if (pollutionCategory.Equals("Z", StringComparison.OrdinalIgnoreCase)) ibcPosition.PollutionCategory = 2;
if (pollutionCategory.Equals("OS", StringComparison.OrdinalIgnoreCase)) ibcPosition.PollutionCategory = 3;
- }
- reader.Conf.ConfirmText(ibc_pollutionCategory, pollutionCategory, ibcPosition.PollutionCategory.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
+ }
- ibcPosition.Flashpoint_CEL = reader.ReadText(ibc_flash);
- ExcelReader.ReadState aReadState = ExcelReader.ReadState.NONE;
+ ibcPosition.Flashpoint_CEL = reader.ReadText(ibc_flash);
if (!ibcPosition.Flashpoint_CEL.IsNullOrEmpty())
{
- if (ibcPosition.Flashpoint_CEL == "-")
- aReadState = ExcelReader.ReadState.FAIL;
- else
- {
- aReadState = ExcelReader.ReadState.OK;
+ if (ibcPosition.Flashpoint_CEL != "-")
+ {
if (double.TryParse(ibcPosition.Flashpoint_CEL, out double flashval))
{
if (flashval > 60) ibcPosition.FlashpointInformation = 1; // GT60CEL
@@ -553,19 +442,17 @@ namespace ENI2.Import
}
}
}
- reader.Conf.ConfirmText(ibc_flash, ibcPosition.Flashpoint_CEL, aReadState);
+
ibcPosition.Quantity_KGM = (int ?) reader.ReadNumber(ibc_quantity);
- ibcPosition.StowagePosition = reader.ReadText(ibc_stowagePosition);
- reader.Conf.ConfirmText(ibc_stowagePosition, ibcPosition.StowagePosition, ibcPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- ibcPosition.PortOfLoading = reader.ReadText(ibc_portOfLoading);
- reader.Conf.ConfirmText(ibc_portOfLoading, ibcPosition.PortOfLoading, ibcPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- ibcPosition.PortOfDischarge = reader.ReadText(ibc_portOfDischarge);
- reader.Conf.ConfirmText(ibc_portOfDischarge, ibcPosition.PortOfDischarge, ibcPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ ibcPosition.StowagePosition = reader.ReadText(ibc_stowagePosition);
+ ibcPosition.PortOfLoading = reader.ReadText(ibc_portOfLoading);
+ ibcPosition.PortOfDischarge = reader.ReadText(ibc_portOfDischarge);
}
+
#endregion
#region IGC
- // IGC
+
for (int i = 1; i <= 5; i++)
{
string igc_productName = string.Format("HAZA.IGC.ProductName_{0}", i);
@@ -575,11 +462,7 @@ namespace ENI2.Import
string igc_portOfDischarge = string.Format("HAZA.IGC.PortOfDischarge_{0}", i);
string productName = reader.ReadText(igc_productName);
- if(productName.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(igc_productName, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (productName.IsNullOrEmpty()) continue;
string posIdent = string.Format("IGC-{0}", i);
IGCPosition igcPosition = haza.GetIGCPositionWithIdentifier(posIdent);
@@ -591,20 +474,17 @@ namespace ENI2.Import
haza.IGCPositions.Add(igcPosition);
}
- igcPosition.ProductName = productName;
- reader.Conf.ConfirmText(igc_productName, productName, ExcelReader.ReadState.OK);
+ igcPosition.ProductName = productName;
igcPosition.Quantity_KGM = reader.ReadNumber(igc_quantity);
- igcPosition.StowagePosition = reader.ReadText(igc_stowagePosition);
- reader.Conf.ConfirmText(igc_stowagePosition, igcPosition.StowagePosition, igcPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- igcPosition.PortOfLoading = reader.ReadText(igc_portOfLoading);
- reader.Conf.ConfirmText(igc_portOfLoading, igcPosition.PortOfLoading, igcPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- igcPosition.PortOfDischarge = reader.ReadText(igc_portOfDischarge);
- reader.Conf.ConfirmText(igc_portOfDischarge, igcPosition.PortOfDischarge, igcPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ igcPosition.StowagePosition = reader.ReadText(igc_stowagePosition);
+ igcPosition.PortOfLoading = reader.ReadText(igc_portOfLoading);
+ igcPosition.PortOfDischarge = reader.ReadText(igc_portOfDischarge);
}
+
#endregion
#region IMSBC
- // IMSBC
+
for (int i = 1; i <= 5; i++)
{
string imsbc_bcsn = string.Format("HAZA.IMSBC.BulkCargoShippingName_{0}", i);
@@ -615,11 +495,7 @@ namespace ENI2.Import
string imsbc_portOfDischarge = string.Format("HAZA.IMSBC.PortOfDischarge_{0}", i);
string bcsn = reader.ReadText(imsbc_bcsn);
- if(bcsn.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(imsbc_bcsn, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (bcsn.IsNullOrEmpty()) continue;
string posIdent = string.Format("IMSBC-{0}", i);
IMSBCPosition imsbcPosition = haza.GetIMSBCPositionWithIdentifier(posIdent);
@@ -631,21 +507,18 @@ namespace ENI2.Import
haza.IMSBCPositions.Add(imsbcPosition);
}
- imsbcPosition.BulkCargoShippingName = bcsn;
- reader.Conf.ConfirmText(imsbc_bcsn, bcsn, ExcelReader.ReadState.OK);
+ imsbcPosition.BulkCargoShippingName = bcsn;
imsbcPosition.MHB = reader.ReadBoolean(imsbc_mhb);
imsbcPosition.Quantity_KGM = reader.ReadNumber(imsbc_quantity);
- imsbcPosition.StowagePosition = reader.ReadText(imsbc_stowagePosition);
- reader.Conf.ConfirmText(imsbc_stowagePosition, imsbcPosition.StowagePosition, imsbcPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imsbcPosition.PortOfLoading = reader.ReadText(imsbc_portOfLoading);
- reader.Conf.ConfirmText(imsbc_portOfLoading, imsbcPosition.PortOfLoading, imsbcPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imsbcPosition.PortOfDischarge = reader.ReadText(imsbc_portOfDischarge);
- reader.Conf.ConfirmText(imsbc_portOfDischarge, imsbcPosition.PortOfDischarge, imsbcPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ imsbcPosition.StowagePosition = reader.ReadText(imsbc_stowagePosition);
+ imsbcPosition.PortOfLoading = reader.ReadText(imsbc_portOfLoading);
+ imsbcPosition.PortOfDischarge = reader.ReadText(imsbc_portOfDischarge);
}
+
#endregion
#region MARPOL
- // MARPOL
+
for (int i = 1; i <= 5; i++)
{
string marpol_name = string.Format("HAZA.MARPOL.Name_{0}", i);
@@ -656,11 +529,7 @@ namespace ENI2.Import
string marpol_portOfDischarge = string.Format("HAZA.MARPOL.PortOfDischarge_{0}", i);
string name = reader.ReadText(marpol_name);
- if(name.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(marpol_name, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (name.IsNullOrEmpty()) continue;
string posIdent = string.Format("MARPOL-{0}", i);
MARPOL_Annex_I_Position marpolPosition = haza.GetMARPOLPositionWithIdentifier(posIdent);
@@ -672,18 +541,8 @@ namespace ENI2.Import
haza.MARPOLPositions.Add(marpolPosition);
}
- marpolPosition.Name = name;
- reader.Conf.ConfirmText(marpol_name, name, ExcelReader.ReadState.OK);
- marpolPosition.Flashpoint_CEL = reader.ReadText(marpol_flash);
- ExcelReader.ReadState aReadState = ExcelReader.ReadState.NONE;
- if (!marpolPosition.Flashpoint_CEL.IsNullOrEmpty())
- {
- if (marpolPosition.Flashpoint_CEL == "-")
- aReadState = ExcelReader.ReadState.FAIL;
- else
- aReadState = ExcelReader.ReadState.OK;
- }
- reader.Conf.ConfirmText(marpol_flash, marpolPosition.Flashpoint_CEL, aReadState);
+ marpolPosition.Name = name;
+ marpolPosition.Flashpoint_CEL = reader.ReadText(marpol_flash);
// Früher bei NULL: NF // Ableitung Flashpoint-Info: Christin, 22.3.2017
// jetzt bei leerer Flashpoint_CEL: Flashpointinformation NULL: Basti, 13.7.2020
@@ -698,32 +557,27 @@ namespace ENI2.Import
}
marpolPosition.Quantity_KGM = reader.ReadNumber(marpol_quantity);
- marpolPosition.StowagePosition = reader.ReadText(marpol_stowagePosition);
- reader.Conf.ConfirmText(marpol_stowagePosition, marpolPosition.StowagePosition, marpolPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- marpolPosition.PortOfLoading = reader.ReadText(marpol_portOfLoading);
- reader.Conf.ConfirmText(marpol_portOfLoading, marpolPosition.PortOfLoading, marpolPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- marpolPosition.PortOfDischarge = reader.ReadText(marpol_portOfDischarge);
- reader.Conf.ConfirmText(marpol_portOfDischarge, marpolPosition.PortOfDischarge, marpolPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ marpolPosition.StowagePosition = reader.ReadText(marpol_stowagePosition);
+ marpolPosition.PortOfLoading = reader.ReadText(marpol_portOfLoading);
+ marpolPosition.PortOfDischarge = reader.ReadText(marpol_portOfDischarge);
}
- #endregion
+ #endregion
if(haza.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
{
haza.NoDPGOnBoardOnArrival = false;
- // haza.DPGManifestOnBoardOnArrival = true;
}
-
+ return true;
}
#endregion
#region HAZD
- private static void ScanHAZD(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message hazdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.HAZD);
+ private static bool ScanHAZD(Message hazdMessage, MessageCore messageCore, ExcelReader reader)
+ {
if (hazdMessage.Elements.Count == 0)
{
HAZ newHazd = new HAZ();
@@ -731,31 +585,21 @@ namespace ENI2.Import
newHazd.MessageHeader = hazdMessage;
hazdMessage.Elements.Add(newHazd);
}
- HAZ hazd = hazdMessage.Elements[0] as HAZ;
- // hazd.DeleteElements();
+ HAZ hazd = hazdMessage.Elements[0] as HAZ;
hazd.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZD.DGOnBoard");
hazd.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZD.DPGManifestOnBoardOnDeparture");
- hazd.DPGContactFamilyName = reader.ReadText("HAZD.DPGContactFamilyName");
- reader.Conf.ConfirmText("HAZD.DPGContactFamilyName", hazd.DPGContactFamilyName, hazd.DPGContactFamilyName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
- hazd.DPGContactPhone = reader.ReadText("HAZD.DPGContactPhone");
- reader.Conf.ConfirmText("HAZD.DPGContactPhone", hazd.DPGContactPhone, hazd.DPGContactPhone.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
+ hazd.DPGContactFamilyName = reader.ReadText("HAZD.DPGContactFamilyName");
+ hazd.DPGContactPhone = reader.ReadText("HAZD.DPGContactPhone");
hazd.MOUBaltic = reader.ReadBoolean("HAZD.MOUBaltic");
string shipClass = reader.ReadText("HAZD.INFShipClass");
- if (shipClass.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText("HAZD.INFShipClass", null, ExcelReader.ReadState.FAIL);
- }
- else
- {
+ if (!shipClass.IsNullOrEmpty())
+ {
if (shipClass.Contains('1')) hazd.INFShipClass = 0;
if (shipClass.Contains('2')) hazd.INFShipClass = 1;
- if (shipClass.Contains('3')) hazd.INFShipClass = 2;
- // if (shipClass.Equals("none", StringComparison.OrdinalIgnoreCase)) hazd.INFShipClass = 0;
- reader.Conf.ConfirmText("HAZD.INFShipClass", shipClass, hazd.INFShipClass.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
+ if (shipClass.Contains('3')) hazd.INFShipClass = 2;
}
-
- // IMDG
+
#region IMDG
for (int i = 1; i <= 10; i++)
@@ -779,11 +623,7 @@ namespace ENI2.Import
string imdg_containerNumber = string.Format("HAZD.IMDG.ContainerNumber_{0}", i);
string unNumber = reader.ReadText(imdg_unno);
- if (unNumber.IsNullOrEmpty()) // if unnumber is not set ignore this row
- {
- reader.Conf.ConfirmText(imdg_unno, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (unNumber.IsNullOrEmpty()) continue; // if unnumber is not set ignore this row
string posIdent = string.Format("IMDG-{0}", i);
IMDGPosition imdgPosition = hazd.GetIMDGPositionWithIdentifier(posIdent);
@@ -795,47 +635,29 @@ namespace ENI2.Import
hazd.IMDGPositions.Add(imdgPosition);
}
- imdgPosition.UNNumber = unNumber;
- reader.Conf.ConfirmText(imdg_unno, unNumber, ExcelReader.ReadState.OK);
- imdgPosition.ProperShippingName = reader.ReadText(imdg_properShippingName);
- reader.Conf.ConfirmText(imdg_properShippingName, imdgPosition.ProperShippingName, imdgPosition.ProperShippingName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.IMOClass = reader.ReadText(imdg_imoClass);
- reader.Conf.ConfirmText(imdg_imoClass, imdgPosition.IMOClass, imdgPosition.IMOClass.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ imdgPosition.UNNumber = unNumber;
+ imdgPosition.ProperShippingName = reader.ReadText(imdg_properShippingName);
+ imdgPosition.IMOClass = reader.ReadText(imdg_imoClass);
imdgPosition.PackingGroup = reader.ReadPackingGroup(imdg_packingGroup);
imdgPosition.MarinePollutant = reader.ReadBoolean(imdg_marinePollutant);
- imdgPosition.Flashpoint_CEL = reader.ReadText(imdg_flashpoint);
- ExcelReader.ReadState aReadState = ExcelReader.ReadState.NONE;
- if (!imdgPosition.Flashpoint_CEL.IsNullOrEmpty())
- {
- if (imdgPosition.Flashpoint_CEL == "-")
- aReadState = ExcelReader.ReadState.FAIL;
- else
- aReadState = ExcelReader.ReadState.OK;
- }
- reader.Conf.ConfirmText(imdg_flashpoint, imdgPosition.Flashpoint_CEL, aReadState);
+ imdgPosition.Flashpoint_CEL = reader.ReadText(imdg_flashpoint);
imdgPosition.NumberOfPackages = (int?)reader.ReadNumber(imdg_numberOfPackages);
- imdgPosition.PackageType = reader.ReadText(imdg_packageType);
- reader.Conf.ConfirmText(imdg_packageType, imdgPosition.PackageType, imdgPosition.PackageType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ imdgPosition.PackageType = reader.ReadText(imdg_packageType);
imdgPosition.LimitedQuantities = reader.ReadBoolean(imdg_limitedQuantities);
imdgPosition.ExceptedQuantities = reader.ReadBoolean(imdg_exceptedQuantities);
imdgPosition.NetQuantity_KGM = reader.ReadNumber(imdg_netQuantity);
imdgPosition.GrossQuantity_KGM = reader.ReadNumber(imdg_grossQuantity);
- imdgPosition.VehicleLicenseNumber = reader.ReadText(imdg_number);
- reader.Conf.ConfirmText(imdg_number, imdgPosition.VehicleLicenseNumber, imdgPosition.VehicleLicenseNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
- imdgPosition.StowagePosition = reader.ReadText(imdg_stowagePosition);
- reader.Conf.ConfirmText(imdg_stowagePosition, imdgPosition.StowagePosition, imdgPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.PortOfLoading = reader.ReadText(imdg_portOfLoading);
- reader.Conf.ConfirmText(imdg_portOfLoading, imdgPosition.PortOfLoading, imdgPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.PortOfDischarge = reader.ReadText(imdg_portOfDischarge);
- reader.Conf.ConfirmText(imdg_portOfDischarge, imdgPosition.PortOfDischarge, imdgPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
- reader.Conf.ConfirmText(imdg_containerNumber, imdgPosition.ContainerNumber, imdgPosition.ContainerNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
+ imdgPosition.VehicleLicenseNumber = reader.ReadText(imdg_number);
+ imdgPosition.StowagePosition = reader.ReadText(imdg_stowagePosition);
+ imdgPosition.PortOfLoading = reader.ReadText(imdg_portOfLoading);
+ imdgPosition.PortOfDischarge = reader.ReadText(imdg_portOfDischarge);
+ imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
}
#endregion
#region IBC
- // IBC
+
for (int i = 1; i <= 5; i++)
{
string ibc_productName = string.Format("HAZD.IBC.ProductName_{0}", i);
@@ -847,11 +669,7 @@ namespace ENI2.Import
string ibc_portOfDischarge = string.Format("HAZD.IBC.PortOfDischarge_{0}", i);
string productName = reader.ReadText(ibc_productName);
- if (productName.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(ibc_productName, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (productName.IsNullOrEmpty()) continue;
string posIdent = string.Format("IBC-{0}", i);
IBCPosition ibcPosition = hazd.GetIBCPositionWithIdentifier(posIdent);
@@ -863,8 +681,7 @@ namespace ENI2.Import
hazd.IBCPositions.Add(ibcPosition);
}
- ibcPosition.ProductName = productName;
- reader.Conf.ConfirmText(ibc_productName, productName, ExcelReader.ReadState.OK);
+ ibcPosition.ProductName = productName;
string pollutionCategory = reader.ReadText(ibc_pollutionCategory);
if (!pollutionCategory.IsNullOrEmpty())
{
@@ -872,40 +689,32 @@ namespace ENI2.Import
if (pollutionCategory.Equals("Y", StringComparison.OrdinalIgnoreCase)) ibcPosition.PollutionCategory = 1;
if (pollutionCategory.Equals("Z", StringComparison.OrdinalIgnoreCase)) ibcPosition.PollutionCategory = 2;
if (pollutionCategory.Equals("OS", StringComparison.OrdinalIgnoreCase)) ibcPosition.PollutionCategory = 3;
- }
- reader.Conf.ConfirmText(ibc_pollutionCategory, pollutionCategory, ibcPosition.PollutionCategory.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
+ }
ibcPosition.Flashpoint_CEL = reader.ReadText(ibc_flash);
- ExcelReader.ReadState aReadState = ExcelReader.ReadState.NONE;
+
if (!ibcPosition.Flashpoint_CEL.IsNullOrEmpty())
{
- if (ibcPosition.Flashpoint_CEL == "-")
- {
- aReadState = ExcelReader.ReadState.FAIL;
- }
- else
- {
- aReadState = ExcelReader.ReadState.OK;
+ if (ibcPosition.Flashpoint_CEL != "-")
+ {
if (double.TryParse(ibcPosition.Flashpoint_CEL, out double flashval))
{
if (flashval > 60) ibcPosition.FlashpointInformation = 1; // GT60CEL
else ibcPosition.FlashpointInformation = 2; // LE60CEL
}
}
- }
- reader.Conf.ConfirmText(ibc_flash, ibcPosition.Flashpoint_CEL, aReadState);
+ }
+
ibcPosition.Quantity_KGM = (int?)reader.ReadNumber(ibc_quantity);
- ibcPosition.StowagePosition = reader.ReadText(ibc_stowagePosition);
- reader.Conf.ConfirmText(ibc_stowagePosition, ibcPosition.StowagePosition, ibcPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- ibcPosition.PortOfLoading = reader.ReadText(ibc_portOfLoading);
- reader.Conf.ConfirmText(ibc_portOfLoading, ibcPosition.PortOfLoading, ibcPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- ibcPosition.PortOfDischarge = reader.ReadText(ibc_portOfDischarge);
- reader.Conf.ConfirmText(ibc_portOfDischarge, ibcPosition.PortOfDischarge, ibcPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ ibcPosition.StowagePosition = reader.ReadText(ibc_stowagePosition);
+ ibcPosition.PortOfLoading = reader.ReadText(ibc_portOfLoading);
+ ibcPosition.PortOfDischarge = reader.ReadText(ibc_portOfDischarge);
}
+
#endregion
#region IGC
- // IGC
+
for (int i = 1; i <= 5; i++)
{
string igc_productName = string.Format("HAZD.IGC.ProductName_{0}", i);
@@ -915,11 +724,7 @@ namespace ENI2.Import
string igc_portOfDischarge = string.Format("HAZD.IGC.PortOfDischarge_{0}", i);
string productName = reader.ReadText(igc_productName);
- if (productName.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(igc_productName, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (productName.IsNullOrEmpty()) continue;
string posIdent = string.Format("IGC-{0}", i);
IGCPosition igcPosition = hazd.GetIGCPositionWithIdentifier(posIdent);
@@ -931,20 +736,17 @@ namespace ENI2.Import
hazd.IGCPositions.Add(igcPosition);
}
- igcPosition.ProductName = productName;
- reader.Conf.ConfirmText(igc_productName, productName, ExcelReader.ReadState.OK);
+ igcPosition.ProductName = productName;
igcPosition.Quantity_KGM = reader.ReadNumber(igc_quantity);
- igcPosition.StowagePosition = reader.ReadText(igc_stowagePosition);
- reader.Conf.ConfirmText(igc_stowagePosition, igcPosition.StowagePosition, igcPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- igcPosition.PortOfLoading = reader.ReadText(igc_portOfLoading);
- reader.Conf.ConfirmText(igc_portOfLoading, igcPosition.PortOfLoading, igcPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- igcPosition.PortOfDischarge = reader.ReadText(igc_portOfDischarge);
- reader.Conf.ConfirmText(igc_portOfDischarge, igcPosition.PortOfDischarge, igcPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ igcPosition.StowagePosition = reader.ReadText(igc_stowagePosition);
+ igcPosition.PortOfLoading = reader.ReadText(igc_portOfLoading);
+ igcPosition.PortOfDischarge = reader.ReadText(igc_portOfDischarge);
}
+
#endregion
#region IMSBC
- // IMSBC
+
for (int i = 1; i <= 5; i++)
{
string imsbc_bcsn = string.Format("HAZD.IMSBC.BulkCargoShippingName_{0}", i);
@@ -955,11 +757,7 @@ namespace ENI2.Import
string imsbc_portOfDischarge = string.Format("HAZD.IMSBC.PortOfDischarge_{0}", i);
string bcsn = reader.ReadText(imsbc_bcsn);
- if (bcsn.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(imsbc_bcsn, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (bcsn.IsNullOrEmpty()) continue;
string posIdent = string.Format("IMSBC-{0}", i);
IMSBCPosition imsbcPosition = hazd.GetIMSBCPositionWithIdentifier(posIdent);
@@ -971,21 +769,18 @@ namespace ENI2.Import
hazd.IMSBCPositions.Add(imsbcPosition);
}
- imsbcPosition.BulkCargoShippingName = bcsn;
- reader.Conf.ConfirmText(imsbc_bcsn, bcsn, ExcelReader.ReadState.OK);
+ imsbcPosition.BulkCargoShippingName = bcsn;
imsbcPosition.MHB = reader.ReadBoolean(imsbc_mhb);
imsbcPosition.Quantity_KGM = reader.ReadNumber(imsbc_quantity);
- imsbcPosition.StowagePosition = reader.ReadText(imsbc_stowagePosition);
- reader.Conf.ConfirmText(imsbc_stowagePosition, imsbcPosition.StowagePosition, imsbcPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imsbcPosition.PortOfLoading = reader.ReadText(imsbc_portOfLoading);
- reader.Conf.ConfirmText(imsbc_portOfLoading, imsbcPosition.PortOfLoading, imsbcPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- imsbcPosition.PortOfDischarge = reader.ReadText(imsbc_portOfDischarge);
- reader.Conf.ConfirmText(imsbc_portOfDischarge, imsbcPosition.PortOfDischarge, imsbcPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ imsbcPosition.StowagePosition = reader.ReadText(imsbc_stowagePosition);
+ imsbcPosition.PortOfLoading = reader.ReadText(imsbc_portOfLoading);
+ imsbcPosition.PortOfDischarge = reader.ReadText(imsbc_portOfDischarge);
}
+
#endregion
#region MARPOL
- // MARPOL
+
for (int i = 1; i <= 5; i++)
{
string marpol_name = string.Format("HAZD.MARPOL.Name_{0}", i);
@@ -996,11 +791,7 @@ namespace ENI2.Import
string marpol_portOfDischarge = string.Format("HAZD.MARPOL.PortOfDischarge_{0}", i);
string name = reader.ReadText(marpol_name);
- if (name.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(marpol_name, null, ExcelReader.ReadState.WARN);
- continue;
- }
+ if (name.IsNullOrEmpty()) continue;
string posIdent = string.Format("MARPOL-{0}", i);
MARPOL_Annex_I_Position marpolPosition = hazd.GetMARPOLPositionWithIdentifier(posIdent);
@@ -1012,20 +803,11 @@ namespace ENI2.Import
hazd.MARPOLPositions.Add(marpolPosition);
}
- marpolPosition.Name = name;
- reader.Conf.ConfirmText(marpol_name, name, ExcelReader.ReadState.OK);
- marpolPosition.Flashpoint_CEL = reader.ReadText(marpol_flash);
- ExcelReader.ReadState aReadState = ExcelReader.ReadState.NONE;
- if (!marpolPosition.Flashpoint_CEL.IsNullOrEmpty())
- {
- if (marpolPosition.Flashpoint_CEL == "-")
- aReadState = ExcelReader.ReadState.FAIL;
- else
- aReadState = ExcelReader.ReadState.OK;
- }
- reader.Conf.ConfirmText(marpol_flash, marpolPosition.Flashpoint_CEL, aReadState);
-
- if (marpolPosition.Flashpoint_CEL.IsNullOrEmpty()) { marpolPosition.FlashpointInformation = 0; } // NF // Ableitung Flashpoint-Info: Christin, 22.3.2017
+ marpolPosition.Name = name;
+ marpolPosition.Flashpoint_CEL = reader.ReadText(marpol_flash);
+ if (marpolPosition.Flashpoint_CEL.IsNullOrEmpty()) {
+ marpolPosition.FlashpointInformation = 0;
+ } // NF // Ableitung Flashpoint-Info: Christin, 22.3.2017
else
{
if (double.TryParse(marpolPosition.Flashpoint_CEL, out double flashval))
@@ -1036,34 +818,27 @@ namespace ENI2.Import
}
marpolPosition.Quantity_KGM = reader.ReadNumber(marpol_quantity);
- marpolPosition.StowagePosition = reader.ReadText(marpol_stowagePosition);
- reader.Conf.ConfirmText(marpol_stowagePosition, marpolPosition.StowagePosition, marpolPosition.StowagePosition.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- marpolPosition.PortOfLoading = reader.ReadText(marpol_portOfLoading);
- reader.Conf.ConfirmText(marpol_portOfLoading, marpolPosition.PortOfLoading, marpolPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- marpolPosition.PortOfDischarge = reader.ReadText(marpol_portOfDischarge);
- reader.Conf.ConfirmText(marpol_portOfDischarge, marpolPosition.PortOfDischarge, marpolPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ marpolPosition.StowagePosition = reader.ReadText(marpol_stowagePosition);
+ marpolPosition.PortOfLoading = reader.ReadText(marpol_portOfLoading);
+ marpolPosition.PortOfDischarge = reader.ReadText(marpol_portOfDischarge);
}
+
#endregion
-
-
if (hazd.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
{
- hazd.NoDPGOnBoardOnArrival = false;
- // hazd.DPGManifestOnBoardOnArrival = true;
+ hazd.NoDPGOnBoardOnArrival = false;
}
-
-
+ return true;
}
#endregion
#region INFO
- private static void ScanINFO(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message infoMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.INFO);
+ private static bool ScanINFO(Message infoMessage, MessageCore messageCore, ExcelReader reader)
+ {
if(infoMessage.Elements.Count == 0)
{
INFO newINFO = new INFO();
@@ -1071,13 +846,13 @@ namespace ENI2.Import
infoMessage.Elements.Add(newINFO);
}
INFO info = infoMessage.Elements[0] as INFO;
- Util.ScanMessage(info, reader);
+ ExcelUtil.ScanMessage(info, reader);
info.ShippingArea = reader.ReadShippingArea("INFO.ShippingArea"); // enum read func
-
bool? fumigatedBulkCargo = reader.ReadBoolean("INFO.FumigatedBulkCargo");
info.FumigatedBulkCargo = (byte) ((fumigatedBulkCargo ?? false) ? 1 : 0);
- // wird nicht wieder entfernt
+
+ return true;
}
#endregion
@@ -1267,9 +1042,8 @@ namespace ENI2.Import
#region AGNT
- private static void ScanAGNT(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message agntMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.AGNT);
+ private static bool ScanAGNT(Message agntMessage, MessageCore messageCore, ExcelReader reader)
+ {
if(agntMessage.Elements.Count == 0)
{
AGNT newAgnt = new AGNT();
@@ -1277,11 +1051,12 @@ namespace ENI2.Import
agntMessage.Elements.Add(newAgnt);
}
AGNT agnt = agntMessage.Elements[0] as AGNT;
- Util.ScanMessage(agnt, reader);
+ ExcelUtil.ScanMessage(agnt, reader);
if (agnt.AgentLastName.IsNullOrEmpty()) agnt.AgentLastName = "-";
// wird nicht mehr entfernt, egal welche Felder gelesen werden
+ return true;
}
#endregion
@@ -1476,9 +1251,8 @@ namespace ENI2.Import
#region MDH
- private static void ScanMDH(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message mdhMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.MDH);
+ private static bool ScanMDH(Message mdhMessage, List messages, MessageCore messageCore, ExcelReader reader)
+ {
if(mdhMessage.Elements.Count == 0)
{
MDH newMDH = new MDH();
@@ -1487,7 +1261,7 @@ namespace ENI2.Import
}
MDH mdh = mdhMessage.Elements[0] as MDH;
mdh.DeleteElements();
- Util.ScanMessage(mdh, reader);
+ ExcelUtil.ScanMessage(mdh, reader);
// lt. Mail von Christin am 28.9.2016
mdh.MDHSimplification = false;
@@ -1506,24 +1280,26 @@ namespace ENI2.Import
// das funktioniert, da SEC vor MDH gelesen wird
if (!kuerzelErsteZelle.IsNullOrEmpty() && kuerzelErsteZelle.Equals("sec", StringComparison.OrdinalIgnoreCase))
{
- Message secMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SEC);
- if (secMessage.Elements.Count == 0) return;
- SEC sec = secMessage.Elements[0] as SEC;
- int i = 1;
- foreach (LastTenPortFacilitiesCalled ltpfc in sec.LastTenPortFacilitesCalled)
+ Message secMessage = ExcelUtil.GetMessageWithType(messages, messageCore, Message.NotificationClass.SEC);
+ if (secMessage.Elements.Count > 0)
{
- if (!(mdh.GetSublistElementWithIdentifier((i + 1).ToString()) is PortOfCallLast30Days poc30d))
+ SEC sec = secMessage.Elements[0] as SEC;
+ int i = 1;
+ foreach (LastTenPortFacilitiesCalled ltpfc in sec.LastTenPortFacilitesCalled)
{
- poc30d = new PortOfCallLast30Days();
- poc30d.Identifier = (i + 1).ToString();
- poc30d.MDH = mdh;
- mdh.PortOfCallLast30Days.Add(poc30d);
- }
+ if (!(mdh.GetSublistElementWithIdentifier((i + 1).ToString()) is PortOfCallLast30Days poc30d))
+ {
+ poc30d = new PortOfCallLast30Days();
+ poc30d.Identifier = (i + 1).ToString();
+ poc30d.MDH = mdh;
+ mdh.PortOfCallLast30Days.Add(poc30d);
+ }
- poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
- poc30d.PortOfCallLast30DaysLocode = ltpfc.PortFacilityPortLoCode;
- poc30d.PortOfCallLast30DaysDateOfDeparture = ltpfc.PortFacilityDateOfDeparture;
- i++;
+ poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
+ poc30d.PortOfCallLast30DaysLocode = ltpfc.PortFacilityPortLoCode;
+ poc30d.PortOfCallLast30DaysDateOfDeparture = ltpfc.PortFacilityDateOfDeparture;
+ i++;
+ }
}
}
else // "normal mode", aus den Zellen lesen
@@ -1548,9 +1324,7 @@ namespace ENI2.Import
}
string pName = reader.ReadText(portName);
- string pCountry = reader.ReadText(portCountry);
- reader.Conf.ConfirmText(portName, pName, ExcelReader.ReadState.NONE);
- reader.Conf.ConfirmText(portCountry, pCountry, ExcelReader.ReadState.NONE);
+ string pCountry = reader.ReadText(portCountry);
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
poc30d.PortOfCallLast30DaysLocode = reader.ReadLoCode(locode);
@@ -1584,15 +1358,8 @@ namespace ENI2.Import
poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
if (crew[j].Length > 90)
readState = ExcelReader.ReadState.FAIL;
- }
- reader.Conf.ConfirmText(crewName, crewNameString, readState);
- }
-
- // falls Häkchen gesetzt aber Namensfeld leer: Fehler markieren
- if((PortOfCallLast30DaysCrewMembersJoinedFlag ?? false) && crewNameString.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(crewName, null, ExcelReader.ReadState.FAIL);
- }
+ }
+ }
// Leer/def. Zeilen entfernen
if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
@@ -1621,18 +1388,8 @@ namespace ENI2.Import
smd.MDH = mdh;
}
- smd.SanitaryMeasuresType = reader.ReadText(smType);
- ExcelReader.ReadState readState = ExcelReader.ReadState.OK;
- if (smd.SanitaryMeasuresType.IsNullOrEmpty() || smd.SanitaryMeasuresType.Length > 90)
- readState = ExcelReader.ReadState.FAIL;
- reader.Conf.ConfirmText(smType, smd.SanitaryMeasuresType, readState);
-
- smd.SanitaryMeasuresLocation = reader.ReadText(smLocation);
- readState = ExcelReader.ReadState.OK;
- if (smd.SanitaryMeasuresLocation.IsNullOrEmpty() || smd.SanitaryMeasuresLocation.Length > 90)
- readState = ExcelReader.ReadState.FAIL;
- reader.Conf.ConfirmText(smLocation, smd.SanitaryMeasuresLocation, smd.SanitaryMeasuresLocation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
-
+ smd.SanitaryMeasuresType = reader.ReadText(smType);
+ smd.SanitaryMeasuresLocation = reader.ReadText(smLocation);
smd.SanitaryMeasuresDate = reader.ReadDate(smDate);
// dont save completely empty structs
if (!smd.SanitaryMeasuresDate.HasValue && smd.SanitaryMeasuresLocation.IsNullOrEmpty() && smd.SanitaryMeasuresType.IsNullOrEmpty())
@@ -1658,11 +1415,8 @@ namespace ENI2.Import
mdh.InfectedAreas.Add(ia);
ia.MDH = mdh;
}
- ia.InfectedAreaPort = reader.ReadText(iaPort);
- ExcelReader.ReadState readState = ExcelReader.ReadState.OK;
- if (ia.InfectedAreaPort.IsNullOrEmpty() || ia.InfectedAreaPort.Length > 90)
- readState = ExcelReader.ReadState.FAIL;
- reader.Conf.ConfirmText(iaPort, ia.InfectedAreaPort, readState);
+
+ ia.InfectedAreaPort = reader.ReadText(iaPort);
ia.InfectedAreaDate = reader.ReadDate(iaDate);
// dont save completely empty structs
if (!ia.InfectedAreaDate.HasValue && ia.InfectedAreaPort.IsNullOrEmpty())
@@ -1690,18 +1444,9 @@ namespace ENI2.Import
sjl.StowawayJoiningLocation = reader.ReadText(sjlLookup);
if (sjl.StowawayJoiningLocation.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(sjlLookup, null, ExcelReader.ReadState.WARN);
+ {
mdh.StowawaysJoiningLocations.Remove(sjl);
- }
- else
- {
- ExcelReader.ReadState readState = ExcelReader.ReadState.OK;
- if (sjl.StowawayJoiningLocation.Length > 90)
- readState = ExcelReader.ReadState.FAIL;
-
- reader.Conf.ConfirmText(sjlLookup, sjl.StowawayJoiningLocation, readState);
- }
+ }
}
}
@@ -1711,9 +1456,11 @@ namespace ENI2.Import
catch(Exception ex)
{
_log.ErrorFormat("Crash during reading of MDH message: {0}", ex);
+ return false;
}
// wird nicht wieder entfernt falls keine Daten vorliegen
+ return true;
}
#endregion
@@ -1909,9 +1656,8 @@ namespace ENI2.Import
#region BKRA
- private static void ScanBKRA(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message bkraMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BKRA);
+ private static bool ScanBKRA(Message bkraMessage, MessageCore messageCore, ExcelReader reader)
+ {
bkraMessage.DeleteElements();
for (int i = 1; i <= bkraMessage.NumberOfExcelRows; i++)
{
@@ -1928,31 +1674,20 @@ namespace ENI2.Import
bkra.BunkerFuelQuantity_TNE = reader.ReadNumber(lnQuantity);
bkra.BunkerFuelType = reader.ReadText(lnType);
- reader.Conf.ConfirmText(lnType, bkra.BunkerFuelType, ExcelReader.ReadState.OK);
-
- // "OK" Quantity falls Type nicht angegeben
- if (bkra.BunkerFuelType.IsNullOrEmpty() && !bkra.BunkerFuelQuantity_TNE.HasValue)
- reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK);
- // "WARN" Quantity falls Menge aber kein Type
- if(bkra.BunkerFuelQuantity_TNE.HasValue && bkra.BunkerFuelType.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
- reader.Conf.ConfirmNumber(lnQuantity, bkra.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN);
- }
// dont save empty element
- if(bkra.IsNew && !bkra.BunkerFuelQuantity_TNE.HasValue && bkra.BunkerFuelType.IsNullOrEmpty())
- bkraMessage.Elements.Remove(bkra);
+ if (bkra.IsNew && !bkra.BunkerFuelQuantity_TNE.HasValue && bkra.BunkerFuelType.IsNullOrEmpty())
+ bkraMessage.Elements.Remove(bkra);
}
+ return true;
}
#endregion
#region BKRD
- private static void ScanBKRD(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message bkrdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BKRD);
+ private static bool ScanBKRD(Message bkrdMessage, MessageCore messageCore, ExcelReader reader)
+ {
bkrdMessage.DeleteElements();
for (int i = 1; i <= bkrdMessage.NumberOfExcelRows; i++)
{
@@ -1967,23 +1702,13 @@ namespace ENI2.Import
}
bkrd.BunkerFuelQuantity_TNE = reader.ReadNumber(lnQuantity);
- bkrd.BunkerFuelType = reader.ReadText(lnType);
- reader.Conf.ConfirmText(lnType, bkrd.BunkerFuelType, ExcelReader.ReadState.OK);
-
- // "OK" Quantity falls Type nicht angegeben
- if (bkrd.BunkerFuelType.IsNullOrEmpty() && !bkrd.BunkerFuelQuantity_TNE.HasValue)
- reader.Conf.ConfirmNumber(lnQuantity, null, ExcelReader.ReadState.OK);
- // "WARN" Quantity falls Menge aber kein Type
- if (bkrd.BunkerFuelQuantity_TNE.HasValue && bkrd.BunkerFuelType.IsNullOrEmpty())
- {
- reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
- reader.Conf.ConfirmNumber(lnQuantity, bkrd.BunkerFuelQuantity_TNE, ExcelReader.ReadState.WARN);
- }
+ bkrd.BunkerFuelType = reader.ReadText(lnType);
// dont save empty element
if (bkrd.IsNew && !bkrd.BunkerFuelQuantity_TNE.HasValue && bkrd.BunkerFuelType.IsNullOrEmpty())
- bkrdMessage.Elements.Remove(bkrd);
+ bkrdMessage.Elements.Remove(bkrd);
}
+ return true;
}
#endregion
@@ -2194,9 +1919,8 @@ namespace ENI2.Import
#region LADG
- private static void ScanLADG(List messages, MessageCore messageCore, ExcelReader reader)
- {
- Message ladgMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.LADG);
+ private static bool ScanLADG(Message ladgMessage, MessageCore messageCore, ExcelReader reader)
+ {
ladgMessage.DeleteElements();
for (int i = 0; i < ladgMessage.NumberOfExcelRows; i++)
@@ -2229,11 +1953,7 @@ namespace ENI2.Import
ladg.CargoCodeNST = reader.ReadText(lnType);
// Cargo Type Freitext in DK
-
- if(reader.Mode == ExcelReader.CountryMode.DK)
- {
- reader.Conf.ConfirmText(lnType, ladg.CargoCodeNST, ladg.CargoCodeNST.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
- }
+
if (reader.Mode == ExcelReader.CountryMode.DE)
{
if (ladg.CargoCodeNST?.Length == 1)
@@ -2242,26 +1962,19 @@ namespace ENI2.Import
if ((ladg.CargoCodeNST != null) && (ladg.CargoCodeNST.Length != 2))
{
ladg.CargoCodeNST = null; // stupid validation
- reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.WARN);
}
else
{
if(Int32.TryParse(ladg.CargoCodeNST, out int ccnst))
{
- if ((ccnst > 0) && (ccnst < 21))
- {
- reader.Conf.ConfirmText(lnType, ladg.CargoCodeNST, ExcelReader.ReadState.OK);
- }
- else
- {
- reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.WARN);
+ if ((ccnst <= 0) && (ccnst > 20))
+ {
ladg.CargoCodeNST = null;
}
}
else
{
- ladg.CargoCodeNST = null;
- reader.Conf.ConfirmText(lnType, null, ExcelReader.ReadState.FAIL);
+ ladg.CargoCodeNST = null;
}
}
}
@@ -2271,20 +1984,9 @@ namespace ENI2.Import
ladg.CargoCodeNST_3 = reader.ReadText(lnZusatz);
if (!ladg.CargoCodeNST_3.IsNullOrEmpty())
{
- if (ladg.CargoCodeNST_3.Length == 1)
- {
- reader.Conf.ConfirmText(lnZusatz, ladg.CargoCodeNST_3, ExcelReader.ReadState.OK);
- }
- else
- {
- if(ladg.CargoCodeNST_3.Length > 8)
- {
- ladg.CargoCodeNST_3 = ladg.CargoCodeNST_3.Substring(0, 8);
- reader.Conf.ConfirmText(lnZusatz, ladg.CargoCodeNST_3, ExcelReader.ReadState.FAIL);
- } else
- {
- reader.Conf.ConfirmText(lnZusatz, ladg.CargoCodeNST_3, ExcelReader.ReadState.WARN);
- }
+ if (ladg.CargoCodeNST_3.Length > 8)
+ {
+ ladg.CargoCodeNST_3 = ladg.CargoCodeNST_3.Substring(0, 8);
}
}
@@ -2297,15 +1999,15 @@ namespace ENI2.Import
if (ladg.IsNew && !ladg.CargoHandlingType.HasValue)
ladgMessage.Elements.Remove(ladg);
}
+ return true;
}
#endregion
#region CREW
- private static void ScanCREW(List messages, MessageCore messageCore, ExcelReader reader)
+ private static bool ScanCREW(Message crewMessage, MessageCore messageCore, ExcelReader reader)
{
- Message crewMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.CREW);
crewMessage.DeleteElements();
for (int i = 0; i < crewMessage.NumberOfExcelRows; i++)
@@ -2334,33 +2036,28 @@ namespace ENI2.Import
crewMessage.Elements.Add(crew);
}
- crew.CrewMemberLastName = lastName;
- reader.Conf.ConfirmText(crewLastName, lastName, crew.CrewMemberLastName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- crew.CrewMemberFirstName = firstName;
- reader.Conf.ConfirmText(crewFirstName, crew.CrewMemberFirstName, crew.CrewMemberFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ crew.CrewMemberLastName = lastName;
+ crew.CrewMemberFirstName = firstName;
crew.CrewMemberGender = reader.ReadGender(crewGender);
- crew.CrewMemberDuty = reader.ReadText(crewDuty);
- reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
-
- crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
- crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
- reader.Conf.ConfirmText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth, crew.CrewMemberPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
-
- crew.CrewMemberDateOfBirth = reader.ReadBirthDate(crewDateOfBirth);
-
+ crew.CrewMemberDuty = reader.ReadText(crewDuty);
+ crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
+ crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
+ crew.CrewMemberDateOfBirth = reader.ReadBirthDate(crewDateOfBirth);
crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType);
- crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId);
- reader.Conf.ConfirmText(crewIdentDocId, crew.CrewMemberIdentityDocumentId, crew.CrewMemberIdentityDocumentId.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
-
- crew.CrewMemberVisaNumber = reader.ReadText(crewVisaNo);
- reader.Conf.ConfirmText(crewVisaNo, crew.CrewMemberVisaNumber, crew.CrewMemberVisaNumber.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
-
+ crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId);
+ crew.CrewMemberVisaNumber = reader.ReadText(crewVisaNo);
}
}
+ return true;
+ }
+
+ private static bool ScanCREWD(Message crewdMessage, MessageCore messageCore, ExcelReader reader)
+ {
+ crewdMessage.DeleteElements();
// CREW DEPARTURE
- crewMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.CREWD);
- for (int i = 0; i < crewMessage.NumberOfExcelRows; i++)
+
+ for (int i = 0; i < crewdMessage.NumberOfExcelRows; i++)
{
string crewLastName = string.Format("CREWD.CrewMemberLastName_{0}", i + 1);
string crewFirstName = string.Format("CREWD.CrewMemberFirstName_{0}", i + 1);
@@ -2376,38 +2073,29 @@ namespace ENI2.Import
string lastName = reader.ReadText(crewLastName);
if (!lastName.IsNullOrEmpty())
{
- if (!(crewMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREWD crew))
+ if (!(crewdMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREWD crew))
{
crew = new CREWD();
crew.Identifier = (i + 1).ToString();
- crew.MessageHeader = crewMessage;
- crewMessage.Elements.Add(crew);
+ crew.MessageHeader = crewdMessage;
+ crewdMessage.Elements.Add(crew);
}
crew.IsDeparture = true;
- crew.CrewMemberLastName = lastName;
- reader.Conf.ConfirmText(crewLastName, lastName, lastName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
- crew.CrewMemberFirstName = reader.ReadText(crewFirstName);
- reader.Conf.ConfirmText(crewFirstName, crew.CrewMemberFirstName, crew.CrewMemberFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
+ crew.CrewMemberLastName = lastName;
+ crew.CrewMemberFirstName = reader.ReadText(crewFirstName);
crew.CrewMemberGender = reader.ReadGender(crewGender);
- crew.CrewMemberDuty = reader.ReadText(crewDuty);
- reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
-
+ crew.CrewMemberDuty = reader.ReadText(crewDuty);
crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
- crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
- reader.Conf.ConfirmText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth, crew.CrewMemberPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
-
+ crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
crew.CrewMemberDateOfBirth = reader.ReadBirthDate(crewDateOfBirth);
-
crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType);
- crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId);
- reader.Conf.ConfirmText(crewIdentDocId, crew.CrewMemberIdentityDocumentId, crew.CrewMemberIdentityDocumentId.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
-
- crew.CrewMemberVisaNumber = reader.ReadText(crewVisaNo);
- reader.Conf.ConfirmText(crewVisaNo, crew.CrewMemberVisaNumber, crew.CrewMemberVisaNumber.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
+ crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId);
+ crew.CrewMemberVisaNumber = reader.ReadText(crewVisaNo);
}
}
+ return true;
}
#endregion