diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj
index 9ecc5387..ce64ebd0 100644
--- a/ENI2/ENI2.csproj
+++ b/ENI2/ENI2.csproj
@@ -237,6 +237,9 @@
EditWasteReceivedDialog.xaml
+
+ FixImportDialog.xaml
+
@@ -644,6 +647,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/ENI2/EditControls/EditCREWDialog.xaml b/ENI2/EditControls/EditCREWDialog.xaml
index f15804ff..ac19e4e7 100644
--- a/ENI2/EditControls/EditCREWDialog.xaml
+++ b/ENI2/EditControls/EditCREWDialog.xaml
@@ -43,7 +43,7 @@
-
+
diff --git a/ENI2/EditControls/EditCREWDialog.xaml.cs b/ENI2/EditControls/EditCREWDialog.xaml.cs
index 91b20c30..2078b5d4 100644
--- a/ENI2/EditControls/EditCREWDialog.xaml.cs
+++ b/ENI2/EditControls/EditCREWDialog.xaml.cs
@@ -30,7 +30,7 @@ namespace ENI2.EditControls
this.textBoxDuty.Text = this.CREW.CrewMemberDuty;
this.textBoxLastName.Text = this.CREW.CrewMemberLastName;
this.textBoxFirstName.Text = this.CREW.CrewMemberFirstName;
- this.comboBoxGender.ItemsSource = GlobalStructures.GenderList;
+ this.comboBoxGender.ItemsSource = GlobalStructures.GenderDict;
//this.comboBoxGender.KeyUp += ComboBox_KeyUp;
this.comboBoxGender.SelectedIndex = this.CREW.CrewMemberGender ?? -1;
if (this.CREW.CrewMemberGender == 9)
@@ -62,8 +62,7 @@ namespace ENI2.EditControls
this.CREW.CrewMemberDuty = this.textBoxDuty.Text.Trim();
this.CREW.CrewMemberLastName = this.textBoxLastName.Text.Trim();
this.CREW.CrewMemberFirstName = this.textBoxFirstName.Text.Trim();
- this.CREW.CrewMemberGender = (this.comboBoxGender.SelectedIndex == -1) ? null : (byte?) this.comboBoxGender.SelectedIndex;
- if (this.CREW.CrewMemberGender == 3) this.CREW.CrewMemberGender = 9;
+ this.CREW.CrewMemberGender = (this.comboBoxGender.SelectedIndex == -1) ? null : (byte?) this.comboBoxGender.SelectedValue;
this.CREW.CrewMemberPlaceOfBirth = this.textBoxPlaceOfBirth.Text.Trim();
this.CREW.CrewMemberNationality = (this.comboBoxNationality.SelectedValue == null) ? "" : (string)this.comboBoxNationality.SelectedValue;
this.CREW.CrewMemberDateOfBirth = this.datePickerDateOfBirth.SelectedDate;
diff --git a/ENI2/EditControls/EditPasDialog.xaml b/ENI2/EditControls/EditPasDialog.xaml
index 8bc3731c..8d924fcf 100644
--- a/ENI2/EditControls/EditPasDialog.xaml
+++ b/ENI2/EditControls/EditPasDialog.xaml
@@ -47,7 +47,7 @@
-
+
diff --git a/ENI2/EditControls/EditPasDialog.xaml.cs b/ENI2/EditControls/EditPasDialog.xaml.cs
index f4587979..f26e51bb 100644
--- a/ENI2/EditControls/EditPasDialog.xaml.cs
+++ b/ENI2/EditControls/EditPasDialog.xaml.cs
@@ -29,7 +29,7 @@ namespace ENI2.EditControls
// copy into fields
this.textBoxLastName.Text = this.PAS.PassengerLastName;
this.textBoxFirstName.Text = this.PAS.PassengerFirstName;
- this.comboBoxGender.ItemsSource = GlobalStructures.GenderList;
+ this.comboBoxGender.ItemsSource = GlobalStructures.GenderDict;
//this.comboBoxGender.KeyUp += ComboBox_KeyUp;
this.comboBoxGender.SelectedIndex = this.PAS.PassengerGender ?? -1;
if (this.PAS.PassengerGender == 9)
@@ -66,9 +66,7 @@ namespace ENI2.EditControls
// copy back
this.PAS.PassengerLastName = this.textBoxLastName.Text.Trim();
this.PAS.PassengerFirstName = this.textBoxFirstName.Text.Trim();
- this.PAS.PassengerGender = (this.comboBoxGender.SelectedIndex == -1) ? null : (byte?)this.comboBoxGender.SelectedIndex;
- if (this.PAS.PassengerGender == 3)
- this.PAS.PassengerGender = 9;
+ this.PAS.PassengerGender = (this.comboBoxGender.SelectedIndex == -1) ? null : (byte?)this.comboBoxGender.SelectedValue;
this.PAS.PassengerPlaceOfBirth = this.textBoxPlaceOfBirth.Text.Trim();
this.PAS.PassengerNationality = (this.comboBoxNationality.SelectedValue == null) ? "" : (string)this.comboBoxNationality.SelectedValue;
this.PAS.PassengerDateOfBirth = this.datePickerDateOfBirth.SelectedDate;
diff --git a/ENI2/EditControls/FixImportDialog.xaml b/ENI2/EditControls/FixImportDialog.xaml
new file mode 100644
index 00000000..8804c161
--- /dev/null
+++ b/ENI2/EditControls/FixImportDialog.xaml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ bla
+ bla
+
+
+
+
+
diff --git a/ENI2/EditControls/FixImportDialog.xaml.cs b/ENI2/EditControls/FixImportDialog.xaml.cs
new file mode 100644
index 00000000..95e6a629
--- /dev/null
+++ b/ENI2/EditControls/FixImportDialog.xaml.cs
@@ -0,0 +1,57 @@
+// Copyright (c) 2017- schick Informatik
+// Description: Dialog to confirm values during excel import (e.g. CREW/PAS)
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+using ENI2.Controls;
+
+namespace ENI2.EditControls
+{
+ ///
+ /// Interaction logic for FixImportDialog.xaml
+ ///
+ public partial class FixImportDialog : EditWindowBase
+ {
+ public FixImportDialog()
+ {
+ InitializeComponent();
+ this.comboBoxValues.ItemsSource = this.SelectionValues;
+ }
+
+ public string SelectedValue
+ {
+ get
+ {
+ return this.comboBoxValues.SelectedValue as string;
+ }
+ }
+
+ public string Value
+ {
+ get { return this.textBlockValue.Text; }
+ set { this.textBlockValue.Text = value.Trim(); }
+ }
+
+ public string ValueType
+ {
+ get { return this.textBlockValue.Text; }
+ set { this.textBlockValue.Text = value; }
+ }
+
+ public Dictionary SelectionValues { get; set; }
+
+ }
+}
diff --git a/ENI2/Excel/ExcelComparer.cs b/ENI2/Excel/ExcelComparer.cs
index 1b1bbca3..1e9b6c0e 100644
--- a/ENI2/Excel/ExcelComparer.cs
+++ b/ENI2/Excel/ExcelComparer.cs
@@ -17,7 +17,7 @@ namespace ENI2.Excel
///
public static class ExcelComparer
{
- private static int diffColor = ColorTranslator.ToOle(Color.FromArgb(150, 150, 255)); // blue
+ private static readonly int diffColor = ColorTranslator.ToOle(Color.FromArgb(150, 150, 255)); // blue
private static bool GetSheetRange(Worksheet sheet, out int lastUsedRow, out int lastUsedColumn)
{
diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs
index 305039eb..640ddd90 100644
--- a/ENI2/Excel/ExcelUtil.cs
+++ b/ENI2/Excel/ExcelUtil.cs
@@ -14,6 +14,7 @@ using System.Reflection;
using log4net;
using bsmd.database;
using ENI2.Locode;
+using ENI2.EditControls;
namespace ENI2.Excel
{
@@ -21,6 +22,10 @@ namespace ENI2.Excel
{
private static readonly ILog _log = LogManager.GetLogger(typeof(ExcelUtil));
+ private static Dictionary _countryImportDict = new Dictionary();
+ private static Dictionary _genderImportDict = new Dictionary();
+ private static Dictionary _documentTypeImportDict = new Dictionary();
+
#region Process Sheet (normal BSMD sheet import)
internal static bool ProcessSheet(ExcelReader reader, out string readMessage, MessageCore messageCore, List notificationClasses)
@@ -2087,7 +2092,25 @@ namespace ENI2.Excel
if(!gender.IsNullOrEmpty() && !crew.CrewMemberGender.HasValue)
{
// special treatment / callback
-
+ if (_genderImportDict.ContainsKey(gender))
+ {
+ crew.CrewMemberGender = DakosyUtil.ParseGender(_genderImportDict[gender]); // we have mapped this before
+ }
+ else
+ {
+ FixImportDialog fid = new FixImportDialog();
+ fid.Value = gender;
+ fid.ValueType = "Gender";
+ fid.SelectionValues = CREW.NationalityDict;
+ if(fid.ShowDialog() ?? false)
+ {
+ if(!fid.SelectedValue.IsNullOrEmpty())
+ {
+ _genderImportDict[gender] = fid.SelectedValue;
+ crew.CrewMemberGender = DakosyUtil.ParseGender(_genderImportDict[gender]);
+ }
+ }
+ }
}
crew.CrewMemberDuty = reader.ReadCellAsText(sheetTitle, string.Format("F{0}", i + 18));
diff --git a/ENI2/Util/GlobalStructures.cs b/ENI2/Util/GlobalStructures.cs
index ffb73d24..b530f643 100644
--- a/ENI2/Util/GlobalStructures.cs
+++ b/ENI2/Util/GlobalStructures.cs
@@ -14,12 +14,12 @@ namespace ENI2.Util
static class GlobalStructures
{
- public static string[] GenderList =
+ public static Dictionary GenderDict = new Dictionary
{
- Properties.Resources.textNotKnown,
- Properties.Resources.textMale,
- Properties.Resources.textFemale,
- Properties.Resources.textNotApplicable
+ { 0, Properties.Resources.textNotKnown },
+ { 1, Properties.Resources.textMale },
+ { 2, Properties.Resources.textFemale },
+ { 9, Properties.Resources.textNotApplicable }
};
public static string[] IDDocTypeList =