diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index 26819c41..800fa9f7 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index dfca7500..2faf88b4 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.0.5")] +[assembly: AssemblyInformationalVersion("3.0.6")] [assembly: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index ba7a8d5e..eab9e0c0 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("3.0.5.*")] +[assembly: AssemblyVersion("3.0.6.*")] diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index 20cf2067..4999302d 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -259,61 +259,63 @@ namespace bsmd.dbh { RootSEC rootSEC = new RootSEC(); SEC sec = message.Elements[0] as SEC; - int numFields = (sec.SECSimplification ?? false) ? - 2 : (14 + sec.LastTenPortFacilitesCalled.Count + sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count); - rootSEC.Items = new object[numFields]; - rootSEC.ItemsElementName = new ItemsChoiceType1[numFields]; + + List secItems = new List(); + List choiceType1s = new List(); rootSEC.CurrentShipSecurityLevel = (int)sec.CurrentShipSecurityLevel.Value; - if (sec.SECSimplification ?? false) { - rootSEC.ItemsElementName[0] = ItemsChoiceType1.SECSimplification; - rootSEC.Items[0] = "Y"; - rootSEC.ItemsElementName[1] = ItemsChoiceType1.PortOfCallWhereCompleteSECNotified; - rootSEC.Items[1] = sec.PortOfCallWhereCompleteSECNotified; + choiceType1s.Add(ItemsChoiceType1.SECSimplification); + secItems.Add("Y"); + choiceType1s.Add(ItemsChoiceType1.PortOfCallWhereCompleteSECNotified); + secItems.Add(sec.PortOfCallWhereCompleteSECNotified); } else { - rootSEC.ItemsElementName[0] = ItemsChoiceType1.CSOLastName; - rootSEC.Items[0] = sec.CSOLastName; - rootSEC.ItemsElementName[1] = ItemsChoiceType1.CSOFirstName; - rootSEC.Items[1] = sec.CSOFirstName; - rootSEC.ItemsElementName[2] = ItemsChoiceType1.CSOPhone; - rootSEC.Items[2] = sec.CSOPhone; - rootSEC.ItemsElementName[3] = ItemsChoiceType1.CSOFax; - rootSEC.Items[3] = sec.CSOFax; - rootSEC.ItemsElementName[4] = ItemsChoiceType1.ValidISSCOnBoard; - rootSEC.Items[4] = sec.ValidISSCOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; - rootSEC.ItemsElementName[5] = ItemsChoiceType1.ISSCType; - rootSEC.Items[5] = (ISSCType) (sec.ISSCType ?? 0); - rootSEC.ItemsElementName[6] = ItemsChoiceType1.ISSCIssuerName; - rootSEC.Items[6] = sec.ISSCIssuerName; - rootSEC.ItemsElementName[7] = ItemsChoiceType1.ISSCDateOfExpiration; - if(sec.ISSCDateOfExpiration.HasValue) - rootSEC.Items[7] = sec.ISSCDateOfExpiration.Value; - rootSEC.ItemsElementName[8] = ItemsChoiceType1.ApprovedSecurityPlanOnBoard; - rootSEC.Items[8] = sec.ApprovedSecurityPlanOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; - - rootSEC.ItemsElementName[9] = ItemsChoiceType1.PortFacilityOfArrival; - rootSEC.Items[9] = sec.PortFacilityOfArrival; - rootSEC.ItemsElementName[10] = ItemsChoiceType1.GeneralDescriptionOfCargo; - if (sec.GeneralDescriptionOfCargo.HasValue) - rootSEC.Items[10] = (CargoDescription)sec.GeneralDescriptionOfCargo.Value; - rootSEC.ItemsElementName[11] = ItemsChoiceType1.ReasonsForNoValidISSC; - rootSEC.Items[11] = sec.ReasonsForNoValidISSC; - rootSEC.ItemsElementName[12] = ItemsChoiceType1.ISSCIssuerType; - rootSEC.Items[12] = (ISSCIssuerType) (sec.ISSCIssuerType ?? 0); - rootSEC.ItemsElementName[13] = ItemsChoiceType1.CSOEMail; - rootSEC.Items[13] = sec.CSOEMail; - - int index = 14; - for (int i=0; i < sec.LastTenPortFacilitesCalled.Count; index++, i++) + choiceType1s.Add(ItemsChoiceType1.CSOLastName); + secItems.Add(sec.CSOLastName); + choiceType1s.Add(ItemsChoiceType1.CSOFirstName); + secItems.Add(sec.CSOFirstName); + choiceType1s.Add(ItemsChoiceType1.CSOPhone); + secItems.Add(sec.CSOPhone); + choiceType1s.Add(ItemsChoiceType1.CSOFax); + secItems.Add(sec.CSOFax); + choiceType1s.Add(ItemsChoiceType1.ValidISSCOnBoard); + secItems.Add(sec.ValidISSCOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N); + choiceType1s.Add(ItemsChoiceType1.ISSCType); + secItems.Add((ISSCType)(sec.ISSCType ?? 0)); + choiceType1s.Add(ItemsChoiceType1.ISSCIssuerName); + secItems.Add(sec.ISSCIssuerName); + if (sec.ISSCDateOfExpiration.HasValue) { - rootSEC.ItemsElementName[index] = ItemsChoiceType1.LastTenPortFacilitiesCalled; + choiceType1s.Add(ItemsChoiceType1.ISSCDateOfExpiration); + secItems.Add(sec.ISSCDateOfExpiration.Value); + } + choiceType1s.Add(ItemsChoiceType1.ApprovedSecurityPlanOnBoard); + secItems.Add(sec.ApprovedSecurityPlanOnBoard ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N); + + choiceType1s.Add(ItemsChoiceType1.PortFacilityOfArrival); + secItems.Add(sec.PortFacilityOfArrival); + if (sec.GeneralDescriptionOfCargo.HasValue) + { + choiceType1s.Add(ItemsChoiceType1.GeneralDescriptionOfCargo); + secItems.Add((CargoDescription)sec.GeneralDescriptionOfCargo.Value); + } + choiceType1s.Add(ItemsChoiceType1.ReasonsForNoValidISSC); + secItems.Add(sec.ReasonsForNoValidISSC); + choiceType1s.Add(ItemsChoiceType1.ISSCIssuerType); + secItems.Add((ISSCIssuerType) (sec.ISSCIssuerType ?? 0)); + choiceType1s.Add(ItemsChoiceType1.CSOEMail); + secItems.Add(sec.CSOEMail); + + + for (int i=0; i < sec.LastTenPortFacilitesCalled.Count; i++) + { + choiceType1s.Add(ItemsChoiceType1.LastTenPortFacilitiesCalled); RootSECLastTenPortFacilitiesCalled lastTen = new RootSECLastTenPortFacilitiesCalled(); - rootSEC.Items[index] = lastTen; + secItems.Add(lastTen); lastTen.PortFacilityPortName = sec.LastTenPortFacilitesCalled[i].PortFacilityPortName; lastTen.PortFacilityPortCountry = sec.LastTenPortFacilitesCalled[i].PortFacilityPortCountry; lastTen.PortFacilityPortLoCode = sec.LastTenPortFacilitesCalled[i].PortFacilityPortLoCode; @@ -327,11 +329,11 @@ namespace bsmd.dbh lastTen.PortFacilityGISISCode = sec.LastTenPortFacilitesCalled[i].PortFacilityGISISCode; } - for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; index++, i++ ) + for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; i++) { - rootSEC.ItemsElementName[index] = ItemsChoiceType1.ShipToShipActivities; + choiceType1s.Add(ItemsChoiceType1.ShipToShipActivities); RootSECShipToShipActivities s2s = new RootSECShipToShipActivities(); - rootSEC.Items[index] = s2s; + secItems.Add(s2s); s2s.ShipToShipActivityLocation = new RootSECShipToShipActivitiesShipToShipActivityLocation(); s2s.ShipToShipActivityLocation.ShipToShipActivityLocationName = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationName; s2s.ShipToShipActivityLocation.ShipToShipActivityLocationLoCode = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityLocationLoCode; @@ -347,9 +349,11 @@ namespace bsmd.dbh s2s.ShipToShipActivityType = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivityType; s2s.ShipToShipActivitySecurityMattersToReport = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled[i].ShipToShipActivitySecurityMattersToReport; } - } + rootSEC.Items = secItems.ToArray(); + rootSEC.ItemsElementName = choiceType1s.ToArray(); + item = rootSEC; } break; @@ -626,7 +630,7 @@ namespace bsmd.dbh rootInfo.BowThrusterPower = info.BowThrusterPower; rootInfo.SternThrusterPower = info.SternThrusterPower; if (info.FumigatedBulkCargo.HasValue) - rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.Y : RootINFOFumigatedBulkCargo.N; + rootInfo.FumigatedBulkCargo = (info.FumigatedBulkCargo.Value == 0) ? RootINFOFumigatedBulkCargo.N : RootINFOFumigatedBulkCargo.Y; else rootInfo.FumigatedBulkCargo = RootINFOFumigatedBulkCargo.N; rootInfo.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue; @@ -851,68 +855,63 @@ namespace bsmd.dbh } else { - rootWAS.Items = new object[14]; - rootWAS.ItemsElementName = new ItemsChoiceType3[14]; + List wasteItems = new List(); + List choiceType3s = new List(); - rootWAS.ItemsElementName[0] = ItemsChoiceType3.ConfirmationOfCorrectness; - rootWAS.Items[0] = was.ConfirmationOfCorrectness ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; + choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectness); + wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N); - rootWAS.ItemsElementName[1] = ItemsChoiceType3.LastWasteDisposalDate; if (was.LastWasteDisposalDate.HasValue) - rootWAS.Items[1] = was.LastWasteDisposalDate.Value; - - rootWAS.ItemsElementName[2] = ItemsChoiceType3.LastWasteDisposalPort; - rootWAS.Items[2] = was.LastWasteDisposalPort; - - - rootWAS.ItemsElementName[3] = ItemsChoiceType3.WasteDisposalDelivery; - if (was.WasteDisposalDelivery.HasValue) - rootWAS.Items[3] = (DisposalType)was.WasteDisposalDelivery.Value; - - rootWAS.ItemsElementName[4] = ItemsChoiceType3.WasteDisposalServiceProviderName; - if (was.WasteDisposalServiceProvider.Count > 0) { - // TODO: Klären wie es nun genau hier aussieht! - string serviceProviderName = ""; - for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) - { - serviceProviderName = string.Format("{0}{1}", serviceProviderName, was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName); - } - rootWAS.Items[4] = serviceProviderName; + choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalDate); + wasteItems.Add(was.LastWasteDisposalDate.Value); + } + + choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort); + wasteItems.Add(was.LastWasteDisposalPort); + + if (was.WasteDisposalDelivery.HasValue) + { + choiceType3s.Add(ItemsChoiceType3.WasteDisposalDelivery); + wasteItems.Add((DisposalType)was.WasteDisposalDelivery.Value); + } + + for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) + { + choiceType3s.Add(ItemsChoiceType3.WasteDisposalServiceProviderName); + wasteItems.Add(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName); + } - /* {"Wert von 'ItemsElementName' stimmt nicht mit dem Typ von 'bsmd.dbh.DBHWebReference.RootWASWaste' überein. * Sie müssen ihn auf 'bsmd.dbh.DBHWebReference.ItemsChoiceType3.@Waste' festlegen."} */ - - for (int j = 5; j < 14; j++) + + for (int j = 0; j < was.Waste.Count; j++) { - if (was.Waste.Count > 0) - { - rootWAS.ItemsElementName[j] = ItemsChoiceType3.Waste; - RootWASWaste rww = new RootWASWaste(); - rootWAS.Items[j] = rww; - if(was.Waste.Count > (j - 5)) - { - rww.WasteDescription = was.Waste[j-5].WasteDescription; - if (was.Waste[j - 5].WasteType.HasValue) - rww.WasteType = (WasteType) (was.Waste[j - 5].WasteType.Value - 1); // im generierten Code ist das 0-basiert - - rww.WasteDisposalAmount_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteDisposalAmount_MTQ ?? 0), 3); - - rww.WasteDetails = new RootWASWasteWasteDetails(); - - rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteCapacity_MTQ ?? 0),3); - rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteAmountRetained_MTQ ?? 0),3); - rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ ?? 0), 3); - rww.WasteDetails.WasteDisposalPort = was.Waste[j - 5].WasteDisposalPort; - if (rww.WasteDetails.WasteDisposalPort.IsNullOrEmpty()) rww.WasteDetails.WasteDisposalPort = "ZZUKN"; - - } - } - } + choiceType3s.Add(ItemsChoiceType3.Waste); + RootWASWaste rww = new RootWASWaste(); + wasteItems.Add(rww); + + Waste waste = was.Waste[j]; + + rww.WasteDescription = waste.WasteDescription; + if (waste.WasteType.HasValue) + rww.WasteType = (WasteType)(waste.WasteType.Value - 1); // in unserer DB 1-basiert(!) im dbh Struct nicht + rww.WasteDisposalAmount_MTQ = decimal.Round((decimal)(waste.WasteDisposalAmount_MTQ ?? 0), 3); + + rww.WasteDetails = new RootWASWasteWasteDetails(); + rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal)(waste.WasteCapacity_MTQ ?? 0), 3); + rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal)(waste.WasteAmountRetained_MTQ ?? 0), 3); + rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = decimal.Round((decimal)(waste.WasteAmountGeneratedTillNextPort_MTQ ?? 0), 3); + rww.WasteDetails.WasteDisposalPort = waste.WasteDisposalPort; + if (rww.WasteDetails.WasteDisposalPort.IsNullOrEmpty()) rww.WasteDetails.WasteDisposalPort = "ZZUKN"; + + } + + rootWAS.ItemsElementName = choiceType3s.ToArray(); + rootWAS.Items = wasteItems.ToArray(); } item = rootWAS;