Änderungen Version 5.7

This commit is contained in:
Daniel Schick 2019-12-12 12:56:52 +00:00
parent 97bf74721a
commit 849578d7a2
11 changed files with 106 additions and 61 deletions

View File

@ -291,7 +291,7 @@ namespace ENI2.DetailViewControls
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return; return;
} }
@ -305,27 +305,37 @@ namespace ENI2.DetailViewControls
{ {
while (reader.Read()) while (reader.Read())
{ {
if (reader.FieldCount < 2) if (reader.FieldCount < 3)
{ {
throw new InvalidDataException("Sheet must have at least 2 Columns of data"); throw new InvalidDataException("Sheet must have at least 3 Columns of data");
} }
PortOfCallLast30Days poc30 = new PortOfCallLast30Days(); PortOfCallLast30Days poc30 = new PortOfCallLast30Days();
if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue; if (reader.IsDBNull(0) && reader.IsDBNull(1)) continue;
if (!reader.IsDBNull(0)) poc30.PortOfCallLast30DaysLocode = reader.GetString(0); if (!reader.IsDBNull(0)) poc30.PortOfCallLast30DaysLocode = reader.GetString(0);
if (!reader.IsDBNull(1)) poc30.PortOfCallLast30DaysDateOfDeparture = reader.GetDateTime(1); if (!reader.IsDBNull(1)) poc30.PortOfCallLast30DaysDateOfDeparture = reader.GetDateTime(1);
// if (DateTime.TryParse(reader.GetString(1), out DateTime dateOfDep)) string boolString = "";
// poc30.PortOfCallLast30DaysDateOfDeparture = dateOfDep; if (!reader.IsDBNull(2)) boolString = reader.GetString(2);
if (!reader.IsDBNull(2) && !reader.GetString(2).IsNullOrEmpty()) poc30.PortOfCallLast30DaysCrewMembersJoined = true; poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) || (boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) ||
(boolString.Equals("j", StringComparison.OrdinalIgnoreCase)));
for (int colIndex = 2; (colIndex < reader.FieldCount) && !reader.IsDBNull(colIndex); colIndex++)
if(reader.FieldCount > 3)
{ {
string crewName = reader.GetString(colIndex); string allNewCrew = reader.GetString(3)?.Trim();
if (crewName.IsNullOrEmpty()) break; if(!allNewCrew.IsNullOrEmpty())
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip(); {
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName; string[] crewNames = allNewCrew.Split(',', ';');
poc30Crew.PortOfCallLast30Days = poc30; for(int i=0;i<crewNames.Length;i++)
poc30.CrewJoinedShip.Add(poc30Crew); {
} string crewName = crewNames[i].Trim();
if (crewName.IsNullOrEmpty()) continue;
PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip();
poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName;
poc30Crew.PortOfCallLast30Days = poc30;
poc30.CrewJoinedShip.Add(poc30Crew);
}
}
}
poc30.MDH = this._mdh; poc30.MDH = this._mdh;
this._mdh.PortOfCallLast30Days.Add(poc30); this._mdh.PortOfCallLast30Days.Add(poc30);

View File

@ -249,7 +249,7 @@ namespace ENI2.DetailViewControls
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return; return;
} }

View File

@ -19,7 +19,14 @@
SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridMessageHistories" SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridMessageHistories"
MouseDoubleClick="DataGridViolations_MouseDoubleClick" CanUserAddRows="False"> MouseDoubleClick="DataGridViolations_MouseDoubleClick" CanUserAddRows="False">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="{x:Static p:Resources.textType}" Binding="{Binding EntityName}" IsReadOnly="True" Width="0.05*" /> <DataGridTextColumn Header="{x:Static p:Resources.textType}" Binding="{Binding EntityName}" IsReadOnly="True" Width="0.05*" >
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Background" Value="{Binding GroupColorBrush}" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textTimestamp}" Binding="{Binding Created}" IsReadOnly="True" Width="0.1*" /> <DataGridTextColumn Header="{x:Static p:Resources.textTimestamp}" Binding="{Binding Created}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textReportingParty}" Binding="{Binding ReportingPartyName}" IsReadOnly="True" Width="0.15*" /> <DataGridTextColumn Header="{x:Static p:Resources.textReportingParty}" Binding="{Binding ReportingPartyName}" IsReadOnly="True" Width="0.15*" />
</DataGrid.Columns> </DataGrid.Columns>

View File

@ -4,17 +4,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using bsmd.database; using bsmd.database;
using ENI2.Controls; using ENI2.Controls;
using log4net; using log4net;
@ -29,11 +23,22 @@ namespace ENI2.EditControls
private static readonly ILog _log = LogManager.GetLogger(typeof(MessageHistoryDialog)); private static readonly ILog _log = LogManager.GetLogger(typeof(MessageHistoryDialog));
private readonly Dictionary<Guid, Brush> groupColorDict = new Dictionary<Guid, Brush>();
public MessageHistoryDialog() public MessageHistoryDialog()
{ {
InitializeComponent(); InitializeComponent();
Loaded += (o, e) => Loaded += (o, e) =>
{ {
// "color-code" (Group) the message histories
foreach(MessageHistory mh in this.MessageHistories)
{
if (!groupColorDict.ContainsKey(mh.EntityId))
groupColorDict[mh.EntityId] = new SolidColorBrush(Util.UIHelper.GetRandomBrightColor());
mh.GroupColorBrush = groupColorDict[mh.EntityId];
}
this.dataGridMessageHistories.ItemsSource = this.MessageHistories; this.dataGridMessageHistories.ItemsSource = this.MessageHistories;
this.dataGridMessageHistories.ContextMenu = new ContextMenu(); this.dataGridMessageHistories.ContextMenu = new ContextMenu();
@ -94,7 +99,7 @@ namespace ENI2.EditControls
foreach (Message aMessage in this.Messages) foreach (Message aMessage in this.Messages)
{ {
if (aMessage.MessageNotificationClassDisplay.Equals(selectedHistory.EntityName) || if (aMessage.MessageNotificationClassDisplay.Equals(selectedHistory.EntityName) ||
(aMessage.MessageNotificationClassDisplay.Equals("BKRA") && selectedHistory.EntityName.Equals("BRKA")) || (aMessage.MessageNotificationClassDisplay.Equals("BKRA") && selectedHistory.EntityName.Equals("BRKA")) || // blöder Schreibfehler beachten
(aMessage.MessageNotificationClassDisplay.Equals("BKRD") && selectedHistory.EntityName.Equals("BRKD")) (aMessage.MessageNotificationClassDisplay.Equals("BKRD") && selectedHistory.EntityName.Equals("BRKD"))
) )
{ {

View File

@ -7,6 +7,7 @@ using System;
using System.Reflection; using System.Reflection;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading; using System.Windows.Threading;
namespace ENI2.Util namespace ENI2.Util
@ -15,6 +16,7 @@ namespace ENI2.Util
{ {
private static bool isBusy; private static bool isBusy;
private static readonly Random r = new Random();
public static void SetBusyState() public static void SetBusyState()
{ {
@ -37,8 +39,7 @@ namespace ENI2.Util
private static void dispatcherTimer_Tick(object sender, EventArgs e) private static void dispatcherTimer_Tick(object sender, EventArgs e)
{ {
DispatcherTimer timer = sender as DispatcherTimer; if (sender is DispatcherTimer timer)
if(timer != null)
{ {
SetBusyState(false); SetBusyState(false);
timer.Stop(); timer.Stop();
@ -50,5 +51,10 @@ namespace ENI2.Util
return (bool)typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(window); return (bool)typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(window);
} }
public static Color GetRandomBrightColor()
{
return Color.FromRgb((byte) r.Next(150, 255), (byte) r.Next(150, 255), (byte) r.Next(150, 255));
}
} }
} }

Binary file not shown.

View File

@ -795,7 +795,7 @@ namespace bsmd.database
} }
// 3. MessageHistory Element speichern // 3. MessageHistory Element speichern
// TODO: das könnte auch in einem Background Thread passieren, da der Wert erst irgendwann gelesen wird und aktuell nicht relevant ist /// TODO: das könnte auch in einem Background Thread passieren, da der Wert erst irgendwann gelesen wird und aktuell nicht relevant ist
using (SqlCommand cmd = new SqlCommand()) using (SqlCommand cmd = new SqlCommand())
{ {
mh.PrepareSave(cmd); mh.PrepareSave(cmd);

View File

@ -6,8 +6,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Linq; using System.Windows.Media;
using System.Text;
namespace bsmd.database namespace bsmd.database
{ {
@ -38,6 +37,11 @@ namespace bsmd.database
public int Identifier { get; set; } public int Identifier { get; set; }
/// <summary>
/// Helper property for display grid
/// </summary>
public Brush GroupColorBrush { get; set; }
/// <summary> /// <summary>
/// ENI Grid helper property /// ENI Grid helper property
/// </summary> /// </summary>

View File

@ -31,7 +31,7 @@ namespace bsmd.database
[ShowReport] [ShowReport]
[MaxLength(99)] [MaxLength(99)]
[ENI2Validation] [ENI2Validation]
[Validation(ValidationCode.NOT_NULL_MAX_LEN, 99)] [Validation(ValidationCode.STRING_MAXLEN, 99)]
public string WasteDisposalServiceProviderName { get; set; } public string WasteDisposalServiceProviderName { get; set; }
[Obsolete] [Obsolete]

View File

@ -47,6 +47,7 @@
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\ENI-2\ENI2\ENI2\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\..\ENI-2\ENI2\ENI2\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />

View File

@ -19,7 +19,7 @@ namespace bsmd.dbh
public class Request public class Request
{ {
private static ILog _log = LogManager.GetLogger(typeof(Request)); private static readonly ILog _log = LogManager.GetLogger(typeof(Request));
public static bool SendCancelCore(MessageCore core, bool useTest) public static bool SendCancelCore(MessageCore core, bool useTest)
{ {
@ -31,7 +31,7 @@ namespace bsmd.dbh
return false; return false;
} }
RootType rootType = RootType.CANCEL; const RootType rootType = RootType.CANCEL;
Dbh_Osis_Answ_Ws client = new Dbh_Osis_Answ_Ws(); Dbh_Osis_Answ_Ws client = new Dbh_Osis_Answ_Ws();
if (useTest) if (useTest)
@ -57,7 +57,7 @@ namespace bsmd.dbh
{ {
object[] items = new object[1]; object[] items = new object[1];
DateTime timestamp = DateTime.Now; DateTime timestamp = DateTime.Now;
string version = "3.0"; const string version = "3.0";
object item = null; object item = null;
string senderReference = core.Id.Value.ToString("N"); string senderReference = core.Id.Value.ToString("N");
items[0] = item; items[0] = item;
@ -76,7 +76,7 @@ namespace bsmd.dbh
_log.InfoFormat("Send Url: {0}", client.Url); _log.InfoFormat("Send Url: {0}", client.Url);
RootVersion rootVersion = RootVersion.Item50; const RootVersion rootVersion = RootVersion.Item50;
string result = client.Root( string result = client.Root(
rootVersion, rootVersion,
@ -101,6 +101,10 @@ namespace bsmd.dbh
return false; return false;
} }
finally
{
client.Dispose();
}
return true; return true;
} }
@ -150,7 +154,7 @@ namespace bsmd.dbh
rp.RPType = (ReportingPartyRPType) message.ReportingParty.ReportingPartyType.Value; rp.RPType = (ReportingPartyRPType) message.ReportingParty.ReportingPartyType.Value;
DateTime timestamp = DateTime.Now; DateTime timestamp = DateTime.Now;
string version = "3.0"; const string version = "3.0";
object item = null; object item = null;
string senderReference = message.Id.Value.ToString("N"); string senderReference = message.Id.Value.ToString("N");
@ -219,8 +223,7 @@ namespace bsmd.dbh
#region NOA_NOD #region NOA_NOD
case Message.NotificationClass.NOA_NOD: case Message.NotificationClass.NOA_NOD:
{ {
NOA_NOD noa_nod = message.Elements[0] as NOA_NOD; if (message.Elements[0] is NOA_NOD noa_nod)
if (noa_nod != null)
{ {
RootNOA_NOD rootNoaNod = new RootNOA_NOD(); RootNOA_NOD rootNoaNod = new RootNOA_NOD();
@ -233,10 +236,10 @@ namespace bsmd.dbh
// rootNoaNod.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue; // rootNoaNod.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue;
rootNoaNod.LastPort = noa_nod.LastPort; rootNoaNod.LastPort = noa_nod.LastPort;
rootNoaNod.NextPort = noa_nod.NextPort; rootNoaNod.NextPort = noa_nod.NextPort;
List<ItemsChoiceType> choiceList = new List<ItemsChoiceType>(); List<ItemsChoiceType> choiceList = new List<ItemsChoiceType>();
List<object> choices = new List<object>(); List<object> choices = new List<object>();
if (message.MessageCore.IsTransit) if (message.MessageCore.IsTransit)
{ {
@ -272,11 +275,11 @@ namespace bsmd.dbh
RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose(); RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose();
CallPurpose callPurpose = noa_nod.CallPurposes[i] as CallPurpose; CallPurpose callPurpose = noa_nod.CallPurposes[i] as CallPurpose;
rnncp.CallPurposeCode = callPurpose.CallPurposeCode; rnncp.CallPurposeCode = callPurpose.CallPurposeCode;
if(callPurpose.CallPurposeDescription != string.Empty) if (callPurpose.CallPurposeDescription != string.Empty)
rnncp.CallPurposeDescription = callPurpose.CallPurposeDescription; rnncp.CallPurposeDescription = callPurpose.CallPurposeDescription;
choices.Add(rnncp); choices.Add(rnncp);
} }
} }
rootNoaNod.Items = choices.ToArray(); rootNoaNod.Items = choices.ToArray();
rootNoaNod.ItemsElementName = choiceList.ToArray(); rootNoaNod.ItemsElementName = choiceList.ToArray();
@ -291,8 +294,7 @@ namespace bsmd.dbh
case Message.NotificationClass.AGNT: case Message.NotificationClass.AGNT:
{ {
AGNT agnt = message.Elements[0] as AGNT; if (message.Elements[0] is AGNT agnt)
if (agnt != null)
{ {
RootAGNT rootAGNT = new RootAGNT(); RootAGNT rootAGNT = new RootAGNT();
rootAGNT.AgentCity = agnt.AgentCity; rootAGNT.AgentCity = agnt.AgentCity;
@ -306,7 +308,7 @@ namespace bsmd.dbh
rootAGNT.AgentPostalCode = agnt.AgentPostalCode; rootAGNT.AgentPostalCode = agnt.AgentPostalCode;
rootAGNT.AgentStreetAndNumber = agnt.AgentStreetAndNumber; rootAGNT.AgentStreetAndNumber = agnt.AgentStreetAndNumber;
item = rootAGNT; item = rootAGNT;
} }
break; break;
} }
@ -315,8 +317,7 @@ namespace bsmd.dbh
#region ATA #region ATA
case Message.NotificationClass.ATA: case Message.NotificationClass.ATA:
{ {
ATA ata = message.Elements[0] as ATA; if (message.Elements[0] is ATA ata)
if (ata != null)
{ {
RootATA rootATA = new RootATA(); RootATA rootATA = new RootATA();
if (ata.ATAPortOfCall.HasValue) if (ata.ATAPortOfCall.HasValue)
@ -330,8 +331,7 @@ namespace bsmd.dbh
#region ATD #region ATD
case Message.NotificationClass.ATD: case Message.NotificationClass.ATD:
{ {
ATD atd = message.Elements[0] as ATD; if (message.Elements[0] is ATD atd)
if (atd != null)
{ {
RootATD rootATD = new RootATD(); RootATD rootATD = new RootATD();
rootATD.ATDPortOfCall = atd.ATDPortOfCall.Value.ToDBHDateString(); rootATD.ATDPortOfCall = atd.ATDPortOfCall.Value.ToDBHDateString();
@ -476,8 +476,7 @@ namespace bsmd.dbh
#region BPOL #region BPOL
case Message.NotificationClass.BPOL: case Message.NotificationClass.BPOL:
{ {
BPOL bpol = message.Elements[0] as BPOL; if (message.Elements[0] is BPOL bpol)
if (bpol != null)
{ {
RootBPOL rootBPOL = new RootBPOL(); RootBPOL rootBPOL = new RootBPOL();
RootBPOLPortOfItinerary[] poiArray = new RootBPOLPortOfItinerary[bpol.PortOfItineraries.Count]; RootBPOLPortOfItinerary[] poiArray = new RootBPOLPortOfItinerary[bpol.PortOfItineraries.Count];
@ -858,6 +857,7 @@ namespace bsmd.dbh
if (!mdh.MDHSimplification.HasValue) if (!mdh.MDHSimplification.HasValue)
{ {
_log.ErrorFormat("MDH {0} doesnt have MDHSimplification field set, aborting message", mdh.Id); _log.ErrorFormat("MDH {0} doesnt have MDHSimplification field set, aborting message", mdh.Id);
client.Dispose();
return false; return false;
} }
if (mdh.MDHSimplification.Value) if (mdh.MDHSimplification.Value)
@ -873,9 +873,11 @@ namespace bsmd.dbh
{ // der blöde Teil { // der blöde Teil
List<object> mdhItems = new List<object>(); List<object> mdhItems = new List<object>();
List<ItemsChoiceType2> choiceTypes2 = new List<ItemsChoiceType2>(); List<ItemsChoiceType2> choiceTypes2 = new List<ItemsChoiceType2>
{
choiceTypes2.Add(ItemsChoiceType2.NonAccidentialDeathsDuringVoyage); ItemsChoiceType2.NonAccidentialDeathsDuringVoyage
};
mdhItems.Add((mdh.NonAccidentalDeathsDuringVoyage ?? false) ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N); mdhItems.Add((mdh.NonAccidentalDeathsDuringVoyage ?? false) ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N);
if (mdh.NonAccidentalDeathsDuringVoyage ?? false) if (mdh.NonAccidentalDeathsDuringVoyage ?? false)
@ -1021,9 +1023,10 @@ namespace bsmd.dbh
// ACHTUNG hier ist die Reihenfolge entscheidend! (siehe XSD) // ACHTUNG hier ist die Reihenfolge entscheidend! (siehe XSD)
List<object> wasteItems = new List<object>(); List<object> wasteItems = new List<object>();
List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>(); List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>
{
choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort); ItemsChoiceType3.LastWasteDisposalPort
};
wasteItems.Add(was.LastWasteDisposalPort); wasteItems.Add(was.LastWasteDisposalPort);
if (was.LastWasteDisposalDate.HasValue) if (was.LastWasteDisposalDate.HasValue)
@ -1262,8 +1265,10 @@ namespace bsmd.dbh
rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue;
if (imdgPos.GeneralCargoIBC.HasValue) if (imdgPos.GeneralCargoIBC.HasValue)
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? DBHWebReference.RootSECValidISSCOnBoard.Y : DBHWebReference.RootSECValidISSCOnBoard.N; rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? DBHWebReference.RootSECValidISSCOnBoard.Y : DBHWebReference.RootSECValidISSCOnBoard.N;
rootIMDG.ContainerNumber = imdgPos.ContainerNumber; if(!imdgPos.ContainerNumber.IsNullOrEmpty())
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
if(!imdgPos.VehicleLicenseNumber.IsNullOrEmpty())
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
if (imdgPos.StowagePosition.IsNullOrEmpty()) if (imdgPos.StowagePosition.IsNullOrEmpty())
{ {
@ -1519,8 +1524,10 @@ namespace bsmd.dbh
rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue; rootIMDG.GeneralCargoIBCSpecified = imdgPos.GeneralCargoIBC.HasValue;
if (imdgPos.GeneralCargoIBC.HasValue) if (imdgPos.GeneralCargoIBC.HasValue)
rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; rootIMDG.GeneralCargoIBC = imdgPos.GeneralCargoIBC.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootIMDG.ContainerNumber = imdgPos.ContainerNumber; if(!imdgPos.ContainerNumber.IsNullOrEmpty())
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber; rootIMDG.ContainerNumber = imdgPos.ContainerNumber;
if(!imdgPos.VehicleLicenseNumber.IsNullOrEmpty())
rootIMDG.VehicleLicenseNumber = imdgPos.VehicleLicenseNumber;
if (imdgPos.StowagePosition.IsNullOrEmpty()) if (imdgPos.StowagePosition.IsNullOrEmpty())
{ {
@ -1676,6 +1683,7 @@ namespace bsmd.dbh
default: default:
{ {
_log.ErrorFormat("DBH send message: message type {0} not implemented", message.MessageNotificationClass); _log.ErrorFormat("DBH send message: message type {0} not implemented", message.MessageNotificationClass);
client.Dispose();
return false; return false;
} }
#endregion #endregion
@ -1706,7 +1714,7 @@ namespace bsmd.dbh
_log.InfoFormat("Send Url: {0}", client.Url); _log.InfoFormat("Send Url: {0}", client.Url);
RootVersion rootVersion = RootVersion.Item50; const RootVersion rootVersion = RootVersion.Item50;
string result = client.Root( string result = client.Root(
rootVersion, rootVersion,
@ -1731,6 +1739,10 @@ namespace bsmd.dbh
returnval = false; returnval = false;
} }
finally
{
client.Dispose();
}
return returnval; return returnval;
} }