Korrekturen Excel einlesen Locode und Datum korrekt schreiben (Localtime)

This commit is contained in:
Daniel Schick 2022-04-03 11:11:24 +02:00
parent 811d8c1eb4
commit 176602c184
4 changed files with 48 additions and 29 deletions

View File

@ -37,7 +37,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>7.0.1.0</ApplicationVersion>
<ApplicationVersion>7.0.2.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -78,7 +78,10 @@ namespace ENI2.Excel
val = val.ToUpper();
string portName = LocodeDB.PortNameFromLocode(val);
if (portName.IsNullOrEmpty())
{
_log.WarnFormat("unknown Locode {0}", val);
val = "";
}
}
return val;
}

View File

@ -1379,7 +1379,7 @@ namespace ENI2.Excel
{
if(v != null)
{
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToOADate(); // Test this I dont believe it
_nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate();
}
}

View File

@ -186,6 +186,9 @@ namespace ENI2.Locode
if (locode.IsNullOrEmpty()) return null;
if (locode.Length != 5) return null;
try
{
string result = null;
string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode);
@ -201,6 +204,12 @@ namespace ENI2.Locode
cmd.Dispose();
return result;
}
catch (Exception ex)
{
_log.WarnFormat("error reading SSN location from locode: {0}", ex.ToString());
return null;
}
}
/// <summary>
@ -212,7 +221,8 @@ namespace ENI2.Locode
{
if (locode.IsNullOrEmpty()) 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));
@ -228,6 +238,12 @@ namespace ENI2.Locode
cmd.Dispose();
return result;
}
catch(Exception ex)
{
_log.WarnFormat("error reading location from locode: {0}", ex.ToString());
return null;
}
}
public static void CloseDB()
{