diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index b657c69b..59067348 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -27,11 +27,11 @@ 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 - + diff --git a/ENI-2/ENI2/ENI2/App.xaml.cs b/ENI-2/ENI2/ENI2/App.xaml.cs index 8df0fa91..56433f4b 100644 --- a/ENI-2/ENI2/ENI2/App.xaml.cs +++ b/ENI-2/ENI2/ENI2/App.xaml.cs @@ -66,7 +66,9 @@ namespace ENI2 EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.PreviewKeyDownEvent, new KeyEventHandler(this.DatePicker_PreviewKeyDown)); CREW.NationalityDict = LocalizedLookup.getNationalities(); - + STAT.VesselTypeDict = LocalizedLookup.getVesselTypes(); + STAT.TransportModeDict = LocalizedLookup.getTransportModes(); + // Connect to locking service (if enabled) try diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml index 7878b045..44cb9895 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml @@ -29,7 +29,7 @@ - + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs index 9629503c..c5fc14d3 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs @@ -148,7 +148,7 @@ namespace ENI2.DetailViewControls { // are you sure dialog is in base class _bpol.PortOfItineraries.Remove(poi); - // DBManager.Instance.Delete(serv); // not yet + DBManager.Instance.Delete(poi); this.dataGridPortOfItinerary.Items.Refresh(); } } @@ -220,7 +220,7 @@ namespace ENI2.DetailViewControls { // are you sure dialog is in base class _pasMessage.Elements.Remove(pas); - // DBManager.Instance.Delete(serv); // not yet + DBManager.Instance.Delete(pas); this.dataGridPassengerList.Items.Refresh(); } } @@ -292,7 +292,7 @@ namespace ENI2.DetailViewControls { // are you sure dialog is in base class _crewMessage.Elements.Remove(crew); - // DBManager.Instance.Delete(serv); // not yet + DBManager.Instance.Delete(crew); this.dataGridCrewList.Items.Refresh(); } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml index d51f0517..24823205 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml @@ -4,10 +4,75 @@ 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: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/DepartureNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs index ec2cd917..d6623093 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DepartureNotificationDetailControl.xaml.cs @@ -1,32 +1,214 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: Detailansicht für ATD, TIEFD, POBD, BKRD // -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 { /// - /// Interaction logic for DepartureNotificationDetailControl.xaml + /// Interaction logic for ArrivalNotificationDetailControl.xaml /// public partial class DepartureNotificationDetailControl : DetailBaseControl { + + private Message _atdMessage; + private Message _tiefdMessage; + private Message _pobdMessage; + private Message _bkrdMessage; + + public DepartureNotificationDetailControl() { InitializeComponent(); + this.Loaded += ArrivalNotificationDetailControl_Loaded; } + + private void ArrivalNotificationDetailControl_Loaded(object sender, RoutedEventArgs e) + { + this.RegisterDateTimePickerChange(this.dateTimePickerATD, Message.NotificationClass.ATD); + this.RegisterDoubleUpDownChange(this.doubleUpDownDraught, Message.NotificationClass.TIEFD); + this.RegisterIntegerUpDownChange(this.integerUpDownCrewMemberOnBoard, Message.NotificationClass.POBD); + this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBD); + this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBD); + this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBD); + } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.ATD) { this._atdMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.TIEFD) { this._tiefdMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.POBD) { this._pobdMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.BKRD) { this._bkrdMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region ATD + + if (this._atdMessage == null) + { + this._atdMessage = this.Core.CreateMessage(Message.NotificationClass.ATD); + this.Messages.Add(this._atdMessage); + } + + ATD atd = null; + if (this._atdMessage.Elements.Count > 0) + atd = this._atdMessage.Elements[0] as ATD; + if (atd == null) + { + atd = new ATD(); + atd.MessageCore = this.Core; + atd.MessageHeader = this._atdMessage; + _atdMessage.Elements.Add(atd); + } + + this.atdGroupBox.DataContext = atd; + + #endregion + + #region TIEFD + + if (this._tiefdMessage == null) + { + this._tiefdMessage = this.Core.CreateMessage(Message.NotificationClass.TIEFD); + this.Messages.Add(this._tiefdMessage); + } + + TIEFD tiefd = null; + if (this._tiefdMessage.Elements.Count > 0) + tiefd = this._tiefdMessage.Elements[0] as TIEFD; + if (tiefd == null) + { + tiefd = new TIEFD(); + tiefd.MessageCore = this.Core; + tiefd.MessageHeader = this._tiefdMessage; + _tiefdMessage.Elements.Add(tiefd); + } + + this.tiefdGroupBox.DataContext = tiefd; + + #endregion + + #region POBD + + if (this._pobdMessage == null) + { + this._pobdMessage = this.Core.CreateMessage(Message.NotificationClass.POBD); + this.Messages.Add(this._pobdMessage); + } + + POBD pobd = null; + if (this._pobdMessage.Elements.Count > 0) + pobd = this._pobdMessage.Elements[0] as POBD; + if (pobd == null) + { + pobd = new POBD(); + pobd.MessageCore = this.Core; + pobd.MessageHeader = this._pobdMessage; + _pobdMessage.Elements.Add(pobd); + } + + this.pobdGroupBox.DataContext = pobd; + + #endregion + + #region BKRD + + if (this._bkrdMessage == null) + { + this._bkrdMessage = this.Core.CreateMessage(Message.NotificationClass.BKRD); + this.Messages.Add(this._bkrdMessage); + } + + this.dataGridBKRD.Initialize(); + this.dataGridBKRD.ItemsSource = this._bkrdMessage.Elements; + this.dataGridBKRD.AddingNewItem += DataGridBKRD_AddingNewItem; + this.dataGridBKRD.EditRequested += DataGridBKRD_EditRequested; + this.dataGridBKRD.DeleteRequested += DataGridBKRD_DeleteRequested; + this.dataGridBKRD.CreateRequested += DataGridBKRD_CreateRequested; + + #endregion + + } + + #region BKRD grid events + + private void DataGridBKRD_CreateRequested() + { + BRKD brkd = new BRKD(); + EditBKRDialog ebd = new EditBKRDialog(); + ebd.BRKD = brkd; + ebd.IsDeparture = true; + + ebd.AddClicked += () => + { + ebd.CopyValuesToEntity(); + this._bkrdMessage.Elements.Add(ebd.BRKD); + ebd.BRKD.MessageHeader = _bkrdMessage; + this.dataGridBKRD.Items.Refresh(); + ebd.BRKD = new BRKD(); + this.SublistElementChanged(Message.NotificationClass.BKRD); + }; + + if (ebd.ShowDialog() ?? false) + { + brkd.MessageHeader = _bkrdMessage; + _bkrdMessage.Elements.Add(brkd); + this.dataGridBKRD.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.BKRD); + } + } + + private void DataGridBKRD_DeleteRequested(DatabaseEntity obj) + { + BRKD brkd = obj as BRKD; + if (brkd != null) + { + // are you sure dialog is in base class + this._bkrdMessage.Elements.Remove(brkd); + this.dataGridBKRD.Items.Refresh(); + } + } + + private void DataGridBKRD_EditRequested(DatabaseEntity obj) + { + BRKD brkd = obj as BRKD; + if (brkd != null) + { + EditBKRDialog eld = new EditBKRDialog(); + eld.IsDeparture = true; + eld.BRKD = brkd; + + eld.AddClicked += () => + { + eld.CopyValuesToEntity(); + _bkrdMessage.Elements.Add(eld.BRKD); + this.dataGridBKRD.Items.Refresh(); + eld.BRKD = new BRKD(); + eld.BRKD.MessageHeader = _bkrdMessage; + this.SublistElementChanged(Message.NotificationClass.BKRD); + }; + + if (eld.ShowDialog() ?? false) + { + this.dataGridBKRD.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.BKRD); + } + } + } + + private void DataGridBKRD_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) + { + this.DataGridBKRD_CreateRequested(); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml index 2073d26a..d5a12a3b 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml @@ -5,9 +5,157 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ENI2.DetailViewControls" + xmlns:enictrl="clr-namespace:ENI2.Controls" + xmlns:p="clr-namespace:ENI2.Properties" + xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - - - + d:DesignHeight="600" d:DesignWidth="1024"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs index d4f02ed1..860a133a 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs @@ -1,21 +1,13 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: MDH Meldung Bearbeitungsseite // -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 ENI2.EditControls; + +using bsmd.database; + namespace ENI2.DetailViewControls { @@ -24,9 +16,298 @@ namespace ENI2.DetailViewControls /// public partial class MaritimeHealthDeclarationDetailControl : DetailBaseControl { + private Message _mdhMessage; + private MDH _mdh; + public MaritimeHealthDeclarationDetailControl() { InitializeComponent(); + Loaded += MaritimeHealthDeclarationDetailControl_Loaded; } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.MDH) { this._mdhMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region init MDH + + if (this._mdhMessage == null) + { + this._mdhMessage = this.Core.CreateMessage(Message.NotificationClass.MDH); + this.Messages.Add(this._mdhMessage); + } + + MDH mdh = null; + if (this._mdhMessage.Elements.Count > 0) + mdh = this._mdhMessage.Elements[0] as MDH; + if (mdh == null) + { + mdh = new MDH(); + mdh.MessageCore = this.Core; + mdh.MessageHeader = this._mdhMessage; + _mdhMessage.Elements.Add(mdh); + } + + this.portCallGroupBox.DataContext = mdh; + this._mdh = mdh; + + this.dataGridPortOfCallLast30Days.Initialize(); + this.dataGridPortOfCallLast30Days.ItemsSource = mdh.PortOfCallLast30Days; + this.dataGridPortOfCallLast30Days.AddingNewItem += DataGridPortOfCallLast30Days_AddingNewItem; + this.dataGridPortOfCallLast30Days.EditRequested += DataGridPortOfCallLast30Days_EditRequested; + this.dataGridPortOfCallLast30Days.DeleteRequested += DataGridPortOfCallLast30Days_DeleteRequested; + this.dataGridPortOfCallLast30Days.CreateRequested += DataGridPortOfCallLast30Days_CreateRequested; + + this.dataGridInfectedAreas.Initialize(); + this.dataGridInfectedAreas.ItemsSource = mdh.InfectedAreas; + this.dataGridInfectedAreas.AddingNewItem += DataGridInfectedAreas_AddingNewItem; + this.dataGridInfectedAreas.EditRequested += DataGridInfectedAreas_EditRequested; + this.dataGridInfectedAreas.DeleteRequested += DataGridInfectedAreas_DeleteRequested; + this.dataGridInfectedAreas.CreateRequested += DataGridInfectedAreas_CreateRequested; + + this.dataGridSanitaryMeasures.Initialize(); + this.dataGridSanitaryMeasures.ItemsSource = mdh.SanitaryMeasuresDetails; + this.dataGridSanitaryMeasures.AddingNewItem += DataGridSanitaryMeasures_AddingNewItem; + this.dataGridSanitaryMeasures.EditRequested += DataGridSanitaryMeasures_EditRequested; + this.dataGridSanitaryMeasures.DeleteRequested += DataGridSanitaryMeasures_DeleteRequested; + this.dataGridSanitaryMeasures.CreateRequested += DataGridSanitaryMeasures_CreateRequested; + + #endregion + + } + + private void MaritimeHealthDeclarationDetailControl_Loaded(object sender, RoutedEventArgs e) + { + + this.RegisterCheckboxChange(this.checkBoxAwareOfConditions, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxHasShipVisited, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxHavePersonsDied, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxIsSuspectedInfectious, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxReinspectionSanitary, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxSanitaryControlExemption, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxSanitaryMeasuresApplied, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxSickAnimalsOrPets, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxSickPersonsOnBoard, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxStowawaysOnBoard, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxTotalNumberSickHigherThan, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkBoxWasMedicalConsulted, Message.NotificationClass.MDH); + this.RegisterCheckboxChange(this.checkSimplification, Message.NotificationClass.MDH); + this.RegisterLocodeChange(this.locodePortWhereHealthDeclarationWasGiven, Message.NotificationClass.MDH); + this.RegisterIntegerUpDownChange(this.integerUpDownNumberOfDeaths, Message.NotificationClass.MDH); + this.RegisterIntegerUpDownChange(this.integerUpDownNumberOfIllPersons, Message.NotificationClass.MDH); + this.RegisterTextboxChange(this.textBoxPlaceOfIssue, Message.NotificationClass.MDH); + this.RegisterTextboxChange(this.textBoxStowawaysJoiningLocation, Message.NotificationClass.MDH); + + } + + #region SanitaryMeasures Grid + + private void DataGridSanitaryMeasures_CreateRequested() + { + SanitaryMeasuresDetail smDetail = new SanitaryMeasuresDetail(); + EditSanitaryMeasureDialog epd = new EditSanitaryMeasureDialog(); + epd.SanitaryMeasureDetail = smDetail; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + epd.SanitaryMeasureDetail.MDH = this._mdh; + this._mdh.SanitaryMeasuresDetails.Add(epd.SanitaryMeasureDetail); + this.dataGridSanitaryMeasures.Items.Refresh(); + epd.SanitaryMeasureDetail = new SanitaryMeasuresDetail(); + this.SublistElementChanged(Message.NotificationClass.MDH); + }; + + if (epd.ShowDialog() ?? false) + { + _mdh.SanitaryMeasuresDetails.Add(epd.SanitaryMeasureDetail); + epd.SanitaryMeasureDetail.MDH = this._mdh; + this.dataGridSanitaryMeasures.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.MDH); + } + } + + private void DataGridSanitaryMeasures_DeleteRequested(DatabaseEntity obj) + { + SanitaryMeasuresDetail smd = obj as SanitaryMeasuresDetail; + if (smd != null) + { + // are you sure dialog is in base class + _mdh.SanitaryMeasuresDetails.Remove(smd); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(smd); + this.dataGridSanitaryMeasures.Items.Refresh(); + } + } + + private void DataGridSanitaryMeasures_EditRequested(DatabaseEntity obj) + { + EditSanitaryMeasureDialog ecpd = new EditSanitaryMeasureDialog(); + ecpd.SanitaryMeasureDetail = obj as SanitaryMeasuresDetail; + ecpd.AddClicked += () => + { + ecpd.CopyValuesToEntity(); + if (!_mdh.SanitaryMeasuresDetails.Contains(ecpd.SanitaryMeasureDetail)) + _mdh.SanitaryMeasuresDetails.Add(ecpd.SanitaryMeasureDetail); + this.dataGridSanitaryMeasures.Items.Refresh(); + ecpd.SanitaryMeasureDetail = new SanitaryMeasuresDetail(); + }; + if (ecpd.ShowDialog() ?? false) + { + if (!_mdh.SanitaryMeasuresDetails.Contains(ecpd.SanitaryMeasureDetail)) + _mdh.SanitaryMeasuresDetails.Add(ecpd.SanitaryMeasureDetail); + this.dataGridSanitaryMeasures.Items.Refresh(); + // signal up + this.SublistElementChanged(Message.NotificationClass.MDH); + } + } + + private void DataGridSanitaryMeasures_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridSanitaryMeasures_CreateRequested(); + } + + #endregion + + #region InfectedAreas Grid + + private void DataGridInfectedAreas_CreateRequested() + { + InfectedArea ia = new InfectedArea(); + EditInfectedAreaDialog epd = new EditInfectedAreaDialog(); + epd.InfectedArea = ia; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + epd.InfectedArea.MDH = this._mdh; + this._mdh.InfectedAreas.Add(epd.InfectedArea); + this.dataGridInfectedAreas.Items.Refresh(); + epd.InfectedArea = new InfectedArea(); + this.SublistElementChanged(Message.NotificationClass.MDH); + }; + + if (epd.ShowDialog() ?? false) + { + _mdh.InfectedAreas.Add(epd.InfectedArea); + epd.InfectedArea.MDH = this._mdh; + this.dataGridInfectedAreas.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.MDH); + } + } + + private void DataGridInfectedAreas_DeleteRequested(DatabaseEntity obj) + { + InfectedArea ia = obj as InfectedArea; + if (ia != null) + { + // are you sure dialog is in base class + _mdh.InfectedAreas.Remove(ia); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ia); + this.dataGridInfectedAreas.Items.Refresh(); + } + } + + private void DataGridInfectedAreas_EditRequested(DatabaseEntity obj) + { + EditInfectedAreaDialog ecpd = new EditInfectedAreaDialog(); + ecpd.InfectedArea = obj as InfectedArea; + ecpd.AddClicked += () => + { + ecpd.CopyValuesToEntity(); + if (!_mdh.InfectedAreas.Contains(ecpd.InfectedArea)) + _mdh.InfectedAreas.Add(ecpd.InfectedArea); + this.dataGridInfectedAreas.Items.Refresh(); + ecpd.InfectedArea= new InfectedArea(); + }; + if (ecpd.ShowDialog() ?? false) + { + if (!_mdh.InfectedAreas.Contains(ecpd.InfectedArea)) + _mdh.InfectedAreas.Add(ecpd.InfectedArea); + this.dataGridInfectedAreas.Items.Refresh(); + // signal up + this.SublistElementChanged(Message.NotificationClass.MDH); + } + } + + private void DataGridInfectedAreas_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridInfectedAreas_CreateRequested(); + } + + #endregion + + #region PortOfCallLast30Days grid + + private void DataGridPortOfCallLast30Days_CreateRequested() + { + PortOfCallLast30Days poc30 = new PortOfCallLast30Days(); + EditPortOfCallLast30DaysDialog epd = new EditPortOfCallLast30DaysDialog(); + epd.PocLast30Days = poc30; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + epd.PocLast30Days.MDH = this._mdh; + this._mdh.PortOfCallLast30Days.Add(epd.PocLast30Days); + this.dataGridPortOfCallLast30Days.Items.Refresh(); + epd.PocLast30Days = new PortOfCallLast30Days(); + this.SublistElementChanged(Message.NotificationClass.MDH); + }; + + if (epd.ShowDialog() ?? false) + { + _mdh.PortOfCallLast30Days.Add(epd.PocLast30Days); + epd.PocLast30Days.MDH = this._mdh; + this.dataGridPortOfCallLast30Days.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.MDH); + } + } + + private void DataGridPortOfCallLast30Days_DeleteRequested(DatabaseEntity obj) + { + PortOfCallLast30Days poc30d = obj as PortOfCallLast30Days; + if (poc30d != null) + { + // are you sure dialog is in base class + _mdh.PortOfCallLast30Days.Remove(poc30d); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(poc30d); + this.dataGridPortOfCallLast30Days.Items.Refresh(); + } + } + + private void DataGridPortOfCallLast30Days_EditRequested(DatabaseEntity obj) + { + EditPortOfCallLast30DaysDialog ecpd = new EditPortOfCallLast30DaysDialog(); + ecpd.PocLast30Days = obj as PortOfCallLast30Days; + ecpd.AddClicked += () => + { + ecpd.CopyValuesToEntity(); + if (!_mdh.PortOfCallLast30Days.Contains(ecpd.PocLast30Days)) + _mdh.PortOfCallLast30Days.Add(ecpd.PocLast30Days); + this.dataGridPortOfCallLast30Days.Items.Refresh(); + ecpd.PocLast30Days = new PortOfCallLast30Days(); + }; + if (ecpd.ShowDialog() ?? false) + { + if (!_mdh.PortOfCallLast30Days.Contains(ecpd.PocLast30Days)) + _mdh.PortOfCallLast30Days.Add(ecpd.PocLast30Days); + this.dataGridPortOfCallLast30Days.Items.Refresh(); + // signal up + this.SublistElementChanged(Message.NotificationClass.MDH); + } + } + + private void DataGridPortOfCallLast30Days_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridPortOfCallLast30Days_CreateRequested(); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs index 77979efe..4f3d7254 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.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(cp); // not yet + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(cp); 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 c13434f2..8ecb2fa8 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.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ladg); // not yet + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ladg); this.dataGridLADG.Items.Refresh(); } } @@ -216,7 +216,7 @@ namespace ENI2.DetailViewControls { // are you sure dialog is in base class _servMessage.Elements.Remove(serv); - // DBManager.Instance.Delete(serv); // not yet + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(serv); this.dataGridSERV.Items.Refresh(); } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml index 77009c9e..6d88c1e1 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml @@ -3,11 +3,138 @@ 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:enictrl="clr-namespace:ENI2.Controls" + xmlns:p="clr-namespace:ENI2.Properties" + 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="600" d:DesignWidth="1024"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs index f9af75f2..e3cf6e01 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs @@ -1,21 +1,12 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: SEC Meldung Bearbeitungsseite // -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 ENI2.EditControls; + +using bsmd.database; namespace ENI2.DetailViewControls { @@ -24,9 +15,282 @@ namespace ENI2.DetailViewControls /// public partial class SecurityDetailControl : DetailBaseControl { + private Message _secMessage; + private SEC _sec; + + private static string[] isscTypes = { "Final", "Preliminary" }; + private static string[] isscIssuerTypes = { "Authority", "RSO (Recognized security org.)" }; + private static string[] cargoDescriptions = { + "Container", + "Vehicles", + "Conventional general cargo", + "Dry bulk cargo", + "Liquid bulk cargo", + "In ballast" + }; + public SecurityDetailControl() { InitializeComponent(); + Loaded += SecurityDetailControl_Loaded; } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.SEC) { this._secMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region init SEC + + if (this._secMessage == null) + { + this._secMessage = this.Core.CreateMessage(Message.NotificationClass.SEC); + this.Messages.Add(this._secMessage); + } + + SEC sec = null; + if (this._secMessage.Elements.Count > 0) + sec = this._secMessage.Elements[0] as SEC; + if (sec == null) + { + sec = new SEC(); + sec.MessageCore = this.Core; + sec.MessageHeader = this._secMessage; + _secMessage.Elements.Add(sec); + } + + this.portCallGroupBox.DataContext = sec; + this._sec = sec; + + this.comboBoxCurrentShipSecurityLevel.ItemsSource = Util.GlobalStructures.ShipSecurityLevels; + this.comboBoxISSCType.ItemsSource = isscTypes; + this.comboBoxISSCIssuerType.ItemsSource = isscIssuerTypes; + this.comboBoxGeneralDescriptionOfCargo.ItemsSource = cargoDescriptions; + + this.dataGridLast10PortFacilities.Initialize(); + this.dataGridLast10PortFacilities.ItemsSource = sec.LastTenPortFacilitesCalled; + + this.dataGridLast10PortFacilities.AddingNewItem += DataGridLast10PortFacilities_AddingNewItem; + this.dataGridLast10PortFacilities.EditRequested += DataGridLast10PortFacilities_EditRequested; + this.dataGridLast10PortFacilities.DeleteRequested += DataGridLast10PortFacilities_DeleteRequested; + this.dataGridLast10PortFacilities.CreateRequested += DataGridLast10PortFacilities_CreateRequested; + + this.dataGridShip2ShipActivities.Initialize(); + this.dataGridShip2ShipActivities.ItemsSource = sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled; + this.dataGridShip2ShipActivities.AddingNewItem += DataGridShip2ShipActivities_AddingNewItem; + this.dataGridShip2ShipActivities.EditRequested += DataGridShip2ShipActivities_EditRequested; + this.dataGridShip2ShipActivities.DeleteRequested += DataGridShip2ShipActivities_DeleteRequested; + this.dataGridShip2ShipActivities.CreateRequested += DataGridShip2ShipActivities_CreateRequested; + + #endregion + + } + + #region data grid ship 2 ship activities + + private void DataGridShip2ShipActivities_CreateRequested() + { + ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled(); + EditShip2ShipActivitiesDialog epd = new EditShip2ShipActivitiesDialog(); + epd.ShipToShipActivity = s2s; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + epd.ShipToShipActivity.SEC = this._sec; + this._sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(epd.ShipToShipActivity); + this.dataGridShip2ShipActivities.Items.Refresh(); + epd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled(); + this.SublistElementChanged(Message.NotificationClass.SEC); + }; + + if (epd.ShowDialog() ?? false) + { + _sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(epd.ShipToShipActivity); + epd.ShipToShipActivity.SEC = this._sec; + this.dataGridShip2ShipActivities.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.SEC); + } + } + + private void DataGridShip2ShipActivities_DeleteRequested(DatabaseEntity obj) + { + ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s = obj as ShipToShipActivitiesDuringLastTenPortFacilitiesCalled; + if (s2s != null) + { + // are you sure dialog is in base class + _sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Remove(s2s); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(s2s); + this.dataGridShip2ShipActivities.Items.Refresh(); + } + } + + private void DataGridShip2ShipActivities_EditRequested(DatabaseEntity obj) + { + EditShip2ShipActivitiesDialog ecpd = new EditShip2ShipActivitiesDialog(); + ecpd.ShipToShipActivity = obj as ShipToShipActivitiesDuringLastTenPortFacilitiesCalled; + ecpd.AddClicked += () => + { + ecpd.CopyValuesToEntity(); + if (!_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Contains(ecpd.ShipToShipActivity)) + _sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(ecpd.ShipToShipActivity); + this.dataGridShip2ShipActivities.Items.Refresh(); + ecpd.ShipToShipActivity = new ShipToShipActivitiesDuringLastTenPortFacilitiesCalled(); + }; + if (ecpd.ShowDialog() ?? false) + { + if (!_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Contains(ecpd.ShipToShipActivity)) + _sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(ecpd.ShipToShipActivity); + this.dataGridShip2ShipActivities.Items.Refresh(); + // signal up + this.SublistElementChanged(Message.NotificationClass.SEC); + } + } + + private void DataGridShip2ShipActivities_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridShip2ShipActivities_CreateRequested(); + } + + #endregion + + #region data grid last 10 port facilities + + private void DataGridLast10PortFacilities_CreateRequested() + { + LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled(); + EditLast10PortFacilitiesDialog epd = new EditLast10PortFacilitiesDialog(); + epd.LastTenPortFacilitiesCalled = l10c; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + epd.LastTenPortFacilitiesCalled.SEC = this._sec; + this._sec.LastTenPortFacilitesCalled.Add(epd.LastTenPortFacilitiesCalled); + this.dataGridLast10PortFacilities.Items.Refresh(); + epd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled(); + this.SublistElementChanged(Message.NotificationClass.SEC); + }; + + if (epd.ShowDialog() ?? false) + { + _sec.LastTenPortFacilitesCalled.Add(epd.LastTenPortFacilitiesCalled); + epd.LastTenPortFacilitiesCalled.SEC = this._sec; + this.dataGridLast10PortFacilities.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.SEC); + } + } + + private void DataGridLast10PortFacilities_DeleteRequested(DatabaseEntity obj) + { + LastTenPortFacilitiesCalled l10c = obj as LastTenPortFacilitiesCalled; + if (l10c != null) + { + // are you sure dialog is in base class + _sec.LastTenPortFacilitesCalled.Remove(l10c); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(l10c); + this.dataGridLast10PortFacilities.Items.Refresh(); + } + } + + private void DataGridLast10PortFacilities_EditRequested(DatabaseEntity obj) + { + EditLast10PortFacilitiesDialog ecpd = new EditLast10PortFacilitiesDialog(); + ecpd.LastTenPortFacilitiesCalled = obj as LastTenPortFacilitiesCalled; + ecpd.AddClicked += () => + { + ecpd.CopyValuesToEntity(); + if (!_sec.LastTenPortFacilitesCalled.Contains(ecpd.LastTenPortFacilitiesCalled)) + _sec.LastTenPortFacilitesCalled.Add(ecpd.LastTenPortFacilitiesCalled); + this.dataGridLast10PortFacilities.Items.Refresh(); + ecpd.LastTenPortFacilitiesCalled = new LastTenPortFacilitiesCalled(); + }; + if (ecpd.ShowDialog() ?? false) + { + if (!_sec.LastTenPortFacilitesCalled.Contains(ecpd.LastTenPortFacilitiesCalled)) + _sec.LastTenPortFacilitesCalled.Add(ecpd.LastTenPortFacilitiesCalled); + this.dataGridLast10PortFacilities.Items.Refresh(); + // signal up + this.SublistElementChanged(Message.NotificationClass.SEC); + } + } + + private void DataGridLast10PortFacilities_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridLast10PortFacilities_CreateRequested(); + } + + #endregion + + private void SecurityDetailControl_Loaded(object sender, RoutedEventArgs e) + { + + this.RegisterTextboxChange(this.textBoxCSOEMailName, Message.NotificationClass.SEC); + this.RegisterTextboxChange(this.textBoxCSOFaxName, Message.NotificationClass.SEC); + this.RegisterTextboxChange(this.textBoxCSOFirstName, Message.NotificationClass.SEC); + this.RegisterTextboxChange(this.textBoxCSOLastName, Message.NotificationClass.SEC); + this.RegisterTextboxChange(this.textBoxCSOPhoneName, Message.NotificationClass.SEC); + this.RegisterTextboxChange(this.textBoxISSCIssuerName, Message.NotificationClass.SEC); + this.RegisterTextboxChange(this.textBoxPortFacilityOfArrival, Message.NotificationClass.SEC); + this.RegisterTextboxChange(this.textBoxReasonsForNoValidISSC, Message.NotificationClass.SEC); + + this.RegisterComboboxIndexChange(this.comboBoxCurrentShipSecurityLevel, Message.NotificationClass.SEC); + this.RegisterComboboxIndexChange(this.comboBoxGeneralDescriptionOfCargo, Message.NotificationClass.SEC); + this.RegisterComboboxIndexChange(this.comboBoxISSCIssuerType, Message.NotificationClass.SEC); + this.RegisterComboboxIndexChange(this.comboBoxISSCType, Message.NotificationClass.SEC); + + this.RegisterDatePickerChange(this.datePickerISSCDateOfExpiration, Message.NotificationClass.SEC); + this.RegisterDateTimePickerChange(this.dateTimePickerKielCanalPassagePlannedIncomming, Message.NotificationClass.SEC); + this.RegisterDateTimePickerChange(this.dateTimePickerKielCanalPassagePlannedOutgoing, Message.NotificationClass.SEC); + + this.RegisterCheckboxChange(this.checkBoxApprovedSecurityPlanOnBoard, Message.NotificationClass.SEC); + this.RegisterCheckboxChange(this.checkBoxKielCanalPassagePlanned, Message.NotificationClass.SEC); + this.RegisterCheckboxChange(this.checkBoxSECSimplification, Message.NotificationClass.SEC); + this.RegisterCheckboxChange(this.checkBoxValidISSCOnBoard, Message.NotificationClass.SEC); + + this.RegisterLocodeChange(this.locodePortOfCallWhereCompleteSECNotified, Message.NotificationClass.SEC); + + this.checkBoxSECSimplification.Checked += CheckBoxSECSimplification_Checked; + this.checkBoxKielCanalPassagePlanned.Checked += CheckBoxKielCanalPassagePlanned_Checked; + } + + #region enable / disable controls + + private void CheckBoxKielCanalPassagePlanned_Checked(object sender, RoutedEventArgs e) + { + this.dateTimePickerKielCanalPassagePlannedIncomming.IsEnabled = this.checkBoxKielCanalPassagePlanned.IsChecked ?? false; + this.dateTimePickerKielCanalPassagePlannedOutgoing.IsEnabled = this.checkBoxKielCanalPassagePlanned.IsChecked ?? false; + } + + private void CheckBoxSECSimplification_Checked(object sender, RoutedEventArgs e) + { + this.locodePortOfCallWhereCompleteSECNotified.IsEnabled = this.checkBoxSECSimplification.IsChecked ?? false; + bool enable = !(this.checkBoxSECSimplification.IsChecked ?? false); + + this.textBoxCSOEMailName.IsEnabled = enable; + this.textBoxCSOFaxName.IsEnabled = enable; + this.textBoxCSOFirstName.IsEnabled = enable; + this.textBoxCSOLastName.IsEnabled = enable; + this.textBoxCSOPhoneName.IsEnabled = enable; + this.textBoxISSCIssuerName.IsEnabled = enable; + this.textBoxPortFacilityOfArrival.IsEnabled = enable; + this.textBoxReasonsForNoValidISSC.IsEnabled = enable; + + this.checkBoxApprovedSecurityPlanOnBoard.IsEnabled = enable; + this.checkBoxValidISSCOnBoard.IsEnabled = enable; + + this.comboBoxGeneralDescriptionOfCargo.IsEnabled = enable; + this.comboBoxISSCIssuerType.IsEnabled = enable; + this.comboBoxISSCType.IsEnabled = enable; + + this.datePickerISSCDateOfExpiration.IsEnabled = enable; + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml index d4418424..b7e9f6f5 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml @@ -4,10 +4,101 @@ 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:enictrl="clr-namespace:ENI2.Controls" + xmlns:p="clr-namespace:ENI2.Properties" + 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="600" d:DesignWidth="800"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml.cs index 97d4178e..4a287aaa 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ShipDataDetailControl.xaml.cs @@ -1,21 +1,11 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: Bearbeitungsmaske STAT // -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,72 @@ namespace ENI2.DetailViewControls /// public partial class ShipDataDetailControl : DetailBaseControl { + private Message _statMessage; + public ShipDataDetailControl() { InitializeComponent(); + Loaded += ShipDataDetailControl_Loaded; + } + + private void ShipDataDetailControl_Loaded(object sender, RoutedEventArgs e) + { + this.RegisterTextboxChange(this.textBoxVesselName, Message.NotificationClass.STAT); + this.RegisterComboboxValueChange(this.comboBoxVesselType, Message.NotificationClass.STAT); + this.RegisterComboboxValueChange(this.comboBoxTransportMode, Message.NotificationClass.STAT); + this.RegisterComboboxValueChange(this.comboBoxFlag, Message.NotificationClass.STAT); + this.RegisterIntegerUpDownChange(this.integerUpDownGrossTonnage, Message.NotificationClass.STAT); + this.RegisterDoubleUpDownChange(this.doubleUpDownLength, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxMMSI, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxCallsign, Message.NotificationClass.STAT); + this.RegisterLocodeChange(this.locodePortOfRegistry, Message.NotificationClass.STAT); + this.RegisterDoubleUpDownChange(this.doubleUpDownBeam, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxInmarsatCallNumber, Message.NotificationClass.STAT); + + this.RegisterTextboxChange(this.textBoxCompanyName, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxStreetNumber, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxPostalCode, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxCountry, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxCompanyId, Message.NotificationClass.STAT); + this.RegisterTextboxChange(this.textBoxCity, Message.NotificationClass.STAT); + + } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.STAT) { this._statMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region STAT + + if (this._statMessage == null) + { + this._statMessage = this.Core.CreateMessage(Message.NotificationClass.STAT); + this.Messages.Add(this._statMessage); + } + + STAT stat = null; + if (this._statMessage.Elements.Count > 0) + stat = this._statMessage.Elements[0] as STAT; + if (stat == null) + { + stat = new STAT(); + stat.MessageCore = this.Core; + stat.MessageHeader = this._statMessage; + _statMessage.Elements.Add(stat); + } + + this.comboBoxFlag.ItemsSource = CREW.NationalityDict; + this.comboBoxVesselType.ItemsSource = STAT.VesselTypeDict; + this.comboBoxTransportMode.ItemsSource = STAT.TransportModeDict; + this.shipDataGroupBox.DataContext = stat; + + #endregion + } } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml index f24e17ce..08c1bebb 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml @@ -5,9 +5,126 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ENI2.DetailViewControls" + xmlns:enictrl="clr-namespace:ENI2.Controls" + xmlns:p="clr-namespace:ENI2.Properties" + xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - - - + d:DesignHeight="600" d:DesignWidth="800"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs index 9b65b42e..26f63b7a 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/WasteDetailControl.xaml.cs @@ -1,21 +1,13 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: Detailansicht Müllmeldung // -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 ENI2.EditControls; + +using bsmd.database; namespace ENI2.DetailViewControls { @@ -24,9 +16,148 @@ namespace ENI2.DetailViewControls /// public partial class WasteDetailControl : DetailBaseControl { + + private Message _wasMessage; + private WAS _was; + + private static string[] _wasteDeliveryList = + { + "ALL", + "SOME", + "NONE" + }; + public WasteDetailControl() { InitializeComponent(); + Loaded += WasteDetailControl_Loaded; } + + private void WasteDetailControl_Loaded(object sender, RoutedEventArgs e) + { + this.RegisterLocodeChange(this.locodeCtrlLastWastePort, Message.NotificationClass.WAS); + this.RegisterCheckboxChange(this.checkBoxAccurateCorrectDetails, Message.NotificationClass.WAS); + this.RegisterCheckboxChange(this.checkBoxValidExemption, Message.NotificationClass.WAS); + this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS); + this.RegisterComboboxIndexChange(this.comboBoxWasteDisposal, Message.NotificationClass.WAS); + this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS); + } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.WAS) { this._wasMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region init WAS + + if (this._wasMessage == null) + { + this._wasMessage = this.Core.CreateMessage(Message.NotificationClass.WAS); + this.Messages.Add(this._wasMessage); + } + + WAS was = null; + if (this._wasMessage.Elements.Count > 0) + was = this._wasMessage.Elements[0] as WAS; + if (was == null) + { + was = new WAS(); + was.MessageCore = this.Core; + was.MessageHeader = this._wasMessage; + _wasMessage.Elements.Add(was); + } + + this.portCallGroupBox.DataContext = was; + this._was = was; + + this.dataGridWaste.Initialize(); + this.dataGridWaste.ItemsSource = was.Waste; + this.comboBoxWasteDisposal.ItemsSource = _wasteDeliveryList; + this.dataGridWaste.AddingNewItem += DataGridWaste_AddingNewItem; + this.dataGridWaste.EditRequested += DataGridWaste_EditRequested; + this.dataGridWaste.DeleteRequested += DataGridWaste_DeleteRequested; + this.dataGridWaste.CreateRequested += DataGridWaste_CreateRequested; + + + #endregion + + } + + #region Waste grid event handler + + private void DataGridWaste_CreateRequested() + { + Waste waste = new Waste(); + EditWasteDialog epd = new EditWasteDialog(); + epd.Waste = waste; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + epd.Waste.WAS = this._was; + this._was.Waste.Add(epd.Waste); + this.dataGridWaste.Items.Refresh(); + epd.Waste = new Waste(); + this.SublistElementChanged(Message.NotificationClass.WAS); + }; + + if (epd.ShowDialog() ?? false) + { + _was.Waste.Add(epd.Waste); + epd.Waste.WAS = this._was; + this.dataGridWaste.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.WAS); + } + } + + private void DataGridWaste_DeleteRequested(DatabaseEntity obj) + { + Waste waste = obj as Waste; + if (waste != null) + { + // are you sure dialog is in base class + _was.Waste.Remove(waste); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste); + this.dataGridWaste.Items.Refresh(); + } + } + + private void DataGridWaste_EditRequested(DatabaseEntity obj) + { + Waste waste = obj as Waste; + if (waste != null) + { + EditWasteDialog epd = new EditWasteDialog(); + epd.Waste = waste; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + _was.Waste.Add(epd.Waste); + this.dataGridWaste.Items.Refresh(); + epd.Waste = new Waste(); + epd.Waste.WAS = _was; + this.SublistElementChanged(Message.NotificationClass.WAS); + }; + + if (epd.ShowDialog() ?? false) + { + this.dataGridWaste.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.WAS); + } + } + } + + private void DataGridWaste_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridWaste_CreateRequested(); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index 44aadcf9..982ea1e7 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 - 2 + 3 3.6.7.%2a false true @@ -221,18 +221,36 @@ EditCREWDialog.xaml + + EditInfectedAreaDialog.xaml + EditLADGDialog.xaml + + EditLast10PortFacilitiesDialog.xaml + EditPASDialog.xaml + + EditPortOfCallLast30DaysDialog.xaml + EditPortOfItineraryDialog.xaml + + EditSanitaryMeasureDialog.xaml + EditSERVDialog.xaml + + EditShip2ShipActivitiesDialog.xaml + + + EditWasteDialog.xaml + SimplePropertyViewDialog.xaml @@ -334,22 +352,46 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs index dc108bf3..f554a000 100644 --- a/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs @@ -14,37 +14,7 @@ namespace ENI2.EditControls /// Interaction logic for EditCallPurposeDialog.xaml /// public partial class EditCallPurposeDialog : EditWindowBase - { - - private static string[] edifact8025Codes = - { - "", - "Cargo operations", - "Passenger movement", - "Taking bunkers", - "Changing crew", - "Goodwill visit", - "Taking supplies", - "Repair", - "Laid-up", - "Awaiting orders", - "Miscellaneous", - "Crew movement", - "Cruise, leisure and recreation", - "Under government order", - "Quarantine inspection", - "Refuge", - "Unloading cargo", - "Loading cargo", - "Repair in dry dock", - "Repair in wet dock", - "Cargo tank cleaning", - "Means of transport customs clearance", - "De-gassing", - "Waste disposal" - }; - - private List itemList = null; + { public EditCallPurposeDialog() { @@ -56,20 +26,7 @@ namespace ENI2.EditControls public CallPurpose CallPurpose { get; set; } - public List EdiCodes - { - get - { - if(itemList == null) - { - this.itemList = new List(); - this.itemList.Add(""); - for (int i = 1; i < edifact8025Codes.Length; i++) - this.itemList.Add(string.Format("{0} - {1}", i, edifact8025Codes[i])); - } - return itemList; - } - } + public void CopyValuesToEntity() { @@ -82,7 +39,7 @@ namespace ENI2.EditControls this.OKClicked += EditCallPurposeDialog_OKClicked; this.AddVisible = true; - this.comboBoxCode.ItemsSource = this.EdiCodes; + this.comboBoxCode.ItemsSource = Util.GlobalStructures.EdiCodes; if((this.CallPurpose != null) && (this.CallPurpose.CallPurposeCode != 0)) { this.comboBoxCode.SelectedIndex = this.CallPurpose.CallPurposeCode; @@ -99,7 +56,7 @@ namespace ENI2.EditControls { if (this.comboBoxCode.SelectedIndex != this.CallPurpose.CallPurposeCode) { - this.textBoxDescription.Text = edifact8025Codes[this.comboBoxCode.SelectedIndex]; + this.textBoxDescription.Text = Util.GlobalStructures.edifact8025Codes[this.comboBoxCode.SelectedIndex]; this.textBoxDescription.Focus(); // this.OnOkClicked(); // doch nicht gleich zu } diff --git a/ENI-2/ENI2/ENI2/EditControls/EditInfectedAreaDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditInfectedAreaDialog.xaml new file mode 100644 index 00000000..f38d18e5 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditInfectedAreaDialog.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/EditControls/EditInfectedAreaDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditInfectedAreaDialog.xaml.cs new file mode 100644 index 00000000..1756786c --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditInfectedAreaDialog.xaml.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2017 schick Informatik +// Description: Infected Area Bearbeitungsdialog +// + +using System.Windows; + +using ENI2.Controls; +using bsmd.database; + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for EditInfectedAreaDialog.xaml + /// + public partial class EditInfectedAreaDialog : EditWindowBase + { + public EditInfectedAreaDialog() + { + InitializeComponent(); + this.Loaded += EditInfectedAreaDialog_Loaded; + } + + public InfectedArea InfectedArea { get; set; } + + private void EditInfectedAreaDialog_Loaded(object sender, RoutedEventArgs e) + { + this.textBoxInfectedAreaPort.Text = this.InfectedArea.InfectedAreaPort; + this.datePickerInfectedAreaDate.SelectedDate = this.InfectedArea.InfectedAreaDate; + + this.AddVisible = true; + this.OKClicked += EditInfectedAreaDialog_OKClicked; + } + + public void CopyValuesToEntity() + { + this.InfectedArea.InfectedAreaPort = this.textBoxInfectedAreaPort.Text; + this.InfectedArea.InfectedAreaDate = this.datePickerInfectedAreaDate.SelectedDate; + } + + private void EditInfectedAreaDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + } +} diff --git a/ENI-2/ENI2/ENI2/EditControls/EditLast10PortFacilitiesDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditLast10PortFacilitiesDialog.xaml new file mode 100644 index 00000000..8da9f474 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditLast10PortFacilitiesDialog.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/EditControls/EditLast10PortFacilitiesDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditLast10PortFacilitiesDialog.xaml.cs new file mode 100644 index 00000000..ffee74a3 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditLast10PortFacilitiesDialog.xaml.cs @@ -0,0 +1,63 @@ +// Copyright (c) 2017 schick Informatik +// Description: Last 10 port facilities Detailansicht +// + +using System.Windows; + +using bsmd.database; +using ENI2.Controls; +using ENI2.Util; + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for EditLast10PortFacilitiesDialog.xaml + /// + public partial class EditLast10PortFacilitiesDialog : EditWindowBase + { + public EditLast10PortFacilitiesDialog() + { + InitializeComponent(); + Loaded += EditLast10PortFacilitiesDialog_Loaded; + AddClicked += () => { this.locodePort.Focus(); }; + } + + public LastTenPortFacilitiesCalled LastTenPortFacilitiesCalled { get; set; } + + private void EditLast10PortFacilitiesDialog_Loaded(object sender, RoutedEventArgs e) + { + this.locodePort.LocodeValue = this.LastTenPortFacilitiesCalled.PortFacilityPortLoCode; + this.textBoxPortName.Text = this.LastTenPortFacilitiesCalled.PortFacilityPortName; + this.textBoxPortCountry.Text = this.LastTenPortFacilitiesCalled.PortFacilityPortCountry; + this.datePickerATA.SelectedDate = this.LastTenPortFacilitiesCalled.PortFacilityDateOfArrival; + this.datePickerATD.SelectedDate = this.LastTenPortFacilitiesCalled.PortFacilityDateOfDeparture; + this.comboBoxShipSecurityLevel.ItemsSource = GlobalStructures.ShipSecurityLevels; + this.comboBoxShipSecurityLevel.SelectedIndex = this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel ?? -1; + this.textBoxGisisCode.Text = this.LastTenPortFacilitiesCalled.PortFacilityGISISCode; + this.textBoxSecurityMatters.Text = this.LastTenPortFacilitiesCalled.PortFacilitySecurityMattersToReport; + + this.AddVisible = true; + this.OKClicked += EditLast10PortFacilitiesDialog_OKClicked; + } + + public void CopyValuesToEntity() + { + this.LastTenPortFacilitiesCalled.PortFacilityPortLoCode = this.locodePort.LocodeValue; + this.LastTenPortFacilitiesCalled.PortFacilityPortName = this.textBoxPortName.Text; + this.LastTenPortFacilitiesCalled.PortFacilityPortCountry = this.textBoxPortCountry.Text; + this.LastTenPortFacilitiesCalled.PortFacilityDateOfArrival = this.datePickerATA.SelectedDate; + this.LastTenPortFacilitiesCalled.PortFacilityDateOfDeparture = this.datePickerATD.SelectedDate; + this.LastTenPortFacilitiesCalled.PortFacilityGISISCode = this.textBoxGisisCode.Text; + if (this.comboBoxShipSecurityLevel.SelectedIndex == -1) + this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel = null; + else + this.LastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel = ((byte)this.comboBoxShipSecurityLevel.SelectedIndex); + this.LastTenPortFacilitiesCalled.PortFacilitySecurityMattersToReport = this.textBoxSecurityMatters.Text; + } + + private void EditLast10PortFacilitiesDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + } +} diff --git a/ENI-2/ENI2/ENI2/EditControls/EditPortOfCallLast30DaysDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditPortOfCallLast30DaysDialog.xaml new file mode 100644 index 00000000..2e937a16 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditPortOfCallLast30DaysDialog.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/EditControls/EditPortOfCallLast30DaysDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditPortOfCallLast30DaysDialog.xaml.cs new file mode 100644 index 00000000..616bff64 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditPortOfCallLast30DaysDialog.xaml.cs @@ -0,0 +1,53 @@ +// Copyright (c) 2017 schick Informatik +// Description: +// + +using System.Windows; +using ENI2.Controls; + +using bsmd.database; + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for EditPortOfCallLast30Days.xaml + /// + public partial class EditPortOfCallLast30DaysDialog : EditWindowBase + { + public EditPortOfCallLast30DaysDialog() + { + InitializeComponent(); + Loaded += EditPortOfCallLast30DaysDialog_Loaded; + AddClicked += () => { this.locodeControlPortName.Focus(); }; + } + + public PortOfCallLast30Days PocLast30Days { get; set; } + + private void EditPortOfCallLast30DaysDialog_Loaded(object sender, RoutedEventArgs e) + { + this.OKClicked += EditPortOfCallLast30DaysDialog_OKClicked; + + // copy into fields + this.locodeControlPortName.LocodeValue = this.PocLast30Days.PortOfCallLast30DaysLocode; + this.datePickerATAPortOfCall.SelectedDate = this.PocLast30Days.PortOfCallLast30DaysDateOfDeparture; + this.checkBoxCrewMembersJoined.IsChecked = this.PocLast30Days.PortOfCallLast30DaysCrewMembersJoined; + this.textBoxCrewMemberNames.Text = this.PocLast30Days.CrewMembersJoinedText; + this.AddVisible = true; + } + + public void CopyValuesToEntity() + { + // copy back + this.PocLast30Days.PortOfCallLast30DaysLocode = this.locodeControlPortName.LocodeValue; + this.PocLast30Days.PortOfCallLast30DaysDateOfDeparture = this.datePickerATAPortOfCall.SelectedDate; + this.PocLast30Days.PortOfCallLast30DaysCrewMembersJoined = this.checkBoxCrewMembersJoined.IsChecked; + this.PocLast30Days.CrewMembersJoinedText = this.textBoxCrewMemberNames.Text; + + } + + private void EditPortOfCallLast30DaysDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + } +} diff --git a/ENI-2/ENI2/ENI2/EditControls/EditSanitaryMeasureDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditSanitaryMeasureDialog.xaml new file mode 100644 index 00000000..24260fb8 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditSanitaryMeasureDialog.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/EditControls/EditSanitaryMeasureDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditSanitaryMeasureDialog.xaml.cs new file mode 100644 index 00000000..f5662462 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditSanitaryMeasureDialog.xaml.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2017 schick Informatik +// Description: SanitaryMeasure Bearbeitungsdialog +// + +using System.Windows; + +using ENI2.Controls; +using bsmd.database; + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for EditSanitaryMeasureDialog.xaml + /// + public partial class EditSanitaryMeasureDialog : EditWindowBase + { + public EditSanitaryMeasureDialog() + { + InitializeComponent(); + this.Loaded += EditSanitaryMeasureDialog_Loaded; + } + + public SanitaryMeasuresDetail SanitaryMeasureDetail { get; set; } + + private void EditSanitaryMeasureDialog_Loaded(object sender, RoutedEventArgs e) + { + this.textBoxSanitaryMeasureKind.Text = this.SanitaryMeasureDetail.SanitaryMeasuresType; + this.textBoxSanitaryMeasurePlace.Text = this.SanitaryMeasureDetail.SanitaryMeasuresLocation; + this.datePickerSanitaryMeasureDate.SelectedDate = this.SanitaryMeasureDetail.SanitaryMeasuresDate; + this.OKClicked += EditSanitaryMeasureDialog_OKClicked; + this.AddVisible = true; + } + + public void CopyValuesToEntity() + { + this.SanitaryMeasureDetail.SanitaryMeasuresType = this.textBoxSanitaryMeasureKind.Text.Trim(); + this.SanitaryMeasureDetail.SanitaryMeasuresLocation = this.textBoxSanitaryMeasurePlace.Text.Trim(); + this.SanitaryMeasureDetail.SanitaryMeasuresDate = this.datePickerSanitaryMeasureDate.SelectedDate; + + } + + private void EditSanitaryMeasureDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + } +} diff --git a/ENI-2/ENI2/ENI2/EditControls/EditShip2ShipActivitiesDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditShip2ShipActivitiesDialog.xaml new file mode 100644 index 00000000..ab95e362 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditShip2ShipActivitiesDialog.xaml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/EditControls/EditShip2ShipActivitiesDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditShip2ShipActivitiesDialog.xaml.cs new file mode 100644 index 00000000..a370d824 --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditShip2ShipActivitiesDialog.xaml.cs @@ -0,0 +1,72 @@ +// Copyright (c) 2017 schick Informatik +// Description: Ship-2-Ship Detailansicht +// + +using System.Windows; + +using bsmd.database; +using ENI2.Controls; +using ENI2.Util; + + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for EditShip2ShipActivitiesDialog.xaml + /// + public partial class EditShip2ShipActivitiesDialog : EditWindowBase + { + public EditShip2ShipActivitiesDialog() + { + InitializeComponent(); + this.Loaded += EditShip2ShipActivitiesDialog_Loaded; + AddClicked += () => { this.textBoxLocationName.Focus(); }; + } + + public ShipToShipActivitiesDuringLastTenPortFacilitiesCalled ShipToShipActivity { get; set; } + + private void EditShip2ShipActivitiesDialog_Loaded(object sender, RoutedEventArgs e) + { + this.textBoxLocationName.Text = this.ShipToShipActivity.ShipToShipActivityLocationName; + this.locodeLocation.LocodeValue = this.ShipToShipActivity.ShipToShipActivityLocationLoCode; + this.doubleUpDownLatitudeDegrees.Value = bsmd.database.Util.NSWToDecimalDegrees(this.ShipToShipActivity.ShipToShipActivityLocationCoordinatesLatitude ?? 0); + this.doubleUpDownLongitudeDegrees.Value = bsmd.database.Util.NSWToDecimalDegrees(this.ShipToShipActivity.ShipToShipActivityLocationCoordinatesLongitude ?? 0); + this.datePickerFrom.SelectedDate = this.ShipToShipActivity.ShipToShipActivityDateFrom; + this.datePickerTo.SelectedDate = this.ShipToShipActivity.ShipToShipActivityDateTo; + this.textBoxActivityType.Text = this.ShipToShipActivity.ShipToShipActivityType; + this.textBoxSecurityMatters.Text = this.ShipToShipActivity.ShipToShipActivitySecurityMattersToReport; + + this.comboBoxActivityType.ItemsSource = Util.GlobalStructures.EdiCodes; + this.comboBoxActivityType.SelectionChanged += ComboBoxActivityType_SelectionChanged; + + this.AddVisible = true; + this.OKClicked += EditShip2ShipActivitiesDialog_OKClicked; ; + } + + private void ComboBoxActivityType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) + { + if(this.comboBoxActivityType.SelectedIndex >= 0) + { + this.textBoxActivityType.Text = Util.GlobalStructures.edifact8025Codes[this.comboBoxActivityType.SelectedIndex]; + } + } + + public void CopyValuesToEntity() + { + this.ShipToShipActivity.ShipToShipActivityLocationName = this.textBoxLocationName.Text.Trim(); + this.ShipToShipActivity.ShipToShipActivityLocationLoCode = this.locodeLocation.LocodeValue; + this.ShipToShipActivity.ShipToShipActivityLocationCoordinatesLatitude = bsmd.database.Util.DecimalDegreesToNSW(this.doubleUpDownLatitudeDegrees.Value ?? 0); + this.ShipToShipActivity.ShipToShipActivityLocationCoordinatesLongitude = bsmd.database.Util.DecimalDegreesToNSW(this.doubleUpDownLongitudeDegrees.Value ?? 0); + this.ShipToShipActivity.ShipToShipActivityDateFrom = this.datePickerFrom.SelectedDate; + this.ShipToShipActivity.ShipToShipActivityDateTo = this.datePickerTo.SelectedDate; + this.ShipToShipActivity.ShipToShipActivityType = this.textBoxActivityType.Text.Trim(); ; + this.ShipToShipActivity.ShipToShipActivitySecurityMattersToReport = this.textBoxSecurityMatters.Text.Trim(); + } + + + private void EditShip2ShipActivitiesDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + } +} diff --git a/ENI-2/ENI2/ENI2/EditControls/EditWasteDialog.xaml b/ENI-2/ENI2/ENI2/EditControls/EditWasteDialog.xaml new file mode 100644 index 00000000..8de61fde --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditWasteDialog.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/EditControls/EditWasteDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditWasteDialog.xaml.cs new file mode 100644 index 00000000..193afd6d --- /dev/null +++ b/ENI-2/ENI2/ENI2/EditControls/EditWasteDialog.xaml.cs @@ -0,0 +1,70 @@ +// Copyright (c) 2017 schick Informatik +// Description: Waste Bearbeitungsdialog +// + +using System.Windows; +using System.Collections.Generic; + +using bsmd.database; +using ENI2.Controls; +using ENI2.Util; + +namespace ENI2.EditControls +{ + /// + /// Interaction logic for EditWasteDialog.xaml + /// + public partial class EditWasteDialog : EditWindowBase + { + public EditWasteDialog() + { + InitializeComponent(); + Loaded += EditWasteDialog_Loaded; + AddClicked += () => { this.comboBoxWasteCode.Focus(); }; + } + + public Waste Waste { get; set; } + + private void EditWasteDialog_Loaded(object sender, RoutedEventArgs e) + { + Dictionary codeDict = new Dictionary(); + for (int i = 0; i < WAS.DKWasteCodes.Length; i++) + { + codeDict[WAS.DKWasteCodes[i]] = string.Format("{0} - {1}", WAS.DKWasteCodes[i], WAS.DKWasteTypes[i]); + } + this.comboBoxWasteCode.ItemsSource = codeDict; + this.comboBoxWasteCode.SelectedValue = this.Waste.WasteType; + this.textBoxDescription.Text = this.Waste.WasteDescription; + this.doubleUpDownAmountWasteDischargedLastPort.Value = this.Waste.WasteDisposedAtLastPort_MTQ; + this.doubleUpDownAmountDisposed.Value = this.Waste.WasteDisposalAmount_MTQ; + this.doubleUpDownAmountGeneratedTilNextPort.Value = this.Waste.WasteAmountGeneratedTillNextPort_MTQ; + this.doubleUpDownAmountRetained.Value = this.Waste.WasteAmountRetained_MTQ; + this.doubleUpDownMaxCapacity.Value = this.Waste.WasteCapacity_MTQ; + this.locodePortOfDeliveryRemainingWaste.LocodeValue = this.Waste.WasteDisposalPort; + + OKClicked += EditWasteDialog_OKClicked; + this.AddVisible = true; + } + public void CopyValuesToEntity() + { + // copy back + if (this.comboBoxWasteCode.SelectedValue != null) + this.Waste.WasteType = (int)this.comboBoxWasteCode.SelectedValue; + else + this.Waste.WasteType = null; + this.Waste.WasteDescription = this.textBoxDescription.Text?.Trim(); + this.Waste.WasteDisposedAtLastPort_MTQ = this.doubleUpDownAmountWasteDischargedLastPort.Value; + this.Waste.WasteDisposalAmount_MTQ = this.doubleUpDownAmountDisposed.Value; + this.Waste.WasteAmountGeneratedTillNextPort_MTQ = this.doubleUpDownAmountGeneratedTilNextPort.Value; + this.Waste.WasteAmountRetained_MTQ = this.doubleUpDownAmountRetained.Value; + this.Waste.WasteCapacity_MTQ = this.doubleUpDownMaxCapacity.Value; + this.Waste.WasteDisposalPort = this.locodePortOfDeliveryRemainingWaste.LocodeValue; + } + + private void EditWasteDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + } + +} diff --git a/ENI-2/ENI2/ENI2/LocalizedLookup.cs b/ENI-2/ENI2/ENI2/LocalizedLookup.cs index 1e934eb4..b6343c46 100644 --- a/ENI-2/ENI2/ENI2/LocalizedLookup.cs +++ b/ENI-2/ENI2/ENI2/LocalizedLookup.cs @@ -72,12 +72,50 @@ namespace ENI2 if (!reader.IsDBNull(0)) code = reader.GetString(0); if (!reader.IsDBNull(1)) name = reader.GetString(1); if((code != null) && (name != null)) - result[code] = name; + result[code] = string.Format("{0} {1}", code, name); } reader.Close(); return result; } + public static Dictionary getVesselTypes() + { + Dictionary result = new Dictionary(); + string query = string.Format("SELECT Code, Name FROM VesselType ORDER BY Code"); + SQLiteCommand cmd = new SQLiteCommand(query, _con); + IDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + string code = null; + string name = null; + if (!reader.IsDBNull(0)) code = reader.GetString(0); + if (!reader.IsDBNull(1)) name = reader.GetString(1); + if ((code != null) && (name != null)) + result[code] = string.Format("{0} {1}", code, name); + } + reader.Close(); + return result; + } + + + public static Dictionary getTransportModes() + { + Dictionary result = new Dictionary(); + string query = string.Format("SELECT Code, Name FROM TransportMode ORDER BY Code"); + SQLiteCommand cmd = new SQLiteCommand(query, _con); + IDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + string code = null; + string name = null; + if (!reader.IsDBNull(0)) code = reader.GetString(0); + if (!reader.IsDBNull(1)) name = reader.GetString(1); + if ((code != null) && (name != null)) + result[code] = string.Format("{0} {1}", code, name); + } + reader.Close(); + return result; + } } } diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs index 1d357e4f..92455f93 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs +++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs @@ -500,6 +500,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Accurate and correct details given?. + /// + public static string textAccurateDetailsGiven { + get { + return ResourceManager.GetString("textAccurateDetailsGiven", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Activity type. + /// + public static string textActivityType { + get { + return ResourceManager.GetString("textActivityType", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Add. /// @@ -518,6 +536,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Amount of planned waste disposal. + /// + public static string textAmountOfPlannedWasteDisposal { + get { + return ResourceManager.GetString("textAmountOfPlannedWasteDisposal", resourceCulture); + } + } + /// /// Looks up a localized string similar to Anchored. /// @@ -527,6 +554,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Any sanitary measures applied?. + /// + public static string textAnySanitaryMeasures { + get { + return ResourceManager.GetString("textAnySanitaryMeasures", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Any sanitary measures applied?. + /// + public static string textAnySanitaryMeasuresApplied { + get { + return ResourceManager.GetString("textAnySanitaryMeasuresApplied", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Approved security plan on board?. + /// + public static string textApprovedSecPlan { + get { + return ResourceManager.GetString("textApprovedSecPlan", resourceCulture); + } + } + /// /// Looks up a localized string similar to Are you sure?. /// @@ -572,6 +626,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Are you aware of any condition on board which may lead to further infections?. + /// + public static string textAwareofConditionInfectious { + get { + return ResourceManager.GetString("textAwareofConditionInfectious", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Beam over all. + /// + public static string textBeamOverAll { + get { + return ResourceManager.GetString("textBeamOverAll", resourceCulture); + } + } + /// /// Looks up a localized string similar to Beam overall in meter. /// @@ -653,6 +725,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Call sign. + /// + public static string textCallsign { + get { + return ResourceManager.GetString("textCallsign", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cancel declaration. /// @@ -761,6 +842,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Chief security officer (CSO). + /// + public static string textChiefSecurityOfficer { + get { + return ResourceManager.GetString("textChiefSecurityOfficer", resourceCulture); + } + } + /// /// Looks up a localized string similar to City. /// @@ -797,6 +887,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Company Id. + /// + public static string textCompanyId { + get { + return ResourceManager.GetString("textCompanyId", resourceCulture); + } + } + /// /// Looks up a localized string similar to Company name. /// @@ -842,6 +941,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Country. + /// + public static string textCountry { + get { + return ResourceManager.GetString("textCountry", resourceCulture); + } + } + /// /// Looks up a localized string similar to Created. /// @@ -878,6 +986,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Did any crew members join the ship at this port?. + /// + public static string textCrewMemberJoinTheShip { + get { + return ResourceManager.GetString("textCrewMemberJoinTheShip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Number of crew members on board. /// @@ -887,6 +1004,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Crew members joined (comma separated). + /// + public static string textCrewMembersJoined { + get { + return ResourceManager.GetString("textCrewMembersJoined", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Names of joined crew members. + /// + public static string textCrewMembersJoinedGrid { + get { + return ResourceManager.GetString("textCrewMembersJoinedGrid", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cruise ship. /// @@ -896,6 +1031,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to cbm. + /// + public static string textCubicMeters { + get { + return ResourceManager.GetString("textCubicMeters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Current ship security level. + /// + public static string textCurrentShipSecLevel { + get { + return ResourceManager.GetString("textCurrentShipSecLevel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Date from. + /// + public static string textDateFrom { + get { + return ResourceManager.GetString("textDateFrom", resourceCulture); + } + } + /// /// Looks up a localized string similar to Date of birth. /// @@ -905,6 +1067,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Date of issue. + /// + public static string textDateOfIssue { + get { + return ResourceManager.GetString("textDateOfIssue", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Date to. + /// + public static string textDateTo { + get { + return ResourceManager.GetString("textDateTo", resourceCulture); + } + } + /// /// Looks up a localized string similar to Declarations. /// @@ -986,6 +1166,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Is there on board or has there been during the international voyage any case of disease which you suspect to be of an infectious nature?. + /// + public static string textDiseaseInfectiousNature { + get { + return ResourceManager.GetString("textDiseaseInfectiousNature", resourceCulture); + } + } + /// /// Looks up a localized string similar to Double hull. /// @@ -1022,6 +1211,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Draught on departure. + /// + public static string textDraughtOnDeparture { + get { + return ResourceManager.GetString("textDraughtOnDeparture", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Draught on departure in decimetre. + /// + public static string textDraughtOnDepartureLabel { + get { + return ResourceManager.GetString("textDraughtOnDepartureLabel", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Edit. /// @@ -1202,6 +1409,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to General cargo description. + /// + public static string textGeneralCargoDescription { + get { + return ResourceManager.GetString("textGeneralCargoDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to GISIS code of the port facility according to ISPS. + /// + public static string textGISISCode { + get { + return ResourceManager.GetString("textGISISCode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Gross tonnage. /// @@ -1220,6 +1445,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Waste residue notification. + /// + public static string textGroupBoxWasteCargo { + get { + return ResourceManager.GetString("textGroupBoxWasteCargo", resourceCulture); + } + } + /// /// Looks up a localized string similar to ID doc. number. /// @@ -1256,6 +1490,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Incoming journey to port of call - ETA NOK. + /// + public static string textIncomingETANOK { + get { + return ResourceManager.GetString("textIncomingETANOK", resourceCulture); + } + } + /// /// Looks up a localized string similar to Inert. /// @@ -1265,6 +1508,42 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Has the ship visited an infected area (WHO)?. + /// + public static string textInfecteAreaVisited { + get { + return ResourceManager.GetString("textInfecteAreaVisited", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Infected area date. + /// + public static string textInfectedAreaDate { + get { + return ResourceManager.GetString("textInfectedAreaDate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Infected area port. + /// + public static string textInfectedAreaPort { + get { + return ResourceManager.GetString("textInfectedAreaPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Infected area visited. + /// + public static string textInfectedAreaVisited { + get { + return ResourceManager.GetString("textInfectedAreaVisited", resourceCulture); + } + } + /// /// Looks up a localized string similar to Info. /// @@ -1274,6 +1553,69 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Inmarsat call number. + /// + public static string textInmarsatCallNumber { + get { + return ResourceManager.GetString("textInmarsatCallNumber", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ISM company. + /// + public static string textISMCompany { + get { + return ResourceManager.GetString("textISMCompany", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ISSC. + /// + public static string textISSC { + get { + return ResourceManager.GetString("textISSC", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ISSC expiration date. + /// + public static string textISSCExpirationDate { + get { + return ResourceManager.GetString("textISSCExpirationDate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ISSC issuer name. + /// + public static string textISSCIssuerName { + get { + return ResourceManager.GetString("textISSCIssuerName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ISSC issuer type. + /// + public static string textISSCIssuerType { + get { + return ResourceManager.GetString("textISSCIssuerType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ISSC type. + /// + public static string textISSCType { + get { + return ResourceManager.GetString("textISSCType", resourceCulture); + } + } + /// /// Looks up a localized string similar to Itinerary port. /// @@ -1283,6 +1625,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Joining location (separated by comma). + /// + public static string textJoiningLocation { + get { + return ResourceManager.GetString("textJoiningLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kiel Canal passage planned?. + /// + public static string textKielPassagePlanned { + get { + return ResourceManager.GetString("textKielPassagePlanned", resourceCulture); + } + } + /// /// Looks up a localized string similar to LA Code. /// @@ -1301,6 +1661,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Last 10 port facilities called. + /// + public static string textLast10PortFacilities { + get { + return ResourceManager.GetString("textLast10PortFacilities", resourceCulture); + } + } + /// /// Looks up a localized string similar to Date of last expanded inspection. /// @@ -1328,6 +1697,60 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Last port where waste or cargo residues where discharged. + /// + public static string textLastPortWasteDischarge { + get { + return ResourceManager.GetString("textLastPortWasteDischarge", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Latitude decimal. + /// + public static string textLatitudeDecimal { + get { + return ResourceManager.GetString("textLatitudeDecimal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Latitude degrees. + /// + public static string textLatitudeDegrees { + get { + return ResourceManager.GetString("textLatitudeDegrees", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Latitude minutes. + /// + public static string textLatitudeMinutes { + get { + return ResourceManager.GetString("textLatitudeMinutes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Latitude seconds. + /// + public static string textLatitudeSeconds { + get { + return ResourceManager.GetString("textLatitudeSeconds", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Length over all. + /// + public static string textLengthOverAll { + get { + return ResourceManager.GetString("textLengthOverAll", resourceCulture); + } + } + /// /// Looks up a localized string similar to Length overall in meter. /// @@ -1346,6 +1769,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Location UNLOCODE. + /// + public static string textLocationLocode { + get { + return ResourceManager.GetString("textLocationLocode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Location name. + /// + public static string textLocationName { + get { + return ResourceManager.GetString("textLocationName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Lock. /// @@ -1382,6 +1823,42 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Longitude decimal. + /// + public static string textLongitudeDecimal { + get { + return ResourceManager.GetString("textLongitudeDecimal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Longitude degrees. + /// + public static string textLongitudeDegrees { + get { + return ResourceManager.GetString("textLongitudeDegrees", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Longitude minutes. + /// + public static string textLongitudeMinutes { + get { + return ResourceManager.GetString("textLongitudeMinutes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Longitude seconds. + /// + public static string textLongitudeSeconds { + get { + return ResourceManager.GetString("textLongitudeSeconds", resourceCulture); + } + } + /// /// Looks up a localized string similar to Male. /// @@ -1391,6 +1868,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Maritime health declaration. + /// + public static string textMaritimeHealthDeclaration { + get { + return ResourceManager.GetString("textMaritimeHealthDeclaration", resourceCulture); + } + } + /// /// Looks up a localized string similar to Master. /// @@ -1409,6 +1895,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Was a medical practitioner consulted?. + /// + public static string textMedicalPractitionerConsulted { + get { + return ResourceManager.GetString("textMedicalPractitionerConsulted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MMSI number. + /// + public static string textMMSI { + get { + return ResourceManager.GetString("textMMSI", resourceCulture); + } + } + /// /// Looks up a localized string similar to Muster book. /// @@ -1481,6 +1985,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Number of deaths. + /// + public static string textNumberOfDeaths { + get { + return ResourceManager.GetString("textNumberOfDeaths", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Number of ill persons. + /// + public static string textNumberOfIl { + get { + return ResourceManager.GetString("textNumberOfIl", resourceCulture); + } + } + /// /// Looks up a localized string similar to Operations. /// @@ -1508,6 +2030,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Outgoing journey from port of call - ETA NOK. + /// + public static string textOutgoingETANOK { + get { + return ResourceManager.GetString("textOutgoingETANOK", resourceCulture); + } + } + /// /// Looks up a localized string similar to Overview. /// @@ -1553,6 +2084,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Has any person died on board during the voyage otherwise than as a result of accident?. + /// + public static string textPersonDiedOnBoard { + get { + return ResourceManager.GetString("textPersonDiedOnBoard", resourceCulture); + } + } + /// /// Looks up a localized string similar to Persons on board arrival. /// @@ -1562,6 +2102,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Persons on board departure. + /// + public static string textPersonOnBoardDeparture { + get { + return ResourceManager.GetString("textPersonOnBoardDeparture", resourceCulture); + } + } + /// /// Looks up a localized string similar to Number of persons on board. /// @@ -1598,6 +2147,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Place of issue. + /// + public static string textPlaceOfIssue { + get { + return ResourceManager.GetString("textPlaceOfIssue", resourceCulture); + } + } + /// /// Looks up a localized string similar to Planned inspection / works. /// @@ -1643,6 +2201,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Port country. + /// + public static string textPortCountry { + get { + return ResourceManager.GetString("textPortCountry", resourceCulture); + } + } + /// /// Looks up a localized string similar to Port facility. /// @@ -1652,6 +2219,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Port facility of arrival. + /// + public static string textPortFacilityOfArrival { + get { + return ResourceManager.GetString("textPortFacilityOfArrival", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Port UNLOCODE. + /// + public static string textPortLocode { + get { + return ResourceManager.GetString("textPortLocode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Port name. /// @@ -1688,6 +2273,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Port where health declaration was given. + /// + public static string textPortOfHealth { + get { + return ResourceManager.GetString("textPortOfHealth", resourceCulture); + } + } + /// /// Looks up a localized string similar to Port of itinerary. /// @@ -1697,6 +2291,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Port of registry. + /// + public static string textPortOfRegistry { + get { + return ResourceManager.GetString("textPortOfRegistry", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ports of call of the last 30 days. + /// + public static string textPortsOfCallLast30Days { + get { + return ResourceManager.GetString("textPortsOfCallLast30Days", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Port where security declaration was given. + /// + public static string textPortWhereSimplWasGiven { + get { + return ResourceManager.GetString("textPortWhereSimplWasGiven", resourceCulture); + } + } + /// /// Looks up a localized string similar to Postalcode. /// @@ -1769,6 +2390,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Reason for invalid ISSC. + /// + public static string textReasonForInvalidISSC { + get { + return ResourceManager.GetString("textReasonForInvalidISSC", resourceCulture); + } + } + /// /// Looks up a localized string similar to Refresh. /// @@ -1778,6 +2408,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Reinspection sanitary control required?. + /// + public static string textReinspectionSanitaryControl { + get { + return ResourceManager.GetString("textReinspectionSanitaryControl", resourceCulture); + } + } + /// /// Looks up a localized string similar to Remarks. /// @@ -1814,6 +2453,60 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Sanitary control exemption or certificate on board?. + /// + public static string textSanitaryControlExemption { + get { + return ResourceManager.GetString("textSanitaryControlExemption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Date of sanitary measure. + /// + public static string textSanitaryMeasureDate { + get { + return ResourceManager.GetString("textSanitaryMeasureDate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Details of sanitary measure. + /// + public static string textSanitaryMeasureDetails { + get { + return ResourceManager.GetString("textSanitaryMeasureDetails", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kind of sanitary measure. + /// + public static string textSanitaryMeasureKind { + get { + return ResourceManager.GetString("textSanitaryMeasureKind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Place of sanitary measure. + /// + public static string textSanitaryMeasurePlace { + get { + return ResourceManager.GetString("textSanitaryMeasurePlace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kind of sanitary measures applied on board. + /// + public static string textSanitaryMeasuresApplied { + get { + return ResourceManager.GetString("textSanitaryMeasuresApplied", resourceCulture); + } + } + /// /// Looks up a localized string similar to Save. /// @@ -1850,6 +2543,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to SEC - Security. + /// + public static string textSEC { + get { + return ResourceManager.GetString("textSEC", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} seconds elapsed. /// @@ -1868,6 +2570,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Security matters. + /// + public static string textSecurityMatters { + get { + return ResourceManager.GetString("textSecurityMatters", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Security notification. + /// + public static string textSecurityNotification { + get { + return ResourceManager.GetString("textSecurityNotification", resourceCulture); + } + } + /// /// Looks up a localized string similar to Send to NSW. /// @@ -1913,6 +2633,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Ship-to-ship activity. + /// + public static string textShip2ShipActivity { + get { + return ResourceManager.GetString("textShip2ShipActivity", resourceCulture); + } + } + /// /// Looks up a localized string similar to Ship data. /// @@ -1958,6 +2687,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Ship security level. + /// + public static string textShipSecLevel { + get { + return ResourceManager.GetString("textShipSecLevel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ship-to-ship acitivities. + /// + public static string textShipToShip { + get { + return ResourceManager.GetString("textShipToShip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Has the ship visited an infected area (WHO)?. + /// + public static string textShipVisitedInfectedArea { + get { + return ResourceManager.GetString("textShipVisitedInfectedArea", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Show as text. /// @@ -1967,6 +2723,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Sick animals or pets on board?. + /// + public static string textSickAnimalsOrPets { + get { + return ResourceManager.GetString("textSickAnimalsOrPets", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sick persons on board?. + /// + public static string textSickPersonsOnBoard { + get { + return ResourceManager.GetString("textSickPersonsOnBoard", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Simplification available. + /// + public static string textSimplificationAvailable { + get { + return ResourceManager.GetString("textSimplificationAvailable", resourceCulture); + } + } + /// /// Looks up a localized string similar to Single hull. /// @@ -2039,6 +2822,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Street, number. + /// + public static string textStreetAndNumber { + get { + return ResourceManager.GetString("textStreetAndNumber", resourceCulture); + } + } + /// /// Looks up a localized string similar to Street / number. /// @@ -2129,6 +2921,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Total number of ill passengers greater than normal / expected?. + /// + public static string textTotalNumberIllHigherThanExpected { + get { + return ResourceManager.GetString("textTotalNumberIllHigherThanExpected", resourceCulture); + } + } + /// /// Looks up a localized string similar to Towage. /// @@ -2165,6 +2966,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Transport mode. + /// + public static string textTransportMode { + get { + return ResourceManager.GetString("textTransportMode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Type for Locode.... /// @@ -2210,6 +3020,42 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Valid exemption. + /// + public static string textValidExemption { + get { + return ResourceManager.GetString("textValidExemption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Valid ISSC on board?. + /// + public static string textValidISSCOnBoard { + get { + return ResourceManager.GetString("textValidISSCOnBoard", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Vessel name. + /// + public static string textVesselName { + get { + return ResourceManager.GetString("textVesselName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Vessel type. + /// + public static string textVesselType { + get { + return ResourceManager.GetString("textVesselType", resourceCulture); + } + } + /// /// Looks up a localized string similar to Visa number. /// @@ -2219,6 +3065,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Visits of infected areas as declared by the WHO. + /// + public static string textVisitsInfectedAreas { + get { + return ResourceManager.GetString("textVisitsInfectedAreas", resourceCulture); + } + } + /// /// Looks up a localized string similar to Visit / transit. /// @@ -2246,6 +3101,78 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Amount of waste of this type that has been discharged at the last port of disposal. + /// + public static string textWasteAmountDischargedLastPort { + get { + return ResourceManager.GetString("textWasteAmountDischargedLastPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Amount to be disposed. + /// + public static string textWasteAmountToBeDisposed { + get { + return ResourceManager.GetString("textWasteAmountToBeDisposed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Date of last disposal. + /// + public static string textWasteDateLastDisposal { + get { + return ResourceManager.GetString("textWasteDateLastDisposal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Waste disposal service providers. + /// + public static string textWasteDisposalServiceProviders { + get { + return ResourceManager.GetString("textWasteDisposalServiceProviders", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Estimated waste/cargo residues amount generated between port of call and next port. + /// + public static string textWasteGeneratedUntilNextPort { + get { + return ResourceManager.GetString("textWasteGeneratedUntilNextPort", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Max.waste capacity on board. + /// + public static string textWasteMaxCapacity { + get { + return ResourceManager.GetString("textWasteMaxCapacity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Port of delivery of remaining waste. + /// + public static string textWastePortOfDelivery { + get { + return ResourceManager.GetString("textWastePortOfDelivery", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Waste amount retained on board. + /// + public static string textWasteRetained { + get { + return ResourceManager.GetString("textWasteRetained", resourceCulture); + } + } + /// /// Looks up a localized string similar to Password is wrong!. /// diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx index 791120bc..c51df2b7 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.resx +++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx @@ -850,4 +850,313 @@ Passenger + + Waste residue notification + + + Accurate and correct details given? + + + Amount of planned waste disposal + + + cbm + + + Last port where waste or cargo residues where discharged + + + Valid exemption + + + Amount of waste of this type that has been discharged at the last port of disposal + + + Amount to be disposed + + + Date of last disposal + + + Waste disposal service providers + + + Estimated waste/cargo residues amount generated between port of call and next port + + + Max.waste capacity on board + + + Port of delivery of remaining waste + + + Waste amount retained on board + + + Beam over all + + + Call sign + + + Company Id + + + Country + + + Inmarsat call number + + + ISM company + + + Length over all + + + MMSI number + + + Port of registry + + + Street, number + + + Transport mode + + + Vessel name + + + Vessel type + + + Activity type + + + Approved security plan on board? + + + Chief security officer (CSO) + + + Current ship security level + + + Date from + + + Date to + + + General cargo description + + + GISIS code of the port facility according to ISPS + + + Incoming journey to port of call - ETA NOK + + + ISSC + + + ISSC expiration date + + + ISSC issuer name + + + ISSC issuer type + + + ISSC type + + + Kiel Canal passage planned? + + + Last 10 port facilities called + + + Latitude decimal + + + Latitude degrees + + + Latitude minutes + + + Latitude seconds + + + Location UNLOCODE + + + Location name + + + Longitude decimal + + + Longitude degrees + + + Longitude minutes + + + Longitude seconds + + + Outgoing journey from port of call - ETA NOK + + + Port country + + + Port facility of arrival + + + Port UNLOCODE + + + Port where security declaration was given + + + Reason for invalid ISSC + + + SEC - Security + + + Security matters + + + Security notification + + + Ship security level + + + Ship-to-ship acitivities + + + Simplification available + + + Valid ISSC on board? + + + Ship-to-ship activity + + + Any sanitary measures applied? + + + Are you aware of any condition on board which may lead to further infections? + + + Is there on board or has there been during the international voyage any case of disease which you suspect to be of an infectious nature? + + + Draught on departure + + + Draught on departure in decimetre + + + Joining location (separated by comma) + + + Maritime health declaration + + + Was a medical practitioner consulted? + + + Number of deaths + + + Number of ill persons + + + Has any person died on board during the voyage otherwise than as a result of accident? + + + Persons on board departure + + + Port where health declaration was given + + + Ports of call of the last 30 days + + + Reinspection sanitary control required? + + + Sanitary control exemption or certificate on board? + + + Kind of sanitary measures applied on board + + + Has the ship visited an infected area (WHO)? + + + Sick animals or pets on board? + + + Sick persons on board? + + + Total number of ill passengers greater than normal / expected? + + + Visits of infected areas as declared by the WHO + + + Place of issue + + + Date of issue + + + Did any crew members join the ship at this port? + + + Crew members joined (comma separated) + + + Names of joined crew members + + + Any sanitary measures applied? + + + Has the ship visited an infected area (WHO)? + + + Infected area date + + + Infected area port + + + Date of sanitary measure + + + Kind of sanitary measure + + + Place of sanitary measure + + + Infected area visited + + + Details of sanitary measure + \ No newline at end of file diff --git a/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs b/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs index ce724bd7..74d0921d 100644 --- a/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs +++ b/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs @@ -12,6 +12,7 @@ namespace ENI2.Util { class GlobalStructures { + private static List itemList = null; public static string[] GenderList = { @@ -30,5 +31,51 @@ namespace ENI2.Util Properties.Resources.textOtherLegalIdentityDocument }; + public static string[] ShipSecurityLevels = { "1", "2", "3" }; + + public static string[] edifact8025Codes = + { + "", + "Cargo operations", + "Passenger movement", + "Taking bunkers", + "Changing crew", + "Goodwill visit", + "Taking supplies", + "Repair", + "Laid-up", + "Awaiting orders", + "Miscellaneous", + "Crew movement", + "Cruise, leisure and recreation", + "Under government order", + "Quarantine inspection", + "Refuge", + "Unloading cargo", + "Loading cargo", + "Repair in dry dock", + "Repair in wet dock", + "Cargo tank cleaning", + "Means of transport customs clearance", + "De-gassing", + "Waste disposal" + }; + + + public static List EdiCodes + { + get + { + if (itemList == null) + { + itemList = new List(); + itemList.Add(""); + for (int i = 1; i < Util.GlobalStructures.edifact8025Codes.Length; i++) + itemList.Add(string.Format("{0} - {1}", i, Util.GlobalStructures.edifact8025Codes[i])); + } + return itemList; + } + } + } } diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index 133da522..5b12652f 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 210b59d9..0470777d 100644 --- a/nsw/Source/bsmd.database/DBManager.cs +++ b/nsw/Source/bsmd.database/DBManager.cs @@ -532,11 +532,13 @@ namespace bsmd.database public void Delete(DatabaseEntity entity) { - SqlCommand cmd = new SqlCommand(); - entity.PrepareDelete(cmd); - int queryResult = this.PerformNonQuery(cmd); - this.LogNonQueryResult(cmd.CommandText, queryResult); - + if (!entity.IsNew) + { + SqlCommand cmd = new SqlCommand(); + entity.PrepareDelete(cmd); + int queryResult = this.PerformNonQuery(cmd); + this.LogNonQueryResult(cmd.CommandText, queryResult); + } if (this._closeConnectionAfterUse) this.Disconnect(); } diff --git a/nsw/Source/bsmd.database/PortOfCallLast30Days.cs b/nsw/Source/bsmd.database/PortOfCallLast30Days.cs index af014f68..9566f8af 100644 --- a/nsw/Source/bsmd.database/PortOfCallLast30Days.cs +++ b/nsw/Source/bsmd.database/PortOfCallLast30Days.cs @@ -9,6 +9,7 @@ using System; using System.Data; +using System.Text; using System.Data.SqlClient; using System.Collections.Generic; @@ -44,6 +45,74 @@ namespace bsmd.database public string Identifier { get; set; } + /// + /// Hilfsproperty, um eine kommaseparierte Liste von Crew (analog ANSW) im ENI-2 anzuzeigen, + /// + public string CrewMembersJoinedText + { + get + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < this.CrewJoinedShip.Count; i++) + { + if (i > 0) + sb.Append(", "); + sb.Append(this.CrewJoinedShip[i].PortOfCallLast30DaysCrewJoinedShipName); + } + return sb.ToString(); + } + set + { + if (value.IsNullOrEmpty()) + { + foreach (PortOfCallLast30DaysCrewJoinedShip wdsp in this.CrewJoinedShip) + DBManager.Instance.Delete(wdsp); + this.CrewJoinedShip.Clear(); + } + else + { + string[] crewNames = value.Split(','); + List foundList = new List(); + + for (int i = 0; i < crewNames.Length; i++) + { + string crewName = crewNames[i].Trim(); + if (crewName.Length > 0) + { + PortOfCallLast30DaysCrewJoinedShip matchingCrew = null; + foreach (PortOfCallLast30DaysCrewJoinedShip wdsp in this.CrewJoinedShip) + { + if (wdsp.PortOfCallLast30DaysCrewJoinedShipName.Equals(crewName, StringComparison.OrdinalIgnoreCase)) + { + matchingCrew = wdsp; + break; + } + } + if (matchingCrew != null) + { + foundList.Add(matchingCrew); + this.CrewJoinedShip.Remove(matchingCrew); + } + else + { + PortOfCallLast30DaysCrewJoinedShip newPoC30Crew = new PortOfCallLast30DaysCrewJoinedShip(); + newPoC30Crew.PortOfCallLast30Days = this; + newPoC30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName; + foundList.Add(newPoC30Crew); + } + } + } + + // remove remaining crew (no longer valid) + foreach (PortOfCallLast30DaysCrewJoinedShip remainingCrew in this.CrewJoinedShip) + DBManager.Instance.Delete(remainingCrew); + this.CrewJoinedShip.Clear(); + // add existing and new crew + this.CrewJoinedShip.AddRange(foundList); + } + } + } + #endregion #region abstract class implementation diff --git a/nsw/Source/bsmd.database/STAT.cs b/nsw/Source/bsmd.database/STAT.cs index d8294a6d..99d92cd4 100644 --- a/nsw/Source/bsmd.database/STAT.cs +++ b/nsw/Source/bsmd.database/STAT.cs @@ -145,6 +145,10 @@ namespace bsmd.database [MaxLength(35)] public string CertificateOfRegistryNumber { get; set; } + public static Dictionary VesselTypeDict { get; set; } + + public static Dictionary TransportModeDict { get; set; } + #endregion #region abstract class implementation diff --git a/nsw/Source/bsmd.database/Util.cs b/nsw/Source/bsmd.database/Util.cs index f354d9eb..b19f2c8f 100644 --- a/nsw/Source/bsmd.database/Util.cs +++ b/nsw/Source/bsmd.database/Util.cs @@ -165,5 +165,23 @@ namespace bsmd.database return result; } + #region CoordinateTransformation + + public static double NSWToDecimalDegrees(int nswCoordinate) + { + double result = Math.Floor(nswCoordinate / 600000.0); + result += (double) (nswCoordinate % 600000.0) / 600000.0; + return result; + } + + public static int DecimalDegreesToNSW(double decimalDegree) + { + int result = ((int)decimalDegree) * 600000; + result += (int) ((decimalDegree - (int)decimalDegree) * 600000); + return result; + } + + #endregion + } } diff --git a/nsw/Source/bsmd.database/WAS.cs b/nsw/Source/bsmd.database/WAS.cs index 257cd959..ca6dc908 100644 --- a/nsw/Source/bsmd.database/WAS.cs +++ b/nsw/Source/bsmd.database/WAS.cs @@ -8,7 +8,7 @@ // Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved. using System; -using System.Data; +using System.Text; using System.Data.SqlClient; using System.Collections.Generic; @@ -65,6 +65,75 @@ namespace bsmd.database public List WasteDisposalServiceProvider { get { return this.wdsp; } } + /// + /// Hilfsproperty, um eine kommaseparierte Liste von WasteDisposalServiceProvider (analog ANSW) im ENI-2 anzuzeigen, + /// bzw im Setter um eine kommaseparierte Liste mit den WasteDisposalServiceProvider Entitäten abzugleichen + /// + public string WasteDisposalServiceProviderText + { + get + { + StringBuilder sb = new StringBuilder(); + for(int i=0;i 0) + sb.Append(", "); + sb.Append(this.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName); + } + return sb.ToString(); + } + set + { + if (value.IsNullOrEmpty()) + { + foreach (WasteDisposalServiceProvider wdsp in this.WasteDisposalServiceProvider) + DBManager.Instance.Delete(wdsp); + this.WasteDisposalServiceProvider.Clear(); + } + else + { + string[] serviceProviderNames = value.Split(','); + List foundList = new List(); + + for (int i=0;i 0) + { + WasteDisposalServiceProvider matchingServiceProvider = null; + foreach(WasteDisposalServiceProvider wdsp in this.WasteDisposalServiceProvider) + { + if(wdsp.WasteDisposalServiceProviderName.Equals(serviceProviderName, StringComparison.OrdinalIgnoreCase)) + { + matchingServiceProvider = wdsp; + break; + } + } + if(matchingServiceProvider != null) + { + foundList.Add(matchingServiceProvider); + this.WasteDisposalServiceProvider.Remove(matchingServiceProvider); + } + else + { + WasteDisposalServiceProvider newWDSP = new WasteDisposalServiceProvider(); + newWDSP.WAS = this; + newWDSP.WasteDisposalServiceProviderName = serviceProviderName; + foundList.Add(newWDSP); + } + } + } + + // remove remaining service provider (no longer valid) + foreach (WasteDisposalServiceProvider remainingProvider in this.WasteDisposalServiceProvider) + DBManager.Instance.Delete(remainingProvider); + this.WasteDisposalServiceProvider.Clear(); + // add existing and new providers + this.WasteDisposalServiceProvider.AddRange(foundList); + } + } + } + #endregion #region DatabaseEntity implementation diff --git a/nsw/Source/misc/db.sqlite b/nsw/Source/misc/db.sqlite index adb5f436..ebf2a3d5 100644 Binary files a/nsw/Source/misc/db.sqlite and b/nsw/Source/misc/db.sqlite differ