diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index 9ff3f9c0..77790c5b 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,12 +26,12 @@ 1000 - http://192.168.2.4/LockingService/LockingService.svc - + + http://heupferd/bsmd.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=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs index 098f1b1d..8a58f5d7 100644 --- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs +++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs @@ -20,6 +20,7 @@ namespace ENI2 protected bool _initialized = false; private DependencyPropertyDescriptor _dpTextBox; + private DependencyPropertyDescriptor _dpDateTimePicker; private DependencyPropertyDescriptor _dpDatePicker; private DependencyPropertyDescriptor _dpLocode; private DependencyPropertyDescriptor _dpCheckbox; @@ -93,13 +94,15 @@ namespace ENI2 public virtual void Initialize() { _dpTextBox = DependencyPropertyDescriptor.FromProperty(TextBox.TextProperty, typeof(TextBox)); - _dpDatePicker = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Toolkit.DateTimePicker.ValueProperty, typeof(Xceed.Wpf.Toolkit.DateTimePicker)); + _dpDateTimePicker = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Toolkit.DateTimePicker.ValueProperty, typeof(Xceed.Wpf.Toolkit.DateTimePicker)); + _dpDatePicker = DependencyPropertyDescriptor.FromProperty(DatePicker.SelectedDateProperty, typeof(DatePicker)); _dpLocode = DependencyPropertyDescriptor.FromProperty(Controls.LocodeControl.LocodeValueProperty, typeof(Controls.LocodeControl)); _dpCheckbox = DependencyPropertyDescriptor.FromProperty(CheckBox.IsCheckedProperty, typeof(CheckBox)); _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) { @@ -132,10 +135,16 @@ namespace ENI2 protected void RegisterDateTimePickerChange(Xceed.Wpf.Toolkit.DateTimePicker dateTimePicker, Message.NotificationClass notificationClass) { - this._dpDatePicker.AddValueChanged(dateTimePicker, this.controlContentChanged); + this._dpDateTimePicker.AddValueChanged(dateTimePicker, this.controlContentChanged); this._controlClassDict[dateTimePicker] = notificationClass; } + protected void RegisterDatePickerChange(DatePicker datePicker, Message.NotificationClass notificationClass) + { + this._dpDatePicker.AddValueChanged(datePicker, this.controlContentChanged); + this._controlClassDict[datePicker] = notificationClass; + } + protected void RegisterLocodeChange(Controls.LocodeControl locodeControl, Message.NotificationClass notificationClass) { this._dpLocode.AddValueChanged(locodeControl, this.controlContentChanged); diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index fa03433d..8f4a5c66 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -75,10 +75,9 @@ namespace ENI2 // 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); - } + + _messages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(_core, DBManager.MessageLoad.ALL); + BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock); Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0)); } @@ -164,7 +163,7 @@ namespace ENI2 { if (message.IsDirty) { - DBManager.Instance.Save(message); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message); message.SaveElements(); message.IsDirty = false; } @@ -185,7 +184,7 @@ namespace ENI2 { if (message.IsDirty) { - DBManager.Instance.Save(message); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message); message.SaveElements(); message.IsDirty = false; this.buttonSaveAll.Visibility = Visibility.Hidden; @@ -242,11 +241,9 @@ namespace ENI2 { /// core und messages neu laden /// - lock (DBManager.Instance) - { - this._core = DBManager.Instance.GetMessageCoreById(this.Core.Id.Value); - this._messages = DBManager.Instance.GetMessagesForCore(this._core, DBManager.MessageLoad.ALL); - } + + this._core = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreById(this.Core.Id.Value); + this._messages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(this._core, DBManager.MessageLoad.ALL); // clear existing controls this.detailView.Children.Clear(); diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs index da65fdb2..f1b84bf2 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs @@ -146,6 +146,14 @@ namespace ENI2.DetailViewControls ebd.BRKA = brka; ebd.IsDeparture = false; + ebd.AddClicked += () => + { + ebd.CopyValuesToEntity(); + this._bkraMessage.Elements.Add(ebd.BRKA); + this.dataGridBKRA.Items.Refresh(); + ebd.BRKA = new BRKA(); + }; + if (ebd.ShowDialog() ?? false) { brka.MessageHeader = _bkraMessage; @@ -174,6 +182,15 @@ namespace ENI2.DetailViewControls EditBKRDialog eld = new EditBKRDialog(); eld.IsDeparture = false; eld.BRKA = brka; + + eld.AddClicked += () => + { + eld.CopyValuesToEntity(); + _bkraMessage.Elements.Add(eld.BRKA); + this.dataGridBKRA.Items.Refresh(); + eld.BRKA = new BRKA(); + }; + if (eld.ShowDialog() ?? false) this.dataGridBKRA.Items.Refresh(); this.SublistElementChanged(Message.NotificationClass.BKRA); diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index ea8d0c34..4f17e77b 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -371,7 +371,7 @@ namespace ENI2.DetailViewControls this.Core.QueryNSWStatus = true; this.Core.StatusCheckErrorCode = string.Empty; this.Core.StatusCheckErrorMessage = string.Empty; - DBManager.Instance.Save(this.Core); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core); this.busyIndicator.IsBusy = true; @@ -391,7 +391,7 @@ namespace ENI2.DetailViewControls private void _checkStatusTimer_Elapsed(object sender, ElapsedEventArgs e) { - bool? statusFlag = DBManager.Instance.GetMessageCoreQueryStatusFlag(this.Core.Id.Value); + bool? statusFlag = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreQueryStatusFlag(this.Core.Id.Value); if (statusFlag ?? true) { double elapsedSec = (DateTime.Now - _startStatusCheck).TotalSeconds; diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml index 2368ec80..c41a4380 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml @@ -3,11 +3,50 @@ 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/PSC72hDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml.cs index 4df9bcc0..c02f49e1 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml.cs @@ -1,21 +1,11 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: Detailansicht für PRE72H // -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,79 @@ namespace ENI2.DetailViewControls /// public partial class PSC72hDetailControl : DetailBaseControl { + + private Message _pre72hMessage; + + private static string[] hullConfiguration = { + Properties.Resources.textSingleHull, + Properties.Resources.textSingleHullBallast, + Properties.Resources.textDoubleHull + }; + + private static string[] conditionCargoTanks = + { + Properties.Resources.textFull, + Properties.Resources.textEmpty, + Properties.Resources.textInert + }; + public PSC72hDetailControl() { InitializeComponent(); + this.Loaded += PSC72hDetailControl_Loaded; } + + private void PSC72hDetailControl_Loaded(object sender, RoutedEventArgs e) + { + this.RegisterCheckboxChange(this.checkBoxTanker, Message.NotificationClass.PRE72H); + this.RegisterComboboxIndexChange(this.comboBoxTankerHullConfig, Message.NotificationClass.PRE72H); + this.RegisterComboboxIndexChange(this.comboBoxConditionCargoBallastTanks, Message.NotificationClass.PRE72H); + this.RegisterTextboxChange(this.textBoxNatureOfCargo, Message.NotificationClass.PRE72H); + this.RegisterDoubleUpDownChange(this.doubleUpDownVolumeOfCargo, Message.NotificationClass.PRE72H); + this.RegisterTextboxChange(this.textBoxPlannedOperations, Message.NotificationClass.PRE72H); + this.RegisterTextboxChange(this.textBoxPlannedWorks, Message.NotificationClass.PRE72H); + this.RegisterDatePickerChange(this.datePickerLastExpandedInspection, Message.NotificationClass.PRE72H); + this.RegisterIntegerUpDownChange(this.integerUpDownPlannedPeriodOfStay, Message.NotificationClass.PRE72H); + } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.PRE72H) { this._pre72hMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + + #region PRE72H + + if (this._pre72hMessage == null) + { + this._pre72hMessage = this.Core.CreateMessage(Message.NotificationClass.PRE72H); + this.Messages.Add(this._pre72hMessage); + } + + PRE72H pre72h = null; + if (this._pre72hMessage.Elements.Count > 0) + pre72h = this._pre72hMessage.Elements[0] as PRE72H; + if (pre72h == null) + { + pre72h = new PRE72H(); + pre72h.MessageCore = this.Core; + pre72h.MessageHeader = this._pre72hMessage; + _pre72hMessage.Elements.Add(pre72h); + } + + this.comboBoxTankerHullConfig.ItemsSource = hullConfiguration; + this.comboBoxConditionCargoBallastTanks.ItemsSource = conditionCargoTanks; + + this.groupBoxPre72H.DataContext = pre72h; + + #endregion + + } + } + } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs index 9795f5e4..77979efe 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs @@ -109,7 +109,7 @@ namespace ENI2.DetailViewControls { // are you sure dialog is in base class _noa_nod.CallPurposes.Remove(cp); - // DBManager.Instance.Delete(cp); // not yet + // DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(cp); // not yet this.dataGridCallPurposes.Items.Refresh(); } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs index 02d0ac4e..c13434f2 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs @@ -172,7 +172,7 @@ namespace ENI2.DetailViewControls { // are you sure dialog is in base class this._ladgMessage.Elements.Remove(ladg); - // DBManager.Instance.Delete(ladg); // not yet + // DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ladg); // not yet this.dataGridLADG.Items.Refresh(); } } diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index b3d97217..df1b8b7c 100644 --- a/ENI-2/ENI2/ENI2/ENI2.csproj +++ b/ENI-2/ENI2/ENI2/ENI2.csproj @@ -35,7 +35,7 @@ 3.5.1.0 true publish.html - 1 + 2 3.6.7.%2a false true diff --git a/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs index 3646c8e4..4836fc67 100644 --- a/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs @@ -17,7 +17,8 @@ namespace ENI2.EditControls public EditBKRDialog() { InitializeComponent(); - Loaded += EditBKRDialog_Loaded; ; + Loaded += EditBKRDialog_Loaded; + AddClicked += () => { this.textBoxBunkerType.Focus(); }; } #region Properties @@ -42,9 +43,10 @@ namespace ENI2.EditControls 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; - } + this.AddVisible = true; + } - private void EditBKRDialog_OKClicked() + public void CopyValuesToEntity() { // copy back if (this.IsDeparture) @@ -59,6 +61,11 @@ namespace ENI2.EditControls } } + private void EditBKRDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + #endregion } diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs index c6a3ecdc..2366c649 100644 --- a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs +++ b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs @@ -250,7 +250,7 @@ namespace ENI2 closedDialog.Core.InitialHIS = Message.NSWProvider.DUDR_TEST; } closedDialog.Core.DefaultReportingPartyId = this.userEntity.Id; - DBManager.Instance.Save(closedDialog.Core); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(closedDialog.Core); // Meldeklassen für neuen Anlauf erzeugen: bsmd.database.Util.CreateMessagesForCore(closedDialog.Core); diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs index 297ecb58..8f2936fe 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs +++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs @@ -950,6 +950,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Double hull. + /// + public static string textDoubleHull { + get { + return ResourceManager.GetString("textDoubleHull", resourceCulture); + } + } + /// /// Looks up a localized string similar to Draught in decimetre. /// @@ -995,6 +1004,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Empty. + /// + public static string textEmpty { + get { + return ResourceManager.GetString("textEmpty", resourceCulture); + } + } + /// /// Looks up a localized string similar to ENI number. /// @@ -1103,6 +1121,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Full. + /// + public static string textFull { + get { + return ResourceManager.GetString("textFull", resourceCulture); + } + } + /// /// Looks up a localized string similar to Fumigated bulk cargo. /// @@ -1130,6 +1157,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Inert. + /// + public static string textInert { + get { + return ResourceManager.GetString("textInert", resourceCulture); + } + } + /// /// Looks up a localized string similar to Info. /// @@ -1157,6 +1193,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Date of last expanded inspection. + /// + public static string textLastExpandedInspection { + get { + return ResourceManager.GetString("textLastExpandedInspection", resourceCulture); + } + } + /// /// Looks up a localized string similar to Last name. /// @@ -1364,6 +1409,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Planned inspection / works. + /// + public static string textPlannedInspection { + get { + return ResourceManager.GetString("textPlannedInspection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Planned operations at port of call. + /// + public static string textPlannedOperations { + get { + return ResourceManager.GetString("textPlannedOperations", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Planned period of stay (hours). + /// + public static string textPlannedPeriodOfStay { + get { + return ResourceManager.GetString("textPlannedPeriodOfStay", resourceCulture); + } + } + /// /// Looks up a localized string similar to Port area. /// @@ -1409,6 +1481,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to PRE72H - 72 hour preannouncement. + /// + public static string textPre72hGroupBox { + get { + return ResourceManager.GetString("textPre72hGroupBox", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Print. /// @@ -1527,7 +1608,7 @@ 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.. + /// 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 limit the results.. /// public static string textSearchExceededMessage { get { @@ -1652,6 +1733,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Single hull. + /// + public static string textSingleHull { + get { + return ResourceManager.GetString("textSingleHull", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Single hull with separate ballast tanks. + /// + public static string textSingleHullBallast { + get { + return ResourceManager.GetString("textSingleHullBallast", resourceCulture); + } + } + /// /// Looks up a localized string similar to Special requirements. /// @@ -1706,6 +1805,51 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Tanker. + /// + public static string textTanker { + get { + return ResourceManager.GetString("textTanker", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Condition of cargo and ballast tanks. + /// + public static string textTankerCondition { + get { + return ResourceManager.GetString("textTankerCondition", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Tanker hull configuration. + /// + public static string textTankerHullConfig { + get { + return ResourceManager.GetString("textTankerHullConfig", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Nature of cargo. + /// + public static string textTankerNatureOfCargo { + get { + return ResourceManager.GetString("textTankerNatureOfCargo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Volume of cargo (t). + /// + public static string textTankerVolumeOfCargo { + get { + return ResourceManager.GetString("textTankerVolumeOfCargo", resourceCulture); + } + } + /// /// Looks up a localized string similar to Ticket No. /// diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx index 11b6375f..1f7867c0 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.resx +++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx @@ -641,10 +641,7 @@ 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 + More than {0} ({1}) search matches found. The first {0} are shown. Please modify your search criteria to limit the results. Draught on arrival @@ -709,6 +706,52 @@ Company name of the operator - - + + PRE72H - 72 hour preannouncement + + + Tanker + + + Tanker hull configuration + + + Condition of cargo and ballast tanks + + + Nature of cargo + + + Volume of cargo (t) + + + Planned operations at port of call + + + Planned inspection / works + + + Date of last expanded inspection + + + Planned period of stay (hours) + + + Single hull + + + Single hull with separate ballast tanks + + + Double hull + + + Full + + + Empty + + + Inert + \ No newline at end of file diff --git a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs index 2c8002ca..78747a05 100644 --- a/ENI-2/ENI2/ENI2/SucheControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/SucheControl.xaml.cs @@ -82,15 +82,13 @@ namespace ENI2 // menge suchen int? resultLimit = null; - int? expectedResultNum = DBManager.Instance.GetNumCoresWithFilters(filterDict); + int? expectedResultNum = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetNumCoresWithFilters(filterDict); if ((expectedResultNum ?? 0) > 100) resultLimit = 100; // suche auslösen - lock (DBManager.Instance) - { - this.anmeldungen = DBManager.Instance.GetMessageCoresWithFilters(filterDict, resultLimit); - } + + this.anmeldungen = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict, resultLimit); BindingOperations.EnableCollectionSynchronization(this.anmeldungen, this.searchLock); // prevent sync lock exceptions (trat bei Sandra auf) diff --git a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs index bd5b0bdd..00039679 100644 --- a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs +++ b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs @@ -34,22 +34,21 @@ namespace ENI2.Util lock (this._entityLock) { List changedCores = new List(); - lock (DBManager.Instance) + + foreach (MessageCore watchedEntity in this._watchedEntities.Keys) { - foreach (MessageCore watchedEntity in this._watchedEntities.Keys) + MessageCore entity = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreById(watchedEntity.Id ?? Guid.Empty); + if (entity != null) { - MessageCore entity = DBManager.Instance.GetMessageCoreById(watchedEntity.Id ?? Guid.Empty); - if (entity != null) + if (entity.Changed.HasValue && (entity.Changed.Value > this._watchedEntities[watchedEntity])) { - if (entity.Changed.HasValue && (entity.Changed.Value > this._watchedEntities[watchedEntity])) - { - OnDatabaseEntityChanged(entity); - changedCores.Add(entity); - } + OnDatabaseEntityChanged(entity); + changedCores.Add(entity); } } } - foreach(MessageCore changedCore in changedCores) + + foreach (MessageCore changedCore in changedCores) this._watchedEntities[changedCore] = DateTime.Now; // nur einmal auslösen } } diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index a4f0052f..b073358e 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs index 2dd246c3..210b59d9 100644 --- a/nsw/Source/bsmd.database/DBManager.cs +++ b/nsw/Source/bsmd.database/DBManager.cs @@ -27,6 +27,7 @@ namespace bsmd.database private static Dictionary allReportingParties; private static Dictionary allPortAreas; private object _lock = new object(); + private bool _closeConnectionAfterUse = false; #endregion @@ -54,6 +55,17 @@ namespace bsmd.database } } + public static DBManager GetSingleCon(string dbConnectionString) + { + DBManager aDBManager = new DBManager(); + if (aDBManager.Connect(dbConnectionString)) + { + aDBManager._closeConnectionAfterUse = true; + return aDBManager; + } + return null; + } + public string ConnectionString { get; set; } #endregion @@ -105,6 +117,9 @@ namespace bsmd.database this.LoadCustomer(core); result.Add(core); } + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -122,6 +137,9 @@ namespace bsmd.database this.LoadCustomer(core); result.Add(core); } + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -139,6 +157,9 @@ namespace bsmd.database this.LoadCustomer(core); result.Add(core); } + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -151,6 +172,9 @@ namespace bsmd.database List result = new List(); foreach (ImportHeader existingHeader in ih.LoadList(reader)) result.Add(existingHeader); + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -163,6 +187,9 @@ namespace bsmd.database List result = new List(); foreach (ImportValue existingValue in iv.LoadList(reader)) result.Add(existingValue); + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -180,6 +207,9 @@ namespace bsmd.database this.LoadCustomer(core); result.Add(core); } + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -190,6 +220,9 @@ namespace bsmd.database aMessageCore.PrepareCountCmd(cmd, Message.LoadFilter.SEARCH_CORE_FILTERS, filters); int? result = this.PerformReadIntQuery(cmd); + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -211,6 +244,10 @@ namespace bsmd.database this.LoadSTATShipName(core); result.Add(core); } + + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -235,6 +272,9 @@ namespace bsmd.database result = (MessageCore)cores[0]; this.LoadCustomer(result); } + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -263,6 +303,9 @@ namespace bsmd.database messageList.Add(message); } this.LoadMessageDependencies(messageList); + + if (this._closeConnectionAfterUse) this.Disconnect(); + return messageList; } @@ -366,6 +409,9 @@ namespace bsmd.database result.Customer = customers[0] as Customer; } } + + if (this._closeConnectionAfterUse) this.Disconnect(); + return result; } @@ -479,7 +525,9 @@ namespace bsmd.database SqlCommand cmd = new SqlCommand(); entity.PrepareSave(cmd); int queryResult = this.PerformNonQuery(cmd); - this.LogNonQueryResult(cmd.CommandText, queryResult); + this.LogNonQueryResult(cmd.CommandText, queryResult); + + if (this._closeConnectionAfterUse) this.Disconnect(); } public void Delete(DatabaseEntity entity) @@ -487,7 +535,9 @@ namespace bsmd.database SqlCommand cmd = new SqlCommand(); entity.PrepareDelete(cmd); int queryResult = this.PerformNonQuery(cmd); - this.LogNonQueryResult(cmd.CommandText, queryResult); + this.LogNonQueryResult(cmd.CommandText, queryResult); + + if (this._closeConnectionAfterUse) this.Disconnect(); } public void DeleteMessageErrors(Message message) @@ -519,14 +569,20 @@ namespace bsmd.database SqlCommand cmd = new SqlCommand(); core.PrepareSave(cmd); int queryResult = this.PerformNonQuery(cmd); - this.LogNonQueryResult(cmd.CommandText, queryResult); + this.LogNonQueryResult(cmd.CommandText, queryResult); + + if (this._closeConnectionAfterUse) this.Disconnect(); } 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); + bool? result = this.PerformReadFlagQuery(cmd); + + if (this._closeConnectionAfterUse) this.Disconnect(); + + return result; } #endregion diff --git a/nsw/Source/bsmd.hisnord/Request.cs b/nsw/Source/bsmd.hisnord/Request.cs index 40db33ff..fe5592d0 100644 --- a/nsw/Source/bsmd.hisnord/Request.cs +++ b/nsw/Source/bsmd.hisnord/Request.cs @@ -61,7 +61,7 @@ namespace bsmd.hisnord } _nsw.conveyance.owner_sender.name_short = @"BSMD"; - _nsw.conveyance.owner_sender.name_long = rp.Name; // messages[0].MessageCore.Customer.Name; + _nsw.conveyance.owner_sender.name_long = @"BSMD";// rp.Name; // messages[0].MessageCore.Customer.Name; _nsw.conveyance.owner_sender.address = new addresstype(); @@ -71,9 +71,9 @@ namespace bsmd.hisnord // das hier ist der e-mail(!) Empfänger für Error/Violation Meldungen _nsw.conveyance.owner_sender.contact = new contacts(); - _nsw.conveyance.owner_sender.contact.name = rp.LastName; + _nsw.conveyance.owner_sender.contact.name = @"BSMD"; // rp.LastName; _nsw.conveyance.owner_sender.contact.email = rp.EMail; - _nsw.conveyance.owner_sender.contact.firstname = rp.FirstName; + _nsw.conveyance.owner_sender.contact.firstname = string.Format("{0} {1}", rp.FirstName, rp.LastName); _nsw.conveyance.owner_sender.contact.phone = rp.Phone; _nsw.conveyance.owner_sender.contact.fax = rp.Fax;