Korrekturen lt Rückmeldung
This commit is contained in:
parent
a0bcbe4ccf
commit
5118ed8aaf
@ -7,27 +7,25 @@
|
||||
//
|
||||
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||
|
||||
using log4net;
|
||||
using bsmd.database;
|
||||
using ENI2.Locode;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using ENI2.Locode;
|
||||
using bsmd.database;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ENI2.Excel
|
||||
{
|
||||
internal class ExcelReader : ExcelBase
|
||||
{
|
||||
internal enum ReadState
|
||||
{ NONE, OK, WARN, FAIL };
|
||||
|
||||
internal enum ReadState { NONE, OK, WARN, FAIL };
|
||||
|
||||
internal enum SheetTypeEnum { BSMD, DAKOSY };
|
||||
internal enum SheetTypeEnum
|
||||
{ BSMD, DAKOSY };
|
||||
|
||||
private readonly SheetTypeEnum _sheetType = SheetTypeEnum.BSMD;
|
||||
|
||||
@ -44,7 +42,8 @@ namespace ENI2.Excel
|
||||
_sheetType = (_nameDict.Count > 10) ? SheetTypeEnum.BSMD : SheetTypeEnum.DAKOSY;
|
||||
}
|
||||
|
||||
public SheetTypeEnum SheetType { get { return _sheetType; } }
|
||||
public SheetTypeEnum SheetType
|
||||
{ get { return _sheetType; } }
|
||||
|
||||
internal static void SaveMessage(Message message)
|
||||
{
|
||||
@ -154,7 +153,8 @@ namespace ENI2.Excel
|
||||
string val = this.ReadText(lookup);
|
||||
if (val != null)
|
||||
{
|
||||
if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase)) {
|
||||
if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
else if (val.Equals("f", StringComparison.CurrentCultureIgnoreCase) || val.Equals("female", StringComparison.CurrentCultureIgnoreCase))
|
||||
@ -535,7 +535,8 @@ namespace ENI2.Excel
|
||||
}
|
||||
}
|
||||
|
||||
if (val is string) {
|
||||
if (val is string)
|
||||
{
|
||||
if (((string)val).EndsWith("lt", StringComparison.OrdinalIgnoreCase))
|
||||
val = ((string)val).Substring(0, ((string)val).Length - 2).Trim();
|
||||
else
|
||||
@ -599,6 +600,19 @@ namespace ENI2.Excel
|
||||
|
||||
#region Dakosy-specific functions
|
||||
|
||||
internal bool HasWorksheetNamed(string sheetName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Worksheet theWorkSheet = _workBook.Worksheets[sheetName];
|
||||
return theWorkSheet != null;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal string ReadCellAsText(string sheetName, string range)
|
||||
{
|
||||
try
|
||||
@ -642,7 +656,6 @@ namespace ENI2.Excel
|
||||
Range aRange = workSheet.Range[range];
|
||||
if (aRange != null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -718,7 +731,6 @@ namespace ENI2.Excel
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion Dakosy-specific functions
|
||||
}
|
||||
}
|
||||
@ -7,14 +7,14 @@
|
||||
//
|
||||
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
|
||||
|
||||
using bsmd.database;
|
||||
using ENI2.EditControls;
|
||||
using ENI2.Locode;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using bsmd.database;
|
||||
using ENI2.Locode;
|
||||
using ENI2.EditControls;
|
||||
|
||||
namespace ENI2.Excel
|
||||
{
|
||||
@ -67,7 +67,6 @@ namespace ENI2.Excel
|
||||
// parse selected classes
|
||||
try
|
||||
{
|
||||
|
||||
foreach (Message message in messages)
|
||||
{
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.AGNT) && notificationClasses.Contains(Message.NotificationClass.AGNT))
|
||||
@ -130,7 +129,6 @@ namespace ENI2.Excel
|
||||
{ if (ScanWAS(message, reader, isOldVersion)) ExcelReader.SaveMessage(message); continue; }
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.WAS_RCPT) && notificationClasses.Contains(Message.NotificationClass.WAS_RCPT))
|
||||
{ if (ScanWAS_RCPT(message, reader)) ExcelReader.SaveMessage(message); continue; }
|
||||
|
||||
}
|
||||
|
||||
DBManager.Instance.Save(messageCore); // muss das eigentlich sein?
|
||||
@ -144,7 +142,7 @@ namespace ENI2.Excel
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion Process Sheet (normal BSMD sheet import)
|
||||
|
||||
#region ATA
|
||||
|
||||
@ -167,7 +165,7 @@ namespace ENI2.Excel
|
||||
return !(!ata.ATAPortOfCall.HasValue && ataMessage.IsNew);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion ATA
|
||||
|
||||
#region ATD
|
||||
|
||||
@ -190,7 +188,7 @@ namespace ENI2.Excel
|
||||
return !(!atd.ATDPortOfCall.HasValue && atdMessage.IsNew);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion ATD
|
||||
|
||||
#region TIEFA
|
||||
|
||||
@ -211,7 +209,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion TIEFA
|
||||
|
||||
#region TIEFD
|
||||
|
||||
@ -232,7 +230,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion TIEFD
|
||||
|
||||
#region NAME
|
||||
|
||||
@ -251,7 +249,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion NAME
|
||||
|
||||
#region BPOL
|
||||
|
||||
@ -313,7 +311,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion BPOL
|
||||
|
||||
#region POBA
|
||||
|
||||
@ -337,7 +335,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion POBA
|
||||
|
||||
#region POBD
|
||||
|
||||
@ -361,13 +359,12 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion POBD
|
||||
|
||||
#region HAZA
|
||||
|
||||
private static bool ScanHAZA(Message hazaMessage, ExcelReader reader, bool isOldVersion)
|
||||
{
|
||||
|
||||
if (hazaMessage.Elements.Count == 0)
|
||||
{
|
||||
HAZ newHaza = new HAZ();
|
||||
@ -449,7 +446,7 @@ namespace ENI2.Excel
|
||||
imdgPosition.Remarks = reader.ReadText(imdg_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IMDG
|
||||
|
||||
#region IBC
|
||||
|
||||
@ -514,7 +511,7 @@ namespace ENI2.Excel
|
||||
ibcPosition.Remarks = reader.ReadText(ibc_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IBC
|
||||
|
||||
#region IGC
|
||||
|
||||
@ -552,7 +549,7 @@ namespace ENI2.Excel
|
||||
igcPosition.Remarks = reader.ReadText(igc_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IGC
|
||||
|
||||
#region IMSBC
|
||||
|
||||
@ -594,7 +591,7 @@ namespace ENI2.Excel
|
||||
imsbcPosition.Remarks = reader.ReadText(imsbc_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IMSBC
|
||||
|
||||
#region MARPOL
|
||||
|
||||
@ -643,7 +640,7 @@ namespace ENI2.Excel
|
||||
marpolPosition.Remarks = reader.ReadText(marpol_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion MARPOL
|
||||
|
||||
if (haza.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
||||
{
|
||||
@ -653,7 +650,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion HAZA
|
||||
|
||||
#region HAZD
|
||||
|
||||
@ -737,7 +734,7 @@ namespace ENI2.Excel
|
||||
imdgPosition.Remarks = reader.ReadText(imdg_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IMDG
|
||||
|
||||
#region IBC
|
||||
|
||||
@ -800,7 +797,7 @@ namespace ENI2.Excel
|
||||
ibcPosition.Remarks = reader.ReadText(ibc_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IBC
|
||||
|
||||
#region IGC
|
||||
|
||||
@ -838,7 +835,7 @@ namespace ENI2.Excel
|
||||
igcPosition.Remarks = reader.ReadText(igc_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IGC
|
||||
|
||||
#region IMSBC
|
||||
|
||||
@ -880,7 +877,7 @@ namespace ENI2.Excel
|
||||
imsbcPosition.Remarks = reader.ReadText(imsbc_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion IMSBC
|
||||
|
||||
#region MARPOL
|
||||
|
||||
@ -909,7 +906,8 @@ namespace ENI2.Excel
|
||||
|
||||
marpolPosition.Name = name;
|
||||
marpolPosition.Flashpoint_CEL = reader.ReadText(marpol_flash);
|
||||
if (marpolPosition.Flashpoint_CEL.IsNullOrEmpty()) {
|
||||
if (marpolPosition.Flashpoint_CEL.IsNullOrEmpty())
|
||||
{
|
||||
marpolPosition.FlashpointInformation = 0;
|
||||
} // NF // Ableitung Flashpoint-Info: Christin, 22.3.2017
|
||||
else
|
||||
@ -928,7 +926,7 @@ namespace ENI2.Excel
|
||||
marpolPosition.Remarks = reader.ReadText(marpol_remarks);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion MARPOL
|
||||
|
||||
if (hazd.HasPositions) // Christin 22.3.17: Felder bei Positionen immer fest ausfüllen
|
||||
{
|
||||
@ -938,7 +936,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion HAZD
|
||||
|
||||
#region INFO
|
||||
|
||||
@ -966,7 +964,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion INFO
|
||||
|
||||
#region STAT
|
||||
|
||||
@ -1007,7 +1005,8 @@ namespace ENI2.Excel
|
||||
if (stat.ISMCompanyId.StartsWith("imo", StringComparison.OrdinalIgnoreCase))
|
||||
stat.ISMCompanyId = stat.ISMCompanyId.Substring(3);
|
||||
|
||||
if(stat.ISMCompanyId.Length < 7) { // zero - fill
|
||||
if (stat.ISMCompanyId.Length < 7)
|
||||
{ // zero - fill
|
||||
while (stat.ISMCompanyId.Length < 7)
|
||||
stat.ISMCompanyId = "0" + stat.ISMCompanyId;
|
||||
}
|
||||
@ -1029,7 +1028,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion STAT
|
||||
|
||||
#region NOA_NOD
|
||||
|
||||
@ -1065,7 +1064,6 @@ namespace ENI2.Excel
|
||||
|
||||
if (!callPurposeCode.IsNullOrEmpty())
|
||||
{
|
||||
|
||||
if (!(noa_nod.GetSublistElementWithIdentifier(i.ToString()) is CallPurpose callPurpose))
|
||||
{
|
||||
callPurpose = new CallPurpose();
|
||||
@ -1120,7 +1118,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion NOA_NOD
|
||||
|
||||
#region AGNT
|
||||
|
||||
@ -1141,7 +1139,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion AGNT
|
||||
|
||||
#region WAS
|
||||
|
||||
@ -1267,7 +1265,8 @@ namespace ENI2.Excel
|
||||
was.AddMissingWaste();
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion WAS
|
||||
|
||||
#region WAS_RCPT
|
||||
|
||||
@ -1345,7 +1344,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion WAS_RCPT
|
||||
|
||||
#region MDH
|
||||
|
||||
@ -1370,7 +1369,6 @@ namespace ENI2.Excel
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
#region PoC last 30 days
|
||||
|
||||
// lt. Mail von Christin am 11.10.2016
|
||||
@ -1402,7 +1400,6 @@ namespace ENI2.Excel
|
||||
}
|
||||
else // "normal mode", aus den Zellen lesen
|
||||
{
|
||||
|
||||
// POC last 30 days
|
||||
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
|
||||
{
|
||||
@ -1460,7 +1457,7 @@ namespace ENI2.Excel
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion PoC last 30 days
|
||||
|
||||
#region SanitaryMeasures
|
||||
|
||||
@ -1490,7 +1487,7 @@ namespace ENI2.Excel
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion SanitaryMeasures
|
||||
|
||||
#region InfectedArea
|
||||
|
||||
@ -1517,7 +1514,7 @@ namespace ENI2.Excel
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion InfectedArea
|
||||
|
||||
#region StowawaysJoiningLocation
|
||||
|
||||
@ -1543,8 +1540,7 @@ namespace ENI2.Excel
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion StowawaysJoiningLocation
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -1556,7 +1552,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion MDH
|
||||
|
||||
#region SEC
|
||||
|
||||
@ -1668,7 +1664,6 @@ namespace ENI2.Excel
|
||||
// keinen "leeren" Hafen anlegen, wenn der Eintrag leer war (trifft anscheinend bei Neubauten zu, siehe E-Mail Christin vom 20./22.6.17
|
||||
if (l10fc.PortFacilityPortName.IsNullOrEmpty() && l10fc.PortFacilityPortLoCode.IsNullOrEmpty() && l10fc.PortFacilityPortCountry.IsNullOrEmpty())
|
||||
sec.LastTenPortFacilitesCalled.Remove(l10fc);
|
||||
|
||||
}
|
||||
|
||||
// Ship2ShipActivities
|
||||
@ -1717,7 +1712,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion SEC
|
||||
|
||||
#region BKRA
|
||||
|
||||
@ -1747,7 +1742,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion BKRA
|
||||
|
||||
#region BKRD
|
||||
|
||||
@ -1776,7 +1771,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion BKRD
|
||||
|
||||
#region TOWA
|
||||
|
||||
@ -1834,13 +1829,12 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion TOWA
|
||||
|
||||
#region TOWD
|
||||
|
||||
private static bool ScanTOWD(Message towdMessage, ExcelReader reader)
|
||||
{
|
||||
|
||||
// 24.4.21: TOWD beim Excel import
|
||||
bool hasTOWDMarker = false;
|
||||
for (int i = 1; i <= towdMessage.NumberOfExcelRows; i++)
|
||||
@ -1892,7 +1886,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion TOWD
|
||||
|
||||
#region PRE72H
|
||||
|
||||
@ -1914,7 +1908,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion PRE72H
|
||||
|
||||
#region SERV
|
||||
|
||||
@ -1935,7 +1929,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion SERV
|
||||
|
||||
#region STO
|
||||
|
||||
@ -1973,7 +1967,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion STO
|
||||
|
||||
#region LADG
|
||||
|
||||
@ -2060,23 +2054,24 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion LADG
|
||||
|
||||
#region CREW
|
||||
|
||||
private static bool ScanCREW(Message crewMessage, ExcelReader reader, bool isOldVersion)
|
||||
{
|
||||
crewMessage.DeleteElements();
|
||||
|
||||
string sheetTitle = "6. CREW - Arrival";
|
||||
// 6. CREW - Arrival
|
||||
// 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? notificationPax = reader.ReadBoolean("CREW.NotificationPAX");
|
||||
|
||||
for (int i = 0; i < 5000; i++)
|
||||
{
|
||||
|
||||
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 18));
|
||||
string firstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 18));
|
||||
if (lastName.IsNullOrEmpty() && firstName.IsNullOrEmpty()) break;
|
||||
@ -2124,6 +2119,52 @@ namespace ENI2.Excel
|
||||
|
||||
Util.UIHelper.SetBusyState(); // dialog might reset busy state
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sheetTitle = "5. CREW - Arrival"; // altes Anmeldeformat
|
||||
if (reader.HasWorksheetNamed(sheetTitle))
|
||||
{
|
||||
for (int i = 0; i < 5000; i++)
|
||||
{
|
||||
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 13));
|
||||
string firstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 13));
|
||||
if (lastName.IsNullOrEmpty() && firstName.IsNullOrEmpty()) break;
|
||||
|
||||
if (!(crewMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREW crew))
|
||||
{
|
||||
crew = new CREW();
|
||||
crew.Identifier = (i + 1).ToString();
|
||||
crew.MessageHeader = crewMessage;
|
||||
crewMessage.Elements.Add(crew);
|
||||
}
|
||||
|
||||
crew.CrewMemberLastName = lastName;
|
||||
crew.CrewMemberFirstName = firstName;
|
||||
|
||||
crew.CrewMemberGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 13)), out bool canceled);
|
||||
if (canceled) return true;
|
||||
|
||||
crew.CrewMemberDuty = reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 13));
|
||||
crew.CrewMemberNationality = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("F{0}", i + 13)), out canceled);
|
||||
if (canceled) return true;
|
||||
crew.CrewMemberPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 13));
|
||||
crew.CrewMemberDateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("I{0}", i + 13));
|
||||
|
||||
crew.CrewMemberIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 13)), out canceled);
|
||||
if (canceled) return true;
|
||||
|
||||
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 13));
|
||||
crew.CrewMemberVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("L{0}", i + 13));
|
||||
|
||||
Util.UIHelper.SetBusyState(); // dialog might reset busy state
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; // nothing found
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2133,13 +2174,13 @@ namespace ENI2.Excel
|
||||
crewdMessage.DeleteElements();
|
||||
string sheetTitle = "7. CREW - Departure";
|
||||
// CREW DEPARTURE
|
||||
|
||||
if (reader.HasWorksheetNamed(sheetTitle))
|
||||
{
|
||||
bool? notificationSchengen = reader.ReadBoolean("CREWD.NotificationSchengen");
|
||||
bool? notificationPax = reader.ReadBoolean("CREWD.NotificationPAX");
|
||||
|
||||
for (int i = 0; i < 5000; i++)
|
||||
{
|
||||
|
||||
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 18));
|
||||
if (lastName.IsNullOrEmpty()) break;
|
||||
|
||||
@ -2182,31 +2223,74 @@ namespace ENI2.Excel
|
||||
|
||||
crewd.Effects = reader.ReadCellAsText("2. PORT", string.Format("C{0}", i + 142));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sheetTitle = "6. CREW - Departure"; // altes Anmeldeformat
|
||||
if (reader.HasWorksheetNamed(sheetTitle))
|
||||
{
|
||||
for (int i = 0; i < 5000; i++)
|
||||
{
|
||||
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 13));
|
||||
if (lastName.IsNullOrEmpty()) break;
|
||||
|
||||
if (!(crewdMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREWD crewd))
|
||||
{
|
||||
crewd = new CREWD();
|
||||
crewd.Identifier = (i + 1).ToString();
|
||||
crewd.MessageHeader = crewdMessage;
|
||||
crewdMessage.Elements.Add(crewd);
|
||||
}
|
||||
|
||||
crewd.CrewMemberLastName = lastName;
|
||||
crewd.CrewMemberFirstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 13));
|
||||
|
||||
crewd.CrewMemberGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 13)), 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);
|
||||
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.CrewMemberIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 13)), out canceled);
|
||||
if (canceled) return true;
|
||||
|
||||
crewd.CrewMemberIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 13));
|
||||
crewd.CrewMemberVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("L{0}", i + 13));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false; // nothing found
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion CREW
|
||||
|
||||
#region PAS
|
||||
|
||||
private static bool ScanPAS(Message pasMessage, ExcelReader reader, bool isOldVersion)
|
||||
{
|
||||
|
||||
List<PAS> newPasList = new List<PAS>();
|
||||
|
||||
string sheetTitle = "8. PAX - Arrival";
|
||||
|
||||
if (reader.HasWorksheetNamed(sheetTitle))
|
||||
{
|
||||
bool? notificationSchengen = reader.ReadBoolean("PAS.NotificationSchengen");
|
||||
bool? notificationPax = reader.ReadBoolean("PAS.NotificationPAX");
|
||||
|
||||
for (int i = 0; i < 5000; i++)
|
||||
{
|
||||
|
||||
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 17));
|
||||
string firstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 17));
|
||||
if (lastName.IsNullOrEmpty() && firstName.IsNullOrEmpty()) break; // finish after reading last row
|
||||
|
||||
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("L{0}", i + 17));
|
||||
PAS pas = new PAS();
|
||||
pas.Identifier = (i + 1).ToString();
|
||||
pas.MessageHeader = pasMessage;
|
||||
@ -2235,6 +2319,7 @@ namespace ENI2.Excel
|
||||
pas.PassengerPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 17));
|
||||
pas.PassengerCountryOfBirth = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("K{0}", i + 17)), out canceled);
|
||||
if (canceled) return true;
|
||||
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("L{0}", i + 17));
|
||||
pas.PassengerDateOfBirth = dateOfBirth;
|
||||
|
||||
pas.PassengerIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("M{0}", i + 17)), out canceled);
|
||||
@ -2250,8 +2335,57 @@ namespace ENI2.Excel
|
||||
pas.EmergencyContactNumber = reader.ReadCellAsText(sheetTitle, string.Format("S{0}", i + 17));
|
||||
|
||||
Util.UIHelper.SetBusyState(); // dialog might reset busy state
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sheetTitle = "7. PAX - Arrival"; // altes Excel Format
|
||||
if (reader.HasWorksheetNamed(sheetTitle))
|
||||
{
|
||||
for (int i = 0; i < 5000; i++)
|
||||
{
|
||||
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 13));
|
||||
string firstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 13));
|
||||
if (lastName.IsNullOrEmpty() && firstName.IsNullOrEmpty()) break; // finish after reading last row
|
||||
|
||||
PAS pas = new PAS();
|
||||
pas.Identifier = (i + 1).ToString();
|
||||
pas.MessageHeader = pasMessage;
|
||||
newPasList.Add(pas);
|
||||
|
||||
pas.PassengerLastName = lastName;
|
||||
pas.PassengerFirstName = firstName;
|
||||
|
||||
pas.PassengerNationality = ReadNationality(reader.ReadCellAsText(sheetTitle, string.Format("F{0}", i + 13)), out bool canceled);
|
||||
if (canceled) return true;
|
||||
|
||||
pas.PassengerGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 13)), out canceled);
|
||||
if (canceled) return true;
|
||||
pas.PassengerPortOfEmbarkation = ReadLocode(reader.ReadCellAsText(sheetTitle, string.Format("G{0}", i + 13)), out canceled);
|
||||
if (canceled) return true;
|
||||
pas.PassengerPortOfDisembarkation = ReadLocode(reader.ReadCellAsText(sheetTitle, string.Format("H{0}", i + 13)), out canceled);
|
||||
if (canceled) return true;
|
||||
|
||||
pas.PassengerInTransit = reader.ReadCellAsBool(sheetTitle, string.Format("I{0}", i + 13));
|
||||
pas.PassengerPlaceOfBirth = reader.ReadCellAsText(sheetTitle, string.Format("J{0}", i + 13));
|
||||
|
||||
DateTime? dateOfBirth = reader.ReadCellAsDateTime(sheetTitle, string.Format("K{0}", i + 13));
|
||||
pas.PassengerDateOfBirth = dateOfBirth;
|
||||
|
||||
pas.PassengerIdentityDocumentType = ReadDocumentType(reader.ReadCellAsText(sheetTitle, string.Format("L{0}", i + 13)), out canceled);
|
||||
if (canceled) return true;
|
||||
pas.PassengerIdentityDocumentId = reader.ReadCellAsText(sheetTitle, string.Format("M{0}", i + 13));
|
||||
pas.PassengerVisaNumber = reader.ReadCellAsText(sheetTitle, string.Format("N{0}", i + 13));
|
||||
|
||||
Util.UIHelper.SetBusyState(); // dialog might reset busy state
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DBManager.Instance.DeleteAllPASForMessage(pasMessage.Id);
|
||||
pasMessage.Elements.Clear();
|
||||
@ -2261,7 +2395,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion PAS
|
||||
|
||||
#region PASD
|
||||
|
||||
@ -2332,7 +2466,7 @@ namespace ENI2.Excel
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion PASD
|
||||
|
||||
#region ScanMessage (generic)
|
||||
|
||||
@ -2394,7 +2528,8 @@ namespace ENI2.Excel
|
||||
{
|
||||
bool? sheetValue = reader.ReadBoolean(lookupNameAttribute.LookupName);
|
||||
string boolStringValue = reader.ReadText(lookupNameAttribute.LookupName);
|
||||
if (sheetValue.HasValue) {
|
||||
if (sheetValue.HasValue)
|
||||
{
|
||||
property.SetValue(dbEntity, sheetValue);
|
||||
}
|
||||
}
|
||||
@ -2402,12 +2537,10 @@ namespace ENI2.Excel
|
||||
{
|
||||
_log.DebugFormat("unhandled property type: {0}", property.PropertyType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion ScanMessage (generic)
|
||||
|
||||
#region LookupMessageCore
|
||||
|
||||
@ -2435,7 +2568,9 @@ namespace ENI2.Excel
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion LookupMessageCore
|
||||
|
||||
|
||||
|
||||
#region GetMessageWithType
|
||||
|
||||
@ -2456,7 +2591,7 @@ namespace ENI2.Excel
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion GetMessageWithType
|
||||
|
||||
#region "Semi-Manual" import functions (may open interactive dialog)
|
||||
|
||||
@ -2653,6 +2788,6 @@ namespace ENI2.Excel
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion "Semi-Manual" import functions (may open interactive dialog)
|
||||
}
|
||||
}
|
||||
@ -212,6 +212,7 @@ namespace ENI2
|
||||
{
|
||||
if(drc.HasCriticalInfoMissing(out string missingClass))
|
||||
{
|
||||
_log.WarnFormat("set close warning because at least {0} is missing from BRE/BRV arrival", missingClass);
|
||||
if (MessageBox.Show(string.Format(Properties.Resources.textSpecialCaseBREBRV, missingClass), Properties.Resources.textConfirmation, MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||
e.Cancel = true;
|
||||
|
||||
2
ENI2/Properties/Resources.Designer.cs
generated
2
ENI2/Properties/Resources.Designer.cs
generated
@ -4552,7 +4552,7 @@ namespace ENI2.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to One or more important classes haven't been sent for DEBRE/DEBRV: {0} Close anyway?.
|
||||
/// Looks up a localized string similar to At least one of NOA_NOD, AGNT, INFO, SEC, TIEFA hasn't been sent for DEBRE/DEBRV: ({0}) Close anyway?.
|
||||
/// </summary>
|
||||
public static string textSpecialCaseBREBRV {
|
||||
get {
|
||||
|
||||
@ -1859,6 +1859,6 @@
|
||||
<value>Search NST2007 list</value>
|
||||
</data>
|
||||
<data name="textSpecialCaseBREBRV" xml:space="preserve">
|
||||
<value>One or more important classes haven't been sent for DEBRE/DEBRV: {0} Close anyway?</value>
|
||||
<value>At least one of NOA_NOD, AGNT, INFO, SEC, TIEFA hasn't been sent for DEBRE/DEBRV: ({0}) Close anyway?</value>
|
||||
</data>
|
||||
</root>
|
||||
Loading…
Reference in New Issue
Block a user