diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index 4f0c1b95..226f0584 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user b/nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user index 2fb2e4dd..1dcb010c 100644 --- a/nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user +++ b/nsw/Source/bsmd.Tool/bsmd.Tool.csproj.user @@ -1,6 +1,6 @@  - -r -c "AA9074D7-2607-445E-A0B9-D07890B6DC23" + -r -c "8ECF90D2-1F1F-4CDD-A7C7-8E1BB3EF7105" \ No newline at end of file diff --git a/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs b/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs index 7cb1d32c..952d3ff0 100644 --- a/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs +++ b/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs @@ -32,18 +32,18 @@ namespace bsmd.database [ShowReport] public string PortFacilityPortLoCode { get; set; } [ShowReport] - [Validation2(ValidationCode.NOT_NULL)] + [Validation(ValidationCode.NOT_NULL)] public DateTime? PortFacilityDateOfArrival { get; set; } [ShowReport] - [Validation2(ValidationCode.NOT_NULL)] + [Validation(ValidationCode.NOT_NULL)] public DateTime? PortFacilityDateOfDeparture { get; set; } [ShowReport] - [Validation2(ValidationCode.NOT_NULL)] + [Validation(ValidationCode.NOT_NULL)] public byte? PortFacilityShipSecurityLevel { get; set; } [ShowReport] public string PortFacilitySecurityMattersToReport { get; set; } [ShowReport] - [Validation2(ValidationCode.GISIS)] + [Validation(ValidationCode.GISIS)] public string PortFacilityGISISCode { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 8be604f3..4bcc7b1c 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("2.4.0")] +[assembly: AssemblyInformationalVersion("2.4.1")] [assembly: AssemblyCopyright("Copyright © 2014-2015 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 7e884bd2..844680c7 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -4,6 +4,6 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.4.0.*")] +[assembly: AssemblyVersion("2.4.1.*")] // wenn das nicht auskommentiert wird erhalten wir eine Warnung // [assembly: AssemblyFileVersion("1.0.0.*")] diff --git a/nsw/Source/bsmd.database/WAS.cs b/nsw/Source/bsmd.database/WAS.cs index da5332a0..cf4cc804 100644 --- a/nsw/Source/bsmd.database/WAS.cs +++ b/nsw/Source/bsmd.database/WAS.cs @@ -224,6 +224,8 @@ namespace bsmd.database newWaste.WasteCapacity_MTQ = 0; newWaste.WasteDisposalAmount_MTQ = 0; newWaste.Identifier = ""; + newWaste.WasteDisposalPort = "ZZUKN"; + newWaste.WasteDescription = "-"; newWaste.WAS = this; this.Waste.Add(newWaste); result.Add(newWaste); diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index 453eff20..b3e20734 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -895,211 +895,219 @@ namespace bsmd.dbh { RootHAZA rootHAZA = new RootHAZA(); HAZ haz = message.Elements[0] as HAZ; - rootHAZA.Items = new object[4]; - - if(haz.DPGManifestOnBoardOnArrival.HasValue) - rootHAZA.Items[0] = haz.DPGManifestOnBoardOnArrival.Value ? RootHAZADPGManifestOnBoardOnArrival.Y : RootHAZADPGManifestOnBoardOnArrival.N; - - #region HAZ positions - RootHAZADPGOnArrival dpgOnArrival = new RootHAZADPGOnArrival(); - - #region IMDG - if (haz.IMDGPositions.Count > 0) - { - dpgOnArrival.DPGItemIMDG = new RootHAZADPGOnArrivalDPGItemIMDG[haz.IMDGPositions.Count]; - for (int i = 0; i < haz.IMDGPositions.Count; i++) - { - IMDGPosition imdgPos = haz.IMDGPositions[i]; - RootHAZADPGOnArrivalDPGItemIMDG rootIMDG = new RootHAZADPGOnArrivalDPGItemIMDG(); - - rootIMDG.UNNumber = imdgPos.UNNumber; - if (imdgPos.PackingGroup.HasValue) - rootIMDG.PackingGroup = (RootHAZADPGOnArrivalDPGItemIMDGPackingGroup)imdgPos.PackingGroup.Value; - rootIMDG.ProperShippingName = imdgPos.ProperShippingName; - rootIMDG.IMOClass = imdgPos.IMOClass; - rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup; - rootIMDG.TechnicalName = imdgPos.TechnicalName; - rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue; - if(imdgPos.NetExplosiveMass_KGM.HasValue) - rootIMDG.NetExplosiveMass_KGM = (float)imdgPos.NetExplosiveMass_KGM.Value; - rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL; - rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName; - rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue; - if (imdgPos.Class7MaxActivity_BQL.HasValue) - rootIMDG.Class7MaxActivity_BQL = (float)imdgPos.Class7MaxActivity_BQL.Value; - rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue; - if (imdgPos.Class7Category.HasValue) - rootIMDG.Class7Category = imdgPos.Class7Category.Value; - rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue; - if (imdgPos.Class7TransportIndex.HasValue) - rootIMDG.Class7TransportIndex = (float) imdgPos.Class7TransportIndex.Value; - rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue; - if (imdgPos.Class7CSI.HasValue) - rootIMDG.Class7CSI = imdgPos.Class7CSI.Value; - rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue; - if (imdgPos.ControlTemperature_CEL.HasValue) - rootIMDG.ControlTemperature_CEL = (float)imdgPos.ControlTemperature_CEL.Value; - rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue; - if (imdgPos.EmergencyTemperature_CEL.HasValue) - rootIMDG.EmergencyTemperature_CEL = (float)imdgPos.EmergencyTemperature_CEL.Value; - if (imdgPos.SubsidiaryRiskList.Count > 0) - { - rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count]; - for (int sCount = 0; sCount < imdgPos.SubsidiaryRiskList.Count; sCount++) - rootIMDG.SubsidiaryRisks[sCount] = imdgPos.SubsidiaryRiskList[sCount].SubsidiaryRisk; - } - if(imdgPos.MarinePollutant.HasValue) - rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootHAZADPGOnArrivalDPGItemIMDGMarinePollutant.Y : RootHAZADPGOnArrivalDPGItemIMDGMarinePollutant.N; - if (imdgPos.NumberOfPackages.HasValue) - rootIMDG.NumberOfPackages = imdgPos.NumberOfPackages.Value; - rootIMDG.PackageType = imdgPos.PackageType; - if(imdgPos.LimitedQuantities.HasValue) - rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootHAZADPGOnArrivalDPGItemIMDGLimitedQuantities.Y : RootHAZADPGOnArrivalDPGItemIMDGLimitedQuantities.N; - if (imdgPos.ExceptedQuantities.HasValue) - rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootHAZADPGOnArrivalDPGItemIMDGExceptedQuantities.Y : RootHAZADPGOnArrivalDPGItemIMDGExceptedQuantities.N; - rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue; - if (imdgPos.NetQuantity_KGM.HasValue) - rootIMDG.NetQuantity_KGM = (float)imdgPos.NetQuantity_KGM.Value; - rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue; - if (imdgPos.GrossQuantity_KGM.HasValue) - rootIMDG.GrossQuantity_KGM = (float)imdgPos.GrossQuantity_KGM.Value; - rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue; - if (imdgPos.Volume_MTQ.HasValue) - rootIMDG.Volume_MTQ = (float)imdgPos.Volume_MTQ.Value; - rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; - if (imdgPos.GeneralCargoIBC.HasValue) - rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootHAZADPGOnArrivalDPGItemIMDGGeneralCargoIBC.Y : RootHAZADPGOnArrivalDPGItemIMDGGeneralCargoIBC.N; - rootIMDG.ContainerNumber = imdgPos.ContainerNumber; - rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; - rootIMDG.StowagePosition = imdgPos.StowagePosition; - rootIMDG.PortOfLoading = imdgPos.PortOfLoading; - rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge; - rootIMDG.Remarks = imdgPos.Remarks; - - dpgOnArrival.DPGItemIMDG[i] = rootIMDG; - } - } - #endregion - - #region IBC - if (haz.IBCPositions.Count > 0) - { - dpgOnArrival.DPGItemIBC = new RootHAZADPGOnArrivalDPGItemIBC[haz.IBCPositions.Count]; - for(int i=0;i 0) - { - dpgOnArrival.DPGItemIGC = new RootHAZADPGOnArrivalDPGItemIGC[haz.IGCPositions.Count]; - for (int i = 0; i < haz.IGCPositions.Count; i++) - { - RootHAZADPGOnArrivalDPGItemIGC rootIGC = new RootHAZADPGOnArrivalDPGItemIGC(); - IGCPosition igcPos = haz.IGCPositions[i]; - - rootIGC.UNNumber = igcPos.UNNumber; - rootIGC.IMOClass = igcPos.IMOClass; - rootIGC.ProductName = igcPos.ProductName; - if (igcPos.Quantity_KGM.HasValue) - rootIGC.Quantity_KGM = (float)igcPos.Quantity_KGM.Value; - rootIGC.StowagePosition = igcPos.StowagePosition; - rootIGC.PortOfLoading = igcPos.PortOfLoading; - rootIGC.PortOfDischarge = igcPos.PortOfDischarge; - rootIGC.Remarks = igcPos.Remarks; - - dpgOnArrival.DPGItemIGC[i] = rootIGC; - } - } - #endregion - - #region IMSBC - if (haz.IMSBCPositions.Count > 0) - { - dpgOnArrival.DPGItemIMSBC = new RootHAZADPGOnArrivalDPGItemIMSBC[haz.IMSBCPositions.Count]; - for (int i = 0; i < haz.IMSBCPositions.Count; i++) - { - RootHAZADPGOnArrivalDPGItemIMSBC rootIMSBC = new RootHAZADPGOnArrivalDPGItemIMSBC(); - IMSBCPosition imsbcPos = haz.IMSBCPositions[i]; - - rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName; - if (imsbcPos.MHB.HasValue) - rootIMSBC.MHB = imsbcPos.MHB.Value ? RootHAZADPGOnArrivalDPGItemIMSBCMHB.Y : RootHAZADPGOnArrivalDPGItemIMSBCMHB.N; - rootIMSBC.UNNumber = imsbcPos.UNNumber; - rootIMSBC.IMOClass = imsbcPos.IMOClass; - if (imsbcPos.Quantity_KGM.HasValue) - rootIMSBC.Quantity_KGM = (float)imsbcPos.Quantity_KGM.Value; - rootIMSBC.StowagePosition = imsbcPos.StowagePosition; - rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading; - rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge; - rootIMSBC.Remarks = imsbcPos.Remarks; - - dpgOnArrival.DPGItemIMSBC[i] = rootIMSBC; - } - } - #endregion - - #region MARPOL_ANNEX_I - if (haz.MARPOLPositions.Count > 0) - { - dpgOnArrival.DPGItemMARPOLAnnexI = new RootHAZADPGOnArrivalDPGItemMARPOLAnnexI[haz.MARPOLPositions.Count]; - for (int i = 0; i < haz.MARPOLPositions.Count; i++) - { - RootHAZADPGOnArrivalDPGItemMARPOLAnnexI rootMarpol = new RootHAZADPGOnArrivalDPGItemMARPOLAnnexI(); - MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i]; - - rootMarpol.Name = marpolPos.Name; - if (marpolPos.FlashpointInformation.HasValue) - rootMarpol.FlashpointInformation = (RootHAZADPGOnArrivalDPGItemMARPOLAnnexIFlashpointInformation)marpolPos.FlashpointInformation.Value; - rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL; - if (marpolPos.Quantity_KGM.HasValue) - rootMarpol.Quantity_KGM = (float)marpolPos.Quantity_KGM.Value; - rootMarpol.StowagePosition = marpolPos.StowagePosition; - rootMarpol.PortOfLoading = marpolPos.PortOfLoading; - rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge; - rootMarpol.Remarks = marpolPos.Remarks; - - dpgOnArrival.DPGItemMARPOLAnnexI[i] = rootMarpol; - } - } - #endregion - - rootHAZA.Items[1] = dpgOnArrival; - #endregion - - if (haz.INFShipClass.HasValue) - { - RootHAZAINFShipClass infShipClass = (RootHAZAINFShipClass) haz.INFShipClass.Value; - rootHAZA.Items[2] = infShipClass; - } if (haz.NoDPGOnBoardOnArrival ?? false) - rootHAZA.Items[3] = RootHAZANoDPGOnBoardOnArrival.Y; + { + rootHAZA.Items = new object[1]; + rootHAZA.Items[0] = RootHAZANoDPGOnBoardOnArrival.Y; + } + else + { + rootHAZA.Items = new object[3]; + + // if(haz.DPGManifestOnBoardOnArrival.HasValue) + rootHAZA.Items[0] = (haz.DPGManifestOnBoardOnArrival ?? false) ? RootHAZADPGManifestOnBoardOnArrival.Y : RootHAZADPGManifestOnBoardOnArrival.N; + + #region HAZ positions + + RootHAZADPGOnArrival dpgOnArrival = new RootHAZADPGOnArrival(); + + #region IMDG + if (haz.IMDGPositions.Count > 0) + { + dpgOnArrival.DPGItemIMDG = new RootHAZADPGOnArrivalDPGItemIMDG[haz.IMDGPositions.Count]; + for (int i = 0; i < haz.IMDGPositions.Count; i++) + { + IMDGPosition imdgPos = haz.IMDGPositions[i]; + RootHAZADPGOnArrivalDPGItemIMDG rootIMDG = new RootHAZADPGOnArrivalDPGItemIMDG(); + + rootIMDG.UNNumber = imdgPos.UNNumber; + if (imdgPos.PackingGroup.HasValue) + rootIMDG.PackingGroup = (RootHAZADPGOnArrivalDPGItemIMDGPackingGroup)imdgPos.PackingGroup.Value; + rootIMDG.ProperShippingName = imdgPos.ProperShippingName; + rootIMDG.IMOClass = imdgPos.IMOClass; + rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup; + rootIMDG.TechnicalName = imdgPos.TechnicalName; + rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue; + if (imdgPos.NetExplosiveMass_KGM.HasValue) + rootIMDG.NetExplosiveMass_KGM = (float)imdgPos.NetExplosiveMass_KGM.Value; + rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL; + rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName; + rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue; + if (imdgPos.Class7MaxActivity_BQL.HasValue) + rootIMDG.Class7MaxActivity_BQL = (float)imdgPos.Class7MaxActivity_BQL.Value; + rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue; + if (imdgPos.Class7Category.HasValue) + rootIMDG.Class7Category = imdgPos.Class7Category.Value; + rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue; + if (imdgPos.Class7TransportIndex.HasValue) + rootIMDG.Class7TransportIndex = (float)imdgPos.Class7TransportIndex.Value; + rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue; + if (imdgPos.Class7CSI.HasValue) + rootIMDG.Class7CSI = imdgPos.Class7CSI.Value; + rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue; + if (imdgPos.ControlTemperature_CEL.HasValue) + rootIMDG.ControlTemperature_CEL = (float)imdgPos.ControlTemperature_CEL.Value; + rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue; + if (imdgPos.EmergencyTemperature_CEL.HasValue) + rootIMDG.EmergencyTemperature_CEL = (float)imdgPos.EmergencyTemperature_CEL.Value; + if (imdgPos.SubsidiaryRiskList.Count > 0) + { + rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count]; + for (int sCount = 0; sCount < imdgPos.SubsidiaryRiskList.Count; sCount++) + rootIMDG.SubsidiaryRisks[sCount] = imdgPos.SubsidiaryRiskList[sCount].SubsidiaryRisk; + } + if (imdgPos.MarinePollutant.HasValue) + rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootHAZADPGOnArrivalDPGItemIMDGMarinePollutant.Y : RootHAZADPGOnArrivalDPGItemIMDGMarinePollutant.N; + if (imdgPos.NumberOfPackages.HasValue) + rootIMDG.NumberOfPackages = imdgPos.NumberOfPackages.Value; + rootIMDG.PackageType = imdgPos.PackageType; + if (imdgPos.LimitedQuantities.HasValue) + rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootHAZADPGOnArrivalDPGItemIMDGLimitedQuantities.Y : RootHAZADPGOnArrivalDPGItemIMDGLimitedQuantities.N; + if (imdgPos.ExceptedQuantities.HasValue) + rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootHAZADPGOnArrivalDPGItemIMDGExceptedQuantities.Y : RootHAZADPGOnArrivalDPGItemIMDGExceptedQuantities.N; + rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue; + if (imdgPos.NetQuantity_KGM.HasValue) + rootIMDG.NetQuantity_KGM = (float)imdgPos.NetQuantity_KGM.Value; + rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue; + if (imdgPos.GrossQuantity_KGM.HasValue) + rootIMDG.GrossQuantity_KGM = (float)imdgPos.GrossQuantity_KGM.Value; + rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue; + if (imdgPos.Volume_MTQ.HasValue) + rootIMDG.Volume_MTQ = (float)imdgPos.Volume_MTQ.Value; + rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; + if (imdgPos.GeneralCargoIBC.HasValue) + rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootHAZADPGOnArrivalDPGItemIMDGGeneralCargoIBC.Y : RootHAZADPGOnArrivalDPGItemIMDGGeneralCargoIBC.N; + rootIMDG.ContainerNumber = imdgPos.ContainerNumber; + rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; + rootIMDG.StowagePosition = imdgPos.StowagePosition; + rootIMDG.PortOfLoading = imdgPos.PortOfLoading; + rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge; + rootIMDG.Remarks = imdgPos.Remarks; + + dpgOnArrival.DPGItemIMDG[i] = rootIMDG; + } + } + #endregion + + #region IBC + if (haz.IBCPositions.Count > 0) + { + dpgOnArrival.DPGItemIBC = new RootHAZADPGOnArrivalDPGItemIBC[haz.IBCPositions.Count]; + for (int i = 0; i < haz.IBCPositions.Count; i++) + { + RootHAZADPGOnArrivalDPGItemIBC rootIBC = new RootHAZADPGOnArrivalDPGItemIBC(); + IBCPosition ibcPos = haz.IBCPositions[i]; + + rootIBC.ProductName = ibcPos.ProductName; + if (ibcPos.PollutionCategory.HasValue) + rootIBC.PollutionCategory = (RootHAZADPGOnArrivalDPGItemIBCPollutionCategory)ibcPos.PollutionCategory.Value; + rootIBC.HazardsSpecified = ibcPos.Hazards.HasValue; + if (ibcPos.Hazards.HasValue) + rootIBC.Hazards = (RootHAZADPGOnArrivalDPGItemIBCHazards)ibcPos.Hazards.Value; + if (ibcPos.FlashpointInformation.HasValue) + rootIBC.FlashpointInformation = (RootHAZADPGOnArrivalDPGItemIBCFlashpointInformation)ibcPos.FlashpointInformation.Value; + rootIBC.Flashpoint_CEL = ibcPos.Flashpoint_CEL; + if (ibcPos.Quantity_KGM.HasValue) + rootIBC.Quantity_KGM = (float)ibcPos.Quantity_KGM.Value; + rootIBC.StowagePosition = ibcPos.StowagePosition; + rootIBC.PortOfLoading = ibcPos.PortOfLoading; + rootIBC.PortOfDischarge = ibcPos.PortOfDischarge; + rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue; + if (ibcPos.SpecRef15_19.HasValue) + rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootHAZADPGOnArrivalDPGItemIBCSpecRef15_19.Y : RootHAZADPGOnArrivalDPGItemIBCSpecRef15_19.N; + rootIBC.Remarks = ibcPos.Remarks; + + dpgOnArrival.DPGItemIBC[i] = rootIBC; + } + } + #endregion + + #region IGC + if (haz.IGCPositions.Count > 0) + { + dpgOnArrival.DPGItemIGC = new RootHAZADPGOnArrivalDPGItemIGC[haz.IGCPositions.Count]; + for (int i = 0; i < haz.IGCPositions.Count; i++) + { + RootHAZADPGOnArrivalDPGItemIGC rootIGC = new RootHAZADPGOnArrivalDPGItemIGC(); + IGCPosition igcPos = haz.IGCPositions[i]; + + rootIGC.UNNumber = igcPos.UNNumber; + rootIGC.IMOClass = igcPos.IMOClass; + rootIGC.ProductName = igcPos.ProductName; + if (igcPos.Quantity_KGM.HasValue) + rootIGC.Quantity_KGM = (float)igcPos.Quantity_KGM.Value; + rootIGC.StowagePosition = igcPos.StowagePosition; + rootIGC.PortOfLoading = igcPos.PortOfLoading; + rootIGC.PortOfDischarge = igcPos.PortOfDischarge; + rootIGC.Remarks = igcPos.Remarks; + + dpgOnArrival.DPGItemIGC[i] = rootIGC; + } + } + #endregion + + #region IMSBC + if (haz.IMSBCPositions.Count > 0) + { + dpgOnArrival.DPGItemIMSBC = new RootHAZADPGOnArrivalDPGItemIMSBC[haz.IMSBCPositions.Count]; + for (int i = 0; i < haz.IMSBCPositions.Count; i++) + { + RootHAZADPGOnArrivalDPGItemIMSBC rootIMSBC = new RootHAZADPGOnArrivalDPGItemIMSBC(); + IMSBCPosition imsbcPos = haz.IMSBCPositions[i]; + + rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName; + if (imsbcPos.MHB.HasValue) + rootIMSBC.MHB = imsbcPos.MHB.Value ? RootHAZADPGOnArrivalDPGItemIMSBCMHB.Y : RootHAZADPGOnArrivalDPGItemIMSBCMHB.N; + rootIMSBC.UNNumber = imsbcPos.UNNumber; + rootIMSBC.IMOClass = imsbcPos.IMOClass; + if (imsbcPos.Quantity_KGM.HasValue) + rootIMSBC.Quantity_KGM = (float)imsbcPos.Quantity_KGM.Value; + rootIMSBC.StowagePosition = imsbcPos.StowagePosition; + rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading; + rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge; + rootIMSBC.Remarks = imsbcPos.Remarks; + + dpgOnArrival.DPGItemIMSBC[i] = rootIMSBC; + } + } + #endregion + + #region MARPOL_ANNEX_I + if (haz.MARPOLPositions.Count > 0) + { + dpgOnArrival.DPGItemMARPOLAnnexI = new RootHAZADPGOnArrivalDPGItemMARPOLAnnexI[haz.MARPOLPositions.Count]; + for (int i = 0; i < haz.MARPOLPositions.Count; i++) + { + RootHAZADPGOnArrivalDPGItemMARPOLAnnexI rootMarpol = new RootHAZADPGOnArrivalDPGItemMARPOLAnnexI(); + MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i]; + + rootMarpol.Name = marpolPos.Name; + if (marpolPos.FlashpointInformation.HasValue) + rootMarpol.FlashpointInformation = (RootHAZADPGOnArrivalDPGItemMARPOLAnnexIFlashpointInformation)marpolPos.FlashpointInformation.Value; + rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL; + if (marpolPos.Quantity_KGM.HasValue) + rootMarpol.Quantity_KGM = (float)marpolPos.Quantity_KGM.Value; + rootMarpol.StowagePosition = marpolPos.StowagePosition; + rootMarpol.PortOfLoading = marpolPos.PortOfLoading; + rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge; + rootMarpol.Remarks = marpolPos.Remarks; + + dpgOnArrival.DPGItemMARPOLAnnexI[i] = rootMarpol; + } + } + #endregion + + rootHAZA.Items[1] = dpgOnArrival; + + #endregion + + if (haz.INFShipClass.HasValue) + { + RootHAZAINFShipClass infShipClass = (RootHAZAINFShipClass)haz.INFShipClass.Value; + rootHAZA.Items[2] = infShipClass; + } + } item = rootHAZA; } @@ -1112,211 +1120,222 @@ namespace bsmd.dbh { RootHAZD rootHAZD = new RootHAZD(); HAZ haz = message.Elements[0] as HAZ; - rootHAZD.Items = new object[4]; - - if (haz.DPGManifestOnBoardOnArrival.HasValue) - rootHAZD.Items[0] = haz.DPGManifestOnBoardOnArrival.Value ? RootHAZDDPGManifestOnBoardOnDeparture.Y : RootHAZDDPGManifestOnBoardOnDeparture.N; - - #region HAZ positions - RootHAZDDPGOnDeparture dpgOnDeparture = new RootHAZDDPGOnDeparture(); - - #region IMDG - if (haz.IMDGPositions.Count > 0) - { - dpgOnDeparture.DPGItemIMDG = new RootHAZDDPGOnDepartureDPGItemIMDG[haz.IMDGPositions.Count]; - for (int i = 0; i < haz.IMDGPositions.Count; i++) - { - IMDGPosition imdgPos = haz.IMDGPositions[i]; - RootHAZDDPGOnDepartureDPGItemIMDG rootIMDG = new RootHAZDDPGOnDepartureDPGItemIMDG(); - - rootIMDG.UNNumber = imdgPos.UNNumber; - if (imdgPos.PackingGroup.HasValue) - rootIMDG.PackingGroup = (RootHAZDDPGOnDepartureDPGItemIMDGPackingGroup)imdgPos.PackingGroup.Value; - rootIMDG.ProperShippingName = imdgPos.ProperShippingName; - rootIMDG.IMOClass = imdgPos.IMOClass; - rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup; - rootIMDG.TechnicalName = imdgPos.TechnicalName; - rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue; - if (imdgPos.NetExplosiveMass_KGM.HasValue) - rootIMDG.NetExplosiveMass_KGM = (float)imdgPos.NetExplosiveMass_KGM.Value; - rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL; - rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName; - rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue; - if (imdgPos.Class7MaxActivity_BQL.HasValue) - rootIMDG.Class7MaxActivity_BQL = (float)imdgPos.Class7MaxActivity_BQL.Value; - rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue; - if (imdgPos.Class7Category.HasValue) - rootIMDG.Class7Category = imdgPos.Class7Category.Value; - rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue; - if (imdgPos.Class7TransportIndex.HasValue) - rootIMDG.Class7TransportIndex = (float)imdgPos.Class7TransportIndex.Value; - rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue; - if (imdgPos.Class7CSI.HasValue) - rootIMDG.Class7CSI = imdgPos.Class7CSI.Value; - rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue; - if (imdgPos.ControlTemperature_CEL.HasValue) - rootIMDG.ControlTemperature_CEL = (float)imdgPos.ControlTemperature_CEL.Value; - rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue; - if (imdgPos.EmergencyTemperature_CEL.HasValue) - rootIMDG.EmergencyTemperature_CEL = (float)imdgPos.EmergencyTemperature_CEL.Value; - if (imdgPos.SubsidiaryRiskList.Count > 0) - { - rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count]; - for (int sCount = 0; sCount < imdgPos.SubsidiaryRiskList.Count; sCount++) - rootIMDG.SubsidiaryRisks[sCount] = imdgPos.SubsidiaryRiskList[sCount].SubsidiaryRisk; - } - if (imdgPos.MarinePollutant.HasValue) - rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootHAZDDPGOnDepartureDPGItemIMDGMarinePollutant.Y : RootHAZDDPGOnDepartureDPGItemIMDGMarinePollutant.N; - if (imdgPos.NumberOfPackages.HasValue) - rootIMDG.NumberOfPackages = imdgPos.NumberOfPackages.Value; - rootIMDG.PackageType = imdgPos.PackageType; - if (imdgPos.LimitedQuantities.HasValue) - rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootHAZDDPGOnDepartureDPGItemIMDGLimitedQuantities.Y : RootHAZDDPGOnDepartureDPGItemIMDGLimitedQuantities.N; - if (imdgPos.ExceptedQuantities.HasValue) - rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootHAZDDPGOnDepartureDPGItemIMDGExceptedQuantities.Y : RootHAZDDPGOnDepartureDPGItemIMDGExceptedQuantities.N; - rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue; - if (imdgPos.NetQuantity_KGM.HasValue) - rootIMDG.NetQuantity_KGM = (float)imdgPos.NetQuantity_KGM.Value; - rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue; - if (imdgPos.GrossQuantity_KGM.HasValue) - rootIMDG.GrossQuantity_KGM = (float)imdgPos.GrossQuantity_KGM.Value; - rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue; - if (imdgPos.Volume_MTQ.HasValue) - rootIMDG.Volume_MTQ = (float)imdgPos.Volume_MTQ.Value; - rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; - if (imdgPos.GeneralCargoIBC.HasValue) - rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootHAZDDPGOnDepartureDPGItemIMDGGeneralCargoIBC.Y : RootHAZDDPGOnDepartureDPGItemIMDGGeneralCargoIBC.N; - rootIMDG.ContainerNumber = imdgPos.ContainerNumber; - rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; - rootIMDG.StowagePosition = imdgPos.StowagePosition; - rootIMDG.PortOfLoading = imdgPos.PortOfLoading; - rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge; - rootIMDG.Remarks = imdgPos.Remarks; - - dpgOnDeparture.DPGItemIMDG[i] = rootIMDG; - } - } - #endregion - - #region IBC - if (haz.IBCPositions.Count > 0) - { - dpgOnDeparture.DPGItemIBC = new RootHAZDDPGOnDepartureDPGItemIBC[haz.IBCPositions.Count]; - for (int i = 0; i < haz.IBCPositions.Count; i++) - { - RootHAZDDPGOnDepartureDPGItemIBC rootIBC = new RootHAZDDPGOnDepartureDPGItemIBC(); - IBCPosition ibcPos = haz.IBCPositions[i]; - - rootIBC.ProductName = ibcPos.ProductName; - if (ibcPos.PollutionCategory.HasValue) - rootIBC.PollutionCategory = (RootHAZDDPGOnDepartureDPGItemIBCPollutionCategory)ibcPos.PollutionCategory.Value; - rootIBC.HazardsSpecified = ibcPos.Hazards.HasValue; - if (ibcPos.Hazards.HasValue) - rootIBC.Hazards = (RootHAZDDPGOnDepartureDPGItemIBCHazards)ibcPos.Hazards.Value; - if (ibcPos.FlashpointInformation.HasValue) - rootIBC.FlashpointInformation = (RootHAZDDPGOnDepartureDPGItemIBCFlashpointInformation)ibcPos.FlashpointInformation.Value; - rootIBC.Flashpoint_CEL = ibcPos.Flashpoint_CEL; - if (ibcPos.Quantity_KGM.HasValue) - rootIBC.Quantity_KGM = (float)ibcPos.Quantity_KGM.Value; - rootIBC.StowagePosition = ibcPos.StowagePosition; - rootIBC.PortOfLoading = ibcPos.PortOfLoading; - rootIBC.PortOfDischarge = ibcPos.PortOfDischarge; - rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue; - if (ibcPos.SpecRef15_19.HasValue) - rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootHAZDDPGOnDepartureDPGItemIBCSpecRef15_19.Y : RootHAZDDPGOnDepartureDPGItemIBCSpecRef15_19.N; - rootIBC.Remarks = ibcPos.Remarks; - - dpgOnDeparture.DPGItemIBC[i] = rootIBC; - } - } - #endregion - - #region IGC - if (haz.IGCPositions.Count > 0) - { - dpgOnDeparture.DPGItemIGC = new RootHAZDDPGOnDepartureDPGItemIGC[haz.IGCPositions.Count]; - for (int i = 0; i < haz.IGCPositions.Count; i++) - { - RootHAZDDPGOnDepartureDPGItemIGC rootIGC = new RootHAZDDPGOnDepartureDPGItemIGC(); - IGCPosition igcPos = haz.IGCPositions[i]; - - rootIGC.UNNumber = igcPos.UNNumber; - rootIGC.IMOClass = igcPos.IMOClass; - rootIGC.ProductName = igcPos.ProductName; - if (igcPos.Quantity_KGM.HasValue) - rootIGC.Quantity_KGM = (float)igcPos.Quantity_KGM.Value; - rootIGC.StowagePosition = igcPos.StowagePosition; - rootIGC.PortOfLoading = igcPos.PortOfLoading; - rootIGC.PortOfDischarge = igcPos.PortOfDischarge; - rootIGC.Remarks = igcPos.Remarks; - - dpgOnDeparture.DPGItemIGC[i] = rootIGC; - } - } - #endregion - - #region IMSBC - if (haz.IMSBCPositions.Count > 0) - { - dpgOnDeparture.DPGItemIMSBC = new RootHAZDDPGOnDepartureDPGItemIMSBC[haz.IMSBCPositions.Count]; - for (int i = 0; i < haz.IMSBCPositions.Count; i++) - { - RootHAZDDPGOnDepartureDPGItemIMSBC rootIMSBC = new RootHAZDDPGOnDepartureDPGItemIMSBC(); - IMSBCPosition imsbcPos = haz.IMSBCPositions[i]; - - rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName; - if (imsbcPos.MHB.HasValue) - rootIMSBC.MHB = imsbcPos.MHB.Value ? RootHAZDDPGOnDepartureDPGItemIMSBCMHB.Y : RootHAZDDPGOnDepartureDPGItemIMSBCMHB.N; - rootIMSBC.UNNumber = imsbcPos.UNNumber; - rootIMSBC.IMOClass = imsbcPos.IMOClass; - if (imsbcPos.Quantity_KGM.HasValue) - rootIMSBC.Quantity_KGM = (float)imsbcPos.Quantity_KGM.Value; - rootIMSBC.StowagePosition = imsbcPos.StowagePosition; - rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading; - rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge; - rootIMSBC.Remarks = imsbcPos.Remarks; - - dpgOnDeparture.DPGItemIMSBC[i] = rootIMSBC; - } - } - #endregion - - #region MARPOL_ANNEX_I - if (haz.MARPOLPositions.Count > 0) - { - dpgOnDeparture.DPGItemMARPOLAnnexI = new RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI[haz.MARPOLPositions.Count]; - for (int i = 0; i < haz.MARPOLPositions.Count; i++) - { - RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI rootMarpol = new RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI(); - MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i]; - - rootMarpol.Name = marpolPos.Name; - if (marpolPos.FlashpointInformation.HasValue) - rootMarpol.FlashpointInformation = (RootHAZDDPGOnDepartureDPGItemMARPOLAnnexIFlashpointInformation)marpolPos.FlashpointInformation.Value; - rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL; - if (marpolPos.Quantity_KGM.HasValue) - rootMarpol.Quantity_KGM = (float)marpolPos.Quantity_KGM.Value; - rootMarpol.StowagePosition = marpolPos.StowagePosition; - rootMarpol.PortOfLoading = marpolPos.PortOfLoading; - rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge; - rootMarpol.Remarks = marpolPos.Remarks; - - dpgOnDeparture.DPGItemMARPOLAnnexI[i] = rootMarpol; - } - } - #endregion - - rootHAZD.Items[1] = dpgOnDeparture; - #endregion - - if (haz.INFShipClass.HasValue) - { - RootHAZDINFShipClass infShipClass = (RootHAZDINFShipClass)haz.INFShipClass.Value; - rootHAZD.Items[2] = infShipClass; - } - + if (haz.NoDPGOnBoardOnArrival ?? false) + { + rootHAZD.Items = new object[1]; rootHAZD.Items[3] = RootHAZDNoDPGOnBoardOnDeparture.Y; + } + + else + { + rootHAZD.Items = new object[3]; + + if (haz.DPGManifestOnBoardOnArrival.HasValue) + rootHAZD.Items[0] = haz.DPGManifestOnBoardOnArrival.Value ? RootHAZDDPGManifestOnBoardOnDeparture.Y : RootHAZDDPGManifestOnBoardOnDeparture.N; + + #region HAZ positions + + RootHAZDDPGOnDeparture dpgOnDeparture = new RootHAZDDPGOnDeparture(); + + #region IMDG + if (haz.IMDGPositions.Count > 0) + { + dpgOnDeparture.DPGItemIMDG = new RootHAZDDPGOnDepartureDPGItemIMDG[haz.IMDGPositions.Count]; + for (int i = 0; i < haz.IMDGPositions.Count; i++) + { + IMDGPosition imdgPos = haz.IMDGPositions[i]; + RootHAZDDPGOnDepartureDPGItemIMDG rootIMDG = new RootHAZDDPGOnDepartureDPGItemIMDG(); + + rootIMDG.UNNumber = imdgPos.UNNumber; + if (imdgPos.PackingGroup.HasValue) + rootIMDG.PackingGroup = (RootHAZDDPGOnDepartureDPGItemIMDGPackingGroup)imdgPos.PackingGroup.Value; + rootIMDG.ProperShippingName = imdgPos.ProperShippingName; + rootIMDG.IMOClass = imdgPos.IMOClass; + rootIMDG.CompatibilityGroup = imdgPos.CompatibilityGroup; + rootIMDG.TechnicalName = imdgPos.TechnicalName; + rootIMDG.NetExplosiveMass_KGMSpecified = imdgPos.NetExplosiveMass_KGM.HasValue; + if (imdgPos.NetExplosiveMass_KGM.HasValue) + rootIMDG.NetExplosiveMass_KGM = (float)imdgPos.NetExplosiveMass_KGM.Value; + rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL; + rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName; + rootIMDG.Class7MaxActivity_BQLSpecified = imdgPos.Class7MaxActivity_BQL.HasValue; + if (imdgPos.Class7MaxActivity_BQL.HasValue) + rootIMDG.Class7MaxActivity_BQL = (float)imdgPos.Class7MaxActivity_BQL.Value; + rootIMDG.Class7CategorySpecified = imdgPos.Class7Category.HasValue; + if (imdgPos.Class7Category.HasValue) + rootIMDG.Class7Category = imdgPos.Class7Category.Value; + rootIMDG.Class7TransportIndexSpecified = imdgPos.Class7TransportIndex.HasValue; + if (imdgPos.Class7TransportIndex.HasValue) + rootIMDG.Class7TransportIndex = (float)imdgPos.Class7TransportIndex.Value; + rootIMDG.Class7CSISpecified = imdgPos.Class7CSI.HasValue; + if (imdgPos.Class7CSI.HasValue) + rootIMDG.Class7CSI = imdgPos.Class7CSI.Value; + rootIMDG.ControlTemperature_CELSpecified = imdgPos.ControlTemperature_CEL.HasValue; + if (imdgPos.ControlTemperature_CEL.HasValue) + rootIMDG.ControlTemperature_CEL = (float)imdgPos.ControlTemperature_CEL.Value; + rootIMDG.EmergencyTemperature_CELSpecified = imdgPos.EmergencyTemperature_CEL.HasValue; + if (imdgPos.EmergencyTemperature_CEL.HasValue) + rootIMDG.EmergencyTemperature_CEL = (float)imdgPos.EmergencyTemperature_CEL.Value; + if (imdgPos.SubsidiaryRiskList.Count > 0) + { + rootIMDG.SubsidiaryRisks = new string[imdgPos.SubsidiaryRiskList.Count]; + for (int sCount = 0; sCount < imdgPos.SubsidiaryRiskList.Count; sCount++) + rootIMDG.SubsidiaryRisks[sCount] = imdgPos.SubsidiaryRiskList[sCount].SubsidiaryRisk; + } + if (imdgPos.MarinePollutant.HasValue) + rootIMDG.MarinePollutant = imdgPos.MarinePollutant.Value ? RootHAZDDPGOnDepartureDPGItemIMDGMarinePollutant.Y : RootHAZDDPGOnDepartureDPGItemIMDGMarinePollutant.N; + if (imdgPos.NumberOfPackages.HasValue) + rootIMDG.NumberOfPackages = imdgPos.NumberOfPackages.Value; + rootIMDG.PackageType = imdgPos.PackageType; + if (imdgPos.LimitedQuantities.HasValue) + rootIMDG.LimitedQuantities = imdgPos.LimitedQuantities.Value ? RootHAZDDPGOnDepartureDPGItemIMDGLimitedQuantities.Y : RootHAZDDPGOnDepartureDPGItemIMDGLimitedQuantities.N; + if (imdgPos.ExceptedQuantities.HasValue) + rootIMDG.ExceptedQuantities = imdgPos.ExceptedQuantities.Value ? RootHAZDDPGOnDepartureDPGItemIMDGExceptedQuantities.Y : RootHAZDDPGOnDepartureDPGItemIMDGExceptedQuantities.N; + rootIMDG.NetQuantity_KGMSpecified = imdgPos.NetQuantity_KGM.HasValue; + if (imdgPos.NetQuantity_KGM.HasValue) + rootIMDG.NetQuantity_KGM = (float)imdgPos.NetQuantity_KGM.Value; + rootIMDG.GrossQuantity_KGMSpecified = imdgPos.GrossQuantity_KGM.HasValue; + if (imdgPos.GrossQuantity_KGM.HasValue) + rootIMDG.GrossQuantity_KGM = (float)imdgPos.GrossQuantity_KGM.Value; + rootIMDG.Volume_MTQSpecified = imdgPos.Volume_MTQ.HasValue; + if (imdgPos.Volume_MTQ.HasValue) + rootIMDG.Volume_MTQ = (float)imdgPos.Volume_MTQ.Value; + rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; + if (imdgPos.GeneralCargoIBC.HasValue) + rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootHAZDDPGOnDepartureDPGItemIMDGGeneralCargoIBC.Y : RootHAZDDPGOnDepartureDPGItemIMDGGeneralCargoIBC.N; + rootIMDG.ContainerNumber = imdgPos.ContainerNumber; + rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; + rootIMDG.StowagePosition = imdgPos.StowagePosition; + rootIMDG.PortOfLoading = imdgPos.PortOfLoading; + rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge; + rootIMDG.Remarks = imdgPos.Remarks; + + dpgOnDeparture.DPGItemIMDG[i] = rootIMDG; + } + } + #endregion + + #region IBC + if (haz.IBCPositions.Count > 0) + { + dpgOnDeparture.DPGItemIBC = new RootHAZDDPGOnDepartureDPGItemIBC[haz.IBCPositions.Count]; + for (int i = 0; i < haz.IBCPositions.Count; i++) + { + RootHAZDDPGOnDepartureDPGItemIBC rootIBC = new RootHAZDDPGOnDepartureDPGItemIBC(); + IBCPosition ibcPos = haz.IBCPositions[i]; + + rootIBC.ProductName = ibcPos.ProductName; + if (ibcPos.PollutionCategory.HasValue) + rootIBC.PollutionCategory = (RootHAZDDPGOnDepartureDPGItemIBCPollutionCategory)ibcPos.PollutionCategory.Value; + rootIBC.HazardsSpecified = ibcPos.Hazards.HasValue; + if (ibcPos.Hazards.HasValue) + rootIBC.Hazards = (RootHAZDDPGOnDepartureDPGItemIBCHazards)ibcPos.Hazards.Value; + if (ibcPos.FlashpointInformation.HasValue) + rootIBC.FlashpointInformation = (RootHAZDDPGOnDepartureDPGItemIBCFlashpointInformation)ibcPos.FlashpointInformation.Value; + rootIBC.Flashpoint_CEL = ibcPos.Flashpoint_CEL; + if (ibcPos.Quantity_KGM.HasValue) + rootIBC.Quantity_KGM = (float)ibcPos.Quantity_KGM.Value; + rootIBC.StowagePosition = ibcPos.StowagePosition; + rootIBC.PortOfLoading = ibcPos.PortOfLoading; + rootIBC.PortOfDischarge = ibcPos.PortOfDischarge; + rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue; + if (ibcPos.SpecRef15_19.HasValue) + rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootHAZDDPGOnDepartureDPGItemIBCSpecRef15_19.Y : RootHAZDDPGOnDepartureDPGItemIBCSpecRef15_19.N; + rootIBC.Remarks = ibcPos.Remarks; + + dpgOnDeparture.DPGItemIBC[i] = rootIBC; + } + } + #endregion + + #region IGC + if (haz.IGCPositions.Count > 0) + { + dpgOnDeparture.DPGItemIGC = new RootHAZDDPGOnDepartureDPGItemIGC[haz.IGCPositions.Count]; + for (int i = 0; i < haz.IGCPositions.Count; i++) + { + RootHAZDDPGOnDepartureDPGItemIGC rootIGC = new RootHAZDDPGOnDepartureDPGItemIGC(); + IGCPosition igcPos = haz.IGCPositions[i]; + + rootIGC.UNNumber = igcPos.UNNumber; + rootIGC.IMOClass = igcPos.IMOClass; + rootIGC.ProductName = igcPos.ProductName; + if (igcPos.Quantity_KGM.HasValue) + rootIGC.Quantity_KGM = (float)igcPos.Quantity_KGM.Value; + rootIGC.StowagePosition = igcPos.StowagePosition; + rootIGC.PortOfLoading = igcPos.PortOfLoading; + rootIGC.PortOfDischarge = igcPos.PortOfDischarge; + rootIGC.Remarks = igcPos.Remarks; + + dpgOnDeparture.DPGItemIGC[i] = rootIGC; + } + } + #endregion + + #region IMSBC + if (haz.IMSBCPositions.Count > 0) + { + dpgOnDeparture.DPGItemIMSBC = new RootHAZDDPGOnDepartureDPGItemIMSBC[haz.IMSBCPositions.Count]; + for (int i = 0; i < haz.IMSBCPositions.Count; i++) + { + RootHAZDDPGOnDepartureDPGItemIMSBC rootIMSBC = new RootHAZDDPGOnDepartureDPGItemIMSBC(); + IMSBCPosition imsbcPos = haz.IMSBCPositions[i]; + + rootIMSBC.BulkCargoShippingName = imsbcPos.BulkCargoShippingName; + if (imsbcPos.MHB.HasValue) + rootIMSBC.MHB = imsbcPos.MHB.Value ? RootHAZDDPGOnDepartureDPGItemIMSBCMHB.Y : RootHAZDDPGOnDepartureDPGItemIMSBCMHB.N; + rootIMSBC.UNNumber = imsbcPos.UNNumber; + rootIMSBC.IMOClass = imsbcPos.IMOClass; + if (imsbcPos.Quantity_KGM.HasValue) + rootIMSBC.Quantity_KGM = (float)imsbcPos.Quantity_KGM.Value; + rootIMSBC.StowagePosition = imsbcPos.StowagePosition; + rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading; + rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge; + rootIMSBC.Remarks = imsbcPos.Remarks; + + dpgOnDeparture.DPGItemIMSBC[i] = rootIMSBC; + } + } + #endregion + + #region MARPOL_ANNEX_I + if (haz.MARPOLPositions.Count > 0) + { + dpgOnDeparture.DPGItemMARPOLAnnexI = new RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI[haz.MARPOLPositions.Count]; + for (int i = 0; i < haz.MARPOLPositions.Count; i++) + { + RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI rootMarpol = new RootHAZDDPGOnDepartureDPGItemMARPOLAnnexI(); + MARPOL_Annex_I_Position marpolPos = haz.MARPOLPositions[i]; + + rootMarpol.Name = marpolPos.Name; + if (marpolPos.FlashpointInformation.HasValue) + rootMarpol.FlashpointInformation = (RootHAZDDPGOnDepartureDPGItemMARPOLAnnexIFlashpointInformation)marpolPos.FlashpointInformation.Value; + rootMarpol.Flashpoint_CEL = marpolPos.Flashpoint_CEL; + if (marpolPos.Quantity_KGM.HasValue) + rootMarpol.Quantity_KGM = (float)marpolPos.Quantity_KGM.Value; + rootMarpol.StowagePosition = marpolPos.StowagePosition; + rootMarpol.PortOfLoading = marpolPos.PortOfLoading; + rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge; + rootMarpol.Remarks = marpolPos.Remarks; + + dpgOnDeparture.DPGItemMARPOLAnnexI[i] = rootMarpol; + } + } + #endregion + + rootHAZD.Items[1] = dpgOnDeparture; + + #endregion + + if (haz.INFShipClass.HasValue) + { + RootHAZDINFShipClass infShipClass = (RootHAZDINFShipClass)haz.INFShipClass.Value; + rootHAZD.Items[2] = infShipClass; + } + + } + item = rootHAZD; } diff --git a/nsw/Source/bsmd.herberg.FormService/FormService.cs b/nsw/Source/bsmd.herberg.FormService/FormService.cs index 62efd76a..f27f5920 100644 --- a/nsw/Source/bsmd.herberg.FormService/FormService.cs +++ b/nsw/Source/bsmd.herberg.FormService/FormService.cs @@ -35,11 +35,13 @@ namespace bsmd.herberg.FormService this.EventLog.Log = "Application"; this.Init(args); this.EventLog.WriteEntry("FormService started.", EventLogEntryType.Information); + this._log.Info("Starting EU-NOAD FormService."); this.DoOnce(); } protected override void OnStop() { + this._log.Info("Stopping EU-NOAD FormService."); } public void Init(string[] args) diff --git a/nsw/Source/bsmd.herberg.FormService/Properties/AssemblyInfo.cs b/nsw/Source/bsmd.herberg.FormService/Properties/AssemblyInfo.cs index 4ff0d72e..d5321544 100644 --- a/nsw/Source/bsmd.herberg.FormService/Properties/AssemblyInfo.cs +++ b/nsw/Source/bsmd.herberg.FormService/Properties/AssemblyInfo.cs @@ -6,12 +6,7 @@ using System.Runtime.InteropServices; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("bsmd.herberg.FormService")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("bsmd.herberg.FormService")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] +[assembly: AssemblyDescription("Imports Herberg Fleettracker form data")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible @@ -21,16 +16,3 @@ using System.Runtime.InteropServices; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("663d14d2-42ce-4efd-9915-82254b211d81")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/nsw/Source/bsmd.herberg.FormService/Util.cs b/nsw/Source/bsmd.herberg.FormService/Util.cs index 44658bb9..cb2d208a 100644 --- a/nsw/Source/bsmd.herberg.FormService/Util.cs +++ b/nsw/Source/bsmd.herberg.FormService/Util.cs @@ -651,9 +651,11 @@ namespace bsmd.herberg.FormService #region CREW case "CREW": { + Dictionary keysInMessage = new Dictionary(); foreach (int key in nDict.Keys) { Dictionary pDict = nDict[key]; + keysInMessage.Add(key.ToString(), key.ToString()); CREW crew = theMessage.GetSublistElementWithIdentifier(key.ToString()) as CREW; if (crew == null) { @@ -680,9 +682,18 @@ namespace bsmd.herberg.FormService { _log.ErrorFormat("Error reading CREW fields: {0}", ex.Message); } - saveMessages.Add(crew); - } + } + // check for missing messages (crew deleted in EU-NOAD) + foreach (CREW crew in theMessage.Elements) + { + if (!keysInMessage.ContainsKey(crew.Identifier)) + { + _log.InfoFormat("CREW {0} {1}, Ident {2} not found in EU-NOAD message, removing!", + crew.CrewMemberLastName ?? "", crew.CrewMemberFirstName ?? "", crew.Identifier); + DBManager.Instance.Delete(crew); + } + } } break; #endregion @@ -816,9 +827,11 @@ namespace bsmd.herberg.FormService #region PAS case "PAS": { + Dictionary keysInMessage = new Dictionary(); foreach (int key in nDict.Keys) { Dictionary pDict = nDict[key]; + keysInMessage.Add(key.ToString(), key.ToString()); PAS pas = theMessage.GetSublistElementWithIdentifier(key.ToString()) as PAS; if (pas == null) { @@ -852,6 +865,16 @@ namespace bsmd.herberg.FormService saveMessages.Add(pas); } + // check for missing messages (passenger deleted in EU-NOAD) + foreach (PAS pas in theMessage.Elements) + { + if (!keysInMessage.ContainsKey(pas.Identifier)) + { + _log.InfoFormat("PAS {0} {1}, Ident {2} not found in EU-NOAD message, removing!", + pas.PassengerLastName ?? "", pas.PassengerFirstName ?? "", pas.Identifier); + DBManager.Instance.Delete(pas); + } + } } break; #endregion diff --git a/nsw/Source/bsmd.herberg.FormService/bsmd.herberg.FormService.csproj b/nsw/Source/bsmd.herberg.FormService/bsmd.herberg.FormService.csproj index 4d10a4a8..c0013931 100644 --- a/nsw/Source/bsmd.herberg.FormService/bsmd.herberg.FormService.csproj +++ b/nsw/Source/bsmd.herberg.FormService/bsmd.herberg.FormService.csproj @@ -62,6 +62,15 @@ + + Properties\AssemblyProductInfo.cs + + + Properties\AssemblyProjectInfo.cs + + + Properties\AssemblyProjectKeyInfo.cs + Component