Zwischenstand Testing + Korrekturen für ENI-2
This commit is contained in:
parent
4e7d1251b9
commit
496b21f95a
@ -3,6 +3,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@ -52,7 +53,7 @@ namespace ENI2.Controls
|
||||
*/
|
||||
private TextBlock textBlock;
|
||||
|
||||
public event EventHandler TabClosing;
|
||||
public event CancelEventHandler TabClosing;
|
||||
|
||||
protected Storyboard BlinkTextStoryboard
|
||||
{
|
||||
@ -142,10 +143,18 @@ namespace ENI2.Controls
|
||||
closeButton.Click +=
|
||||
(sender, e) =>
|
||||
{
|
||||
var tabControl = Parent as ItemsControl;
|
||||
tabControl.Items.Remove(this);
|
||||
bool abort = false;
|
||||
if (TabClosing != null)
|
||||
this.TabClosing(this, new EventArgs());
|
||||
{
|
||||
CancelEventArgs cancelEventArgs = new CancelEventArgs();
|
||||
this.TabClosing(this, cancelEventArgs);
|
||||
if (cancelEventArgs.Cancel) abort = true;
|
||||
}
|
||||
if (!abort)
|
||||
{
|
||||
var tabControl = Parent as ItemsControl;
|
||||
tabControl.Items.Remove(this);
|
||||
}
|
||||
};
|
||||
dockPanel.Children.Add(closeButton);
|
||||
|
||||
|
||||
@ -48,6 +48,11 @@ namespace ENI2
|
||||
|
||||
internal event DatabaseEntityWatchdog.DatabaseEntityChangedHandler HighlightReset;
|
||||
|
||||
public bool HasUnsavedChanges
|
||||
{
|
||||
get { return (this.buttonSave.Visibility == Visibility.Visible); } // schwach aber es wird's tun
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Construction
|
||||
@ -370,7 +375,6 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -94,7 +94,7 @@
|
||||
<Button Name="buttonImportFromSEC" Margin="2" Content="{x:Static p:Resources.textImportFromSEC}" Width="120" VerticalAlignment="Center" Click="buttonImportFromSEC_Click" />
|
||||
</StackPanel>
|
||||
<enictrl:ENIDataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridPortOfCallLast30Days" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||
SelectionMode="Extended" AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textPortCall}" Binding="{Binding PortOfCallLast30DaysLocode, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
|
||||
|
||||
@ -437,6 +437,7 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
// are you sure dialog is in base class
|
||||
_mdh.PortOfCallLast30Days.Remove(poc30d);
|
||||
poc30d.DeleteElements();
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(poc30d);
|
||||
DatabaseEntity.ResetIdentifiers(_mdh.PortOfCallLast30Days);
|
||||
this.SublistElementChanged(Message.NotificationClass.MDH);
|
||||
|
||||
@ -392,6 +392,18 @@ namespace ENI2.DetailViewControls
|
||||
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmSend, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
bool somethingsNotSaved = false;
|
||||
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
|
||||
{
|
||||
if (selectedMessage.IsDirty) somethingsNotSaved = true;
|
||||
}
|
||||
|
||||
if(somethingsNotSaved)
|
||||
{
|
||||
if (MessageBox.Show(Properties.Resources.textUnsavedChangesSendAnyWay, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
|
||||
{
|
||||
if (selectedMessage.Reset) selectedMessage.Reset = false; // "nochmal" Versenden ist möglich
|
||||
|
||||
@ -46,12 +46,13 @@
|
||||
<xctk:DateTimePicker Grid.Column="3" Grid.Row="0" Value="{Binding ETDFromPortOfCall, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromPortOfCall" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
|
||||
<xctk:DateTimePicker Grid.Column="1" Grid.Row="1" Value="{Binding ETAToKielCanal, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
|
||||
<xctk:DateTimePicker Grid.Column="3" Grid.Row="1" Value="{Binding ETDFromKielCanal, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
|
||||
<xctk:DateTimePicker Grid.Column="3" Grid.Row="3" Value="{Binding ETAToNextPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToNextPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
|
||||
<xctk:DateTimePicker Grid.Column="3" Grid.Row="2" Value="{Binding ETDFromLastPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromLastPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
|
||||
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.Row="2" Width="Auto" x:Name="locodeControl_LastPort" LocodeValue="{Binding LastPort, Mode=TwoWay}"/>
|
||||
<xctk:DateTimePicker Grid.Column="3" Grid.Row="2" Value="{Binding ETDFromLastPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETDFromLastPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.Row="3" Width="Auto" x:Name="locodeControl_NextPort" LocodeValue="{Binding NextPort, Mode=TwoWay}"/>
|
||||
|
||||
<xctk:DateTimePicker Grid.Column="3" Grid.Row="3" Value="{Binding ETAToNextPort, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" Name="dateTimePicker_ETAToNextPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left"/>
|
||||
|
||||
|
||||
|
||||
<CheckBox Grid.Column="1" Grid.Row="4" IsThreeState="True" VerticalContentAlignment="Center" Name="checkBox_IsAnchored" IsChecked="{Binding IsAnchored}"/>
|
||||
<GroupBox Grid.Row="5" Grid.ColumnSpan="4" Name="groupBoxCallPurpose" Header="{x:Static p:Resources.textCallPurposes}" >
|
||||
<enictrl:ENIDataGrid x:Name="dataGridCallPurposes" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
@ -102,10 +103,10 @@
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Name="textBox_AgentCity" MaxLength="100" Margin="2" Text="{Binding AgentCity}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Name="textBox_AgentCountry" MaxLength="100" Margin="2" Text="{Binding AgentCountry}" VerticalContentAlignment="Center" />
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Name="textBox_AgentLastName" MaxLength="100" Margin="2" Text="{Binding AgentLastName}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="100" Margin="2" Text="{Binding AgentPhone}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="100" Margin="2" Text="{Binding AgentEMail}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Grid.Row="5" Grid.Column="3" Name="textBox_AgentFirstName" MaxLength="100" Margin="2" Text="{Binding AgentFirstName}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="100" Margin="2" Text="{Binding AgentPhone}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Grid.Row="6" Grid.Column="3" Name="textBox_AgentFax" MaxLength="100" Margin="2" Text="{Binding AgentFax}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="100" Margin="2" Text="{Binding AgentEMail}" VerticalContentAlignment="Center"/>
|
||||
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoCodeNST}" Binding="{Binding CargoCodeNST, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoCodeNST3}" Binding="{Binding CargoCodeNST_3, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoNumberOfItems}" Binding="{Binding CargoNumberOfItems, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoGrossQuantity}" Binding="{Binding CargoGrossQuantity_TNE, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoGrossQuantity}" Binding="{Binding CargoGrossQuantity_TNE, Mode=TwoWay, StringFormat={}{0:N3}}" IsReadOnly="True" Width="0.15*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoPortOfLoading}" Binding="{Binding PortOfLoading, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoPortOfDischarge}" Binding="{Binding PortOfDischarge, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
|
||||
</DataGrid.Columns>
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationRevision>2</ApplicationRevision>
|
||||
<ApplicationVersion>3.7.5.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
|
||||
@ -41,7 +41,7 @@ Copyright (c) 2017 schick Informatik
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxNSTCode" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="3" Name="comboBoxNST3Code" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/>
|
||||
<xctk:IntegerUpDown Grid.Row="2" Grid.Column="1" Name="integerUpDownNumberOfItems" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" TextAlignment="Left"/>
|
||||
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownGrossQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N1" TextAlignment="Left"/>
|
||||
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownGrossQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N3" TextAlignment="Left"/>
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.Row="4" Width="Auto" x:Name="locodeControl_PortOfLoading" />
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.Row="5" Width="Auto" x:Name="locodeControl_PortOfDischarge" />
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ namespace ENI2
|
||||
if (!reader.IsDBNull(1)) portarea = reader.GetString(1);
|
||||
if((code != null) && (portarea != null))
|
||||
{
|
||||
result[code] = portarea;
|
||||
result[code] = string.Format("{0}-{1}", code, portarea);
|
||||
}
|
||||
}
|
||||
reader.Close();
|
||||
|
||||
@ -141,29 +141,40 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchResultItem_TabClosing(object sender, EventArgs e)
|
||||
private void SearchResultItem_TabClosing(object sender, CancelEventArgs e)
|
||||
{
|
||||
ClosableTabItem tabItem = sender as ClosableTabItem;
|
||||
if(tabItem != null)
|
||||
{
|
||||
if(lockedCores.ContainsKey(tabItem))
|
||||
DetailRootControl drc = tabItem.Content as DetailRootControl;
|
||||
|
||||
// Test for unsaved changes
|
||||
if(drc.HasUnsavedChanges)
|
||||
{
|
||||
try
|
||||
{
|
||||
App.LockingServiceClient.Unlock(lockedCores[tabItem], this.userEntity.Id.Value);
|
||||
lockedCores.Remove(tabItem);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("LockingService.Unlock: {0}", ex.Message);
|
||||
}
|
||||
if (MessageBox.Show(Properties.Resources.textConfirmWithoutSaving, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
DetailRootControl drc = tabItem.Content as DetailRootControl;
|
||||
if (openTabs.ContainsKey(drc.Core.Id.Value))
|
||||
if (!e.Cancel)
|
||||
{
|
||||
this._dbWatchDog.UnRegister(drc.Core);
|
||||
openTabs.Remove(drc.Core.Id.Value);
|
||||
if (lockedCores.ContainsKey(tabItem))
|
||||
{
|
||||
try
|
||||
{
|
||||
App.LockingServiceClient.Unlock(lockedCores[tabItem], this.userEntity.Id.Value);
|
||||
lockedCores.Remove(tabItem);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("LockingService.Unlock: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
if (openTabs.ContainsKey(drc.Core.Id.Value))
|
||||
{
|
||||
this._dbWatchDog.UnRegister(drc.Core);
|
||||
openTabs.Remove(drc.Core.Id.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
18
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
@ -1187,6 +1187,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unsaved changes! Do you want to close anyway?.
|
||||
/// </summary>
|
||||
public static string textConfirmWithoutSaving {
|
||||
get {
|
||||
return ResourceManager.GetString("textConfirmWithoutSaving", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Construction characteristics.
|
||||
/// </summary>
|
||||
@ -4022,6 +4031,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Some messages have unsaved changes. Send anyway?.
|
||||
/// </summary>
|
||||
public static string textUnsavedChangesSendAnyWay {
|
||||
get {
|
||||
return ResourceManager.GetString("textUnsavedChangesSendAnyWay", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User administration.
|
||||
/// </summary>
|
||||
|
||||
@ -1522,4 +1522,10 @@
|
||||
<data name="textOnlyIfGridIsEmpty" xml:space="preserve">
|
||||
<value>This only works if the grid is empty!</value>
|
||||
</data>
|
||||
<data name="textConfirmWithoutSaving" xml:space="preserve">
|
||||
<value>Unsaved changes! Do you want to close anyway?</value>
|
||||
</data>
|
||||
<data name="textUnsavedChangesSendAnyWay" xml:space="preserve">
|
||||
<value>Some messages have unsaved changes. Send anyway?</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -71,15 +71,16 @@
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Type" Binding="{Binding HerbergReportType}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="IMO" Binding="{Binding IMO}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Ship name" Binding="{Binding Shipname}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ETA" Binding="{Binding ETADisplay, StringFormat=\{0:dd.MM.yyyy\}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ETA" Binding="{Binding ETA_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ETD" Binding="{Binding ETD_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ATA" Binding="{Binding ATA, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ATD" Binding="{Binding ATD, StringFormat=\{0:dd.MM.yyyy HH:mm\}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Hafen" Binding="{Binding PortnameDisplay}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Id" Binding="{Binding DisplayId}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Status" Binding="{Binding BSMDStatusInternal}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textTicketNo}" Binding="{Binding TicketNo}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Edited by" Binding="{Binding EditedBy}" IsReadOnly="True" Width="*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textTicketNo}" Binding="{Binding TicketNo}" IsReadOnly="True" Width="*"/>
|
||||
<DataGridCheckBoxColumn Header="Locked" Binding="{Binding Locked}" IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
@ -96,7 +96,7 @@ namespace bsmd.ExcelReadService
|
||||
results.Add(entry);
|
||||
}
|
||||
}
|
||||
string query = "SELECT locodes.name, city_code, countries.code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND (locodes.name like $PAR OR locodes.name_wo_diacritics like $PAR)";
|
||||
string query = "SELECT locodes.name_wo_diacritics, city_code, countries.code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND (locodes.name like $PAR OR locodes.name_wo_diacritics like $PAR)";
|
||||
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||
cmd.Parameters.AddWithValue("$PAR", city);
|
||||
IDataReader reader = cmd.ExecuteReader();
|
||||
@ -143,7 +143,7 @@ namespace bsmd.ExcelReadService
|
||||
if (locode.Length != 5) return null;
|
||||
|
||||
string result = null;
|
||||
string query = string.Format("SELECT locodes.name FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND locodes.city_code = '{0}' AND countries.code = '{1}'",
|
||||
string query = string.Format("SELECT locodes.name_wo_diacritics FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND locodes.city_code = '{0}' AND countries.code = '{1}'",
|
||||
locode.Substring(2), locode.Substring(0,2));
|
||||
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||
IDataReader reader = cmd.ExecuteReader();
|
||||
|
||||
@ -78,6 +78,7 @@ namespace bsmd.database
|
||||
{
|
||||
_con = new SqlConnection(dbConnectionString);
|
||||
_con.Open();
|
||||
this.ConnectionString = dbConnectionString;
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -242,6 +243,9 @@ namespace bsmd.database
|
||||
{
|
||||
this.LoadCustomer(core);
|
||||
this.LoadSTATShipName(core);
|
||||
this.LoadETA_ETD(core);
|
||||
this.LoadATA(core);
|
||||
this.LoadATD(core);
|
||||
result.Add(core);
|
||||
}
|
||||
|
||||
@ -1080,6 +1084,49 @@ namespace bsmd.database
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
internal void LoadETA_ETD(MessageCore core)
|
||||
{
|
||||
if (core == null) return;
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = "SELECT NOA_NOD.ETAToPortOfCall, NOA_NOD.ETDFromPortOfCall FROM NOA_NOD JOIN MessageHeader ON NOA_NOD.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
|
||||
cmd.Parameters.AddWithValue("@ID", core.Id);
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
if (reader.Read())
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ETA_NOA_NOD = reader.GetDateTime(0);
|
||||
if (!reader.IsDBNull(1)) core.ETD_NOA_NOD = reader.GetDateTime(1);
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
internal void LoadATA(MessageCore core)
|
||||
{
|
||||
if (core == null) return;
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = "SELECT ATA.ATAPortOfCall FROM ATA JOIN MessageHeader ON ATA.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
|
||||
cmd.Parameters.AddWithValue("@ID", core.Id);
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
if (reader.Read())
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ATA = reader.GetDateTime(0);
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
internal void LoadATD(MessageCore core)
|
||||
{
|
||||
if (core == null) return;
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = "SELECT ATD.ATDPortOfCall FROM ATD JOIN MessageHeader ON ATD.MessageHeaderId = MessageHeader.Id WHERE MessageHeader.MessageCoreId = @ID";
|
||||
cmd.Parameters.AddWithValue("@ID", core.Id);
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
if (reader.Read())
|
||||
{
|
||||
if (!reader.IsDBNull(0)) core.ATD = reader.GetDateTime(0);
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
internal Dictionary<int, string> LoadErrorTexts()
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
|
||||
@ -190,9 +190,25 @@ namespace bsmd.database
|
||||
public string EditedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ENI-2
|
||||
/// ENI-2 display prop
|
||||
/// </summary>
|
||||
public string Shipname { get; set; }
|
||||
/// <summary>
|
||||
/// ENI-2 display prop
|
||||
/// </summary>
|
||||
public DateTime? ETA_NOA_NOD { get; set; }
|
||||
/// <summary>
|
||||
/// ENI-2 display prop
|
||||
/// </summary>
|
||||
public DateTime? ETD_NOA_NOD { get; set; }
|
||||
/// <summary>
|
||||
/// ENI-2 display prop
|
||||
/// </summary>
|
||||
public DateTime? ATA { get; set; }
|
||||
/// <summary>
|
||||
/// ENI-2 display prop
|
||||
/// </summary>
|
||||
public DateTime? ATD { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Flag zeigt an ob ein Excelsheet erzeugt werden soll
|
||||
|
||||
@ -218,7 +218,7 @@ namespace bsmd.database
|
||||
{
|
||||
foreach (PortOfCallLast30DaysCrewJoinedShip cjs in this.CrewJoinedShip)
|
||||
{
|
||||
DBManager.Instance.Delete(cjs);
|
||||
DBManager.GetSingleCon(DBManager.Instance.ConnectionString).Delete(cjs);
|
||||
}
|
||||
this.CrewJoinedShip.Clear();
|
||||
}
|
||||
|
||||
@ -120,6 +120,38 @@ namespace bsmd.database
|
||||
}
|
||||
}
|
||||
|
||||
if (message.MessageNotificationClass == Message.NotificationClass.TIEFA)
|
||||
{
|
||||
if (message.Elements.Count > 0)
|
||||
{
|
||||
bsmd.database.TIEFA tiefa = message.Elements[0] as bsmd.database.TIEFA;
|
||||
if (!tiefa.DraughtUponArrival_DMT.HasValue)
|
||||
{
|
||||
message.StatusInfo = "TIEFA without value";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (message.MessageNotificationClass == Message.NotificationClass.TIEFD)
|
||||
{
|
||||
if (message.Elements.Count > 0)
|
||||
{
|
||||
bsmd.database.TIEFD tiefd = message.Elements[0] as bsmd.database.TIEFD;
|
||||
if (!tiefd.DraughtUponDeparture_DMT.HasValue)
|
||||
{
|
||||
message.StatusInfo = "TIEFD without value";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0))
|
||||
{
|
||||
message.StatusInfo = "empty list message type";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,14 +193,19 @@ namespace bsmd.hisnord
|
||||
hn_stat.Flag = stat.Flag;
|
||||
if (stat.GrossTonnage.HasValue)
|
||||
hn_stat.GrossTonnage = stat.GrossTonnage.Value.ToString();
|
||||
hn_stat.InmarsatCallNumber = stat.InmarsatCallNumber;
|
||||
if(!stat.InmarsatCallNumber.IsNullOrEmpty())
|
||||
hn_stat.InmarsatCallNumber = stat.InmarsatCallNumber;
|
||||
hn_stat.ISMCompany = new ismcompany();
|
||||
hn_stat.ISMCompany.ISMCompanyCity = stat.ISMCompanyCity;
|
||||
hn_stat.ISMCompany.ISMCompanyCountry = stat.ISMCompanyCountry;
|
||||
if(!stat.ISMCompanyCity.IsNullOrEmpty())
|
||||
hn_stat.ISMCompany.ISMCompanyCity = stat.ISMCompanyCity;
|
||||
if(!stat.ISMCompanyCountry.IsNullOrEmpty())
|
||||
hn_stat.ISMCompany.ISMCompanyCountry = stat.ISMCompanyCountry;
|
||||
hn_stat.ISMCompany.ISMCompanyId = stat.ISMCompanyId;
|
||||
hn_stat.ISMCompany.ISMCompanyName = stat.ISMCompanyName;
|
||||
hn_stat.ISMCompany.ISMCompanyPostalCode = stat.ISMCompanyPostalCode;
|
||||
hn_stat.ISMCompany.ISMCompanyStreetAndNumber = stat.ISMCompanyStreetAndNumber;
|
||||
if(!stat.ISMCompanyPostalCode.IsNullOrEmpty())
|
||||
hn_stat.ISMCompany.ISMCompanyPostalCode = stat.ISMCompanyPostalCode;
|
||||
if(!stat.ISMCompanyStreetAndNumber.IsNullOrEmpty())
|
||||
hn_stat.ISMCompany.ISMCompanyStreetAndNumber = stat.ISMCompanyStreetAndNumber;
|
||||
if (stat.LengthOverall_MTR.HasValue)
|
||||
hn_stat.LengthOverall_MTR = (float)stat.LengthOverall_MTR.Value;
|
||||
hn_stat.MMSINumber = stat.MMSINumber;
|
||||
@ -832,14 +837,23 @@ namespace bsmd.hisnord
|
||||
{
|
||||
secItemNames.Add(ItemsChoiceType4.CSOLastName);
|
||||
secItems.Add(sec.CSOLastName);
|
||||
secItemNames.Add(ItemsChoiceType4.CSOFirstName);
|
||||
secItems.Add(sec.CSOFirstName);
|
||||
if (!sec.CSOFirstName.IsNullOrEmpty())
|
||||
{
|
||||
secItemNames.Add(ItemsChoiceType4.CSOFirstName);
|
||||
secItems.Add(sec.CSOFirstName);
|
||||
}
|
||||
secItemNames.Add(ItemsChoiceType4.CSOPhone);
|
||||
secItems.Add(sec.CSOPhone);
|
||||
secItemNames.Add(ItemsChoiceType4.CSOFax);
|
||||
secItems.Add(sec.CSOFax);
|
||||
secItemNames.Add(ItemsChoiceType4.CSOEMail);
|
||||
secItems.Add(sec.CSOEMail);
|
||||
if (!sec.CSOFax.IsNullOrEmpty())
|
||||
{
|
||||
secItemNames.Add(ItemsChoiceType4.CSOFax);
|
||||
secItems.Add(sec.CSOFax);
|
||||
}
|
||||
if (!sec.CSOEMail.IsNullOrEmpty())
|
||||
{
|
||||
secItemNames.Add(ItemsChoiceType4.CSOEMail);
|
||||
secItems.Add(sec.CSOEMail);
|
||||
}
|
||||
secItemNames.Add(ItemsChoiceType4.ValidISSCOnBoard);
|
||||
secItems.Add((sec.ValidISSCOnBoard ?? false) ? yorntype.Y : yorntype.N);
|
||||
secItemNames.Add(ItemsChoiceType4.ReasonsForNoValidISSC);
|
||||
@ -866,8 +880,11 @@ namespace bsmd.hisnord
|
||||
secItemNames.Add(ItemsChoiceType4.ApprovedSecurityPlanOnBoard);
|
||||
secItems.Add(sec.ApprovedSecurityPlanOnBoard.Value ? yorntype.Y : yorntype.N);
|
||||
}
|
||||
secItemNames.Add(ItemsChoiceType4.PortFacilityOfArrival);
|
||||
secItems.Add(sec.PortFacilityOfArrival);
|
||||
if (!sec.PortFacilityOfArrival.IsNullOrEmpty())
|
||||
{
|
||||
secItemNames.Add(ItemsChoiceType4.PortFacilityOfArrival);
|
||||
secItems.Add(sec.PortFacilityOfArrival);
|
||||
}
|
||||
if (sec.GeneralDescriptionOfCargo.HasValue)
|
||||
{
|
||||
secItemNames.Add(ItemsChoiceType4.GeneralDescriptionOfCargo);
|
||||
@ -877,16 +894,20 @@ namespace bsmd.hisnord
|
||||
foreach (LastTenPortFacilitiesCalled l10Called in sec.LastTenPortFacilitesCalled)
|
||||
{
|
||||
last10port hn_last10port = new last10port();
|
||||
hn_last10port.PortFacilityPortName = l10Called.PortFacilityPortName;
|
||||
hn_last10port.PortFacilityPortCountry = l10Called.PortFacilityPortCountry;
|
||||
hn_last10port.PortFacilityPortLoCode = l10Called.PortFacilityPortLoCode;
|
||||
if(!l10Called.PortFacilityPortName.IsNullOrEmpty())
|
||||
hn_last10port.PortFacilityPortName = l10Called.PortFacilityPortName;
|
||||
if(!l10Called.PortFacilityPortCountry.IsNullOrEmpty())
|
||||
hn_last10port.PortFacilityPortCountry = l10Called.PortFacilityPortCountry;
|
||||
if(!l10Called.PortFacilityPortLoCode.IsNullOrEmpty())
|
||||
hn_last10port.PortFacilityPortLoCode = l10Called.PortFacilityPortLoCode;
|
||||
if (l10Called.PortFacilityDateOfArrival.HasValue)
|
||||
hn_last10port.PortFacilityDateOfArrival = l10Called.PortFacilityDateOfArrival.Value;
|
||||
if (l10Called.PortFacilityDateOfDeparture.HasValue)
|
||||
hn_last10port.PortFacilityDateOfDeparture = l10Called.PortFacilityDateOfDeparture.Value;
|
||||
if (l10Called.PortFacilityShipSecurityLevel.HasValue)
|
||||
hn_last10port.PortFacilityShipSecurityLevel = (posint13type)l10Called.PortFacilityShipSecurityLevel.Value;
|
||||
hn_last10port.PortFacilitySecurityMattersToReport = l10Called.PortFacilitySecurityMattersToReport;
|
||||
if(!l10Called.PortFacilitySecurityMattersToReport.IsNullOrEmpty())
|
||||
hn_last10port.PortFacilitySecurityMattersToReport = l10Called.PortFacilitySecurityMattersToReport;
|
||||
hn_last10port.PortFacilityGISISCode = l10Called.PortFacilityGISISCode;
|
||||
|
||||
secItemNames.Add(ItemsChoiceType4.LastTenPortFacilitiesCalled);
|
||||
@ -1150,8 +1171,11 @@ namespace bsmd.hisnord
|
||||
}
|
||||
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
|
||||
{
|
||||
was_items.Add(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName);
|
||||
was_item_names.Add(ItemsChoiceType6.WasteDisposalServiceProviderName);
|
||||
if (!was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName.IsNullOrEmpty())
|
||||
{
|
||||
was_items.Add(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName);
|
||||
was_item_names.Add(ItemsChoiceType6.WasteDisposalServiceProviderName);
|
||||
}
|
||||
}
|
||||
if (was.WasteDisposalDelivery.HasValue)
|
||||
{
|
||||
@ -1174,7 +1198,9 @@ namespace bsmd.hisnord
|
||||
hn_waste.WasteType = new wastetyp();
|
||||
if (waste.WasteType.HasValue)
|
||||
hn_waste.WasteType.WasteCode = waste.WasteType.Value.ToString();
|
||||
hn_waste.WasteType.WasteDescription = waste.WasteDescription;
|
||||
|
||||
if(!waste.WasteDescription.IsNullOrEmpty())
|
||||
hn_waste.WasteType.WasteDescription = waste.WasteDescription;
|
||||
|
||||
|
||||
hn_waste.WasteDetails = new wastedetails();
|
||||
@ -1570,12 +1596,15 @@ namespace bsmd.hisnord
|
||||
pi.PackingGroup = (packinggrouptype)imdgPosition.PackingGroup;
|
||||
pi.ProperShippingName = imdgPosition.ProperShippingName;
|
||||
pi.IMOClass = imdgPosition.IMOClass;
|
||||
pi.TechnicalName = imdgPosition.TechnicalName;
|
||||
if(!imdgPosition.TechnicalName.IsNullOrEmpty())
|
||||
pi.TechnicalName = imdgPosition.TechnicalName;
|
||||
pi.NetExplosiveMass_KGMSpecified = imdgPosition.NetExplosiveMass_KGM.HasValue;
|
||||
if (pi.NetExplosiveMass_KGMSpecified)
|
||||
pi.NetExplosiveMass_KGM = (float)imdgPosition.NetExplosiveMass_KGM.Value;
|
||||
pi.Flashpoint_CEL = imdgPosition.Flashpoint_CEL;
|
||||
pi.Class7NuclideName = imdgPosition.Class7NuclideName;
|
||||
if(!imdgPosition.Flashpoint_CEL.IsNullOrEmpty())
|
||||
pi.Flashpoint_CEL = imdgPosition.Flashpoint_CEL;
|
||||
if(!imdgPosition.Class7NuclideName.IsNullOrEmpty())
|
||||
pi.Class7NuclideName = imdgPosition.Class7NuclideName;
|
||||
pi.Class7MaxActivity_BQLSpecified = imdgPosition.Class7MaxActivity_BQL.HasValue;
|
||||
if (pi.Class7MaxActivity_BQLSpecified)
|
||||
pi.Class7MaxActivity_BQL = (float)imdgPosition.Class7MaxActivity_BQL.Value;
|
||||
@ -1617,7 +1646,8 @@ namespace bsmd.hisnord
|
||||
pi.GeneralCargoIBCSpecified = imdgPosition.GeneralCargoIBC.HasValue;
|
||||
if (pi.GeneralCargoIBCSpecified)
|
||||
pi.GeneralCargoIBC = imdgPosition.GeneralCargoIBC.Value ? yorntype.Y : yorntype.N;
|
||||
pi.ContainerNumber = imdgPosition.ContainerNumber;
|
||||
if(!imdgPosition.ContainerNumber.IsNullOrEmpty())
|
||||
pi.ContainerNumber = imdgPosition.ContainerNumber;
|
||||
if(!imdgPosition.VehicleLicenseNumber.IsNullOrEmpty())
|
||||
pi.VehicleLicenseNumber = imdgPosition.VehicleLicenseNumber;
|
||||
if(!imdgPosition.StowagePosition.IsNullOrEmpty())
|
||||
@ -1661,7 +1691,8 @@ namespace bsmd.hisnord
|
||||
pi.Hazards = (hazardtype)ibcPosition.Hazards.Value;
|
||||
if (ibcPosition.FlashpointInformation.HasValue)
|
||||
pi.FlashpointInformation = (flashpointinfotype)ibcPosition.FlashpointInformation.Value;
|
||||
pi.Flashpoint_CEL = ibcPosition.Flashpoint_CEL;
|
||||
if(!ibcPosition.Flashpoint_CEL.IsNullOrEmpty())
|
||||
pi.Flashpoint_CEL = ibcPosition.Flashpoint_CEL;
|
||||
if (ibcPosition.Quantity_KGM.HasValue)
|
||||
pi.Quantity_KGM = (float)ibcPosition.Quantity_KGM.Value;
|
||||
pi.StowagePosition = ibcPosition.StowagePosition;
|
||||
@ -1688,8 +1719,10 @@ namespace bsmd.hisnord
|
||||
positionigc pi = new positionigc();
|
||||
IGCPosition igcPosition = haz.IGCPositions[i] as IGCPosition;
|
||||
|
||||
pi.UNNumber = igcPosition.UNNumber;
|
||||
pi.IMOClass = igcPosition.IMOClass;
|
||||
if(!igcPosition.UNNumber.IsNullOrEmpty())
|
||||
pi.UNNumber = igcPosition.UNNumber;
|
||||
if(!igcPosition.IMOClass.IsNullOrEmpty())
|
||||
pi.IMOClass = igcPosition.IMOClass;
|
||||
pi.ProductName = igcPosition.ProductName;
|
||||
if (igcPosition.Quantity_KGM.HasValue)
|
||||
pi.Quantity_KGM = (float)igcPosition.Quantity_KGM.Value;
|
||||
@ -1716,8 +1749,10 @@ namespace bsmd.hisnord
|
||||
|
||||
pi.BulkCargoShippingName = imsbcPosition.BulkCargoShippingName;
|
||||
pi.MHB = (imsbcPosition.MHB ?? false) ? yorntype.Y : yorntype.N;
|
||||
pi.UNNumber = imsbcPosition.UNNumber;
|
||||
pi.IMOClass = imsbcPosition.IMOClass;
|
||||
if(!imsbcPosition.UNNumber.IsNullOrEmpty())
|
||||
pi.UNNumber = imsbcPosition.UNNumber;
|
||||
if(!imsbcPosition.IMOClass.IsNullOrEmpty())
|
||||
pi.IMOClass = imsbcPosition.IMOClass;
|
||||
if (imsbcPosition.Quantity_KGM.HasValue)
|
||||
pi.Quantity_KGM = (float)imsbcPosition.Quantity_KGM.Value;
|
||||
pi.StowagePosition = imsbcPosition.StowagePosition;
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user