diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index 5446d2eb..26819c41 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/SQL/purge.sql b/nsw/Source/SQL/purge.sql index 627e135c..77647504 100644 --- a/nsw/Source/SQL/purge.sql +++ b/nsw/Source/SQL/purge.sql @@ -24,6 +24,14 @@ PRINT 'Deleting WasteDisposalServiceProvider' DELETE FROM WasteDisposalServiceProvider PRINT 'Deleting Waste' DELETE FROM Waste +PRINT 'Deleting InfectedArea' +DELETE FROM InfectedArea +PRINT 'Deleting SanitaryMeasuresDetail' +DELETE FROM SanitaryMeasuresDetail +PRINT 'Deleting StowawaysJoiningLocation' +DELETE FROM StowawaysJoiningLocation +PRINT 'Deleting SubsidiaryRisks' +DELETE FROM SubsidiaryRisks -- DELETE FROM ReportingParty @@ -35,6 +43,8 @@ PRINT 'Deleting Customer' DELETE FROM Customer PRINT 'Deleting CallPurpose' DELETE FROM CallPurpose +PRINT 'Deleting AGNT' +DELETE FROM AGNT PRINT 'Deleting ATA' DELETE FROM ATA PRINT 'Deleting ATD' diff --git a/nsw/Source/bsmd.database/HAZ.cs b/nsw/Source/bsmd.database/HAZ.cs index 4ab6db61..e8ed0234 100644 --- a/nsw/Source/bsmd.database/HAZ.cs +++ b/nsw/Source/bsmd.database/HAZ.cs @@ -25,9 +25,7 @@ namespace bsmd.database private bool _isDeparture; public HAZ() - { - this.tablename = "[dbo].[HAZA]"; // muss noch umschaltbar - } + { } #region Properties @@ -71,12 +69,9 @@ namespace bsmd.database // selektor HAZA / HAZD [ShowReport] - public bool IsDeparture { get { return this._isDeparture; } - set - { - this._isDeparture = value; - this.tablename = this._isDeparture ? "[dbo].[HAZD]" : "[dbo].[HAZA]"; - } + public bool IsDeparture { + get { return this._isDeparture; } + set { this._isDeparture = value; } } /// @@ -89,6 +84,18 @@ namespace bsmd.database #region DatabaseEntity implementation + + public new string Tablename + { + get + { + if (this._isDeparture) + return "[dbo].[HAZD]"; + else + return "[dbo].[HAZA]"; + } + } + public override void PrepareSave(System.Data.IDbCommand cmd) { SqlCommand scmd = cmd as SqlCommand; diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 2a63217f..dfca7500 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.4")] +[assembly: AssemblyInformationalVersion("3.0.5")] [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 df71804a..ba7a8d5e 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.4.*")] +[assembly: AssemblyVersion("3.0.5.*")] diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index bfc01b63..20cf2067 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -556,7 +556,7 @@ namespace bsmd.dbh rootStat.MMSINumber = stat.MMSINumber; rootStat.Flag = stat.Flag; if (stat.LengthOverall_MTR.HasValue) rootStat.LengthOverall_MTR = Decimal.Round((decimal) (stat.LengthOverall_MTR.Value), 2); - if (stat.Beam_MTR.HasValue) rootStat.Beam_MTR = Decimal.Round((decimal) (stat.Beam_MTR.Value)); + if (stat.Beam_MTR.HasValue) rootStat.Beam_MTR = Decimal.Round((decimal) (stat.Beam_MTR.Value), 2); if (stat.GrossTonnage.HasValue) rootStat.GrossTonnage = stat.GrossTonnage.Value; rootStat.PortOfRegistry = stat.PortOfRegistry; rootStat.ShipType = stat.ShipType; @@ -899,16 +899,17 @@ namespace bsmd.dbh 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 - if (was.Waste[j - 5].WasteDisposalAmount_MTQ.HasValue) - rww.WasteDisposalAmount_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteDisposalAmount_MTQ.Value,3); + + rww.WasteDisposalAmount_MTQ = decimal.Round((decimal) (was.Waste[j - 5].WasteDisposalAmount_MTQ ?? 0), 3); + rww.WasteDetails = new RootWASWasteWasteDetails(); - if (was.Waste[j - 5].WasteCapacity_MTQ.HasValue) - rww.WasteDetails.WasteCapacity_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteCapacity_MTQ.Value,3); - if (was.Waste[j - 5].WasteAmountRetained_MTQ.HasValue) - rww.WasteDetails.WasteAmountRetained_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteAmountRetained_MTQ.Value,3); + + 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 (was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.HasValue) - rww.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = decimal.Round((decimal)was.Waste[j - 5].WasteAmountGeneratedTillNextPort_MTQ.Value, 3); + if (rww.WasteDetails.WasteDisposalPort.IsNullOrEmpty()) rww.WasteDetails.WasteDisposalPort = "ZZUKN"; + } } } diff --git a/nsw/Source/bsmd.herberg.FormService/Util.cs b/nsw/Source/bsmd.herberg.FormService/Util.cs index 98f59db9..0a7636fe 100644 --- a/nsw/Source/bsmd.herberg.FormService/Util.cs +++ b/nsw/Source/bsmd.herberg.FormService/Util.cs @@ -468,8 +468,9 @@ namespace bsmd.herberg.FormService if (mdh != null) { try - { + { if (vDict.ContainsKey("Simplification")) mdh.MDHSimplification = vDict["Simplification"].Equals("Y"); + else mdh.MDHSimplification = false; if (vDict.ContainsKey("PortOfCallWhereCompleteMDHNotified")) mdh.PortOfCallWhereCompleteMDHNotified = vDict["PortOfCallWhereCompleteMDHNotified"]; if (vDict.ContainsKey("NonAccidentialDeathsDuringVoyage")) mdh.NonAccidentalDeathsDuringVoyage = vDict["NonAccidentialDeathsDuringVoyage"].Equals("Y"); if (vDict.ContainsKey("NonAccidentialDeathsDuringVoyageCount")) mdh.NonAccidentalDeathsDuringVoyageCount = Int32.Parse(vDict["NonAccidentialDeathsDuringVoyageCount"]); @@ -923,7 +924,7 @@ namespace bsmd.herberg.FormService if (vDict.ContainsKey("ConstructionCharacteristicsOfShip")) info.ConstructionCharacteristicsOfShip = vDict["ConstructionCharacteristicsOfShip"]; if (vDict.ContainsKey("FumigatedBulkCargo") && !vDict["FumigatedBulkCargo"].IsNullOrEmpty()) { - info.FumigatedBulkCargo = (byte)Enum.Parse(typeof(Enums.FumigatedBulkCargo), vDict["FumigatedBulkCargo"]); + info.FumigatedBulkCargo = vDict["FumigatedBulkCargo"].Equals("0") ? (byte) 1 : (byte) 0; _log.DebugFormat("FumigatedBulkCargo {0} parsed to {1}", vDict["FumigatedBulkCargo"], info.FumigatedBulkCargo); } else @@ -1050,9 +1051,12 @@ namespace bsmd.herberg.FormService if (pDict.ContainsKey("PassengerVisaNumber")) pas.PassengerVisaNumber = pDict["PassengerVisaNumber"]; if (pDict.ContainsKey("PassengerPortCodeOfEmbarkation") && pDict.ContainsKey("PassengerCountryCodeOfEmbarkation")) pas.PassengerPortOfEmbarkation = pDict["PassengerCountryCodeOfEmbarkation"] + pDict["PassengerPortCodeOfEmbarkation"]; + if (pas.PassengerPortOfEmbarkation.IsNullOrEmpty()) pas.PassengerPortOfEmbarkation = "ZZUKN"; if (pDict.ContainsKey("PassengerPortCodeOfDisembarkation") && pDict.ContainsKey("PassengerCountryCodeOfDisembarkation")) - pas.PassengerPortOfDisembarkation = pDict["PassengerCountryCodeOfEmbarkation"] + pDict["PassengerPortCodeOfDisembarkation"]; + pas.PassengerPortOfDisembarkation = pDict["PassengerCountryCodeOfDisembarkation"] + pDict["PassengerPortCodeOfDisembarkation"]; + if (pas.PassengerPortOfDisembarkation.IsNullOrEmpty()) pas.PassengerPortOfDisembarkation = "ZZUKN"; if (pDict.ContainsKey("PassengerInTransit")) pas.PassengerInTransit = pDict["PassengerInTransit"].Equals("Y"); + else pas.PassengerInTransit = false; } catch (Exception ex) { @@ -1125,11 +1129,17 @@ namespace bsmd.herberg.FormService waste.WasteType = (byte) wCounter; if (vDict.ContainsKey(wda)) waste.WasteDisposalAmount_MTQ = Extensions.TryParseDouble(vDict[wda]); + else waste.WasteDisposalAmount_MTQ = 0; if (vDict.ContainsKey(wc)) waste.WasteCapacity_MTQ = Extensions.TryParseDouble(vDict[wc]); + else waste.WasteCapacity_MTQ = 0; if (vDict.ContainsKey(war)) waste.WasteAmountRetained_MTQ = Extensions.TryParseDouble(vDict[war]); + else waste.WasteAmountRetained_MTQ = 0; if (vDict.ContainsKey(wagtnp)) waste.WasteAmountGeneratedTillNextPort_MTQ = Extensions.TryParseDouble(vDict[wagtnp]); + else waste.WasteAmountGeneratedTillNextPort_MTQ = 0; if ((vDict.ContainsKey(wdpc)) && (vDict.ContainsKey(wdcc))) waste.WasteDisposalPort = vDict[wdcc] + vDict[wdpc]; + else waste.WasteDisposalPort = "ZZUKN"; if (vDict.ContainsKey(wd)) waste.WasteDescription = vDict[wd]; + else waste.WasteDescription = "-"; if (!waste.WasteDisposalPort.IsNullOrEmpty() && waste.WasteDisposalPort.Length > 5) { @@ -1250,6 +1260,7 @@ namespace bsmd.herberg.FormService try { if (vDict.ContainsKey("Simplification")) sec.SECSimplification = vDict["Simplification"].Equals("Y"); + else sec.SECSimplification = false; if (vDict.ContainsKey("PortOfCallWhereCompleteSECNotified")) sec.PortOfCallWhereCompleteSECNotified = vDict["PortOfCallWhereCompleteSECNotified"]; if (vDict.ContainsKey("CSOLastName")) sec.CSOLastName = vDict["CSOLastName"]; if (vDict.ContainsKey("CSOFirstName")) sec.CSOFirstName = vDict["CSOFirstName"]; @@ -1538,6 +1549,7 @@ namespace bsmd.herberg.FormService HAZ newHaz = new HAZ(); newHaz.MessageHeader = theMessage; theMessage.MessageNotificationClass = isDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA; + newHaz.IsDeparture = isDeparture; theMessage.Elements.Add(newHaz); } HAZ haz = theMessage.Elements[0] as HAZ; @@ -1562,6 +1574,9 @@ namespace bsmd.herberg.FormService } Dictionary> subDict = null; + + #region IMDG + if (groupedRowVals.ContainsKey("HAZ.IMDG")) { subDict = groupedRowVals["HAZ.IMDG"]; @@ -1637,6 +1652,10 @@ namespace bsmd.herberg.FormService } } + #endregion + + #region IBC + if (groupedRowVals.ContainsKey("HAZ.IBC")) { subDict = groupedRowVals["HAZ.IBC"]; @@ -1676,6 +1695,10 @@ namespace bsmd.herberg.FormService } } + #endregion + + #region IGC + if (groupedRowVals.ContainsKey("HAZ.IGC")) { subDict = groupedRowVals["HAZ.IGC"]; @@ -1715,6 +1738,10 @@ namespace bsmd.herberg.FormService } } + #endregion + + #region IMSBC + if (groupedRowVals.ContainsKey("HAZ.IMSBC")) { subDict = groupedRowVals["HAZ.IMSBC"]; @@ -1754,6 +1781,10 @@ namespace bsmd.herberg.FormService } } + #endregion + + #region MARPOL + if (groupedRowVals.ContainsKey("HAZ.MARPOLAnnexI")) { subDict = groupedRowVals["HAZ.MARPOLAnnexI"]; @@ -1790,7 +1821,10 @@ namespace bsmd.herberg.FormService saveMessages.Add(marpolPosition); } } - } + } + + #endregion + } catch (Exception ex) {