3.2.22
Korrekturen: 1. "leere" Next/Lastport (statt ZZUKN) crashfrei tolerieren 2. Locode DB auch mit name_wo_diacritics durchsuchen, damit Fuglafjordur statt Fuglafjørdur gefunden werden kann
This commit is contained in:
parent
625a9f262e
commit
edd48e8c0b
Binary file not shown.
@ -41,7 +41,7 @@ namespace bsmd.ExcelReadService
|
|||||||
public static string LocodeFromCity(string city, string country)
|
public static string LocodeFromCity(string city, string country)
|
||||||
{
|
{
|
||||||
string result = null;
|
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);
|
country, city);
|
||||||
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||||
IDataReader reader = cmd.ExecuteReader();
|
IDataReader reader = cmd.ExecuteReader();
|
||||||
@ -67,7 +67,7 @@ namespace bsmd.ExcelReadService
|
|||||||
if ((countryCode != null) && (lcLookup != null))
|
if ((countryCode != null) && (lcLookup != null))
|
||||||
results.Add(lcLookup);
|
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);
|
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||||
IDataReader reader = cmd.ExecuteReader();
|
IDataReader reader = cmd.ExecuteReader();
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
|
|||||||
@ -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;
|
if (LocodeDB.PortNameFromLocode(lastPort) != null)
|
||||||
}
|
{
|
||||||
else
|
noa_nod.LastPort = lastPort;
|
||||||
{
|
}
|
||||||
List<string> 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<string> nextPorts = LocodeDB.AllLocodesForCityName(nextPort);
|
|
||||||
if (nextPorts.Count == 1)
|
|
||||||
noa_nod.NextPort = nextPorts[0];
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (nextPort.Equals("ZZUKN", StringComparison.OrdinalIgnoreCase))
|
List<string> lastPorts = LocodeDB.AllLocodesForCityName(lastPort);
|
||||||
noa_nod.NextPort = nextPort;
|
if (lastPorts.Count == 1)
|
||||||
|
noa_nod.LastPort = lastPorts[0];
|
||||||
else
|
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<string> 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
[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: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.2.21.*")]
|
[assembly: AssemblyVersion("3.2.22.*")]
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user