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,19 +51,27 @@ 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)
|
||||
{
|
||||
switch(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,8 +17,8 @@
|
||||
<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">
|
||||
|
||||
@ -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;
|
||||
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) => {
|
||||
|
||||
detailControl.JumpToListElementRequest += (index) =>
|
||||
{
|
||||
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,6 +10,20 @@
|
||||
xmlns:local="clr-namespace:ENI2.DetailViewControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="600">
|
||||
<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>
|
||||
@ -61,7 +75,13 @@
|
||||
<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}"/>
|
||||
<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"
|
||||
@ -112,4 +132,5 @@
|
||||
</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,6 +17,9 @@
|
||||
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">
|
||||
@ -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()
|
||||
{
|
||||
@ -42,13 +43,33 @@ namespace ENI2
|
||||
private void AnmeldungenControl_MessageCoreSelected(MessageCore aMessageCore)
|
||||
{
|
||||
if(aMessageCore != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -236,7 +236,7 @@
|
||||
<value>_Print</value>
|
||||
</data>
|
||||
<data name="textPortCall" xml:space="preserve">
|
||||
<value>Port Call</value>
|
||||
<value>Port of call</value>
|
||||
</data>
|
||||
<data name="textArrivalDeparture" xml:space="preserve">
|
||||
<value>Arrival/Departure</value>
|
||||
@ -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>
|
||||
@ -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)
|
||||
@ -241,7 +250,9 @@ namespace SendNSWMessageService
|
||||
if (toSendMessageList.Count > 0)
|
||||
{
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
|
||||
} else {
|
||||
}
|
||||
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
|
||||
|
||||
@ -85,6 +86,7 @@ namespace bsmd.database
|
||||
get { return (this._con != null) && (this._con.State == ConnectionState.Open); }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region public helper funcs
|
||||
@ -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
|
||||
@ -921,20 +947,24 @@ namespace bsmd.database
|
||||
#region DB access methods
|
||||
|
||||
internal SqlDataReader PerformCommand(SqlCommand cmd)
|
||||
{
|
||||
SqlDataReader reader = null;
|
||||
|
||||
lock (this._lock)
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.Connection = this._con;
|
||||
// Stopwatch sw = new Stopwatch();
|
||||
// sw.Start();
|
||||
SqlDataReader reader = cmd.ExecuteReader();
|
||||
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);
|
||||
Trace.WriteLine("SQL Exception:" + ex.Message);
|
||||
_log.Error("Error performing command", ex);
|
||||
_log.DebugFormat("Query: {0}", cmd.CommandText);
|
||||
_log.Debug("Parameters:");
|
||||
@ -942,16 +972,20 @@ namespace bsmd.database
|
||||
{
|
||||
_log.DebugFormat("{0}:{1}", cmd.Parameters[i].ParameterName, cmd.Parameters[i].Value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
||||
internal int PerformNonQuery(SqlCommand cmd)
|
||||
{
|
||||
int result = -1;
|
||||
lock (this._lock)
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.Connection = this._con;
|
||||
return cmd.ExecuteNonQuery();
|
||||
result = cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
@ -963,9 +997,35 @@ namespace bsmd.database
|
||||
{
|
||||
_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>
|
||||
|
||||
@ -198,9 +198,11 @@ namespace bsmd.database
|
||||
|
||||
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),
|
||||
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 }
|
||||
});
|
||||
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
private void Client_UploadValuesCompleted(object sender, UploadValuesCompletedEventArgs e)
|
||||
if (result != null)
|
||||
{
|
||||
if(e.Result != null)
|
||||
// Update database with result values
|
||||
|
||||
if (result.NswResponse != null)
|
||||
{
|
||||
string result = Encoding.UTF8.GetString(e.Result);
|
||||
// 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