Korrekturen Excel einlesen Locode und Datum korrekt schreiben (Localtime)
This commit is contained in:
parent
811d8c1eb4
commit
176602c184
@ -37,7 +37,7 @@
|
|||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>publish.html</WebPage>
|
<WebPage>publish.html</WebPage>
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>7.0.1.0</ApplicationVersion>
|
<ApplicationVersion>7.0.2.0</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
|
|||||||
@ -77,8 +77,11 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
val = val.ToUpper();
|
val = val.ToUpper();
|
||||||
string portName = LocodeDB.PortNameFromLocode(val);
|
string portName = LocodeDB.PortNameFromLocode(val);
|
||||||
if(portName.IsNullOrEmpty())
|
if (portName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
_log.WarnFormat("unknown Locode {0}", val);
|
_log.WarnFormat("unknown Locode {0}", val);
|
||||||
|
val = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1379,7 +1379,7 @@ namespace ENI2.Excel
|
|||||||
{
|
{
|
||||||
if(v != null)
|
if(v != null)
|
||||||
{
|
{
|
||||||
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToOADate(); // Test this I dont believe it
|
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,20 +186,29 @@ namespace ENI2.Locode
|
|||||||
if (locode.IsNullOrEmpty()) return null;
|
if (locode.IsNullOrEmpty()) return null;
|
||||||
if (locode.Length != 5) return null;
|
if (locode.Length != 5) return null;
|
||||||
|
|
||||||
string result = null;
|
try
|
||||||
string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode);
|
|
||||||
|
|
||||||
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
|
||||||
IDataReader reader = cmd.ExecuteReader();
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
{
|
||||||
if (!reader.IsDBNull(0))
|
|
||||||
result = reader.GetString(0);
|
string result = null;
|
||||||
break;
|
string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode);
|
||||||
|
|
||||||
|
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||||
|
IDataReader reader = cmd.ExecuteReader();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (!reader.IsDBNull(0))
|
||||||
|
result = reader.GetString(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
cmd.Dispose();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.WarnFormat("error reading SSN location from locode: {0}", ex.ToString());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
reader.Close();
|
|
||||||
cmd.Dispose();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,21 +221,28 @@ namespace ENI2.Locode
|
|||||||
{
|
{
|
||||||
if (locode.IsNullOrEmpty()) return null;
|
if (locode.IsNullOrEmpty()) return null;
|
||||||
if (locode.Length != 5) return null;
|
if (locode.Length != 5) return null;
|
||||||
|
try
|
||||||
string result = null;
|
|
||||||
string query = string.Format("SELECT locodes.name_wo_diacritics FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.city_code = '{0}' AND countries.code = '{1}'",
|
|
||||||
locode.Substring(2), locode.Substring(0, 2));
|
|
||||||
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
|
||||||
IDataReader reader = cmd.ExecuteReader();
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
{
|
||||||
if (!reader.IsDBNull(0))
|
string result = null;
|
||||||
result = reader.GetString(0);
|
string query = string.Format("SELECT locodes.name_wo_diacritics FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.city_code = '{0}' AND countries.code = '{1}'",
|
||||||
break;
|
locode.Substring(2), locode.Substring(0, 2));
|
||||||
|
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||||
|
IDataReader reader = cmd.ExecuteReader();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (!reader.IsDBNull(0))
|
||||||
|
result = reader.GetString(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
cmd.Dispose();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
_log.WarnFormat("error reading location from locode: {0}", ex.ToString());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
reader.Close();
|
|
||||||
cmd.Dispose();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CloseDB()
|
public static void CloseDB()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user