3.6.0 neuer Stand (DB Erweiterung für NSW "Live"-Abfrage
This commit is contained in:
parent
f1cb014fa3
commit
f02530f960
@ -48,6 +48,9 @@ namespace ENI2.Controls
|
||||
}
|
||||
*/
|
||||
|
||||
public event EventHandler TabClosing;
|
||||
|
||||
|
||||
public void SetHeaderText(string headerText)
|
||||
{
|
||||
// Container for header controls
|
||||
@ -80,6 +83,8 @@ namespace ENI2.Controls
|
||||
{
|
||||
var tabControl = Parent as ItemsControl;
|
||||
tabControl.Items.Remove(this);
|
||||
if (TabClosing != null)
|
||||
this.TabClosing(this, new EventArgs());
|
||||
};
|
||||
dockPanel.Children.Add(closeButton);
|
||||
|
||||
|
||||
@ -32,11 +32,14 @@ namespace ENI2.Controls
|
||||
{
|
||||
var okButton = (Button)Template.FindName("buttonOK", this);
|
||||
var cancelButton = (Button)Template.FindName("buttonCancel", this);
|
||||
okButton.Click += (s, e) => { DialogResult = true; OKClicked?.Invoke(); };
|
||||
cancelButton.Click += (s, e) => { DialogResult = false; CancelClicked?.Invoke(); };
|
||||
okButton.Click += (s, e) => { if (IsModal) DialogResult = true; else this.Close(); OKClicked?.Invoke(); };
|
||||
cancelButton.Click += (s, e) => { if (IsModal) DialogResult = false; else this.Close(); CancelClicked?.Invoke(); };
|
||||
};
|
||||
this.IsModal = true; // default
|
||||
}
|
||||
|
||||
public bool IsModal { get; set; }
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (this.shouldCancel) e.Cancel = true;
|
||||
|
||||
@ -26,7 +26,6 @@ namespace ENI2
|
||||
AMBIGUOUS
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region events
|
||||
@ -37,6 +36,11 @@ namespace ENI2
|
||||
/// </summary>
|
||||
public event Action<int> JumpToListElementRequest;
|
||||
|
||||
/// <summary>
|
||||
/// Mit diesem Event kann ein Listen-Element einen Reload der gesamten Anmeldung auslösen (ob das so eine tolle Idee ist.)
|
||||
/// </summary>
|
||||
public event Action RequestReload;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
@ -47,18 +51,26 @@ namespace ENI2
|
||||
|
||||
#endregion
|
||||
|
||||
#region protected methods
|
||||
#region public methods
|
||||
|
||||
public virtual void Initialize() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region protected methods
|
||||
|
||||
protected virtual void OnJumpToListElementRequest(int index)
|
||||
{
|
||||
this.JumpToListElementRequest?.Invoke(index);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnRequestReload()
|
||||
{
|
||||
this.RequestReload?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
protected void SetLocodeStateImage(Image stateImage, LocodeState state)
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:local="clr-namespace:ENI2"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
@ -16,9 +17,9 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label x:Name="shipNameLabel" Grid.Row="0" Grid.Column="0" VerticalContentAlignment="Center" FontWeight="Bold" />
|
||||
<Label x:Name="displayIdLabel" Grid.Row="0" Grid.Column="1" VerticalContentAlignment="Center" FontWeight="Bold" />
|
||||
|
||||
<xctk:AutoSelectTextBox x:Name="shipNameLabel" Grid.Row="0" Grid.Column="0" VerticalContentAlignment="Center" FontWeight="Bold" IsReadOnly="True" BorderThickness="0" AutoSelectBehavior="OnFocus" />
|
||||
<xctk:AutoSelectTextBox x:Name="displayIdLabel" Grid.Row="0" Grid.Column="1" VerticalContentAlignment="Center" FontWeight="Bold" IsReadOnly="True" BorderThickness="0" AutoSelectBehavior="OnFocus" />
|
||||
|
||||
<ListBox x:Name="listBoxMessages" Margin="2" SelectionMode="Single" SelectionChanged="listBoxMessages_SelectionChanged"
|
||||
Grid.Row="1" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
||||
<ListBox.ItemTemplate>
|
||||
|
||||
@ -19,13 +19,16 @@ namespace ENI2
|
||||
private MessageCore _core;
|
||||
private List<MessageGroup> _listBoxList = new List<MessageGroup>();
|
||||
private List<Message> _messages;
|
||||
private Dictionary<Type, DetailBaseControl> controlCache = new Dictionary<Type, DetailBaseControl>();
|
||||
public MessageCore Core { get { return this._core; } }
|
||||
|
||||
public DetailRootControl(MessageCore aCore)
|
||||
{
|
||||
_core = aCore;
|
||||
InitializeComponent();
|
||||
shipNameLabel.Content = aCore.Shipname;
|
||||
displayIdLabel.Content = aCore.DisplayId;
|
||||
shipNameLabel.Text = aCore.Shipname;
|
||||
displayIdLabel.Text = aCore.DisplayId;
|
||||
|
||||
|
||||
// Listbox befüllen
|
||||
this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" });
|
||||
@ -70,21 +73,45 @@ namespace ENI2
|
||||
if(listBoxMessages.SelectedItem != null)
|
||||
{
|
||||
MessageGroup mg = this.listBoxMessages.SelectedItem as MessageGroup;
|
||||
// create control instance for display:
|
||||
DetailBaseControl detailControl = (DetailBaseControl) Activator.CreateInstance(mg.MessageGroupControlType);
|
||||
detailControl.Core = _core;
|
||||
detailControl.Messages = _messages;
|
||||
detailControl.JumpToListElementRequest += (index) => {
|
||||
if((index >= 0) && (index < _listBoxList.Count))
|
||||
if (!controlCache.ContainsKey(mg.MessageGroupControlType))
|
||||
{
|
||||
// create control instance for display:
|
||||
DetailBaseControl detailControl = (DetailBaseControl)Activator.CreateInstance(mg.MessageGroupControlType);
|
||||
detailControl.Core = _core;
|
||||
detailControl.Messages = _messages;
|
||||
|
||||
detailControl.JumpToListElementRequest += (index) =>
|
||||
{
|
||||
this.listBoxMessages.SelectedIndex = index;
|
||||
}
|
||||
};
|
||||
detailControl.Initialize();
|
||||
if ((index >= 0) && (index < _listBoxList.Count))
|
||||
{
|
||||
this.listBoxMessages.SelectedIndex = index;
|
||||
}
|
||||
};
|
||||
|
||||
detailControl.RequestReload += DetailControl_RequestReload;
|
||||
|
||||
detailControl.Initialize();
|
||||
controlCache.Add(mg.MessageGroupControlType, detailControl);
|
||||
}
|
||||
// plug it in ;-)
|
||||
detailView.Children.Clear();
|
||||
detailView.Children.Add(detailControl);
|
||||
detailView.Children.Add(controlCache[mg.MessageGroupControlType]);
|
||||
}
|
||||
}
|
||||
|
||||
private void DetailControl_RequestReload()
|
||||
{
|
||||
/// core und messages neu laden
|
||||
///
|
||||
this._core = DBManager.Instance.GetMessageCoreById(this.Core.Id.Value);
|
||||
this._messages = DBManager.Instance.GetMessagesForCore(this._core, DBManager.MessageLoad.ALL);
|
||||
|
||||
// clear existing controls
|
||||
this.detailView.Children.Clear();
|
||||
this.controlCache.Clear();
|
||||
|
||||
// return to "new" overview
|
||||
Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages_SelectionChanged(this, null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,28 +10,42 @@
|
||||
xmlns:local="clr-namespace:ENI2.DetailViewControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="600">
|
||||
<GroupBox Name="visitTransitGroupBox" Header="{x:Static p:Resources.textVisitTransit}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" Margin="0,0,10,0"/>
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="0" Width="Auto" x:Name="locodePoC" LocodeValue="{Binding PoC, Mode=TwoWay}"/>
|
||||
<!--Grid Grid.Column="1" Grid.Row="0" Width="Auto">
|
||||
<xctk:BusyIndicator Name="busyIndicator">
|
||||
<xctk:BusyIndicator.ProgressBarStyle>
|
||||
<Style TargetType="ProgressBar">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</Style>
|
||||
</xctk:BusyIndicator.ProgressBarStyle>
|
||||
<xctk:BusyIndicator.BusyContent>
|
||||
<StackPanel>
|
||||
<Label Name="labelBusyWaitLabel" Content="{x:Static p:Resources.textBusyCheckStatus}" />
|
||||
<Label Name="labelBusyTimeElapsed" Content=""/>
|
||||
<Button Name="buttonStopWaiting" Content="{x:Static p:Resources.textStopWaiting}" Click="buttonStopWaiting_Click"/>
|
||||
</StackPanel>
|
||||
</xctk:BusyIndicator.BusyContent>
|
||||
|
||||
<GroupBox Name="visitTransitGroupBox" Header="{x:Static p:Resources.textVisitTransit}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" Margin="0,0,10,0"/>
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="0" Width="Auto" x:Name="locodePoC" LocodeValue="{Binding PoC, Mode=TwoWay}"/>
|
||||
<!--Grid Grid.Column="1" Grid.Row="0" Width="Auto">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@ -39,77 +53,84 @@
|
||||
<xctk:WatermarkComboBox Grid.Column="0" x:Name="comboBoxPoC" Margin="2" IsEditable="True" Watermark="Type for Locode.." TextBoxBase.TextChanged="ComboBox_TextChanged" ItemsSource="{Binding LocodePoCList, Mode=TwoWay}" SelectedItem="{Binding PoC, Mode=TwoWay}" />
|
||||
<Image Name="imagePoCState" Grid.Column="1" Source="../Resources/bullet_ball_grey.png" />
|
||||
</-->
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="3" Content="{x:Static p:Resources.textVisitTransitId}" Margin="0,0,10,0" />
|
||||
<TextBox Name="textBoxDisplayId" Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2" IsReadOnly="True" Margin="2" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textIMO}" Margin="0,0,10,0" />
|
||||
<TextBox Name="textBoxIMO" Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="1" Text="{Binding IMO}" Margin="2" IsReadOnly="True" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="3" Content="{x:Static p:Resources.textENI}" Margin="0,0,10,0" />
|
||||
<TextBox Name="textBoxENI" Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" Text="{Binding ENI}" Margin="2" IsReadOnly="True" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textETAPortOfCall}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="3" Content="{x:Static p:Resources.textETDPortOfCall}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textATAPortOfCall}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="3" Content="{x:Static p:Resources.textATDPortOfCall}" Margin="0,0,10,0" />
|
||||
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2" Value="{Binding ETAToPortOfCall, Mode=TwoWay}" Name="dateTimePickerETA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
<xctk:DateTimePicker Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="2" Value="{Binding ETDFromPortOfCall, Mode=TwoWay}" Name="dateTimePickerETD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="3" Value="{Binding ATAPortOfCall, Mode=TwoWay}" Name="dateTimePickerATA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||
<xctk:DateTimePicker Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="3" Value="{Binding ATDPortOfCall, Mode=TwoWay}" Name="dateTimePickerATD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||
<Label HorizontalAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textTicketNo}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="3" Content="{x:Static p:Resources.textCreated}" Margin="0,0,10,0" />
|
||||
<Label Name="labelCreated" Grid.Column="4" Grid.Row="4" Margin="2, 0, 0, 0" />
|
||||
<TextBox Name="textBoxTicketNo" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2" Text="{Binding TicketNo}" Margin="2" />
|
||||
<!-- Command buttons -->
|
||||
<Button IsEnabled="False" Name="buttonStorno" Grid.Column="1" Grid.Row="5" Margin="2" Click="buttonStorno_Click" Content="{x:Static p:Resources.textCancelDeclaration}"/>
|
||||
<Button IsEnabled="False" Name="buttonCopy" Grid.Column="2" Grid.Row="5" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
|
||||
<Button IsEnabled="False" Name="buttonSendPDF" Grid.Column="3" Grid.Row="5" Margin="2" Click="buttonSendPDF_Click" Content="{x:Static p:Resources.textCreatePDF}"/>
|
||||
<Button IsEnabled="False" Name="buttonQueryHIS" Grid.Column="5" Grid.Row="5" Margin="2" Click="buttonQueryHIS_Click" Content="{x:Static p:Resources.textQueryHIS}"/>
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="3" Content="{x:Static p:Resources.textVisitTransitId}" Margin="0,0,10,0" />
|
||||
<TextBox Name="textBoxDisplayId" Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2" IsReadOnly="True" Margin="2" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textIMO}" Margin="0,0,10,0" />
|
||||
<TextBox Name="textBoxIMO" Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="1" Text="{Binding IMO}" Margin="2" IsReadOnly="True" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="3" Content="{x:Static p:Resources.textENI}" Margin="0,0,10,0" />
|
||||
<TextBox Name="textBoxENI" Grid.Row="1" Grid.Column="4" Grid.ColumnSpan="2" Text="{Binding ENI}" Margin="2" IsReadOnly="True" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textETAPortOfCall}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="3" Content="{x:Static p:Resources.textETDPortOfCall}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textATAPortOfCall}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="3" Content="{x:Static p:Resources.textATDPortOfCall}" Margin="0,0,10,0" />
|
||||
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2" Value="{Binding ETAToPortOfCall, Mode=TwoWay}" Name="dateTimePickerETA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
<xctk:DateTimePicker Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="2" Value="{Binding ETDFromPortOfCall, Mode=TwoWay}" Name="dateTimePickerETD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||
<xctk:DateTimePicker Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="3" Value="{Binding ATAPortOfCall, Mode=TwoWay}" Name="dateTimePickerATA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||
<xctk:DateTimePicker Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="3" Value="{Binding ATDPortOfCall, Mode=TwoWay}" Name="dateTimePickerATD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||
<Label HorizontalAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textTicketNo}" Margin="0,0,10,0" />
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="3" Content="{x:Static p:Resources.textCreated}" Margin="0,0,10,0" />
|
||||
<Label Name="labelCreated" Grid.Column="4" Grid.Row="4" Margin="2, 0, 0, 0" />
|
||||
<TextBox Name="textBoxTicketNo" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2" Text="{Binding TicketNo}" Margin="2" />
|
||||
<!-- Command buttons -->
|
||||
<Button IsEnabled="False" Name="buttonStorno" Grid.Column="1" Grid.Row="5" Margin="2" Click="buttonStorno_Click" Content="{x:Static p:Resources.textCancelDeclaration}"/>
|
||||
<Button IsEnabled="False" Name="buttonCopy" Grid.Column="2" Grid.Row="5" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
|
||||
<Button IsEnabled="False" Name="buttonSendPDF" Grid.Column="3" Grid.Row="5" Margin="2" Click="buttonSendPDF_Click" Content="{x:Static p:Resources.textCreatePDF}"/>
|
||||
<Button Name="buttonQueryHIS" Grid.Column="4" Grid.Row="5" Margin="2" Click="buttonQueryHIS_Click" Content="{x:Static p:Resources.textQueryHIS}"/>
|
||||
<Button Name="buttonRefresh" Grid.Column="5" Grid.Row="5" Margin="2" Click="buttonRefresh_Click">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="../Resources/nav_refresh_blue.png" Margin="0,0,10,0"/>
|
||||
<TextBlock Text="{x:Static p:Resources.textRefresh}"/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<!-- Data Grid -->
|
||||
<DataGrid Grid.Row="6" Grid.ColumnSpan="6" Margin="0,8,0,0" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
|
||||
<!-- Data Grid -->
|
||||
<DataGrid Grid.Row="6" Grid.ColumnSpan="6" Margin="0,8,0,0" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header=" " Width="SizeToCells" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<!--Image Source="{Binding src:Util.ImageDict[ENINotificationDetailGroup]}" /-->
|
||||
<!--Image Source="{Binding Source={x:Static src:Util.ImageDict}, Path=[ENINotificationDetailGroup]}"></-->
|
||||
<Image Source="{Binding ENINotificationIconString}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<!--
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header=" " Width="SizeToCells" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<!--Image Source="{Binding src:Util.ImageDict[ENINotificationDetailGroup]}" /-->
|
||||
<!--Image Source="{Binding Source={x:Static src:Util.ImageDict}, Path=[ENINotificationDetailGroup]}"></-->
|
||||
<Image Source="{Binding ENINotificationIconString}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<!--
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationGroup}" Binding="{Binding ENINotificationDetailGroup}" IsReadOnly="True" Width="0.25*" />
|
||||
-->
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationClass}" Binding="{Binding MessageNotificationClassDisplay}" IsReadOnly="True" Width="0.1*" FontWeight="Bold">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="10,0,0,0" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.15*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textStatus}" Binding="{Binding InternalStatus}" IsReadOnly="True" Width="0.1*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textChangedBy}" Binding="{Binding ChangedBy}" IsReadOnly="True" Width="0.5*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationClass}" Binding="{Binding MessageNotificationClassDisplay}" IsReadOnly="True" Width="0.1*" FontWeight="Bold">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="10,0,0,0" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.15*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textStatus}" Binding="{Binding InternalStatus}" IsReadOnly="True" Width="0.1*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textChangedBy}" Binding="{Binding ChangedBy}" IsReadOnly="True" Width="0.5*">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</xctk:BusyIndicator>
|
||||
</src:DetailBaseControl>
|
||||
|
||||
@ -3,10 +3,12 @@
|
||||
//
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Timers;
|
||||
|
||||
using bsmd.database;
|
||||
|
||||
@ -21,6 +23,8 @@ namespace ENI2.DetailViewControls
|
||||
private Message _ataMessage;
|
||||
private Message _atdMessage;
|
||||
private Message _noanodMessage;
|
||||
private Timer _checkStatusTimer;
|
||||
private DateTime _startStatusCheck;
|
||||
|
||||
public OverViewDetailControl()
|
||||
{
|
||||
@ -313,10 +317,65 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
private void buttonQueryHIS_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this._startStatusCheck = DateTime.Now;
|
||||
this.Core.QueryNSWStatus = true;
|
||||
DBManager.Instance.Save(this.Core);
|
||||
this.busyIndicator.IsBusy = true;
|
||||
|
||||
// Hintergrund-Thread starten, der gelegentlich auf das Ergebnis prüft..
|
||||
if (_checkStatusTimer == null)
|
||||
{
|
||||
_checkStatusTimer = new Timer(3000);
|
||||
_checkStatusTimer.Elapsed += _checkStatusTimer_Elapsed;
|
||||
_checkStatusTimer.AutoReset = true;
|
||||
}
|
||||
_checkStatusTimer.Start();
|
||||
}
|
||||
|
||||
private void _checkStatusTimer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
bool? statusFlag = DBManager.Instance.GetMessageCoreQueryStatusFlag(this.Core.Id.Value);
|
||||
if(statusFlag ?? true)
|
||||
{
|
||||
// not yet.. (calling ui thread async)
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
this.labelBusyTimeElapsed.Content = string.Format(Properties.Resources.textSecondsElapsed, (DateTime.Now - _startStatusCheck).TotalSeconds.ToString("N1"));
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
this.busyIndicator.IsBusy = false;
|
||||
this.OnRequestReload();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonStopWaiting_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.busyIndicator.IsBusy = false;
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// reload Core and all message classes
|
||||
// container class needs to dismiss all created controls
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
this.OnRequestReload();
|
||||
}));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region private methods
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,6 +232,7 @@
|
||||
<Compile Include="SucheControl.xaml.cs">
|
||||
<DependentUpon>SucheControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Util\BoolToVisibilityConverter.cs" />
|
||||
<Compile Include="VorgaengeControl.xaml.cs">
|
||||
<DependentUpon>VorgaengeControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -365,6 +366,7 @@
|
||||
<Generator>WCF Proxy Generator</Generator>
|
||||
<LastGenOutput>Reference.cs</LastGenOutput>
|
||||
</None>
|
||||
<Resource Include="Resources\nav_refresh_blue.png" />
|
||||
<Content Include="x64\SQLite.Interop.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
xmlns:enidtctrl="clr-namespace:ENI2.DetailViewControls"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:util="clr-namespace:ENI2.Util"
|
||||
xmlns:local="clr-namespace:ENI2"
|
||||
mc:Ignorable="d"
|
||||
Title="ENI 2" Height="450" Width="825" Icon="Resources/logo_schwarz.ico" Loaded="Window_Loaded" Closing="Window_Closing"
|
||||
@ -15,7 +17,10 @@
|
||||
Executed="ExecutedClearCommand"
|
||||
CanExecute="CanExecuteClearCommand" />
|
||||
</Window.CommandBindings>
|
||||
|
||||
<Window.Resources>
|
||||
<util:BoolToVisibilityConverter x:Key="BoolToHiddenConverter" TrueValue="Visible" FalseValue="Hidden" />
|
||||
</Window.Resources>
|
||||
|
||||
<DockPanel Name="mainPanel">
|
||||
<Grid DockPanel.Dock="Top" Height="80" Background="#FFE8F6FF">
|
||||
<Image x:Name="logoImage" HorizontalAlignment="Left" Height="80" Width="80" Source="Resources/EUREPORT.png" Stretch="Fill" MouseUp="logoImage_MouseUp"/>
|
||||
@ -67,4 +72,7 @@
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
<!--Rectangle Fill="White" Opacity="0.7" Visibility="{Binding IsWaiting, Converter={StaticResource BoolToHiddenConverter}}" /-->
|
||||
|
||||
|
||||
</Window>
|
||||
|
||||
@ -27,6 +27,7 @@ namespace ENI2
|
||||
private List<MessageCore> anmeldungen = new List<MessageCore>();
|
||||
private bool efMode = false;
|
||||
ScaleTransform _transform = new ScaleTransform(1.0, 1.0);
|
||||
private Dictionary<Guid, ClosableTabItem> openTabs = new Dictionary<Guid, ClosableTabItem>();
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
@ -43,15 +44,35 @@ namespace ENI2
|
||||
{
|
||||
if(aMessageCore != null)
|
||||
{
|
||||
ClosableTabItem searchResultItem = new ClosableTabItem();
|
||||
searchResultItem.SetHeaderText(string.Format("{0} [{1}-{2}]", aMessageCore.Shipname, aMessageCore.PoC, aMessageCore.ETA.HasValue ? aMessageCore.ETA.Value.ToShortDateString() : ""));
|
||||
DetailRootControl drc = new DetailRootControl(aMessageCore);
|
||||
searchResultItem.Content = drc;
|
||||
this.mainFrame.Items.Add(searchResultItem);
|
||||
Dispatcher.BeginInvoke((Action)(() => this.mainFrame.SelectedIndex = (this.mainFrame.Items.Count - 1)));
|
||||
if (!openTabs.ContainsKey(aMessageCore.Id.Value))
|
||||
{
|
||||
ClosableTabItem searchResultItem = new ClosableTabItem();
|
||||
searchResultItem.TabClosing += SearchResultItem_TabClosing;
|
||||
searchResultItem.SetHeaderText(string.Format("{0} [{1}-{2}]", aMessageCore.Shipname, aMessageCore.PoC, aMessageCore.ETA.HasValue ? aMessageCore.ETA.Value.ToShortDateString() : ""));
|
||||
DetailRootControl drc = new DetailRootControl(aMessageCore);
|
||||
searchResultItem.Content = drc;
|
||||
this.mainFrame.Items.Add(searchResultItem);
|
||||
Dispatcher.BeginInvoke((Action)(() => this.mainFrame.SelectedIndex = (this.mainFrame.Items.Count - 1)));
|
||||
this.openTabs.Add(aMessageCore.Id.Value, searchResultItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dispatcher.BeginInvoke((Action)(() => this.mainFrame.SelectedItem = openTabs[aMessageCore.Id.Value]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchResultItem_TabClosing(object sender, EventArgs e)
|
||||
{
|
||||
ClosableTabItem tabItem = sender as ClosableTabItem;
|
||||
if(tabItem != null)
|
||||
{
|
||||
DetailRootControl drc = tabItem.Content as DetailRootControl;
|
||||
if (openTabs.ContainsKey(drc.Core.Id.Value))
|
||||
openTabs.Remove(drc.Core.Id.Value);
|
||||
}
|
||||
}
|
||||
|
||||
#region Window control click event handler
|
||||
|
||||
private void logoImage_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
@ -121,11 +142,8 @@ namespace ENI2
|
||||
MessageCore newCore = new MessageCore();
|
||||
VisitIdDialog visitIdDialog = new VisitIdDialog();
|
||||
visitIdDialog.Core = newCore;
|
||||
|
||||
if (visitIdDialog.ShowDialog() ?? false)
|
||||
{
|
||||
|
||||
}
|
||||
visitIdDialog.IsModal = false;
|
||||
visitIdDialog.Show();
|
||||
}
|
||||
|
||||
private void closeButton_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
46
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
46
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
@ -280,6 +280,16 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap nav_refresh_blue {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("nav_refresh_blue", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@ -420,6 +430,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checking declaration status...
|
||||
/// </summary>
|
||||
public static string textBusyCheckStatus {
|
||||
get {
|
||||
return ResourceManager.GetString("textBusyCheckStatus", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Call Purposes.
|
||||
/// </summary>
|
||||
@ -1023,6 +1042,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Refresh.
|
||||
/// </summary>
|
||||
public static string textRefresh {
|
||||
get {
|
||||
return ResourceManager.GetString("textRefresh", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Requested position in port of call.
|
||||
/// </summary>
|
||||
@ -1041,6 +1069,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} seconds elapsed.
|
||||
/// </summary>
|
||||
public static string textSecondsElapsed {
|
||||
get {
|
||||
return ResourceManager.GetString("textSecondsElapsed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Security.
|
||||
/// </summary>
|
||||
@ -1167,6 +1204,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Stop waiting...
|
||||
/// </summary>
|
||||
public static string textStopWaiting {
|
||||
get {
|
||||
return ResourceManager.GetString("textStopWaiting", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Street / number.
|
||||
/// </summary>
|
||||
|
||||
@ -235,8 +235,8 @@
|
||||
<data name="textPrint" xml:space="preserve">
|
||||
<value>_Print</value>
|
||||
</data>
|
||||
<data name="textPortCall" xml:space="preserve">
|
||||
<value>Port Call</value>
|
||||
<data name="textPortCall" xml:space="preserve">
|
||||
<value>Port of call</value>
|
||||
</data>
|
||||
<data name="textArrivalDeparture" xml:space="preserve">
|
||||
<value>Arrival/Departure</value>
|
||||
@ -250,7 +250,7 @@
|
||||
<data name="textLastPort" xml:space="preserve">
|
||||
<value>Last Port</value>
|
||||
</data>
|
||||
<data name="textNextPort" xml:space="preserve">
|
||||
<data name="textNextPort" xml:space="preserve">
|
||||
<value>Next Port</value>
|
||||
</data>
|
||||
<data name="textETDPortOfCall" xml:space="preserve">
|
||||
@ -268,7 +268,7 @@
|
||||
<data name="textAnchored" xml:space="preserve">
|
||||
<value>Anchored</value>
|
||||
</data>
|
||||
<data name="textCallPurposes" xml:space="preserve">
|
||||
<data name="textCallPurposes" xml:space="preserve">
|
||||
<value>Call Purposes</value>
|
||||
</data>
|
||||
<data name="textCode" xml:space="preserve">
|
||||
@ -310,9 +310,6 @@
|
||||
<data name="textVisitTransit" xml:space="preserve">
|
||||
<value>Visit / transit</value>
|
||||
</data>
|
||||
<data name="textPortCall" xml:space="preserve">
|
||||
<value>Port of call</value>
|
||||
</data>
|
||||
<data name="textIMO" xml:space="preserve">
|
||||
<value>IMO number</value>
|
||||
</data>
|
||||
@ -352,7 +349,7 @@
|
||||
<data name="textShipData" xml:space="preserve">
|
||||
<value>Ship data</value>
|
||||
</data>
|
||||
<data name="textBorderPolice" xml:space="preserve">
|
||||
<data name="textBorderPolice" xml:space="preserve">
|
||||
<value>Border Police</value>
|
||||
</data>
|
||||
<data name="textDepartureNotification" xml:space="preserve">
|
||||
@ -505,4 +502,19 @@
|
||||
<data name="textTicketNo" xml:space="preserve">
|
||||
<value>Ticket No</value>
|
||||
</data>
|
||||
<data name="textBusyCheckStatus" xml:space="preserve">
|
||||
<value>Checking declaration status..</value>
|
||||
</data>
|
||||
<data name="textSecondsElapsed" xml:space="preserve">
|
||||
<value>{0} seconds elapsed</value>
|
||||
</data>
|
||||
<data name="textStopWaiting" xml:space="preserve">
|
||||
<value>Stop waiting..</value>
|
||||
</data>
|
||||
<data name="nav_refresh_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\nav_refresh_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="textRefresh" xml:space="preserve">
|
||||
<value>Refresh</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
ENI-2/ENI2/ENI2/Resources/nav_refresh_blue.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/nav_refresh_blue.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
43
ENI-2/ENI2/ENI2/Util/BoolToVisibilityConverter.cs
Normal file
43
ENI-2/ENI2/ENI2/Util/BoolToVisibilityConverter.cs
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2017 schick Informatik
|
||||
// Description: Converter
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ENI2.Util
|
||||
{
|
||||
[ValueConversion(typeof(bool), typeof(Visibility))]
|
||||
public sealed class BoolToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public Visibility TrueValue { get; set; }
|
||||
public Visibility FalseValue { get; set; }
|
||||
|
||||
public BoolToVisibilityConverter()
|
||||
{
|
||||
// set defaults
|
||||
TrueValue = Visibility.Visible;
|
||||
FalseValue = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object Convert(object value, Type targetType,
|
||||
object parameter, CultureInfo culture)
|
||||
{
|
||||
if (!(value is bool))
|
||||
return null;
|
||||
return (bool)value ? TrueValue : FalseValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType,
|
||||
object parameter, CultureInfo culture)
|
||||
{
|
||||
if (Equals(value, TrueValue))
|
||||
return true;
|
||||
if (Equals(value, FalseValue))
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
17
nsw/Source/SQL/Update_3.5.9_To_3.6.0.sql
Normal file
17
nsw/Source/SQL/Update_3.5.9_To_3.6.0.sql
Normal file
@ -0,0 +1,17 @@
|
||||
-- Update für Status Check
|
||||
|
||||
PRINT N'Altering [dbo].[MessageCore]...';
|
||||
|
||||
GO
|
||||
ALTER TABLE [dbo].[MessageCore]
|
||||
ADD [Cancelled] BIT NULL,
|
||||
[VisitIdOrTransitIdCancellable] BIT NULL,
|
||||
[BlockedNotificationClasses] NVARCHAR (128) NULL,
|
||||
[FreeNotificationClasses] NVARCHAR (128) NULL,
|
||||
[OwnNotificationClasses] NVARCHAR (128) NULL,
|
||||
[StatusCheckErrorCode] NVARCHAR (50) NULL,
|
||||
[StatusCheckErrorMessage] NVARCHAR (50) NULL,
|
||||
[QueryNSWStatus] BIT NULL
|
||||
|
||||
GO
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using bsmd.database;
|
||||
using bsmd.status;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -20,6 +21,14 @@ namespace SendNSWMessageService
|
||||
{
|
||||
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
|
||||
InitializeComponent();
|
||||
|
||||
System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
|
||||
System.Security.Cryptography.X509Certificates.X509Chain chain,
|
||||
System.Net.Security.SslPolicyErrors sslPolicyErrors)
|
||||
{
|
||||
return true; // **** Immer OK weil wir nur mit einem dedizierten Endpoint reden..
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public void Commandline(string[] args)
|
||||
@ -75,7 +84,7 @@ namespace SendNSWMessageService
|
||||
{
|
||||
|
||||
// Datenbank auf zu sendende Objekte überprüfen und laden
|
||||
|
||||
|
||||
List<MessageCore> coresMarkedForSending = DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.TOSEND);
|
||||
|
||||
foreach (MessageCore core in coresMarkedForSending)
|
||||
@ -146,12 +155,12 @@ namespace SendNSWMessageService
|
||||
|
||||
// Wenn das ein Transit ist, werden nicht erforderliche Meldeklassen übersprungen
|
||||
if (core.IsTransit)
|
||||
{
|
||||
{
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.BKRD) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.PRE72H) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.TIEFD) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.NAME) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.INFO) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.INFO) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.ATA) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.ATD) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.LADG) ||
|
||||
@ -164,15 +173,15 @@ namespace SendNSWMessageService
|
||||
// Visit/Transit Meldeklassen werden nicht erneut übertragen
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.VISIT) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.TRANSIT))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if ((message.InternalStatus != Message.BSMDStatus.CONFIRMED) &&
|
||||
(message.InternalStatus != Message.BSMDStatus.SENT))
|
||||
(message.InternalStatus != Message.BSMDStatus.SENT))
|
||||
{
|
||||
|
||||
// 28.12.2015: Das über "Overview" eingestellte HIS ist immer "führend" (zumindest aktuell zum Testen)
|
||||
// if (message.HIS == Message.NSWProvider.UNDEFINED)
|
||||
message.HIS = core.InitialHIS;
|
||||
message.HIS = core.InitialHIS;
|
||||
if (core.DefaultReportingPartyId.HasValue)
|
||||
{
|
||||
message.ReportingPartyId = core.DefaultReportingPartyId; // Referenz umbiegen
|
||||
@ -195,14 +204,14 @@ namespace SendNSWMessageService
|
||||
|
||||
// switch über passendes HIS / Schnittstelle
|
||||
switch (message.HIS)
|
||||
{
|
||||
{
|
||||
case Message.NSWProvider.DBH:
|
||||
case Message.NSWProvider.DBH_TEST:
|
||||
sendSucceeded = bsmd.dbh.Request.SendMessage(message, (message.HIS == Message.NSWProvider.DBH_TEST));
|
||||
if (!sendSucceeded)
|
||||
message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
|
||||
break;
|
||||
|
||||
|
||||
case Message.NSWProvider.DAKOSY:
|
||||
case Message.NSWProvider.DAKOSY_TEST:
|
||||
sendSucceeded = bsmd.dakosy.Request.Send(message, true);
|
||||
@ -240,8 +249,10 @@ namespace SendNSWMessageService
|
||||
|
||||
if (toSendMessageList.Count > 0)
|
||||
{
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
|
||||
} else {
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
|
||||
}
|
||||
DBManager.Instance.Save(core);
|
||||
@ -249,6 +260,15 @@ namespace SendNSWMessageService
|
||||
}
|
||||
}
|
||||
|
||||
List<MessageCore> coresMarkedForStatusQuery = DBManager.Instance.GetMessageCoresWithNSWStatusFlag();
|
||||
|
||||
foreach (MessageCore core in coresMarkedForStatusQuery)
|
||||
{
|
||||
core.QueryNSWStatus = false; // reset flag
|
||||
Status aStatus = new Status(core);
|
||||
aStatus.PerformQuery();
|
||||
}
|
||||
|
||||
// Auf erhaltene Visit-Ids prüfen (HIS-NORD)
|
||||
// TODO
|
||||
// bsmd.hisnord.Request.ReadAnswers();
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.ServiceProcess;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using log4net;
|
||||
|
||||
namespace SendNSWMessageService
|
||||
{
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.7" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -36,8 +36,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.7" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -26,6 +26,7 @@ namespace bsmd.database
|
||||
private static ILog _log = LogManager.GetLogger(typeof(DBManager));
|
||||
private static Dictionary<Guid, ReportingParty> allReportingParties;
|
||||
private static Dictionary<string, PortArea> allPortAreas;
|
||||
private object _lock = new object();
|
||||
|
||||
#endregion
|
||||
|
||||
@ -84,6 +85,7 @@ namespace bsmd.database
|
||||
{
|
||||
get { return (this._con != null) && (this._con.State == ConnectionState.Open); }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@ -140,6 +142,23 @@ namespace bsmd.database
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<MessageCore> GetMessageCoresWithNSWStatusFlag()
|
||||
{
|
||||
MessageCore aMessageCore = new MessageCore();
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
aMessageCore.PrepareLoadCommand(cmd, Message.LoadFilter.QUERY_NSW_STATUS);
|
||||
|
||||
SqlDataReader reader = this.PerformCommand(cmd);
|
||||
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
||||
List<MessageCore> result = new List<MessageCore>();
|
||||
foreach (MessageCore core in cores)
|
||||
{
|
||||
this.LoadCustomer(core);
|
||||
result.Add(core);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<MessageCore> GetMessageCoresWithFilters(Dictionary<MessageCore.SearchFilterType, string> filters)
|
||||
{
|
||||
MessageCore aMessageCore = new MessageCore();
|
||||
@ -464,6 +483,13 @@ namespace bsmd.database
|
||||
this.LogNonQueryResult(cmd.CommandText, queryResult);
|
||||
}
|
||||
|
||||
public bool? GetMessageCoreQueryStatusFlag(Guid messageCoreId)
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = string.Format("SELECT QueryNSWStatus FROM MessageCore WHERE Id = '{0}'", messageCoreId);
|
||||
return this.PerformReadFlagQuery(cmd);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region internal/private funcs
|
||||
@ -922,49 +948,83 @@ namespace bsmd.database
|
||||
|
||||
internal SqlDataReader PerformCommand(SqlCommand cmd)
|
||||
{
|
||||
try
|
||||
SqlDataReader reader = null;
|
||||
|
||||
lock (this._lock)
|
||||
{
|
||||
cmd.Connection = this._con;
|
||||
// Stopwatch sw = new Stopwatch();
|
||||
// sw.Start();
|
||||
SqlDataReader reader = cmd.ExecuteReader();
|
||||
// sw.Stop();
|
||||
// _log.DebugFormat("{1}ms: {0}", cmd.CommandText, sw.ElapsedMilliseconds);
|
||||
return reader;
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("SQL Exception:" + ex.Message);
|
||||
_log.Error("Error performing command", ex);
|
||||
_log.DebugFormat("Query: {0}", cmd.CommandText);
|
||||
_log.Debug("Parameters:");
|
||||
for (int i = 0; i < cmd.Parameters.Count; i++)
|
||||
try
|
||||
{
|
||||
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
|
||||
cmd.Connection = this._con;
|
||||
// Stopwatch sw = new Stopwatch();
|
||||
// sw.Start();
|
||||
reader = cmd.ExecuteReader();
|
||||
// sw.Stop();
|
||||
// _log.DebugFormat("{1}ms: {0}", cmd.CommandText, sw.ElapsedMilliseconds);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
Trace.WriteLine("SQL Exception:" + ex.Message);
|
||||
_log.Error("Error performing command", ex);
|
||||
_log.DebugFormat("Query: {0}", cmd.CommandText);
|
||||
_log.Debug("Parameters:");
|
||||
for (int i = 0; i < cmd.Parameters.Count; i++)
|
||||
{
|
||||
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
||||
internal int PerformNonQuery(SqlCommand cmd)
|
||||
{
|
||||
try
|
||||
int result = -1;
|
||||
lock (this._lock)
|
||||
{
|
||||
cmd.Connection = this._con;
|
||||
return cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("SQL Exception:" + ex.Message);
|
||||
_log.Error("Error performing command", ex);
|
||||
_log.DebugFormat("Query: {0}", cmd.CommandText);
|
||||
_log.Debug("Parameters:");
|
||||
for (int i = 0; i < cmd.Parameters.Count; i++)
|
||||
try
|
||||
{
|
||||
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
|
||||
cmd.Connection = this._con;
|
||||
result = cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("SQL Exception:" + ex.Message);
|
||||
_log.Error("Error performing command", ex);
|
||||
_log.DebugFormat("Query: {0}", cmd.CommandText);
|
||||
_log.Debug("Parameters:");
|
||||
for (int i = 0; i < cmd.Parameters.Count; i++)
|
||||
{
|
||||
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal bool? PerformReadFlagQuery(SqlCommand cmd)
|
||||
{
|
||||
bool? result = null;
|
||||
|
||||
lock (this._lock)
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.Connection = this._con;
|
||||
result = (bool?)cmd.ExecuteScalar();
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
_log.Error("Error performing command", ex);
|
||||
_log.DebugFormat("Query: {0}", cmd.CommandText);
|
||||
_log.Debug("Parameters:");
|
||||
for (int i = 0; i < cmd.Parameters.Count; i++)
|
||||
{
|
||||
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -136,7 +136,8 @@ namespace bsmd.database
|
||||
BY_CORE_EXCEL,
|
||||
BY_CORE_HE,
|
||||
CREATE_EXCEL,
|
||||
SEARCH_CORE_FILTERS
|
||||
SEARCH_CORE_FILTERS,
|
||||
QUERY_NSW_STATUS
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -191,16 +191,18 @@ namespace bsmd.database
|
||||
|
||||
/// <summary>
|
||||
/// als string serialisierte Enumeration - Liste
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public string BlockedNotificationClasses { get; set; }
|
||||
|
||||
public string OwnNotificationClasses { get; set; }
|
||||
|
||||
public string FreeNotificationClasses { get; set; }
|
||||
public string FreeNotificationClasses { get; set; }
|
||||
|
||||
public string ErrorCode { get; set; }
|
||||
public string StatusCheckErrorCode { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
public string StatusCheckErrorMessage { get; set; }
|
||||
|
||||
public bool? QueryNSWStatus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -251,6 +253,14 @@ namespace bsmd.database
|
||||
scmd.Parameters.AddWithValue("@P26", this.CreateExcel ? 1 : 0);
|
||||
scmd.Parameters.AddWithNullableValue("@P27", this.EditedBy);
|
||||
scmd.Parameters.AddWithNullableValue("@P28", this.TicketNo);
|
||||
scmd.Parameters.AddWithNullableValue("@P29", this.Cancelled);
|
||||
scmd.Parameters.AddWithNullableValue("@P30", this.VisitIdOrTransitIdCancellable);
|
||||
scmd.Parameters.AddWithNullableValue("@P31", this.BlockedNotificationClasses);
|
||||
scmd.Parameters.AddWithNullableValue("@P32", this.FreeNotificationClasses);
|
||||
scmd.Parameters.AddWithNullableValue("@P33", this.OwnNotificationClasses);
|
||||
scmd.Parameters.AddWithNullableValue("@P34", this.StatusCheckErrorCode);
|
||||
scmd.Parameters.AddWithNullableValue("@P35", this.StatusCheckErrorMessage);
|
||||
scmd.Parameters.AddWithNullableValue("@P36", this.QueryNSWStatus);
|
||||
|
||||
if (this.IsNew)
|
||||
{
|
||||
@ -260,9 +270,10 @@ namespace bsmd.database
|
||||
"Previous, Next, IsTransit, Wetris_zz_56_datensatz_id, BSMDStatus, InitialHIS, HerbergFormGuid, " +
|
||||
"HerbergFormTemplateGuid, HerbergReportType, HerbergEmailcontactReportingVessel, HerbergEmail24HrsContact, " +
|
||||
"ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion, Incoming, DefaultReportingPartyId, CreateExcel, " +
|
||||
"EditedBy, TicketNo) VALUES " +
|
||||
"EditedBy, TicketNo, Cancelled, VisitIdOrTransitIdCancellable, BlockedNotificationClasses, FreeNotificationClasses, " +
|
||||
"OwnNotificationClasses, StatusCheckErrorCode, StatusCheckErrorMessage, QueryNSWStatus) VALUES " +
|
||||
"(@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, " +
|
||||
"@P18, @P19, @P20, @P21, @P22, @P23, @P24, @P25, @P26, @P27, @P28)",
|
||||
"@P18, @P19, @P20, @P21, @P22, @P23, @P24, @P25, @P26, @P27, @P28, @P29, @P30, @P31, @P32, @P33, @P34, @P35, @P36)",
|
||||
this.Tablename);
|
||||
scmd.CommandText = query;
|
||||
}
|
||||
@ -275,7 +286,9 @@ namespace bsmd.database
|
||||
"HerbergFormTemplateGuid = @P16, HerbergReportType = @P17, HerbergEmailContactReportingVessel = @P18, " +
|
||||
"HerbergEmail24HrsContact = @P19, ETAKielCanal = @P20, HerbergRevDate = @P21, ReportStatus = @P22, " +
|
||||
"SietasSheetVersion = @P23, Incoming = @P24, DefaultReportingPartyId = @P25, CreateExcel = @P26, EditedBy = @P27, " +
|
||||
"TicketNo = @P28 WHERE Id = @ID", this.Tablename);
|
||||
"TicketNo = @P28, Cancelled = @P29, VisitIdOrTransitIdCancellable = @P30, BlockedNotificationClasses = @P31, " +
|
||||
"FreeNotificationClasses = @P32, OwnNotificationClasses = @P33, StatusCheckErrorCode = @P34, StatusCheckErrorMessage = @P35, " +
|
||||
"QueryNSWStatus = @P36 WHERE Id = @ID", this.Tablename);
|
||||
scmd.CommandText = query;
|
||||
}
|
||||
}
|
||||
@ -287,7 +300,9 @@ namespace bsmd.database
|
||||
"[{0}].[ETA], [{0}].[CustomerId], [{0}].[Previous], [{0}].[Next], [{0}].[IsTransit], [{0}].[Wetris_zz_56_datensatz_id], [{0}].[BSMDStatus], " +
|
||||
"[{0}].[InitialHIS], [{0}].[HerbergFormGuid], [{0}].[HerbergFormTemplateGuid], [{0}].[HerbergReportType], [{0}].[HerbergEmailContactReportingVessel], " +
|
||||
"[{0}].[HerbergEmail24HrsContact], [{0}].[ETAKielCanal], [{0}].[HerbergRevDate], [{0}].[ReportStatus], [{0}].[SietasSheetVersion], [{0}].[Incoming], " +
|
||||
"[{0}].[DefaultReportingPartyId], [{0}].[Created], [{0}].[Changed], [{0}].[CreateExcel], [{0}].[EditedBy], [{0}].[TicketNo] FROM {0} ",
|
||||
"[{0}].[DefaultReportingPartyId], [{0}].[Created], [{0}].[Changed], [{0}].[CreateExcel], [{0}].[EditedBy], [{0}].[TicketNo], " +
|
||||
"[{0}].[Cancelled], [{0}].[VisitIdOrTransitIdCancellable], [{0}].[BlockedNotificationClasses], [{0}].[FreeNotificationClasses], " +
|
||||
"[{0}].[OwnNotificationClasses], [{0}].[StatusCheckErrorCode], [{0}].[StatusCheckErrorMessage], [{0}].[QueryNSWStatus] FROM {0} ",
|
||||
this.Tablename));
|
||||
|
||||
switch (filter)
|
||||
@ -347,6 +362,11 @@ namespace bsmd.database
|
||||
sb.Append("WHERE CreateExcel = 1");
|
||||
break;
|
||||
}
|
||||
case Message.LoadFilter.QUERY_NSW_STATUS:
|
||||
{
|
||||
sb.Append("WHERE QueryNSWStatus = 1");
|
||||
break;
|
||||
}
|
||||
case Message.LoadFilter.SEARCH_CORE_FILTERS:
|
||||
{
|
||||
// object ist jetzt ein dict aus filtertyp und filterparameter
|
||||
@ -478,6 +498,14 @@ namespace bsmd.database
|
||||
if (!reader.IsDBNull(28)) core.CreateExcel = reader.GetBoolean(28);
|
||||
if (!reader.IsDBNull(29)) core.EditedBy = reader.GetString(29);
|
||||
if (!reader.IsDBNull(30)) core.TicketNo = reader.GetString(30);
|
||||
if (!reader.IsDBNull(31)) core.Cancelled = reader.GetBoolean(31);
|
||||
if (!reader.IsDBNull(32)) core.VisitIdOrTransitIdCancellable = reader.GetBoolean(32);
|
||||
if (!reader.IsDBNull(33)) core.BlockedNotificationClasses = reader.GetString(33);
|
||||
if (!reader.IsDBNull(34)) core.FreeNotificationClasses = reader.GetString(34);
|
||||
if (!reader.IsDBNull(35)) core.OwnNotificationClasses = reader.GetString(35);
|
||||
if (!reader.IsDBNull(36)) core.StatusCheckErrorCode = reader.GetString(36);
|
||||
if (!reader.IsDBNull(37)) core.StatusCheckErrorMessage = reader.GetString(37);
|
||||
if (!reader.IsDBNull(38)) core.QueryNSWStatus = reader.GetBoolean(38);
|
||||
|
||||
result.Add(core);
|
||||
}
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.5.9")]
|
||||
[assembly: AssemblyInformationalVersion("3.6.0")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.5.9.*")]
|
||||
[assembly: AssemblyVersion("3.6.0.*")]
|
||||
|
||||
|
||||
@ -39,8 +39,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
@ -126,9 +126,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="..\bsmdKey.snk" />
|
||||
<None Include="bsmd.database.licenseheader" />
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.7" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -36,8 +36,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.7" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -36,8 +36,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.7" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -1,43 +1,103 @@
|
||||
// Copyright (c) 2017 schick Informatik
|
||||
// Description:
|
||||
// Description: Query NSW via HIS-Nord for free / taken message classes and visit id
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net;
|
||||
|
||||
using log4net;
|
||||
using bsmd.database;
|
||||
|
||||
namespace bsmd.status
|
||||
{
|
||||
public class Status
|
||||
{
|
||||
|
||||
public void PerformQuery(string visitId)
|
||||
private static ILog _log = LogManager.GetLogger(typeof(bsmd.status.Status));
|
||||
private MessageCore _queryCore;
|
||||
|
||||
public Status(MessageCore core2Query) { _queryCore = core2Query; }
|
||||
|
||||
public void PerformQuery()
|
||||
{
|
||||
if (this._queryCore == null) return;
|
||||
|
||||
using (WebClient client = new WebClient())
|
||||
{
|
||||
|
||||
client.UploadValuesCompleted += Client_UploadValuesCompleted;
|
||||
|
||||
client.UploadValuesAsync(new Uri(Properties.Settings.Default.url),
|
||||
new NameValueCollection()
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] resultData = client.UploadValues(new Uri(Properties.Settings.Default.url),
|
||||
new NameValueCollection()
|
||||
{
|
||||
// ich glaube ein HTML Encoding braucht man hier nicht?
|
||||
{ "login", Properties.Settings.Default.login },
|
||||
{ "password", Properties.Settings.Default.password },
|
||||
{ "visitIdTransitId", visitId },
|
||||
{ "visitIdTransitId", _queryCore.IsTransit ? _queryCore.TransitId : _queryCore.VisitId },
|
||||
{ "format", Properties.Settings.Default.format }
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
private void Client_UploadValuesCompleted(object sender, UploadValuesCompletedEventArgs e)
|
||||
{
|
||||
if(e.Result != null)
|
||||
{
|
||||
string result = Encoding.UTF8.GetString(e.Result);
|
||||
|
||||
// Do some log output
|
||||
|
||||
string resultString = Encoding.UTF8.GetString(resultData);
|
||||
|
||||
_log.InfoFormat("Status query result: {0}", resultString);
|
||||
|
||||
dataset result = null;
|
||||
try
|
||||
{
|
||||
result = dataset.ReadStatus(resultString);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error parsing status request result: {0}", ex.ToString());
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
// Update database with result values
|
||||
|
||||
if (result.NswResponse != null)
|
||||
{
|
||||
// three-way bool!
|
||||
if (result.NswResponse.Cancelled != null)
|
||||
_queryCore.Cancelled = result.NswResponse.Equals("Y") ? true : false;
|
||||
else
|
||||
_queryCore.Cancelled = null;
|
||||
|
||||
if (result.NswResponse.VisitIdOrTransitIdCancellable != null)
|
||||
_queryCore.VisitIdOrTransitIdCancellable = result.NswResponse.VisitIdOrTransitIdCancellable.Equals("Y") ? true : false;
|
||||
else
|
||||
_queryCore.VisitIdOrTransitIdCancellable = null;
|
||||
|
||||
_queryCore.BlockedNotificationClasses = result.NswResponse.BlockedNotificationClasses;
|
||||
_queryCore.OwnNotificationClasses = result.NswResponse.OwnNotificationClasses;
|
||||
_queryCore.FreeNotificationClasses = result.NswResponse.FreeNotificationClasses;
|
||||
_queryCore.StatusCheckErrorCode = result.NswResponse.ErrorCode;
|
||||
_queryCore.StatusCheckErrorMessage = result.NswResponse.ErrorMessage;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(result.LoginError != null)
|
||||
{
|
||||
_log.ErrorFormat("Login error: {0}", result.LoginError);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Error("parsing result status failed");
|
||||
}
|
||||
|
||||
DBManager.Instance.Save(_queryCore);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.ErrorFormat("Error uploading status request values: {0}", e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,17 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -66,8 +76,12 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\bsmdKey.snk">
|
||||
<Link>bsmdKey.snk</Link>
|
||||
</None>
|
||||
<None Include="app.config" />
|
||||
<None Include="bsmd.status.licenseheader" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
||||
@ -25,6 +25,10 @@ namespace bsmd.status
|
||||
|
||||
public string VisitIdTransitId { get; set; }
|
||||
|
||||
public string LoginError { get; set; }
|
||||
|
||||
public NswResponse NswResponse { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Deserialization
|
||||
@ -55,6 +59,9 @@ namespace bsmd.status
|
||||
[Serializable]
|
||||
public class NswResponse
|
||||
{
|
||||
|
||||
public NswResponse() { }
|
||||
|
||||
#region Properties
|
||||
|
||||
public string Cancelled { get; set; }
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user