excel Tool 3.2.14
neue Locode DB
This commit is contained in:
parent
2a54e905e6
commit
3cbc32d6da
Binary file not shown.
@ -12,18 +12,50 @@ namespace SafeSeaNetTest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
|
||||
private static string veryBasicUri = "https://nswtestapi.safeseanet.dk/";
|
||||
private static string baseUri = "https://nswtestapi.safeseanet.dk/api/v1/";
|
||||
private static string searchUri = "search?query=contentType: ship&take=5";
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Login();
|
||||
Login3();
|
||||
|
||||
|
||||
Console.Read();
|
||||
}
|
||||
|
||||
private static async void Login3()
|
||||
{
|
||||
|
||||
var credential = new NetworkCredential("bsm-schick", "R1g048r20l", "SSNTEST");
|
||||
var myCache = new CredentialCache();
|
||||
|
||||
Uri uri = new Uri(Path.Combine(baseUri, searchUri));
|
||||
Uri authUri = new Uri(uri.GetLeftPart(UriPartial.Authority));
|
||||
|
||||
// welche Uri wird hier tatsächlich hinzugefügt? nur die Base oder ganz speziell?
|
||||
myCache.Add(authUri, "ntlm", credential);
|
||||
|
||||
var handler = new HttpClientHandler();
|
||||
handler.AllowAutoRedirect = true;
|
||||
handler.Credentials = myCache;
|
||||
|
||||
// Create an HttpClient with the handler object
|
||||
HttpClient httpClient = new HttpClient(handler);
|
||||
|
||||
// Wait to get the reponse, and you can use the reponse in your code
|
||||
HttpResponseMessage responseMessage = await httpClient.GetAsync(uri);
|
||||
|
||||
|
||||
string jsonMessage;
|
||||
using (Stream responseStream = await responseMessage.Content.ReadAsStreamAsync())
|
||||
{
|
||||
jsonMessage = new StreamReader(responseStream).ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static async void Login()
|
||||
{
|
||||
NetworkCredential credential = new NetworkCredential("bsm-schick", "R1g048r20l");
|
||||
|
||||
@ -4,8 +4,7 @@ G
|
||||
Anmeldung: bsm-schick
|
||||
PW: Melder2016
|
||||
Januar-2016
|
||||
|
||||
(funktioniert aktuell beides nicht)
|
||||
--> R1g048r20l
|
||||
|
||||
https://nswtest.safeseanet.dk/api/v1/search?query=contentType: ship&take=5
|
||||
|
||||
|
||||
@ -314,6 +314,12 @@ namespace bsmd.ExcelReadService
|
||||
stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber");
|
||||
stat.ISMCompanyId = reader.ReadTextNoWhitespace("STAT.ISMCompanyId");
|
||||
|
||||
if(!stat.ISMCompanyId.IsNullOrEmpty() && stat.ISMCompanyId.Length < 7)
|
||||
{
|
||||
while (stat.ISMCompanyId.Length < 7)
|
||||
stat.ISMCompanyId = "0" + stat.ISMCompanyId;
|
||||
}
|
||||
|
||||
if (!stat.Flag.IsNullOrEmpty() && stat.Flag.Length > 2)
|
||||
stat.Flag = LocodeDB.CountryCodeFromName(stat.Flag);
|
||||
|
||||
@ -430,6 +436,9 @@ namespace bsmd.ExcelReadService
|
||||
}
|
||||
AGNT agnt = agntMessage.Elements[0] as AGNT;
|
||||
Util.ScanMessage(agnt, reader);
|
||||
|
||||
if (agnt.AgentLastName.IsNullOrEmpty()) agnt.AgentLastName = "-";
|
||||
|
||||
// wird nicht mehr entfernt, egal welche Felder gelesen werden
|
||||
}
|
||||
|
||||
@ -527,58 +536,92 @@ namespace bsmd.ExcelReadService
|
||||
mdh.MDHSimplification = false;
|
||||
mdh.PortOfCallWhereCompleteMDHNotified = "";
|
||||
|
||||
// POC last 30 days
|
||||
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
|
||||
|
||||
string kuerzelErsteZelle = reader.ReadText("MDH.PortOfCallLast30DaysLocode_1");
|
||||
|
||||
|
||||
// lt. Mail von Christin am 11.10.2016
|
||||
// "SEC" Mode, die Werte aus last10PortFacilitesCalled (SEC) werden übernommen
|
||||
// das funktioniert, da SEC vor MDH gelesen wird
|
||||
if (!kuerzelErsteZelle.IsNullOrEmpty() && kuerzelErsteZelle.Equals("sec", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
|
||||
string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
|
||||
string locode = string.Format("MDH.PortOfCallLast30DaysLocode_{0}", i + 1);
|
||||
string crewJoined = string.Format("MDH.PortOfCallLast30DaysCrewMembersJoined_{0}", i + 1);
|
||||
string crewName = string.Format("MDH.PortOfCallLast30DaysCrewJoinedShipName_{0}", i + 1);
|
||||
string depDate = string.Format("MDH.PortOfCallLast30DaysDateOfDeparture_{0}", i + 1);
|
||||
|
||||
PortOfCallLast30Days poc30d = mdh.GetSublistElementWithIdentifier((i + 1).ToString()) as PortOfCallLast30Days;
|
||||
if (poc30d == null)
|
||||
Message secMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SEC);
|
||||
if (secMessage.Elements.Count == 0) return;
|
||||
SEC sec = secMessage.Elements[0] as SEC;
|
||||
int i = 1;
|
||||
foreach (LastTenPortFacilitiesCalled ltpfc in sec.LastTenPortFacilitesCalled)
|
||||
{
|
||||
poc30d = new PortOfCallLast30Days();
|
||||
poc30d.Identifier = (i + 1).ToString();
|
||||
poc30d.MDH = mdh;
|
||||
mdh.PortOfCallLast30Days.Add(poc30d);
|
||||
}
|
||||
|
||||
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
|
||||
poc30d.PortOfCallLast30DaysLocode = reader.ReadTextNoWhitespace(locode);
|
||||
poc30d.PortOfCallLast30DaysCrewMembersJoined = reader.ReadBoolean(crewJoined);
|
||||
|
||||
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
|
||||
{
|
||||
string crewNameString = reader.ReadText(crewName);
|
||||
if (!crewName.IsNullOrEmpty())
|
||||
PortOfCallLast30Days poc30d = mdh.GetSublistElementWithIdentifier((i + 1).ToString()) as PortOfCallLast30Days;
|
||||
if (poc30d == null)
|
||||
{
|
||||
// try different separators
|
||||
string[] crew = crewNameString.Split(';');
|
||||
if (crew.Length == 1)
|
||||
crew = crewNameString.Split(',');
|
||||
poc30d = new PortOfCallLast30Days();
|
||||
poc30d.Identifier = (i + 1).ToString();
|
||||
poc30d.MDH = mdh;
|
||||
mdh.PortOfCallLast30Days.Add(poc30d);
|
||||
}
|
||||
|
||||
for (int j = 0; j < crew.Length; j++)
|
||||
poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
|
||||
poc30d.PortOfCallLast30DaysLocode = ltpfc.PortFacilityPortLoCode;
|
||||
poc30d.PortOfCallLast30DaysDateOfDeparture = ltpfc.PortFacilityDateOfDeparture;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else // "normal mode", aus den Zellen lesen
|
||||
{
|
||||
|
||||
// POC last 30 days
|
||||
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
|
||||
{
|
||||
string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
|
||||
string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
|
||||
string locode = string.Format("MDH.PortOfCallLast30DaysLocode_{0}", i + 1);
|
||||
string crewJoined = string.Format("MDH.PortOfCallLast30DaysCrewMembersJoined_{0}", i + 1);
|
||||
string crewName = string.Format("MDH.PortOfCallLast30DaysCrewJoinedShipName_{0}", i + 1);
|
||||
string depDate = string.Format("MDH.PortOfCallLast30DaysDateOfDeparture_{0}", i + 1);
|
||||
|
||||
PortOfCallLast30Days poc30d = mdh.GetSublistElementWithIdentifier((i + 1).ToString()) as PortOfCallLast30Days;
|
||||
if (poc30d == null)
|
||||
{
|
||||
poc30d = new PortOfCallLast30Days();
|
||||
poc30d.Identifier = (i + 1).ToString();
|
||||
poc30d.MDH = mdh;
|
||||
mdh.PortOfCallLast30Days.Add(poc30d);
|
||||
}
|
||||
|
||||
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
|
||||
poc30d.PortOfCallLast30DaysLocode = reader.ReadTextNoWhitespace(locode);
|
||||
poc30d.PortOfCallLast30DaysCrewMembersJoined = reader.ReadBoolean(crewJoined);
|
||||
|
||||
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
|
||||
{
|
||||
string crewNameString = reader.ReadText(crewName);
|
||||
if (!crewName.IsNullOrEmpty())
|
||||
{
|
||||
PortOfCallLast30DaysCrewJoinedShip poc30dCrew = poc30d.GetSublistElementWithIdentifier((j + 1).ToString()) as PortOfCallLast30DaysCrewJoinedShip;
|
||||
if (poc30dCrew == null)
|
||||
{
|
||||
poc30dCrew = new PortOfCallLast30DaysCrewJoinedShip();
|
||||
poc30dCrew.Identifier = (j + 1).ToString();
|
||||
poc30dCrew.PortOfCallLast30Days = poc30d;
|
||||
poc30d.CrewJoinedShip.Add(poc30dCrew);
|
||||
}
|
||||
// try different separators
|
||||
string[] crew = crewNameString.Split(';');
|
||||
if (crew.Length == 1)
|
||||
crew = crewNameString.Split(',');
|
||||
|
||||
poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
|
||||
for (int j = 0; j < crew.Length; j++)
|
||||
{
|
||||
PortOfCallLast30DaysCrewJoinedShip poc30dCrew = poc30d.GetSublistElementWithIdentifier((j + 1).ToString()) as PortOfCallLast30DaysCrewJoinedShip;
|
||||
if (poc30dCrew == null)
|
||||
{
|
||||
poc30dCrew = new PortOfCallLast30DaysCrewJoinedShip();
|
||||
poc30dCrew.Identifier = (j + 1).ToString();
|
||||
poc30dCrew.PortOfCallLast30Days = poc30d;
|
||||
poc30d.CrewJoinedShip.Add(poc30dCrew);
|
||||
}
|
||||
|
||||
poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Leer/def. Zeilen entfernen
|
||||
if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
|
||||
mdh.PortOfCallLast30Days.Remove(poc30d);
|
||||
// Leer/def. Zeilen entfernen
|
||||
if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
|
||||
mdh.PortOfCallLast30Days.Remove(poc30d);
|
||||
}
|
||||
}
|
||||
|
||||
// wird nicht wieder entfernt falls keine Daten vorliegen
|
||||
@ -639,10 +682,6 @@ namespace bsmd.ExcelReadService
|
||||
string portDateOfDeparture = string.Format("SEC.PortFacilityDateOfDeparture_{0}", i);
|
||||
string portShipSecLevel = string.Format("SEC.PortFacilityShipSecurityLevel_{0}", i);
|
||||
string portGISISCode = string.Format("SEC.PortFacilityGISISCode_{0}", i);
|
||||
if((portGISISCode != null) && (portGISISCode.Length < 4))
|
||||
{
|
||||
while (portGISISCode.Length < 4) portGISISCode = "0" + portGISISCode;
|
||||
}
|
||||
string portSecMatters = string.Format("SEC.PortFacilitySecurityMattersToReport_{0}", i);
|
||||
|
||||
LastTenPortFacilitiesCalled l10fc = sec.GetPortFacilityWithIdentifier(i.ToString()) as LastTenPortFacilitiesCalled;
|
||||
@ -661,6 +700,13 @@ namespace bsmd.ExcelReadService
|
||||
l10fc.PortFacilityDateOfDeparture = reader.ReadDate(portDateOfDeparture);
|
||||
l10fc.PortFacilityShipSecurityLevel = (byte) reader.ReadNumber(portShipSecLevel);
|
||||
l10fc.PortFacilityGISISCode = reader.ReadTextNoWhitespace(portGISISCode);
|
||||
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
|
||||
l10fc.PortFacilityGISISCode = "0000";
|
||||
if((l10fc.PortFacilityGISISCode != null) && (l10fc.PortFacilityGISISCode.Length < 4))
|
||||
{
|
||||
while (l10fc.PortFacilityGISISCode.Length < 4) l10fc.PortFacilityGISISCode = "0" + l10fc.PortFacilityGISISCode;
|
||||
}
|
||||
|
||||
l10fc.PortFacilitySecurityMattersToReport = reader.ReadText(portSecMatters);
|
||||
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.101.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SQLite.Core.1.0.101.0\lib\net45\System.Data.SQLite.dll</HintPath>
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.103.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SQLite.Core.1.0.103\lib\net45\System.Data.SQLite.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
@ -128,12 +128,12 @@
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets')" />
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.103\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.103\build\net45\System.Data.SQLite.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.101.0\build\net45\System.Data.SQLite.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.103\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.103\build\net45\System.Data.SQLite.Core.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -2,5 +2,5 @@
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.5" targetFramework="net45" />
|
||||
<package id="OpenPop.NET" version="2.0.6.1120" targetFramework="net45" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.101.0" targetFramework="net45" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.103" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -136,7 +136,7 @@ namespace bsmd.database
|
||||
|
||||
[ShowReport]
|
||||
[Validation2(ValidationCode.NOT_NULL)]
|
||||
[LookupName("SanitaryControlReinspectionRequired")]
|
||||
[LookupName("MDH.SanitaryControlReinspectionRequired")]
|
||||
public bool? SanitaryControlReinspectionRequired { get; set; }
|
||||
|
||||
[ShowReport]
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.2.10")]
|
||||
[assembly: AssemblyInformationalVersion("3.2.14")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.2.10.*")]
|
||||
[assembly: AssemblyVersion("3.2.14.*")]
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user