diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx
index 47e49252..6eabd0c8 100644
Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ
diff --git a/nsw/Dänemark/SafeSeaNetTest/Program.cs b/nsw/Dänemark/SafeSeaNetTest/Program.cs
index 05bff7bb..74804e8c 100644
--- a/nsw/Dänemark/SafeSeaNetTest/Program.cs
+++ b/nsw/Dänemark/SafeSeaNetTest/Program.cs
@@ -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");
diff --git a/nsw/Dänemark/readme.txt b/nsw/Dänemark/readme.txt
index c169ca03..672c839a 100644
--- a/nsw/Dänemark/readme.txt
+++ b/nsw/Dänemark/readme.txt
@@ -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
diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs
index b6b99386..acfae9cb 100644
--- a/nsw/Source/bsmd.ExcelReadService/Util.cs
+++ b/nsw/Source/bsmd.ExcelReadService/Util.cs
@@ -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
@@ -638,11 +681,7 @@ namespace bsmd.ExcelReadService
string portDateOfArrival = string.Format("SEC.PortFacilityDateOfArrival_{0}", i);
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 portGISISCode = string.Format("SEC.PortFacilityGISISCode_{0}", i);
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);
}
diff --git a/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj b/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj
index a8d72038..7607c7a3 100644
--- a/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj
+++ b/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj
@@ -48,8 +48,8 @@
-
- ..\packages\System.Data.SQLite.Core.1.0.101.0\lib\net45\System.Data.SQLite.dll
+
+ ..\packages\System.Data.SQLite.Core.1.0.103\lib\net45\System.Data.SQLite.dll
True
@@ -128,12 +128,12 @@
-
+
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}.
-
+