diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj
index a501638d..e2d058ce 100644
--- a/ENI2/ENI2.csproj
+++ b/ENI2/ENI2.csproj
@@ -36,7 +36,7 @@
5.4.0.0
true
publish.html
- 11
+ 12
7.5.0.%2a
false
true
diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs
index 22f06626..13647208 100644
--- a/ENI2/Excel/ExcelUtil.cs
+++ b/ENI2/Excel/ExcelUtil.cs
@@ -2072,7 +2072,8 @@ namespace ENI2.Excel
{
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 18));
- if (lastName.IsNullOrEmpty()) break;
+ string firstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 18));
+ if (lastName.IsNullOrEmpty() && firstName.IsNullOrEmpty()) break;
if (!(crewMessage.GetSublistElementWithIdentifier((i + 1).ToString()) is CREW crew))
{
@@ -2085,7 +2086,7 @@ namespace ENI2.Excel
crew.NotificationSchengen = notificationSchengen;
crew.NotificationPAX = notificationPax;
crew.CrewMemberLastName = lastName;
- crew.CrewMemberFirstName = reader.ReadCellAsText(sheetTitle, string.Format("D{0}", i + 18));
+ crew.CrewMemberFirstName = firstName;
crew.CrewMemberGender = ReadGender(reader.ReadCellAsText(sheetTitle, string.Format("E{0}", i + 18)), out bool canceled);
if (canceled) return true;
@@ -2193,10 +2194,10 @@ namespace ENI2.Excel
{
string lastName = reader.ReadCellAsText(sheetTitle, string.Format("C{0}", i + 17));
- if (lastName.IsNullOrEmpty()) break; // finish after reading last row
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;
@@ -2482,7 +2483,7 @@ namespace ENI2.Excel
}
}
}
- else
+ if(!result.HasValue)
{
result = 0; // not known
}
@@ -2518,8 +2519,8 @@ namespace ENI2.Excel
{
if (!fid.SelectedValue.IsNullOrEmpty())
{
- _genderImportDict[documentType] = fid.SelectedValue;
- result = byte.Parse(_genderImportDict[documentType]);
+ _documentTypeImportDict[documentType] = fid.SelectedValue;
+ result = byte.Parse(_documentTypeImportDict[documentType]);
}
}
else
@@ -2542,9 +2543,9 @@ namespace ENI2.Excel
{
result = "XX";
}
- else if(CREW.NationalityDict.ContainsKey(nationality))
+ else if(CREW.NationalityDict.ContainsKey(nationality.ToUpper()))
{
- result = nationality;
+ result = nationality.ToUpper();
}
else if(CREW.NationalityDict.ContainsKey(nationality.ToUpper()))
{
diff --git a/bsmd.database/CREW.cs b/bsmd.database/CREW.cs
index e937251f..fd25a834 100644
--- a/bsmd.database/CREW.cs
+++ b/bsmd.database/CREW.cs
@@ -356,7 +356,17 @@ namespace bsmd.database
row[14] = crew.CrewMemberIdentityDocumentExpiryDate ?? (object)DBNull.Value;
row[15] = crew.NotificationSchengen ?? (object)DBNull.Value;
row[16] = crew.NotificationPAX ?? (object)DBNull.Value;
- row[17] = crew.CrewMemberCountryOfBirth?.Substring(0,2) ?? (object)DBNull.Value;
+ if (crew.CrewMemberCountryOfBirth == null)
+ {
+ row[17] = DBNull.Value;
+ }
+ else
+ {
+ if (crew.CrewMemberCountryOfBirth.Length > 2)
+ row[17] = crew.CrewMemberCountryOfBirth.Substring(0, 2);
+ else
+ row[17] = crew.CrewMemberCountryOfBirth;
+ }
row[18] = crew.Effects ?? (object)DBNull.Value;
result.Rows.Add(row);
}