diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index bba41b5d..0daca6a2 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs b/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs index b1916d50..c2a98299 100644 --- a/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs +++ b/nsw/Source/bsmd.ExcelReadService/LocodeDB.cs @@ -41,7 +41,7 @@ namespace bsmd.ExcelReadService public static string LocodeFromCity(string city, string country) { string result = null; - string query = string.Format("SELECT city_code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE countries.code = '{0}' AND locodes.port='t' AND locodes.name like '{1}'", + string query = string.Format("SELECT city_code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE countries.code = '{0}' AND locodes.port='t' AND (locodes.name like '{1}' OR locodes.name_wo_diacritics like '{1}')", country, city); SQLiteCommand cmd = new SQLiteCommand(query, _con); IDataReader reader = cmd.ExecuteReader(); @@ -67,7 +67,7 @@ namespace bsmd.ExcelReadService if ((countryCode != null) && (lcLookup != null)) results.Add(lcLookup); } - string query = string.Format("SELECT city_code, countries.code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND locodes.name like '{0}'", city); + string query = string.Format("SELECT city_code, countries.code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND (locodes.name like '{0}' OR locodes.name_wo_diacritics like '{0}')", city); SQLiteCommand cmd = new SQLiteCommand(query, _con); IDataReader reader = cmd.ExecuteReader(); while (reader.Read()) diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs index efb0bc2d..7239b527 100644 --- a/nsw/Source/bsmd.ExcelReadService/Util.cs +++ b/nsw/Source/bsmd.ExcelReadService/Util.cs @@ -380,38 +380,46 @@ namespace bsmd.ExcelReadService } - string lastPort = reader.ReadText("NOA_NOD.LastPort").Trim(); + string lastPort = reader.ReadText("NOA_NOD.LastPort"); + if (!lastPort.IsNullOrEmpty()) lastPort = lastPort.Trim(); - if (LocodeDB.PortNameFromLocode(lastPort) != null) + if (lastPort != null) { - noa_nod.LastPort = lastPort; - } - else - { - List lastPorts = LocodeDB.AllLocodesForCityName(lastPort); - if (lastPorts.Count == 1) - noa_nod.LastPort = lastPorts[0]; - else - _log.WarnFormat("{0} results in {1} possible LOCODES", lastPort, lastPorts.Count); - } - - string nextPort = reader.ReadText("NOA_NOD.NextPort").Trim(); - - if (LocodeDB.PortNameFromLocode(nextPort) != null) - { - noa_nod.NextPort = nextPort; - } - else - { - List nextPorts = LocodeDB.AllLocodesForCityName(nextPort); - if (nextPorts.Count == 1) - noa_nod.NextPort = nextPorts[0]; + if (LocodeDB.PortNameFromLocode(lastPort) != null) + { + noa_nod.LastPort = lastPort; + } else { - if (nextPort.Equals("ZZUKN", StringComparison.OrdinalIgnoreCase)) - noa_nod.NextPort = nextPort; + List lastPorts = LocodeDB.AllLocodesForCityName(lastPort); + if (lastPorts.Count == 1) + noa_nod.LastPort = lastPorts[0]; else - _log.WarnFormat("{0} results in {1} possible LOCODES", nextPort, nextPorts.Count); + _log.WarnFormat("{0} results in {1} possible LOCODES", lastPort, lastPorts.Count); + } + } + + string nextPort = reader.ReadText("NOA_NOD.NextPort"); + if (!nextPort.IsNullOrEmpty()) nextPort = nextPort.Trim(); + + if (nextPort != null) + { + if (LocodeDB.PortNameFromLocode(nextPort) != null) + { + noa_nod.NextPort = nextPort; + } + else + { + List nextPorts = LocodeDB.AllLocodesForCityName(nextPort); + if (nextPorts.Count == 1) + noa_nod.NextPort = nextPorts[0]; + else + { + if (nextPort.Equals("ZZUKN", StringComparison.OrdinalIgnoreCase)) + noa_nod.NextPort = nextPort; + else + _log.WarnFormat("{0} results in {1} possible LOCODES", nextPort, nextPorts.Count); + } } } diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 360d7eb9..2984595d 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.2.21")] +[assembly: AssemblyInformationalVersion("3.2.22")] [assembly: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index 845220b6..d22ccb13 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.21.*")] +[assembly: AssemblyVersion("3.2.22.*")]