diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index 4dbc9f08..9ff3f9c0 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,10 +26,12 @@ 1000 - http://192.168.2.4/LockingService/LockingService.svc + http://192.168.2.4/LockingService/LockingService.svc + - Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False + Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False + diff --git a/ENI-2/ENI2/ENI2/App.xaml b/ENI-2/ENI2/ENI2/App.xaml index f9bc5948..4538fad7 100644 --- a/ENI-2/ENI2/ENI2/App.xaml +++ b/ENI-2/ENI2/ENI2/App.xaml @@ -22,6 +22,24 @@ + + + + diff --git a/ENI-2/ENI2/ENI2/Controls/ClosableTabItem.cs b/ENI-2/ENI2/ENI2/Controls/ClosableTabItem.cs index c773b97a..142fae87 100644 --- a/ENI-2/ENI2/ENI2/Controls/ClosableTabItem.cs +++ b/ENI-2/ENI2/ENI2/Controls/ClosableTabItem.cs @@ -99,7 +99,7 @@ namespace ENI2.Controls this.textBlock = new TextBlock { Text = headerText }; this.textBlock.Foreground = new SolidColorBrush(Colors.Black); - this.textBlock.Background = lockedTab ? Brushes.LightGreen : Brushes.Orange; + // this.textBlock.Background = lockedTab ? Brushes.LightGreen : Brushes.Orange; // sie wollen die bunten Panels doch nicht this.textBlock.Margin = new Thickness(1); this.textBlock.VerticalAlignment = VerticalAlignment.Center; diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs index f5ce8e7f..098f1b1d 100644 --- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs +++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs @@ -26,6 +26,7 @@ namespace ENI2 private DependencyPropertyDescriptor _dpComboboxIndex; private DependencyPropertyDescriptor _dpComboboxValue; private DependencyPropertyDescriptor _dpNumericUpdown; + private DependencyPropertyDescriptor _dpIntUpdown; private Dictionary _controlClassDict = new Dictionary(); private Dictionary _typeMessageDict = new Dictionary(); private List _controlMessages = new List(); @@ -98,6 +99,7 @@ namespace ENI2 _dpComboboxIndex = DependencyPropertyDescriptor.FromProperty(ComboBox.SelectedIndexProperty, typeof(ComboBox)); _dpComboboxValue = DependencyPropertyDescriptor.FromProperty(ComboBox.SelectedValueProperty, typeof(ComboBox)); _dpNumericUpdown = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Toolkit.DoubleUpDown.ValueProperty, typeof(Xceed.Wpf.Toolkit.DoubleUpDown)); + _dpIntUpdown = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Toolkit.IntegerUpDown.ValueProperty, typeof(Xceed.Wpf.Toolkit.IntegerUpDown)); foreach(Message message in this.Messages) { @@ -164,6 +166,12 @@ namespace ENI2 this._controlClassDict[doubleUpDown] = notificationClass; } + protected void RegisterIntegerUpDownChange(Xceed.Wpf.Toolkit.IntegerUpDown intUpDown, Message.NotificationClass notificationClass) + { + this._dpIntUpdown.AddValueChanged(intUpDown, this.controlContentChanged); + this._controlClassDict[intUpDown] = notificationClass; + } + protected void SublistElementChanged(Message.NotificationClass notificationClass) { if (_typeMessageDict.ContainsKey(notificationClass)) diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 7c567be5..fa03433d 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -73,7 +73,12 @@ namespace ENI2 this.listBoxMessages.ItemsSource = this._listBoxList; - _messages = DBManager.Instance.GetMessagesForCore(_core, DBManager.MessageLoad.ALL); + // Locking ergänzt. Ich habe den Eindruck, dass die DataReader Fehler beim BSMD daran liegen, dass das hier länger dauert als + // man eine neue Anmeldung anklickt -> paralleles Laden -> Autsch + lock (DBManager.Instance) + { + _messages = DBManager.Instance.GetMessagesForCore(_core, DBManager.MessageLoad.ALL); + } BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock); Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0)); } @@ -236,9 +241,12 @@ namespace ENI2 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); + /// + lock (DBManager.Instance) + { + 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(); diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml index 43c26a3c..7878b045 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml @@ -3,11 +3,76 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 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:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:p="clr-namespace:ENI2.Properties" + xmlns:enictrl="clr-namespace:ENI2.Controls" + xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:local="clr-namespace:ENI2.DetailViewControls" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - - - + d:DesignHeight="800" d:DesignWidth="1024"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs index 5b306a3d..da65fdb2 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs @@ -1,21 +1,11 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: Detailansicht für ATA, TIEFA, POBA, BKRA // -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.Navigation; -using System.Windows.Shapes; + +using bsmd.database; +using ENI2.EditControls; namespace ENI2.DetailViewControls { @@ -24,9 +14,178 @@ namespace ENI2.DetailViewControls /// public partial class ArrivalNotificationDetailControl : DetailBaseControl { + + private Message _ataMessage; + private Message _tiefaMessage; + private Message _pobaMessage; + private Message _bkraMessage; + + public ArrivalNotificationDetailControl() { InitializeComponent(); + this.Loaded += ArrivalNotificationDetailControl_Loaded; } + + private void ArrivalNotificationDetailControl_Loaded(object sender, RoutedEventArgs e) + { + this.RegisterDateTimePickerChange(this.dateTimePickerATA, Message.NotificationClass.ATA); + this.RegisterDoubleUpDownChange(this.doubleUpDownDraught, Message.NotificationClass.TIEFA); + this.RegisterIntegerUpDownChange(this.integerUpDownCrewMemberOnBoard, Message.NotificationClass.POBA); + this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBA); + this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBA); + this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBA); + } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.ATA) { this._ataMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.TIEFA) { this._tiefaMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.POBA) { this._pobaMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.BKRA) { this._bkraMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region ATA + + if (this._ataMessage == null) + { + this._ataMessage = this.Core.CreateMessage(Message.NotificationClass.ATA); + this.Messages.Add(this._ataMessage); + } + + ATA ata = null; + if (this._ataMessage.Elements.Count > 0) + ata = this._ataMessage.Elements[0] as ATA; + if (ata == null) + { + ata = new ATA(); + ata.MessageCore = this.Core; + ata.MessageHeader = this._ataMessage; + _ataMessage.Elements.Add(ata); + } + + this.ataGroupBox.DataContext = ata; + + #endregion + + #region TIEFA + + if (this._tiefaMessage == null) + { + this._tiefaMessage = this.Core.CreateMessage(Message.NotificationClass.TIEFA); + this.Messages.Add(this._tiefaMessage); + } + + TIEFA tiefa = null; + if (this._tiefaMessage.Elements.Count > 0) + tiefa = this._tiefaMessage.Elements[0] as TIEFA; + if (tiefa == null) + { + tiefa = new TIEFA(); + tiefa.MessageCore = this.Core; + tiefa.MessageHeader = this._tiefaMessage; + _tiefaMessage.Elements.Add(tiefa); + } + + this.tiefaGroupBox.DataContext = tiefa; + + #endregion + + #region POBA + + if (this._pobaMessage == null) + { + this._pobaMessage = this.Core.CreateMessage(Message.NotificationClass.POBA); + this.Messages.Add(this._pobaMessage); + } + + POBA poba = null; + if (this._pobaMessage.Elements.Count > 0) + poba = this._pobaMessage.Elements[0] as POBA; + if (poba == null) + { + poba = new POBA(); + poba.MessageCore = this.Core; + poba.MessageHeader = this._pobaMessage; + _pobaMessage.Elements.Add(poba); + } + + this.pobaGroupBox.DataContext = poba; + + #endregion + + #region BKRA + + if (this._bkraMessage == null) + { + this._bkraMessage = this.Core.CreateMessage(Message.NotificationClass.BKRA); + this.Messages.Add(this._bkraMessage); + } + + this.dataGridBKRA.Initialize(); + this.dataGridBKRA.ItemsSource = this._bkraMessage.Elements; + this.dataGridBKRA.AddingNewItem += DataGridBKRA_AddingNewItem; + this.dataGridBKRA.EditRequested += DataGridBKRA_EditRequested; + this.dataGridBKRA.DeleteRequested += DataGridBKRA_DeleteRequested; + this.dataGridBKRA.CreateRequested += DataGridBKRA_CreateRequested; + + #endregion + + } + + #region BKRA grid events + + private void DataGridBKRA_CreateRequested() + { + BRKA brka = new BRKA(); + EditBKRDialog ebd = new EditBKRDialog(); + ebd.BRKA = brka; + ebd.IsDeparture = false; + + if (ebd.ShowDialog() ?? false) + { + brka.MessageHeader = _bkraMessage; + _bkraMessage.Elements.Add(brka); + this.dataGridBKRA.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.BKRA); + } + } + + private void DataGridBKRA_DeleteRequested(DatabaseEntity obj) + { + BRKA brka = obj as BRKA; + if (brka != null) + { + // are you sure dialog is in base class + this._bkraMessage.Elements.Remove(brka); + this.dataGridBKRA.Items.Refresh(); + } + } + + private void DataGridBKRA_EditRequested(DatabaseEntity obj) + { + BRKA brka = obj as BRKA; + if (brka != null) + { + EditBKRDialog eld = new EditBKRDialog(); + eld.IsDeparture = false; + eld.BRKA = brka; + if (eld.ShowDialog() ?? false) + this.dataGridBKRA.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.BKRA); + } + } + + private void DataGridBKRA_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) + { + this.DataGridBKRA_CreateRequested(); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index ca9353ca..b3d97217 100644 --- a/ENI-2/ENI2/ENI2/ENI2.csproj +++ b/ENI-2/ENI2/ENI2/ENI2.csproj @@ -35,8 +35,8 @@ 3.5.1.0 true publish.html - 2 - 3.6.4.%2a + 1 + 3.6.7.%2a false true true @@ -212,6 +212,9 @@ WasteDetailControl.xaml + + EditBKRDialog.xaml + EditCallPurposeDialog.xaml @@ -309,6 +312,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml new file mode 100644 index 00000000..d12e1022 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs new file mode 100644 index 00000000..3646c8e4 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs @@ -0,0 +1,65 @@ +// Copyright (c) 2017 schick Informatik +// Description: Dialog zum Bearbeiten von Bunker-Informationen +// + +using System.Windows; + +using bsmd.database; +using ENI2.Controls; + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for EditBKRDialog.xaml + /// + public partial class EditBKRDialog : EditWindowBase + { + public EditBKRDialog() + { + InitializeComponent(); + Loaded += EditBKRDialog_Loaded; ; + } + + #region Properties + + public bool IsDeparture { get; set; } + + public BRKA BRKA { get; set; } + + public BRKD BRKD { get; set; } + + #endregion + + #region event handler + + private void EditBKRDialog_Loaded(object sender, RoutedEventArgs e) + { + this.OKClicked += EditBKRDialog_OKClicked; ; + + this.Title = this.IsDeparture ? Properties.Resources.textBunkerOnDeparture : Properties.Resources.textBunkerOnArrival; + + // copy into fields + this.textBoxBunkerType.Text = this.IsDeparture ? this.BRKD.BunkerFuelType : this.BRKA.BunkerFuelType; + this.doubleUpDownBunkerQuantity.Value = this.IsDeparture ? this.BRKD.BunkerFuelQuantity_TNE : this.BRKA.BunkerFuelQuantity_TNE; + this.OKClicked += EditBKRDialog_OKClicked; + } + + private void EditBKRDialog_OKClicked() + { + // copy back + if (this.IsDeparture) + { + this.BRKD.BunkerFuelType = this.textBoxBunkerType.Text.Trim(); + this.BRKD.BunkerFuelQuantity_TNE = this.doubleUpDownBunkerQuantity.Value; + } + else + { + this.BRKA.BunkerFuelType = this.textBoxBunkerType.Text.Trim(); + this.BRKA.BunkerFuelQuantity_TNE = this.doubleUpDownBunkerQuantity.Value; + } + } + + #endregion + + } +} diff --git a/ENI-2/ENI2/ENI2/EditControls/EditSERVDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditSERVDialog.xaml.cs index 90c477f5..f91e8b07 100644 --- a/ENI-2/ENI2/ENI2/EditControls/EditSERVDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/EditSERVDialog.xaml.cs @@ -2,19 +2,7 @@ // Description: // -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 bsmd.database; using ENI2.Controls; diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs index 2b33b778..297ecb58 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs +++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs @@ -572,6 +572,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Beam overall in meter. + /// + public static string textBeamOverallInMeter { + get { + return ResourceManager.GetString("textBeamOverallInMeter", resourceCulture); + } + } + /// /// Looks up a localized string similar to Border Police. /// @@ -590,6 +599,42 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Bunker on arrival. + /// + public static string textBunkerOnArrival { + get { + return ResourceManager.GetString("textBunkerOnArrival", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bunker on departure. + /// + public static string textBunkerOnDeparture { + get { + return ResourceManager.GetString("textBunkerOnDeparture", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Quantity of bunker fuel (t). + /// + public static string textBunkerQuantity { + get { + return ResourceManager.GetString("textBunkerQuantity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type of bunker fuel. + /// + public static string textBunkerType { + get { + return ResourceManager.GetString("textBunkerType", resourceCulture); + } + } + /// /// Looks up a localized string similar to Checking declaration status... /// @@ -761,6 +806,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Company name of the operator. + /// + public static string textCompanyNameOperator { + get { + return ResourceManager.GetString("textCompanyNameOperator", resourceCulture); + } + } + /// /// Looks up a localized string similar to Confirmation. /// @@ -806,6 +860,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Number of crew members on board. + /// + public static string textCrewMemberOnBoard { + get { + return ResourceManager.GetString("textCrewMemberOnBoard", resourceCulture); + } + } + /// /// Looks up a localized string similar to Declarations. /// @@ -887,6 +950,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Draught in decimetre. + /// + public static string textDraughtInDecimetre { + get { + return ResourceManager.GetString("textDraughtInDecimetre", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Draught on arrival. + /// + public static string textDraughtOnArrival { + get { + return ResourceManager.GetString("textDraughtOnArrival", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Draught on arrival in decimetre. + /// + public static string textDraughtOnArrivalLabel { + get { + return ResourceManager.GetString("textDraughtOnArrivalLabel", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Edit. /// @@ -1004,6 +1094,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Flag. + /// + public static string textFlag { + get { + return ResourceManager.GetString("textFlag", resourceCulture); + } + } + /// /// Looks up a localized string similar to Fumigated bulk cargo. /// @@ -1013,6 +1112,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Gross tonnage. + /// + public static string textGrossTonnage { + get { + return ResourceManager.GetString("textGrossTonnage", resourceCulture); + } + } + /// /// Looks up a localized string similar to IMO number. /// @@ -1067,6 +1175,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Length overall in meter. + /// + public static string textLengthOverallInMeter { + get { + return ResourceManager.GetString("textLengthOverallInMeter", resourceCulture); + } + } + /// /// Looks up a localized string similar to Loading. /// @@ -1130,6 +1247,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Name. + /// + public static string textName { + get { + return ResourceManager.GetString("textName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Name of master. /// @@ -1193,6 +1319,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Number of passengers on board. + /// + public static string textPassengersOnBoard { + get { + return ResourceManager.GetString("textPassengersOnBoard", resourceCulture); + } + } + /// /// Looks up a localized string similar to Password. /// @@ -1202,6 +1337,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Persons on board arrival. + /// + public static string textPersonOnBoardArrival { + get { + return ResourceManager.GetString("textPersonOnBoardArrival", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Number of persons on board. + /// + public static string textPersonsOnBoard { + get { + return ResourceManager.GetString("textPersonsOnBoard", resourceCulture); + } + } + /// /// Looks up a localized string similar to Phone. /// @@ -1274,6 +1427,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Purpose of call. + /// + public static string textPurposeOfCall { + get { + return ResourceManager.GetString("textPurposeOfCall", resourceCulture); + } + } + /// /// Looks up a localized string similar to Check status. /// @@ -1310,6 +1472,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Remarks. + /// + public static string textRemarks { + get { + return ResourceManager.GetString("textRemarks", resourceCulture); + } + } + /// /// Looks up a localized string similar to Requested position in port of call. /// @@ -1355,6 +1526,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to More than {0} ({1}) search matches found. The first {0} are shown. Please modify your search criteria to see more results.. + /// + public static string textSearchExceededMessage { + get { + return ResourceManager.GetString("textSearchExceededMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} seconds elapsed. /// @@ -1508,6 +1688,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Number of stowaways on board. + /// + public static string textStowawaysOnBoard { + get { + return ResourceManager.GetString("textStowawaysOnBoard", resourceCulture); + } + } + /// /// Looks up a localized string similar to Street / number. /// @@ -1535,6 +1724,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Towage on arrival. + /// + public static string textTowageOnArrival { + get { + return ResourceManager.GetString("textTowageOnArrival", resourceCulture); + } + } + /// /// Looks up a localized string similar to Transit. /// diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx index 62ddcc18..11b6375f 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.resx +++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx @@ -640,4 +640,75 @@ Send to NSW + + More than {0} ({1}) search matches found. The first {0} are shown. Please modify your search criteria to see more results. + + + Arrival notification + + + Draught on arrival + + + Draught on arrival in decimetre + + + Persons on board arrival + + + Number of crew members on board + + + Number of passengers on board + + + Number of stowaways on board + + + Number of persons on board + + + Bunker on arrival + + + Bunker on departure + + + Quantity of bunker fuel (t) + + + Type of bunker fuel + + + Towage on arrival + + + Name + + + Purpose of call + + + Flag + + + Draught in decimetre + + + Gross tonnage + + + Length overall in meter + + + Beam overall in meter + + + Remarks + + + Company name of the operator + + + \ No newline at end of file diff --git a/ENI-2/ENI2/ENI2/SucheControl.xaml b/ENI-2/ENI2/ENI2/SucheControl.xaml index 91aab83b..967b924f 100644 --- a/ENI-2/ENI2/ENI2/SucheControl.xaml +++ b/ENI-2/ENI2/ENI2/SucheControl.xaml @@ -70,7 +70,7 @@ - + diff --git a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs index 58b41c9b..2c8002ca 100644 --- a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs @@ -87,7 +87,11 @@ namespace ENI2 resultLimit = 100; // suche auslösen - this.anmeldungen = DBManager.Instance.GetMessageCoresWithFilters(filterDict, resultLimit); + lock (DBManager.Instance) + { + this.anmeldungen = DBManager.Instance.GetMessageCoresWithFilters(filterDict, resultLimit); + } + BindingOperations.EnableCollectionSynchronization(this.anmeldungen, this.searchLock); // prevent sync lock exceptions (trat bei Sandra auf) if (App.UserId.HasValue) @@ -114,6 +118,13 @@ namespace ENI2 this.dataGrid.ItemsSource = this.anmeldungen; this.searchResultLabel.Content = ((expectedResultNum ?? 0) > 0) ? string.Format("{0} results found, {1} displayed.", (expectedResultNum ?? 0), this.anmeldungen.Count) : "no results"; + if((expectedResultNum ?? 0) > 100) + { + // Messagebox damit es wirklich jeder merkt :\ + string searchMessage = string.Format(Properties.Resources.textSearchExceededMessage, 100, expectedResultNum.Value); + MessageBox.Show(searchMessage, Properties.Resources.textInfo, MessageBoxButton.OK, MessageBoxImage.Warning); + } + } private void etaValueChanged(object sender, EventArgs args) diff --git a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs index dfceb402..bd5b0bdd 100644 --- a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs +++ b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs @@ -34,19 +34,21 @@ namespace ENI2.Util lock (this._entityLock) { List changedCores = new List(); - foreach (MessageCore watchedEntity in this._watchedEntities.Keys) + lock (DBManager.Instance) { - MessageCore entity = DBManager.Instance.GetMessageCoreById(watchedEntity.Id ?? Guid.Empty); - if (entity != null) + foreach (MessageCore watchedEntity in this._watchedEntities.Keys) { - if (entity.Changed.HasValue && (entity.Changed.Value > this._watchedEntities[watchedEntity])) + MessageCore entity = DBManager.Instance.GetMessageCoreById(watchedEntity.Id ?? Guid.Empty); + if (entity != null) { - OnDatabaseEntityChanged(entity); - changedCores.Add(entity); + if (entity.Changed.HasValue && (entity.Changed.Value > this._watchedEntities[watchedEntity])) + { + OnDatabaseEntityChanged(entity); + changedCores.Add(entity); + } } } } - foreach(MessageCore changedCore in changedCores) this._watchedEntities[changedCore] = DateTime.Now; // nur einmal auslösen } diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index ac760d7d..a4f0052f 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs b/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs index d6d8864a..d0eaab25 100644 --- a/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs +++ b/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs @@ -166,6 +166,7 @@ namespace bsmd.ExcelReadService } catch (Exception ex) { + _log.Error(ex.ToString()); readMessage = string.Format("{0} Unerwartete Fehlersitutation:Bitte Info an Christin od. Daniel", ex.Message); } diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs index 8efecb51..80883f75 100644 --- a/nsw/Source/bsmd.ExcelReadService/Util.cs +++ b/nsw/Source/bsmd.ExcelReadService/Util.cs @@ -1736,11 +1736,22 @@ namespace bsmd.ExcelReadService { while (l10fc.PortFacilityGISISCode.Length < 4) l10fc.PortFacilityGISISCode = "0" + l10fc.PortFacilityGISISCode; } - reader.Conf.ConfirmText(portGISISCode, l10fc.PortFacilityGISISCode, l10fc.PortFacilityGISISCode.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); + if (l10fc.PortFacilityGISISCode.IsNullOrEmpty()) + { + reader.Conf.ConfirmText(portGISISCode, l10fc.PortFacilityGISISCode, ExcelReader.ReadState.FAIL); + } + else + { + reader.Conf.ConfirmText(portGISISCode, l10fc.PortFacilityGISISCode, l10fc.PortFacilityGISISCode.IsDigitsOnly() ? ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN); + } l10fc.PortFacilitySecurityMattersToReport = reader.ReadText(portSecMatters); reader.Conf.ConfirmText(portSecMatters, l10fc.PortFacilitySecurityMattersToReport, l10fc.PortFacilitySecurityMattersToReport.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL :ExcelReader.ReadState.OK); + // keinen "leeren" Hafen anlegen, wenn der Eintrag leer war (trifft anscheinend bei Neubauten zu, siehe E-Mail Christin vom 20./22.6.17 + if (l10fc.PortFacilityPortName.IsNullOrEmpty() && l10fc.PortFacilityPortLoCode.IsNullOrEmpty() && l10fc.PortFacilityPortCountry.IsNullOrEmpty()) + sec.LastTenPortFacilitesCalled.Remove(l10fc); + } // Ship2ShipActivities diff --git a/nsw/Source/bsmd.database/DatabaseEntity.cs b/nsw/Source/bsmd.database/DatabaseEntity.cs index 8d070175..ff871806 100644 --- a/nsw/Source/bsmd.database/DatabaseEntity.cs +++ b/nsw/Source/bsmd.database/DatabaseEntity.cs @@ -21,6 +21,7 @@ namespace bsmd.database { protected Guid? id; protected string tablename; + private Guid instance_id = Guid.NewGuid(); // Comparison id in case entity has not been saved public enum ValidationBlock { @@ -156,7 +157,10 @@ namespace bsmd.database public bool Equals(DatabaseEntity other) { - return null != other && Id == other.Id; + if (other == null) return false; + if (this.Id.HasValue && other.Id.HasValue && (this.Id.Value != Guid.Empty) && (other.Id.Value != Guid.Empty)) + return this.Id == other.Id; + return this.GetHashCode() == other.GetHashCode(); } public override bool Equals(object obj) @@ -166,6 +170,8 @@ namespace bsmd.database public override int GetHashCode() { + if (!this.Id.HasValue || this.Id.Value == Guid.Empty) + return this.instance_id.GetHashCode(); return this.Id.GetHashCode(); } diff --git a/nsw/Source/bsmd.database/Extensions.cs b/nsw/Source/bsmd.database/Extensions.cs index 6c75b927..71ca479d 100644 --- a/nsw/Source/bsmd.database/Extensions.cs +++ b/nsw/Source/bsmd.database/Extensions.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Globalization; using System.Text.RegularExpressions; using log4net; +using System.Linq; namespace bsmd.database { @@ -50,6 +51,16 @@ namespace bsmd.database return new Regex(pattern).IsMatch(str); } + public static bool IsDigitsOnly(this String str) + { + foreach (char c in str) + { + if (c < '0' || c > '9') + return false; + } + return true; + } + public static bool IsBoolean(this String str) { if (str == null) return false; @@ -126,6 +137,6 @@ namespace bsmd.database List result = new List(source.Split(splitDelimiter, StringSplitOptions.RemoveEmptyEntries)); return result; } - + } } diff --git a/nsw/Source/bsmd.database/Message.cs b/nsw/Source/bsmd.database/Message.cs index 23336482..24d3be61 100644 --- a/nsw/Source/bsmd.database/Message.cs +++ b/nsw/Source/bsmd.database/Message.cs @@ -684,6 +684,13 @@ namespace bsmd.database return this.MessageNotificationClass.CompareTo(other.MessageNotificationClass); } + /* + public override int GetHashCode() + { + return this.Id.GetHashCode() * 17 + this.messageCoreId.GetHashCode() * 17 + this.MessageNotificationClass.GetHashCode(); + } + */ + #endregion } diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 981f9143..ddac88d7 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.6.5")] +[assembly: AssemblyInformationalVersion("3.6.7")] [assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index 336c2b05..66df411b 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("3.6.5.*")] +[assembly: AssemblyVersion("3.6.7.*")]