3.6.3 Statusabfrage, Benutzeranmeldung

This commit is contained in:
Daniel Schick 2017-05-31 09:31:11 +00:00
parent 4d76d7191d
commit 03813b1921
45 changed files with 944 additions and 105 deletions

View File

@ -17,7 +17,7 @@
<applicationSettings>
<ENI2.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value>
<value>Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value>
</setting>
<setting name="UseLocking" serializeAs="String">
<value>True</value>

View File

@ -14,7 +14,7 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<xctk:WatermarkComboBox Grid.Column="0" x:Name="comboBoxLocode" Margin="2" IsEditable="True" Watermark="{x:Static p:Resources.textTypeLocode}"
<xctk:WatermarkComboBox Grid.Column="0" x:Name="comboBoxLocode" Margin="2" IsEditable="True" Watermark="{x:Static p:Resources.textTypeLocode}" VerticalContentAlignment="Center"
TextBoxBase.TextChanged="ComboBox_TextChanged" SelectionChanged="comboBoxLocode_SelectionChanged"/> <!-- ItemsSource="{Binding LocodeList, Mode=TwoWay}"
SelectedItem="{Binding LocodeValue}" /> -->
<!--, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:LocodeControl}}-->

View File

@ -19,8 +19,7 @@ namespace ENI2.Controls
/// </summary>
public partial class LocodeControl : UserControl, INotifyPropertyChanged
{
private List<string> _locodeList = new List<string>();
// private string _selectedLocode;
private List<string> _locodeList = new List<string>();
public event PropertyChangedEventHandler PropertyChanged;
public LocodeControl()
@ -47,17 +46,15 @@ namespace ENI2.Controls
public static readonly DependencyProperty LocodeValueProperty = DependencyProperty.Register("LocodeValue", typeof(string), typeof(LocodeControl),
new UIPropertyMetadata(LocodeValueChangedHandler));
//new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public static void LocodeValueChangedHandler(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
// Get instance of current control from sender
// and property value from e.NewValue
// Set public property on TaregtCatalogControl, e.g.
if(e.NewValue != null)
((LocodeControl)sender).SelectedItem = e.NewValue.ToString();
((LocodeControl)sender).SelectedItem = e.NewValue.ToString().Substring(0,5);
}
@ -91,6 +88,8 @@ namespace ENI2.Controls
{
if (this.comboBoxLocode.Text.Length > 4)
{
this.LocodeList.Clear();
// check if actual locode
if (this.comboBoxLocode.Text.Length == 5)
{
@ -98,16 +97,17 @@ namespace ENI2.Controls
bool isLocode = !LocodeDB.PortNameFromLocode(directLocode).IsNullOrEmpty();
if (isLocode)
{
this.comboBoxLocode.Text = directLocode;
this.LocodeList.Clear();
this.comboBoxLocode.Text = directLocode;
this.LocodeList.Add(directLocode);
this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
return;
}
}
// assume this is a harbour name typed out..
this.LocodeList = LocodeDB.AllLocodesForCityName(this.comboBoxLocode.Text + "%");
// assume this is a harbour name typed out..
List<LocodeDB.LocodeEntry> locodeEntries = LocodeDB.AllLocodesForCityNameAsEntries(this.comboBoxLocode.Text + "%");
foreach (LocodeDB.LocodeEntry entry in locodeEntries)
this.LocodeList.Add(string.Format("{0} - {1}", entry.Locode, entry.Name));
if (this.LocodeList.Count == 1)
{

View File

@ -4,6 +4,7 @@
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:p="clr-namespace:ENI2.Properties"
xmlns:local="clr-namespace:ENI2"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
@ -21,18 +22,20 @@
<Grid Grid.Row="0" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<xctk:AutoSelectTextBox x:Name="displayIdLabel" Width="Auto" VerticalContentAlignment="Center" FontWeight="Bold" IsReadOnly="True" BorderThickness="0" AutoSelectBehavior="OnFocus" />
<Button Name="buttonSave" Grid.Column="1" Grid.Row="0" Margin="2" Click="buttonSave_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">
<Button Name="buttonSave" Grid.Column="1" Grid.Row="0" Margin="2" Click="buttonSave_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">
<StackPanel Orientation="Horizontal">
<Image Source="./Resources/floppy_disk_edit.png" Margin="0,0,5,0" Height="24" />
<TextBlock Text="{x:Static p:Resources.textSave}" VerticalAlignment="Center" />
</StackPanel>
</Button>
<Button Name="buttonSaveAll" Grid.Column="2" Grid.Row="0" Margin="2" Click="buttonSaveAll_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">
<StackPanel Orientation="Horizontal">
<Image Source="./Resources/Floppy_disks.png" Margin="0,0,5,0" Height="24" />
<TextBlock Text="{x:Static p:Resources.textSaveAll}" VerticalAlignment="Center" />
</StackPanel>
</Button>
</Grid>

View File

@ -134,7 +134,7 @@ namespace ENI2
private void buttonSave_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult result = MessageBox.Show(Properties.Resources.textSavePage, Properties.Resources.textConfirmation,
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
@ -158,7 +158,7 @@ namespace ENI2
private void buttonSaveAll_Click(object sender, RoutedEventArgs e)
{
MessageBoxResult result = MessageBox.Show(Properties.Resources.textSaveAll, Properties.Resources.textConfirmation,
MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{

View File

@ -10,7 +10,7 @@
xmlns:local="clr-namespace:ENI2.DetailViewControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="600">
<xctk:BusyIndicator Name="busyIndicator">
<xctk:BusyIndicator Name="busyIndicator">
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed" />
@ -27,11 +27,11 @@
<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="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="4" />
<RowDefinition Height="32" />
<RowDefinition Height="4" />
@ -84,12 +84,17 @@
<Button IsEnabled="False" Name="buttonCopy" Grid.Column="2" Grid.Row="6" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
<Button IsEnabled="False" Name="buttonSendPDF" Grid.Column="3" Grid.Row="6" Margin="2" Click="buttonSendPDF_Click" Content="{x:Static p:Resources.textCreatePDF}"/>
<Button Name="buttonQueryHIS" Grid.Column="4" Grid.Row="6" Margin="2" Click="buttonQueryHIS_Click" Content="{x:Static p:Resources.textQueryHIS}"/>
<Button Name="buttonRefresh" Grid.Column="5" Grid.Row="6" Margin="2" Click="buttonRefresh_Click" BorderThickness="0" Background="Transparent">
<StackPanel Orientation="Horizontal" Grid.Column="5" Grid.Row="6">
<Button Name="buttonRefresh" Margin="2" Click="buttonRefresh_Click" BorderThickness="0" Background="Transparent">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/nav_refresh_blue.png" Margin="0,0,5,0" Height="24"/>
<TextBlock Text="{x:Static p:Resources.textRefresh}" VerticalAlignment="Center"/>
</StackPanel>
</Button>
<Button Name="buttonInfoCore" Margin="2" Click="buttonInfoCore_Click" BorderThickness="0" Background="Transparent">
<Image Source="../Resources/document_view.png" Margin="0,0,5,0" Height="24" />
</Button>
</StackPanel>
<!-- Data Grid -->
<DataGrid Grid.Row="8" Grid.ColumnSpan="6" Margin="0,8,0,0" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"

View File

@ -1,8 +1,7 @@
// Copyright (c) 2017 schick Informatik
// Description:
// Description: Haupt-Übersichtsansicht eines Anlaufs / Auftrags (Core)
//
using System.Collections.Generic;
using System;
using System.Windows;
using System.Windows.Controls;
@ -11,7 +10,7 @@ using System.Windows.Input;
using System.Timers;
using bsmd.database;
using System.ComponentModel;
using ENI2.EditControls;
namespace ENI2.DetailViewControls
{
@ -341,8 +340,12 @@ namespace ENI2.DetailViewControls
private void buttonQueryHIS_Click(object sender, RoutedEventArgs e)
{
this._startStatusCheck = DateTime.Now;
this.Core.QueryNSWStatus = true;
this.Core.StatusCheckErrorCode = string.Empty;
this.Core.StatusCheckErrorMessage = string.Empty;
DBManager.Instance.Save(this.Core);
this.busyIndicator.IsBusy = true;
// Hintergrund-Thread starten, der gelegentlich auf das Ergebnis prüft..
@ -367,13 +370,15 @@ namespace ENI2.DetailViewControls
// 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"));
this.labelBusyTimeElapsed.Content = string.Format(Properties.Resources.textSecondsElapsed, (DateTime.Now - _startStatusCheck).TotalSeconds.ToString("N0"));
}));
}
else
{
this._checkStatusTimer.Stop();
this.Dispatcher.BeginInvoke(new Action(() =>
{
{
this.busyIndicator.IsBusy = false;
this.OnRequestReload();
}));
@ -382,6 +387,7 @@ namespace ENI2.DetailViewControls
private void buttonStopWaiting_Click(object sender, RoutedEventArgs e)
{
this._checkStatusTimer.Stop();
this.busyIndicator.IsBusy = false;
}
@ -407,7 +413,16 @@ namespace ENI2.DetailViewControls
}
private void buttonInfoCore_Click(object sender, RoutedEventArgs e)
{
SimplePropertyViewDialog spvd = new SimplePropertyViewDialog();
spvd.IsModal = false;
spvd.DisplayObject = this.Core;
spvd.Show();
}
#endregion
}
}

View File

@ -25,11 +25,11 @@
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textETAPortOfCall}" Name="label_ETAToPortOfCall" Margin="0,0,10,0"/>
@ -66,14 +66,14 @@
<GroupBox Name="agentGroupBox" Header="{x:Static p:Resources.textAgent}" Grid.Row="1" Margin="5, 20, 5, 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>

View File

@ -35,8 +35,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>3.6.2.%2a</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>3.6.3.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@ -221,6 +221,9 @@
<Compile Include="EditControls\EditSERVDialog.xaml.cs">
<DependentUpon>EditSERVDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\SimplePropertyViewDialog.xaml.cs">
<DependentUpon>SimplePropertyViewDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\VisitIdDialog.xaml.cs">
<DependentUpon>VisitIdDialog.xaml</DependentUpon>
</Compile>
@ -317,6 +320,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="EditControls\SimplePropertyViewDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\VisitIdDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -398,6 +405,19 @@
<Resource Include="Resources\floppy_disk_edit.png" />
<Resource Include="Resources\floppy_disks.png" />
<Resource Include="Resources\logo_transparent_babyblau.png" />
<None Include="Resources\flash_red.png" />
<None Include="Resources\flash_yellow.png" />
<None Include="Resources\lightbulb_on.png" />
<None Include="Resources\rotate_left.png" />
<None Include="Resources\sign_warning.png" />
<None Include="Resources\trafficlight_green.png" />
<None Include="Resources\trafficlight_off.png" />
<None Include="Resources\trafficlight_red.png" />
<None Include="Resources\trafficlight_yellow.png" />
<None Include="Resources\user_edit.png" />
<None Include="Resources\delete2.png" />
<None Include="Resources\mail_new.png" />
<Resource Include="Resources\document_view.png" />
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -0,0 +1,19 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.SimplePropertyViewDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="SimplePropertyViewDialog" Height="640" Width="480" WindowStyle="ToolWindow" ResizeMode="NoResize"
Background="White">
<Grid>
<xctk:PropertyGrid Name="propertyGrid" ShowPreview="False" ShowSummary="True" IsReadOnly="True" IsCategorized="True"
HideInheritedProperties="True" Width="460" Height="560" ShowSearchBox="False" ShowSortOptions="False" />
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,46 @@
// Copyright (c) 2017 schick Informatik
// Description: Generic Info dialog for any object
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ENI2.Controls;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for SimplePropertyViewDialog.xaml
/// </summary>
public partial class SimplePropertyViewDialog : EditWindowBase
{
private object _displayObject;
public SimplePropertyViewDialog()
{
InitializeComponent();
}
public object DisplayObject
{
get { return this._displayObject; }
set
{
this._displayObject = value;
this.propertyGrid.SelectedObject = value;
this.Title = string.Format(Properties.Resources.textDetailInfoPropertyGridTitle, value.ToString());
}
}
}
}

View File

@ -14,6 +14,8 @@ namespace ENI2.EditControls
/// </summary>
public partial class VisitIdDialog : EditWindowBase
{
private bool _isOK;
public VisitIdDialog()
{
InitializeComponent();
@ -42,13 +44,13 @@ namespace ENI2.EditControls
}
this.Core.PoC = this.locodePoC.LocodeValue;
this._isOK = true;
}
public MessageCore Core { get; set; }
public bool IsOK { get { return this._isOK; } }
#region event handler
private void doubleUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)

View File

@ -20,7 +20,35 @@
<Window.Resources>
<util:BoolToVisibilityConverter x:Key="BoolToHiddenConverter" TrueValue="Visible" FalseValue="Hidden" />
</Window.Resources>
<xctk:BusyIndicator Name="busyIndicator" IsBusy="True">
<xctk:BusyIndicator.ProgressBarStyle>
<Style TargetType="ProgressBar">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</xctk:BusyIndicator.ProgressBarStyle>
<xctk:BusyIndicator.BusyContent>
<Grid Width="320">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Content="{x:Static p:Resources.textLoginCaption}" Grid.Row="0" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textUsername}" Grid.Row="1" VerticalContentAlignment="Center" />
<Label Content="{x:Static p:Resources.textPassword}" Grid.Row="2" VerticalContentAlignment="Center" />
<TextBox Name="textUsername" Grid.Row="1" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" />
<PasswordBox Name="textPassword" Grid.Row="2" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" PasswordChar="*"/>
<Label Name="labelLoginResult" Grid.Row="3" Grid.ColumnSpan="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" />
<Button Name="buttonLogin" Content="{x:Static p:Resources.textLogin}" Grid.Row="4" Grid.Column="0" Margin="2" Click="buttonLogin_Click" IsDefault="True" />
<Button Name="buttonExit" Content="{x:Static p:Resources.textExit}" Grid.Row="4" Grid.Column="1" Margin="2" Click="buttonExit_Click" />
</Grid>
</xctk:BusyIndicator.BusyContent>
<DockPanel Name="mainPanel">
<Grid DockPanel.Dock="Top" Height="80" Background="#FFE8F6FF">
<Image x:Name="logoImage" HorizontalAlignment="Left" Height="75" Width="75" Source="Resources/EUREPORT.png" Stretch="Fill" MouseUp="logoImage_MouseUp" />
@ -30,7 +58,7 @@
<!-- Button x:Name="buttonSuche" Content="{x:Static p:Resources.textSearch}" HorizontalAlignment="Left" Margin="301,25,0,0" VerticalAlignment="Top" Width="95" Height="23" Click="buttonSuche_Click" Background="Transparent" /-->
</Grid>
<Grid DockPanel.Dock="Bottom" Height="20" Background="#FFE8F6FF">
<Grid DockPanel.Dock="Bottom" Height="22" Background="#FFE8F6FF">
<StatusBar>
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
@ -48,7 +76,7 @@
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="0">
<TextBlock Name="labelGeneralStatus"></TextBlock>
<TextBlock Name="labelGeneralStatus" FontSize="9"></TextBlock>
</StatusBarItem>
<StatusBarItem Grid.Column="1">
<TextBlock Name="labelVersion"></TextBlock>
@ -73,6 +101,6 @@
</TabControl>
</DockPanel>
<!--Rectangle Fill="White" Opacity="0.7" Visibility="{Binding IsWaiting, Converter={StaticResource BoolToHiddenConverter}}" /-->
</xctk:BusyIndicator>
</Window>

View File

@ -23,12 +23,21 @@ namespace ENI2
/// </summary>
public partial class MainWindow : Window
{
#region Fields
private bool dbConnected;
private SucheControl sucheControl;
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>();
private int failedLogonCount = 0;
private ReportingParty userEntity = null;
#endregion
#region Construction
public MainWindow()
{
@ -45,6 +54,8 @@ namespace ENI2
App.SplashScreen.LoadComplete();
}
#endregion
private void AnmeldungenControl_MessageCoreSelected(MessageCore aMessageCore)
{
if(aMessageCore != null)
@ -53,7 +64,8 @@ namespace ENI2
{
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() : ""));
DateTime? eta = aMessageCore.IsTransit ? aMessageCore.ETAKielCanal : aMessageCore.ETA;
searchResultItem.SetHeaderText(string.Format("{0} [{1}-{2}]", aMessageCore.Shipname, aMessageCore.PoC, eta.HasValue ? eta.Value.ToShortDateString() : ""));
DetailRootControl drc = new DetailRootControl(aMessageCore);
searchResultItem.Content = drc;
this.mainFrame.Items.Add(searchResultItem);
@ -148,6 +160,23 @@ namespace ENI2
VisitIdDialog visitIdDialog = new VisitIdDialog();
visitIdDialog.Core = newCore;
visitIdDialog.IsModal = false;
visitIdDialog.Closed += (senderDialog, closeArgs) =>
{
VisitIdDialog closedDialog = senderDialog as VisitIdDialog;
if(closedDialog.IsOK)
{
if (!closedDialog.Core.IsDK)
{
// deutsche Häfen fordern eine Visit-Id an, für DK erfolgt hier nur die Anlage eines Datensatzes
closedDialog.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
closedDialog.Core.InitialHIS = Message.NSWProvider.DUDR_TEST;
}
DBManager.Instance.Save(closedDialog.Core);
// Meldeklassen für neuen Anlauf erzeugen:
bsmd.database.Util.CreateMessagesForCore(closedDialog.Core);
}
};
visitIdDialog.Show();
}
@ -189,5 +218,44 @@ namespace ENI2
}
#endregion
#region logon box event handlers
private void buttonLogin_Click(object sender, RoutedEventArgs e)
{
if(this.textPassword.Password.IsNullOrEmpty() || this.textUsername.Text.IsNullOrEmpty())
{
this.labelLoginResult.Content = Properties.Resources.textUserNamePasswordEmpty;
return;
}
ReportingParty.LogonResult logonResult = ReportingParty.Login(this.textUsername.Text, this.textPassword.Password, out this.userEntity);
switch(logonResult)
{
case ReportingParty.LogonResult.OK:
this.busyIndicator.IsBusy = false;
this.labelStatusBar.Text = string.Format("Rep.Party: {0} {1} [{2}]", this.userEntity.FirstName, this.userEntity.LastName, this.userEntity.Logon);
break;
case ReportingParty.LogonResult.FAILED:
this.labelLoginResult.Content = Properties.Resources.textWrongPassword;
failedLogonCount++;
break;
case ReportingParty.LogonResult.USERUKN:
this.labelLoginResult.Content = Properties.Resources.textUsernameUnknown;
failedLogonCount++;
break;
}
if (failedLogonCount == 3)
this.buttonLogin.IsEnabled = false;
}
private void buttonExit_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
#endregion
}
}

View File

@ -190,6 +190,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap delete2 {
get {
object obj = ResourceManager.GetObject("delete2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -200,6 +210,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap document_view {
get {
object obj = ResourceManager.GetObject("document_view", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -250,6 +270,26 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap flash_red {
get {
object obj = ResourceManager.GetObject("flash_red", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap flash_yellow {
get {
object obj = ResourceManager.GetObject("flash_yellow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -290,6 +330,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap lightbulb_on {
get {
object obj = ResourceManager.GetObject("lightbulb_on", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -340,6 +390,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap mail_new {
get {
object obj = ResourceManager.GetObject("mail_new", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -380,6 +440,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap rotate_left {
get {
object obj = ResourceManager.GetObject("rotate_left", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -400,6 +470,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap sign_warning {
get {
object obj = ResourceManager.GetObject("sign_warning", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -752,6 +832,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Detail info for: {0}.
/// </summary>
public static string textDetailInfoPropertyGridTitle {
get {
return ResourceManager.GetString("textDetailInfoPropertyGridTitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Dangerous goods arrival.
/// </summary>
@ -860,6 +949,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Exit.
/// </summary>
public static string textExit {
get {
return ResourceManager.GetString("textExit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Export.
/// </summary>
@ -968,6 +1066,33 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Login.
/// </summary>
public static string textLogin {
get {
return ResourceManager.GetString("textLogin", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please logon.
/// </summary>
public static string textLoginCaption {
get {
return ResourceManager.GetString("textLoginCaption", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Login failed..
/// </summary>
public static string textLoginFailed {
get {
return ResourceManager.GetString("textLoginFailed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Master.
/// </summary>
@ -1049,6 +1174,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Password.
/// </summary>
public static string textPassword {
get {
return ResourceManager.GetString("textPassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Phone.
/// </summary>
@ -1130,6 +1264,24 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Save all?.
/// </summary>
public static string textQuestionSaveAll {
get {
return ResourceManager.GetString("textQuestionSaveAll", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save data on this page?.
/// </summary>
public static string textQuestionSavePage {
get {
return ResourceManager.GetString("textQuestionSavePage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Refresh.
/// </summary>
@ -1149,20 +1301,20 @@ namespace ENI2.Properties {
}
/// <summary>
/// Looks up a localized string similar to Save all?.
/// Looks up a localized string similar to Save.
/// </summary>
public static string textSaveAll {
public static string textSave {
get {
return ResourceManager.GetString("textSaveAll", resourceCulture);
return ResourceManager.GetString("textSave", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save data on this page?.
/// Looks up a localized string similar to Save all.
/// </summary>
public static string textSavePage {
public static string textSaveAll {
get {
return ResourceManager.GetString("textSavePage", resourceCulture);
return ResourceManager.GetString("textSaveAll", resourceCulture);
}
}
@ -1373,6 +1525,33 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Username.
/// </summary>
public static string textUsername {
get {
return ResourceManager.GetString("textUsername", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Username and/or password empty!.
/// </summary>
public static string textUserNamePasswordEmpty {
get {
return ResourceManager.GetString("textUserNamePasswordEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Username unknown.
/// </summary>
public static string textUsernameUnknown {
get {
return ResourceManager.GetString("textUsernameUnknown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Visit / transit.
/// </summary>
@ -1399,5 +1578,64 @@ namespace ENI2.Properties {
return ResourceManager.GetString("textWaste", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password is wrong!.
/// </summary>
public static string textWrongPassword {
get {
return ResourceManager.GetString("textWrongPassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap trafficlight_green {
get {
object obj = ResourceManager.GetObject("trafficlight_green", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap trafficlight_off {
get {
object obj = ResourceManager.GetObject("trafficlight_off", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap trafficlight_red {
get {
object obj = ResourceManager.GetObject("trafficlight_red", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap trafficlight_yellow {
get {
object obj = ResourceManager.GetObject("trafficlight_yellow", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap user_edit {
get {
object obj = ResourceManager.GetObject("user_edit", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -541,10 +541,10 @@
<data name="floppy_disks" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\floppy_disks.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="textSavePage" xml:space="preserve">
<data name="textQuestionSavePage" xml:space="preserve">
<value>Save data on this page?</value>
</data>
<data name="textSaveAll" xml:space="preserve">
<data name="textQuestionSaveAll" xml:space="preserve">
<value>Save all?</value>
</data>
<data name="textConfirmation" xml:space="preserve">
@ -553,4 +553,79 @@
<data name="logo_transparent_babyblau" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo_transparent_babyblau.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="delete2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\delete2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="flash_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\flash_red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="flash_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\flash_yellow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="lightbulb_on" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\lightbulb_on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mail_new" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mail_new.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="rotate_left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\rotate_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="sign_warning" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sign_warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="trafficlight_green" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\trafficlight_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="trafficlight_off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\trafficlight_off.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="trafficlight_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\trafficlight_red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="trafficlight_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\trafficlight_yellow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="user_edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\user_edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="textSave" xml:space="preserve">
<value>Save</value>
</data>
<data name="textSaveAll" xml:space="preserve">
<value>Save all</value>
</data>
<data name="textLoginCaption" xml:space="preserve">
<value>Please logon</value>
</data>
<data name="textUsername" xml:space="preserve">
<value>Username</value>
</data>
<data name="textPassword" xml:space="preserve">
<value>Password</value>
</data>
<data name="textLoginFailed" xml:space="preserve">
<value>Login failed.</value>
</data>
<data name="textLogin" xml:space="preserve">
<value>Login</value>
</data>
<data name="textExit" xml:space="preserve">
<value>Exit</value>
</data>
<data name="textUserNamePasswordEmpty" xml:space="preserve">
<value>Username and/or password empty!</value>
</data>
<data name="textUsernameUnknown" xml:space="preserve">
<value>Username unknown</value>
</data>
<data name="textWrongPassword" xml:space="preserve">
<value>Password is wrong!</value>
</data>
<data name="document_view" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\document_view.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="textDetailInfoPropertyGridTitle" xml:space="preserve">
<value>Detail info for: {0}</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -64,8 +64,8 @@
<DataGridTextColumn Header="Type" Binding="{Binding HerbergReportType}" IsReadOnly="True" />
<DataGridTextColumn Header="IMO" Binding="{Binding IMO}" IsReadOnly="True" />
<DataGridTextColumn Header="Ship name" Binding="{Binding Shipname}" IsReadOnly="True" />
<DataGridTextColumn Header="ETA" Binding="{Binding ETA , StringFormat=\{0:dd.MM.yyyy\}}" IsReadOnly="True" />
<DataGridTextColumn Header="Hafen" Binding="{Binding Portname}" IsReadOnly="True" />
<DataGridTextColumn Header="ETA" Binding="{Binding ETADisplay, StringFormat=\{0:dd.MM.yyyy\}}" IsReadOnly="True" />
<DataGridTextColumn Header="Hafen" Binding="{Binding PortnameDisplay}" IsReadOnly="True" />
<DataGridTextColumn Header="Id" Binding="{Binding DisplayId}" IsReadOnly="True" />
<DataGridTextColumn Header="Status" Binding="{Binding BSMDStatusInternal}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textTicketNo}" Binding="{Binding TicketNo}" IsReadOnly="True" />

Binary file not shown.

View File

@ -95,10 +95,10 @@ namespace SendNSWMessageService
//
// if (core.InitialHIS != Message.NSWProvider.DBH_TEST) continue; // ignore everything else
if (core.InitialHIS == Message.NSWProvider.DUDR)
if ((core.InitialHIS == Message.NSWProvider.DUDR) || (core.InitialHIS == Message.NSWProvider.DUDR_TEST))
{
// HIS-NORD: alles auf einmal
sendSucceeded = bsmd.hisnord.Request.Send(messages);
sendSucceeded = bsmd.hisnord.Request.Send(messages, (core.InitialHIS == Message.NSWProvider.DUDR_TEST));
if (!sendSucceeded) core.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE;
else core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;

View File

@ -80,6 +80,39 @@ namespace bsmd.ExcelReadService
return results;
}
public static List<LocodeEntry> AllLocodesForCityNameAsEntries(string city)
{
List<LocodeEntry> results = new List<LocodeEntry>();
if (city.Contains(","))
{
string[] elems = city.Split(',');
string countryCode = CountryCodeFromName(elems[1].Trim());
string lcLookup = LocodeFromCity(elems[0].Trim(), countryCode);
if ((countryCode != null) && (lcLookup != null))
{
LocodeEntry entry = new LocodeEntry();
entry.Locode = lcLookup;
entry.Name = elems[0].Trim();
results.Add(entry);
}
}
string query = string.Format("SELECT locodes.name, city_code, countries.code FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.port='t' AND (locodes.name like '{0}' OR locodes.name_wo_diacritics like '{0}')", city);
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
if (!reader.IsDBNull(1) && !reader.IsDBNull(2)) {
LocodeEntry entry = new LocodeEntry();
entry.Locode = string.Format("{0}{1}", reader.GetString(2), reader.GetString(1));
if (!reader.IsDBNull(0))
entry.Name = reader.GetString(0);
results.Add(entry);
}
}
reader.Close();
return results;
}
/// <summary>
/// Lookup 2CHAR Country Code from country name (like search). Hopefully this will result in many hits
/// </summary>
@ -130,5 +163,15 @@ namespace bsmd.ExcelReadService
#endregion
#region class LocodeEntry
public class LocodeEntry
{
public string Locode { get; set; }
public string Name { get; set; }
}
#endregion
}
}

View File

@ -137,7 +137,9 @@ namespace bsmd.database
BY_CORE_HE,
CREATE_EXCEL,
SEARCH_CORE_FILTERS,
QUERY_NSW_STATUS
QUERY_NSW_STATUS,
NOT_DELETED,
DELETED
}
/// <summary>

View File

@ -54,7 +54,7 @@ namespace bsmd.database
FAILURE,
REPORTREQUESTED,
ARCHIVED,
HIS_FAILURE_DBH
HIS_FAILURE_DBH
}
/// <summary>
@ -119,6 +119,16 @@ namespace bsmd.database
public DateTime? ETAKielCanal { get; set; }
public DateTime? ETADisplay
{
get { return this.IsTransit ? this.ETAKielCanal : this.ETA; }
}
public string PortnameDisplay
{
get { return this.IsTransit ? "NOK" : this.Portname; }
}
public bool IsTransit { get; set; }
public bool Incoming { get; set; } // tbd: für HIS-NORD, mal sehen ob das so bleibt

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("3.6.2")]
[assembly: AssemblyInformationalVersion("3.6.3")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
[assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("3.6.2.*")]
[assembly: AssemblyVersion("3.6.3.*")]

View File

@ -1,10 +1,24 @@
using System;
// Copyright (c) 2015-2017 schick Informatik
// Description: Benutzerobjekt (erweitert um eigene Zwecke..)
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;
using System.Security.Cryptography;
namespace bsmd.database
{
public class ReportingParty : DatabaseEntity
{
{
private DateTime? _created, _changed;
public enum LogonResult
{
OK,
FAILED,
USERUKN
}
#region enumerations
@ -20,6 +34,8 @@ namespace bsmd.database
#region Properties
#region NSW Reporting Party Properties
[MaxLength(100)]
public string Name { get; set; }
@ -54,6 +70,35 @@ namespace bsmd.database
#endregion
#region ENI Logon User Properties
/// <summary>
/// login ID (=idealerweise dasselbe wie im AD!)
/// </summary>
public string Logon { get; set; }
/// <summary>
/// SHA 512
/// </summary>
public string PasswordHash { get; set; }
/// <summary>
/// We know it's safer that way ;-)
/// </summary>
public string Salt { get; set; }
public DateTime? Created { get { return _created; } }
public DateTime? Changed { get { return _changed; } }
public int Flags { get; set; }
public int Deleted { get; set; }
#endregion
#endregion
#region overrides
public override string ToString()
@ -67,18 +112,51 @@ namespace bsmd.database
public override void PrepareSave(System.Data.IDbCommand cmd)
{
throw new NotImplementedException();
SqlCommand scmd = cmd as SqlCommand;
scmd.Parameters.AddWithNullableValue("@P2", this.Name);
scmd.Parameters.AddWithNullableValue("@P3", this.StreetAndNumber);
scmd.Parameters.AddWithNullableValue("@P4", this.PostalCode);
scmd.Parameters.AddWithNullableValue("@P5", this.City);
scmd.Parameters.AddWithNullableValue("@P6", this.Country);
scmd.Parameters.AddWithNullableValue("@P7", this.LastName);
scmd.Parameters.AddWithNullableValue("@P8", this.FirstName);
scmd.Parameters.AddWithNullableValue("@P9", this.Phone);
scmd.Parameters.AddWithNullableValue("@P10", this.Fax);
scmd.Parameters.AddWithNullableValue("@P11", this.EMail);
scmd.Parameters.AddWithNullableValue("@P12", this.Logon);
scmd.Parameters.AddWithNullableValue("@P13", this.PasswordHash);
scmd.Parameters.AddWithNullableValue("@P14", this.Salt);
scmd.Parameters.AddWithNullableValue("@P15", this.Flags);
scmd.Parameters.AddWithNullableValue("@P16", this.Deleted);
if (this.IsNew)
{
scmd.CommandText = string.Format("INSERT INTO {0} (RPName, RPStreetAndNumber, RPPostalCode, RPCity, RPCountry " +
"RPLastName, RPFirstName, RPPhone, RPFax, RPEMail, Logon, PasswordHash, Salt, Flags) VALUES " +
"( @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15 )", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue(@"ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET RPName = @P2, RPStreetAndNumber = @P3, RPPostalCode = @P4, " +
"RPCity = @P5, RPCountry = @P6, RPLastName = @P7, RPFirstName = @P8, RPPhone = @P9, RPFax = @P10, " +
"RPEMail = @P11, Logon = @P12, PasswordHash = @P13, Salt= @P14, Flags = @P15, Deleted = @P16 WHERE Id = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, RPName, RPStreetAndNumber, RPPostalCode, RPCity, RPCountry, RPLastName, " +
"RPFirstName, RPPhone, RPFax, RPEMail FROM {0} ", this.Tablename);
"RPFirstName, RPPhone, RPFax, RPEMail, Logon, PasswordHash, Salt, Created, Changed, Flags, Deleted FROM {0} ", this.Tablename);
switch (filter)
{
case Message.LoadFilter.NOT_DELETED:
query += " WHERE Deleted = 0";
break;
case Message.LoadFilter.ALL:
default:
break;
@ -90,27 +168,75 @@ namespace bsmd.database
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
{
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
ReportingParty rp = new ReportingParty();
List<DatabaseEntity> result = new List<DatabaseEntity>();
while (reader.Read())
{
ReportingParty rp = new ReportingParty();
rp.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) rp.Name = reader.GetString(1);
if (!reader.IsDBNull(2)) rp.StreetAndNumber = reader.GetString(2);
if (!reader.IsDBNull(3)) rp.PostalCode = reader.GetString(3);
if (!reader.IsDBNull(4)) rp.City = reader.GetString(4);
if (!reader.IsDBNull(5)) rp.Country = reader.GetString(5);
if (!reader.IsDBNull(6)) rp.LastName = reader.GetString(6);
if (!reader.IsDBNull(7)) rp.FirstName = reader.GetString(7);
if (!reader.IsDBNull(8)) rp.Phone = reader.GetString(8);
if (!reader.IsDBNull(9)) rp.Fax = reader.GetString(9);
if (!reader.IsDBNull(10)) rp.EMail = reader.GetString(10);
rp.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) rp.Name = reader.GetString(1);
if (!reader.IsDBNull(2)) rp.StreetAndNumber = reader.GetString(2);
if (!reader.IsDBNull(3)) rp.PostalCode = reader.GetString(3);
if (!reader.IsDBNull(4)) rp.City = reader.GetString(4);
if (!reader.IsDBNull(5)) rp.Country = reader.GetString(5);
if (!reader.IsDBNull(6)) rp.LastName = reader.GetString(6);
if (!reader.IsDBNull(7)) rp.FirstName = reader.GetString(7);
if (!reader.IsDBNull(8)) rp.Phone = reader.GetString(8);
if (!reader.IsDBNull(9)) rp.Fax = reader.GetString(9);
if (!reader.IsDBNull(10)) rp.EMail = reader.GetString(10);
if (!reader.IsDBNull(11)) rp.Logon = reader.GetString(11);
if (!reader.IsDBNull(12)) rp.PasswordHash = reader.GetString(12);
if (!reader.IsDBNull(13)) rp.Salt = reader.GetGuid(13).ToString();
if (!reader.IsDBNull(14)) rp._created = reader.GetDateTime(14);
if (!reader.IsDBNull(15)) rp._changed = reader.GetDateTime(15);
if (!reader.IsDBNull(16)) rp.Flags = reader.GetInt32(16);
if (!reader.IsDBNull(17)) rp.Deleted = reader.GetInt32(17);
result.Add(rp);
}
reader.Close();
return result;
}
result.Add(rp);
}
reader.Close();
return result;
#endregion
#region public static methods
public static LogonResult Login(string name, string password, out ReportingParty reportingParty)
{
LogonResult result = LogonResult.USERUKN;
reportingParty = null;
// load all users
Dictionary<Guid, ReportingParty> reportingPartyDict = DBManager.Instance.GetReportingPartyDict(); // passt nicht ganz aber egal
foreach(Guid key in reportingPartyDict.Keys)
{
if(reportingPartyDict[key].Logon.Equals(name))
{
// found user
using (SHA512 shaM = new SHA512Managed())
{
// first-time logon sets the password
if (reportingPartyDict[key].Salt == null) reportingPartyDict[key].Salt = Guid.NewGuid().ToString();
if (reportingPartyDict[key].PasswordHash == null)
{
byte[] hashData = shaM.ComputeHash(Encoding.UTF8.GetBytes(password + reportingPartyDict[key].Salt));
reportingPartyDict[key].PasswordHash = BitConverter.ToString(hashData).Replace("-", "");
result = LogonResult.OK;
DBManager.Instance.Save(reportingPartyDict[key]);
reportingParty = reportingPartyDict[key];
}
else // calculate hash from PW
{
byte[] hashData = shaM.ComputeHash(Encoding.UTF8.GetBytes(password + reportingPartyDict[key].Salt));
string calcPWHash = BitConverter.ToString(hashData).Replace("-", "");
result = reportingPartyDict[key].PasswordHash.Equals(calcPWHash) ? LogonResult.OK : LogonResult.FAILED;
if (result == LogonResult.OK) reportingParty = reportingPartyDict[key];
}
}
}
}
return result;
}
#endregion

View File

@ -116,5 +116,48 @@ namespace bsmd.database
return regexTransit.IsMatch(val);
}
/// <summary>
/// Hilfsfunktion für "manuelle" Anlage eines Schiffsanlaufs. Die Objekte sind bereits gespeichert.
/// </summary>
public static List<Message> CreateMessagesForCore(MessageCore core)
{
List<Message> result = new List<Message>();
bool isDE, isDK;
if(core != null)
{
isDE = core.PoC.Equals("ZZNOK") || core.PoC.StartsWith("DE");
isDK = core.PoC.StartsWith("DK");
foreach (Message.NotificationClass notificationClass in Enum.GetValues(typeof(Message.NotificationClass)))
{
if(isDE)
{
if ((notificationClass == Message.NotificationClass.CREWD) ||
(notificationClass == Message.NotificationClass.PASD) ||
(notificationClass == Message.NotificationClass.STO)) continue;
}
if(isDK)
{
// gibt es hier etwas, das nicht gebraucht wird? (siehe Mail von Christin, 29.5.17
if ((notificationClass == Message.NotificationClass.MDH) ||
(notificationClass == Message.NotificationClass.BKRA) ||
(notificationClass == Message.NotificationClass.BKRD) ||
(notificationClass == Message.NotificationClass.TOWA) ||
(notificationClass == Message.NotificationClass.TOWD)) continue;
}
Message message = new Message();
message.MessageCoreId = core.Id;
message.MessageNotificationClass = notificationClass;
DatabaseEntity classElement = DBManager.CreateMessage(notificationClass);
DBManager.Instance.Save(classElement);
message.Elements.Add(classElement);
message.SaveElements();
result.Add(message);
}
}
return result;
}
}
}

View File

@ -23,10 +23,9 @@ namespace bsmd.database
/// <returns>true falls Nachricht versendet werden soll</returns>
public static bool ShouldSendMessage(Message message)
{
// zurückgestellte Nachrichten werden ignoriert. Das kann ggf. ein Problem werden, wenn die
// Nachricht bei HIS-Nord ein wesentlicher Bestandteil ist. -> muss beobachtet werden
// zurückgestellte Nachrichten werden ignoriert
if (message.InternalStatus == Message.BSMDStatus.SUSPENDED) return false;
if (message.InternalStatus == Message.BSMDStatus.UNDEFINED) return false;
// Wenn das ein Transit ist, werden nicht erforderliche Meldeklassen übersprungen
if (message.MessageCore.IsTransit)

View File

@ -21,7 +21,7 @@ namespace bsmd.hisnord
{
private static ILog _log = LogManager.GetLogger(typeof(Request));
public static bool Send(List<Message> messages)
public static bool Send(List<Message> messages, bool useTest)
{
bool retval = true;

View File

@ -1,9 +1,91 @@
Neue Version (Stand 11.4.2017) mit einzelnen Meldeklassen
Alle Informationen aus den E-Mails hier zusammengetragen:
1.) Welche Informationen werden erwartet unter conveyance->visit-> name/code?
Im Bereich der choice mit id=“visit“ kann entweder eine bekannte VisitId bzw. TransitId oder ein eindeutiger Code (zusätzlich optional ein Name),
den Sie selber für sich festlegen können, angegeben werden
a. Im letzten Fall wird zusätzlich die Angabe der IMO- oder ENI-Nummer erwartet, sowie der PortOfCall und ETAPortOfCall um eine entsprechende VisitId
bzw. TransitId zu beantragen
2.) HAZA, DPGOnArrival: hier kann es auch passieren dass Position unterschiedlichen Typs zusammen in der Liste landen, z.B. IMDGPosition, IBCPosition?
Soweit ich weiß gibt das NSW das nicht vor
Ich kann Sie beruhigen, dass NSW verträgt mehrere Positionen unterschiedlicher Typen
3.) Identifier: wie werden die Identifier von z.B. IMDG Position übertragen. Ist das implizit durch die Reihenfolge?
Hier wird zurzeit von uns aus automatisch ein Identifier beim Erzeugen der NSW-Meldung generiert.
a. Beim Rückkanal würden Sie die erfolgte Meldung an das NSW mit den erweiterten Identifier bekommen, sowie den Status, d.h. ob akzeptiert oder Violation/Error
4.) noanod: ETAToKielCanal gibt es nicht separat, ist das bei Transitmeldungen ETAtoPortOfCall? dito ETD?
Exakt
Eine andere Frage zum Testbetrieb:
Wie können gesendete Testdaten eingesehen werden? Steht dazu noch die Webanwendung mit den alten Verbindungsdaten zu Verfügung?
Die Testdaten bekommen Sie als erstes über den Rückkanal (wie in 3.a beschrieben)
a.Zusätzlich werden die Daten im Referenzsystem dargestellt, sofern wir die Berechtigung zum Abholen der Daten vom NSW-Nachrichtenkorb besitzen,
d.h. wenn wir dort keine Berechtigung haben, ist Ihre einzige Kontrollmöglichkeit der Rückkanal
- Die Verbindungsdaten für den Transmitter sind dieselben geblieben?
Ja
- Ich kann nach wie vor dieselbe Version des Transmitter verwenden?
Ja, lediglich den Parameter Version in der Konfiguration anpassen auf BSMD
- Wir haben ein xsd für das Datenformat der Meldeklassen erhalten, allerdings noch nicht für die zusätzl. Funktionen:
o Anforderung einer Visit-Id
die Anforderung einer Visit-id erfolgt mit dem gleichen Schema unter Angabe von:
der IMO- oder ENI-Nummer, sowie der PortOfCall und ETAPortOfCall um eine entsprechende VisitId bzw. TransitId zu beantragen
o Abfrage des "Belegt"-Status einer Meldeklasse ....
Bitte benutzen Sie für die Abfrage folgende Seite:
Page: https://ref-app.his-nord.de/HIS-Service/StatusInfoNSW.jsp
Login: BSMD-REF
Password: Hd47#fz9Bl48sxU#2
Was wir noch benötigen für ein erfolgreiches Login, ist die IP-Adresse/n über welche die Abfrage/n ausgeführt werden
im Rückkanal des Transmitter erhalten Sie wie abgesprochen die Antworten (XML-Response) vom NSW Kernsystem.
Bei Systemfehlern, die ein Senden an das NSW Kernsystem verhindern, erhalten Sie ein Fehler XML.
Beschreibung und Beispiel finden Sie im Anhang (SystemError-ProcessStatus.7z).
noch ein Hinweis für das Login "Live Abfrage - NSW-Kernsystem".
Wenn der Zugriff verweigert wird, dann bekommen Sie vom Server eine Fehlermeldung.
- Enthält die Fehlermeldung keinen Code, dann ist die JavaScript Validierung auf der Page fehlgeschlagen.
- Enthält die Fehlermeldung einen Code, dann können Sie diesen wie folgt interpretieren.
---
URL-REF: https://ref-app.his-nord.de/HIS-Service/StatusInfoNSW.jsp
Fehler-Code:
- Fehler-Code = -10 -> Login und/oder Password falsch
- Fehler-Code = -11 -> IP-Adresse ohne Berechtigung
- Fehler-Code = -12 -> Mehr als 3 fehlerhafte Login Versuche
- Beispiel:
Zugriff verweigert, keine Berechtigung für diesen Service. [Code: Fehler-Code ]
---
Nach mehr als 3 fehlerhafte Login Versuche, erhalten Sie den Code:-12.
In diesem Fall erfolgt keine Prüfung des Logins mehr.
Es gibt dann drei Möglichkeiten um die Login Prüfung auf dem Server wieder anzustoßen:
- warten bis die Session abgelaufen ist (z.Z. 8 Stunden)
- einen anderen Browser nehmen
- den aktuellen Cookie im Browser löschen
Beispiel (Anhang: Login-Fehler-Code-10.jpg):
Zugriff verweigert, keine Berechtigung für diesen Service. [Code: -10]
Info:
Beim NSW-Kernsystem ist es nicht möglich einen einzelnen Meldetypen abzufragen.
Es werden immer alle Informationen zu einer VisitID bzw. TransitID zurückgegeben.
-----------------------------------------------------------------------------------------
Spezialitäten bei HIS Nord (Stand 17.4.16)
Generell: Die Datenvorlage (XSD) wird per xsd.exe /classes aus den einzelnen Quelldateien generiert. Wir bekommen XSD 1.1 geliefert

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Specialized;
using System.Text;
using System.Net;
using System.Web;
using log4net;
using bsmd.database;
@ -28,20 +29,29 @@ namespace bsmd.status
try
{
byte[] resultData = client.UploadValues(new Uri(Properties.Settings.Default.url),
new NameValueCollection()
string encodedLogin = HttpUtility.HtmlEncode(Properties.Settings.Default.login);
string encodedPW = HttpUtility.HtmlEncode(Properties.Settings.Default.password);
NameValueCollection postCollection = new NameValueCollection()
{
// ich glaube ein HTML Encoding braucht man hier nicht?
{ "login", Properties.Settings.Default.login },
{ "password", Properties.Settings.Default.password },
{ "login", encodedLogin },
{ "password", encodedPW },
{ "visitIdTransitId", _queryCore.IsTransit ? _queryCore.TransitId : _queryCore.VisitId },
{ "format", Properties.Settings.Default.format }
});
};
string uploadString = string.Format("login={0}&password={1}&visitIdTransitId={2}&format=xml", encodedLogin, encodedPW, _queryCore.IsTransit ? _queryCore.TransitId : _queryCore.VisitId);
_log.InfoFormat("Upload string: {0}", encodedLogin, encodedPW);
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string resultString = client.UploadString(new Uri(Properties.Settings.Default.url), uploadString);
// Do some log output
string resultString = Encoding.UTF8.GetString(resultData);
//string resultString = Encoding.UTF8.GetString(resultData);
_log.InfoFormat("Status query result: {0}", resultString);
@ -76,7 +86,9 @@ namespace bsmd.status
_queryCore.OwnNotificationClasses = result.NswResponse.OwnNotificationClasses;
_queryCore.FreeNotificationClasses = result.NswResponse.FreeNotificationClasses;
_queryCore.StatusCheckErrorCode = result.NswResponse.ErrorCode;
_queryCore.StatusCheckErrorMessage = result.NswResponse.ErrorMessage;
string errorText = result.NswResponse.ErrorMessage;
if ((errorText != null) && (errorText.Length > 512)) errorText = errorText.Substring(0, 512);
_queryCore.StatusCheckErrorMessage = errorText;
}
else
@ -91,13 +103,15 @@ namespace bsmd.status
{
_log.Error("parsing result status failed");
}
DBManager.Instance.Save(_queryCore);
}
catch (Exception e)
{
_log.ErrorFormat("Error uploading status request values: {0}", e.ToString());
_queryCore.StatusCheckErrorMessage = string.Format("Exception trying to reach HIS-Nord service: {0}", e.Message);
}
DBManager.Instance.Save(_queryCore);
}
}
}

View File

@ -43,6 +43,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />

Binary file not shown.