diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index 59067348..0a568992 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,12 +26,12 @@ 1000 - http://192.168.2.4/LockingService/LockingService.svc - + + http://heupferd/bsmd.LockingService/LockingService.svc - Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False - + + Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False diff --git a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs index a50a1566..96940938 100644 --- a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs +++ b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs @@ -120,12 +120,13 @@ namespace ENI2.Controls protected void addItem(object sender, RoutedEventArgs e) { - this.CreateRequested?.Invoke(); + if(!this.IsReadOnly) + this.CreateRequested?.Invoke(); } protected void deleteItem(object sender, RoutedEventArgs e) { - if((this.SelectedItems != null) && (this.SelectedItems.Count == 1)) + if((this.SelectedItems != null) && (this.SelectedItems.Count == 1) && !this.IsReadOnly) { MessageBoxResult result = MessageBox.Show(Properties.Resources.textAreYouSure, Properties.Resources.textCaptionDeleteConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) @@ -140,7 +141,7 @@ namespace ENI2.Controls protected void editItem(object sender, RoutedEventArgs e) { - if((this.SelectedItems != null) && (this.SelectedItems.Count == 1)) + if((this.SelectedItems != null) && (this.SelectedItems.Count == 1) && !this.IsReadOnly) { DatabaseEntity selectedEntity = this.SelectedItems[0] as DatabaseEntity; if (selectedEntity != null) @@ -150,7 +151,7 @@ namespace ENI2.Controls protected void printItem(object sender, RoutedEventArgs e) { - if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1)) + if ((this.SelectedItems != null) && (this.SelectedItems.Count == 1) ) { DatabaseEntity selectedEntity = this.SelectedItems[0] as DatabaseEntity; if (selectedEntity != null) @@ -183,7 +184,7 @@ namespace ENI2.Controls if (sender != null) { DataGrid grid = sender as DataGrid; - if ((grid != null) && (grid.SelectedItems != null) && (grid.SelectedItems.Count == 1)) + if ((grid != null) && (grid.SelectedItems != null) && (grid.SelectedItems.Count == 1) && !this.IsReadOnly) { DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow; DatabaseEntity selectedEntity = grid.SelectedItem as DatabaseEntity; diff --git a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs index 632b63e3..2b743070 100644 --- a/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs +++ b/ENI-2/ENI2/ENI2/Controls/EditWindowBase.cs @@ -6,6 +6,9 @@ using System; using System.Windows; using System.Windows.Controls; using System.ComponentModel; +using System.Windows.Data; +using System.Linq; +using bsmd.database; namespace ENI2.Controls { @@ -75,5 +78,38 @@ namespace ENI2.Controls OKClicked?.Invoke(); } + #region combobox content filtering + + protected void ComboBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) + { + ComboBox cmb = sender as ComboBox; + if (cmb == null) return; + CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource); + + itemsViewOriginal.Filter = ((o) => + { + bool result = false; + if (String.IsNullOrEmpty(cmb.Text)) + { + result = true; + } + else + { + if(o is System.Collections.Generic.KeyValuePair) + if(((System.Collections.Generic.KeyValuePair)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase)) + result = true; + if(o is string) + if (((string)o).Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true; + } + //System.Diagnostics.Trace.WriteLine(string.Format("{0} - {1} - {2}", o, cmb.Text, result)); + return result; + }); + + //System.Diagnostics.Trace.WriteLine("---"); + itemsViewOriginal.Refresh(); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs index 3d713761..781a9a21 100644 --- a/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/Controls/LocodeControl.xaml.cs @@ -54,7 +54,7 @@ namespace ENI2.Controls // Get instance of current control from sender // and property value from e.NewValue - if (e.NewValue != null) + if ((e.NewValue != null) && (e.NewValue.ToString().Trim() != "")) ((LocodeControl)sender).SelectedItem = e.NewValue.ToString();//.Substring(0,5); } diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs index 8a58f5d7..f70ff10c 100644 --- a/ENI-2/ENI2/ENI2/DetailBaseControl.cs +++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs @@ -9,6 +9,7 @@ using System.Windows.Controls; using bsmd.database; using System.Windows.Media.Imaging; using System.ComponentModel; +using System.Windows.Data; namespace ENI2 { @@ -212,6 +213,35 @@ namespace ENI2 #endregion + #region combobox content filtering + + protected void ComboBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) + { + ComboBox cmb = sender as ComboBox; + if (cmb == null) return; + CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource); + + itemsViewOriginal.Filter = ((o) => + { + bool result = false; + if (String.IsNullOrEmpty(cmb.Text)) + { + result = true; + } + else if(o is string) + { + if (((string)o).Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true; + } + //System.Diagnostics.Trace.WriteLine(string.Format("{0} - {1} - {2}", o, cmb.Text, result)); + return result; + }); + + //System.Diagnostics.Trace.WriteLine("---"); + itemsViewOriginal.Refresh(); + } + + #endregion + #endregion diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 8f4a5c66..3d170931 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -109,6 +109,9 @@ namespace ENI2 { // create control instance for display: DetailBaseControl detailControl = (DetailBaseControl)Activator.CreateInstance(mg.MessageGroupControlType); + // Spezial-Balkon für die Wiederverwendung von HAZD / HAZA als ein Control (es tut mir leid :D) + if (mg.MessageGroupName.Equals(Properties.Resources.textDGDeparture)) + ((DangerousGoodsDetailControl)detailControl).IsDeparture = true; detailControl.Core = _core; detailControl.Messages = _messages; detailControl.LockedByOtherUser = this.LockedByOtherUser; diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml index 44cb9895..7878b045 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/DangerousGoodsDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml index 42fed0dc..9437e8f6 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml @@ -5,9 +5,100 @@ 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:p="clr-namespace:ENI2.Properties" + xmlns:enictrl="clr-namespace:ENI2.Controls" + xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - - - + d:DesignHeight="768" d:DesignWidth="1024"> + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs index 5861ae7e..5a83fdbd 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs @@ -2,20 +2,10 @@ // Description: Für Arrival / Departure // -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,453 @@ namespace ENI2.DetailViewControls /// public partial class DangerousGoodsDetailControl : DetailBaseControl { + + private Message _hazMessage; + private HAZ haz; + public DangerousGoodsDetailControl() { InitializeComponent(); + this.Loaded += DangerousGoodsDetailControl_Loaded; } + + private void DangerousGoodsDetailControl_Loaded(object sender, RoutedEventArgs e) + { + this.RegisterCheckboxChange(this.checkBoxDangerousGoodsOnBoard, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + this.RegisterCheckboxChange(this.checkBoxDGManifestOnBoard, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + this.RegisterCheckboxChange(this.checkBoxMoUBaltic, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + this.RegisterComboboxIndexChange(this.comboBoxVesselClass, this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + + public bool IsDeparture { get; set; } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if(IsDeparture) + if (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) { this._hazMessage = aMessage; this.ControlMessages.Add(aMessage); } + else + if (aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) { this._hazMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region HAZ + + if (this._hazMessage == null) + { + this._hazMessage = this.Core.CreateMessage(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + this.Messages.Add(this._hazMessage); + } + + HAZ haz = null; + if (this._hazMessage.Elements.Count > 0) + haz = this._hazMessage.Elements[0] as HAZ; + if (haz == null) + { + haz = new HAZ(); + haz.MessageCore = this.Core; + haz.MessageHeader = this._hazMessage; + _hazMessage.Elements.Add(haz); + } + + this.haz = haz; + this.groupBoxHAZ.DataContext = haz; + + this.dataGridIMDGItems.Initialize(); + this.dataGridIMDGItems.ItemsSource = this.haz.IMDGPositions; + this.dataGridIMDGItems.CreateRequested += DataGridIMDGItems_CreateRequested; + this.dataGridIMDGItems.AddingNewItem += DataGridIMDGItems_AddingNewItem; + this.dataGridIMDGItems.EditRequested += DataGridIMDGItems_EditRequested; + this.dataGridIMDGItems.DeleteRequested += DataGridIMDGItems_DeleteRequested; + + this.dataGridIBCItems.Initialize(); + this.dataGridIBCItems.ItemsSource = this.haz.IBCPositions; + this.dataGridIBCItems.CreateRequested += DataGridIBCItems_CreateRequested; + this.dataGridIBCItems.AddingNewItem += DataGridIBCItems_AddingNewItem; + this.dataGridIBCItems.EditRequested += DataGridIBCItems_EditRequested; + this.dataGridIBCItems.DeleteRequested += DataGridIBCItems_DeleteRequested; + + this.dataGridIGCItems.Initialize(); + this.dataGridIGCItems.ItemsSource = this.haz.IGCPositions; + this.dataGridIGCItems.CreateRequested += DataGridIGCItems_CreateRequested; + this.dataGridIGCItems.AddingNewItem += DataGridIGCItems_AddingNewItem; + this.dataGridIGCItems.EditRequested += DataGridIGCItems_EditRequested; + this.dataGridIGCItems.DeleteRequested += DataGridIGCItems_DeleteRequested; + + this.dataGridIMSBCItems.Initialize(); + this.dataGridIMSBCItems.ItemsSource = this.haz.IMSBCPositions; + this.dataGridIMSBCItems.CreateRequested += DataGridIMSBCItems_CreateRequested; + this.dataGridIMSBCItems.AddingNewItem += DataGridIMSBCItems_AddingNewItem; + this.dataGridIMSBCItems.EditRequested += DataGridIMSBCItems_EditRequested; + this.dataGridIMSBCItems.DeleteRequested += DataGridIMSBCItems_DeleteRequested; + + this.dataGridMARPOLItems.Initialize(); + this.dataGridMARPOLItems.ItemsSource = this.haz.MARPOLPositions; + this.dataGridMARPOLItems.CreateRequested += DataGridMARPOLItems_CreateRequested; + this.dataGridMARPOLItems.AddingNewItem += DataGridMARPOLItems_AddingNewItem; + this.dataGridMARPOLItems.EditRequested += DataGridMARPOLItems_EditRequested; + this.dataGridMARPOLItems.DeleteRequested += DataGridMARPOLItems_DeleteRequested; + + #endregion + + } + + #region MARPOL datagrid handlers + + private void DataGridMARPOLItems_DeleteRequested(DatabaseEntity obj) + { + MARPOL_Annex_I_Position marpol = obj as MARPOL_Annex_I_Position; + if (marpol != null) + { + // are you sure dialog is in base class + this.haz.MARPOLPositions.Remove(marpol); + this.dataGridMARPOLItems.Items.Refresh(); + } + } + + private void DataGridMARPOLItems_EditRequested(DatabaseEntity obj) + { + MARPOL_Annex_I_Position marpol = obj as MARPOL_Annex_I_Position; + if (marpol != null) + { + EditMarpolDialog eld = new EditMarpolDialog(); + eld.MARPOL = marpol; + + eld.AddClicked += () => + { + eld.CopyValuesToEntity(); + haz.MARPOLPositions.Add(eld.MARPOL); + this.dataGridMARPOLItems.Items.Refresh(); + eld.MARPOL = new MARPOL_Annex_I_Position(); + eld.MARPOL.HAZ = this.haz; + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (eld.ShowDialog() ?? false) + { + this.dataGridMARPOLItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + } + + private void DataGridMARPOLItems_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) + { + this.DataGridMARPOLItems_CreateRequested(); + } + + private void DataGridMARPOLItems_CreateRequested() + { + MARPOL_Annex_I_Position marpol = new MARPOL_Annex_I_Position(); + EditMarpolDialog ebd = new EditMarpolDialog(); + ebd.MARPOL = marpol; + + ebd.AddClicked += () => + { + ebd.CopyValuesToEntity(); + this.haz.MARPOLPositions.Add(ebd.MARPOL); + ebd.MARPOL.HAZ = this.haz; + this.dataGridMARPOLItems.Items.Refresh(); + ebd.MARPOL = new MARPOL_Annex_I_Position(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (ebd.ShowDialog() ?? false) + { + marpol.HAZ = haz; + haz.MARPOLPositions.Add(marpol); + this.dataGridMARPOLItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + + #endregion + + #region IMSBC datagrid handlers + + private void DataGridIMSBCItems_DeleteRequested(DatabaseEntity obj) + { + IMSBCPosition imsbc = obj as IMSBCPosition; + if (imsbc != null) + { + // are you sure dialog is in base class + this.haz.IMSBCPositions.Remove(imsbc); + this.dataGridIMSBCItems.Items.Refresh(); + } + } + + private void DataGridIMSBCItems_EditRequested(DatabaseEntity obj) + { + IMSBCPosition imsbc = obj as IMSBCPosition; + if (imsbc != null) + { + EditIMSBCDialog eld = new EditIMSBCDialog(); + eld.IMSBC = imsbc; + + eld.AddClicked += () => + { + eld.CopyValuesToEntity(); + haz.IMSBCPositions.Add(eld.IMSBC); + this.dataGridIMSBCItems.Items.Refresh(); + eld.IMSBC = new IMSBCPosition(); + eld.IMSBC.HAZ = this.haz; + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (eld.ShowDialog() ?? false) + { + this.dataGridIMSBCItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + } + + private void DataGridIMSBCItems_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) + { + this.DataGridIMSBCItems_CreateRequested(); + } + + private void DataGridIMSBCItems_CreateRequested() + { + IMSBCPosition imsbc = new IMSBCPosition(); + EditIMSBCDialog ebd = new EditIMSBCDialog(); + ebd.IMSBC = imsbc; + + ebd.AddClicked += () => + { + ebd.CopyValuesToEntity(); + this.haz.IMSBCPositions.Add(ebd.IMSBC); + ebd.IMSBC.HAZ = this.haz; + this.dataGridIMSBCItems.Items.Refresh(); + ebd.IMSBC = new IMSBCPosition(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (ebd.ShowDialog() ?? false) + { + imsbc.HAZ = haz; + haz.IMSBCPositions.Add(imsbc); + this.dataGridIMSBCItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + + #endregion + + #region IGC datagrid handlers + + private void DataGridIGCItems_DeleteRequested(DatabaseEntity obj) + { + IGCPosition igc = obj as IGCPosition; + if (igc != null) + { + // are you sure dialog is in base class + this.haz.IGCPositions.Remove(igc); + this.dataGridIGCItems.Items.Refresh(); + } + } + + private void DataGridIGCItems_EditRequested(DatabaseEntity obj) + { + IGCPosition igc = obj as IGCPosition; + if (igc != null) + { + EditIGCDialog eld = new EditIGCDialog(); + eld.IGC = igc; + + eld.AddClicked += () => + { + eld.CopyValuesToEntity(); + haz.IGCPositions.Add(eld.IGC); + this.dataGridIGCItems.Items.Refresh(); + eld.IGC = new IGCPosition(); + eld.IGC.HAZ = this.haz; + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (eld.ShowDialog() ?? false) + { + this.dataGridIGCItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + } + + private void DataGridIGCItems_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) + { + this.DataGridIGCItems_CreateRequested(); + } + + private void DataGridIGCItems_CreateRequested() + { + IGCPosition igc = new IGCPosition(); + EditIGCDialog ebd = new EditIGCDialog(); + ebd.IGC = igc; + + ebd.AddClicked += () => + { + ebd.CopyValuesToEntity(); + this.haz.IGCPositions.Add(ebd.IGC); + ebd.IGC.HAZ = this.haz; + this.dataGridIGCItems.Items.Refresh(); + ebd.IGC = new IGCPosition(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (ebd.ShowDialog() ?? false) + { + igc.HAZ = haz; + haz.IGCPositions.Add(igc); + this.dataGridIGCItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + + #endregion + + #region IBC datagrid handlers + + private void DataGridIBCItems_DeleteRequested(DatabaseEntity obj) + { + IBCPosition ibc = obj as IBCPosition; + if (ibc != null) + { + // are you sure dialog is in base class + this.haz.IBCPositions.Remove(ibc); + this.dataGridIBCItems.Items.Refresh(); + } + } + + private void DataGridIBCItems_EditRequested(DatabaseEntity obj) + { + IBCPosition ibc = obj as IBCPosition; + if (ibc != null) + { + EditIBCDialog eld = new EditIBCDialog(); + eld.IBC = ibc; + + eld.AddClicked += () => + { + eld.CopyValuesToEntity(); + haz.IBCPositions.Add(eld.IBC); + this.dataGridIBCItems.Items.Refresh(); + eld.IBC = new IBCPosition(); + eld.IBC.HAZ = this.haz; + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (eld.ShowDialog() ?? false) + { + this.dataGridIBCItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + } + + private void DataGridIBCItems_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) + { + this.DataGridIBCItems_CreateRequested(); + } + + private void DataGridIBCItems_CreateRequested() + { + IBCPosition ibc = new IBCPosition(); + EditIBCDialog ebd = new EditIBCDialog(); + ebd.IBC = ibc; + + ebd.AddClicked += () => + { + ebd.CopyValuesToEntity(); + this.haz.IBCPositions.Add(ebd.IBC); + ebd.IBC.HAZ = this.haz; + this.dataGridIBCItems.Items.Refresh(); + ebd.IBC = new IBCPosition(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (ebd.ShowDialog() ?? false) + { + ibc.HAZ = haz; + haz.IBCPositions.Add(ibc); + this.dataGridIBCItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + + #endregion + + #region IMDG datagrid handlers + + private void DataGridIMDGItems_DeleteRequested(DatabaseEntity obj) + { + IMDGPosition imdg = obj as IMDGPosition; + if (imdg != null) + { + // are you sure dialog is in base class + this.haz.IMDGPositions.Remove(imdg); + this.dataGridIMDGItems.Items.Refresh(); + } + } + + private void DataGridIMDGItems_EditRequested(DatabaseEntity obj) + { + IMDGPosition imdg = obj as IMDGPosition; + if (imdg != null) + { + EditIMDGDialog eld = new EditIMDGDialog(); + eld.IMDG = imdg; + + eld.AddClicked += () => + { + eld.CopyValuesToEntity(); + haz.IMDGPositions.Add(eld.IMDG); + this.dataGridIMDGItems.Items.Refresh(); + eld.IMDG = new IMDGPosition(); + eld.IMDG.HAZ = this.haz; + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (eld.ShowDialog() ?? false) + { + this.dataGridIMDGItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + } + + private void DataGridIMDGItems_AddingNewItem(object sender, System.Windows.Controls.AddingNewItemEventArgs e) + { + this.DataGridIMDGItems_CreateRequested(); + } + + private void DataGridIMDGItems_CreateRequested() + { + IMDGPosition imdg = new IMDGPosition(); + EditIMDGDialog ebd = new EditIMDGDialog(); + ebd.IMDG = imdg; + + ebd.AddClicked += () => + { + ebd.CopyValuesToEntity(); + this.haz.IMDGPositions.Add(ebd.IMDG); + ebd.IMDG.HAZ = this.haz; + this.dataGridIMDGItems.Items.Refresh(); + ebd.IMDG = new IMDGPosition(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + }; + + if (ebd.ShowDialog() ?? false) + { + imdg.HAZ = haz; + haz.IMDGPositions.Add(imdg); + this.dataGridIMDGItems.Items.Refresh(); + this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZD : Message.NotificationClass.HAZA); + } + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml index d5a12a3b..f4967ab8 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml @@ -11,7 +11,7 @@ mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="1024"> - + @@ -96,7 +96,7 @@ SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0"> - + @@ -106,7 +106,7 @@ - + @@ -117,16 +117,17 @@ - - + + + - diff --git a/ENI-2/ENI2/ENI2/EditControls/EditTOWDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditTOWDialog.xaml.cs index 86e386de..50f3d142 100644 --- a/ENI-2/ENI2/ENI2/EditControls/EditTOWDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/EditTOWDialog.xaml.cs @@ -50,6 +50,7 @@ namespace ENI2.EditControls this.textBoxRemarks.Text = this.IsDeparture ? this.TOWD.TowageOnDepartureRemarks : this.TOWA.TowageOnArrivalRemarks; this.comboBoxFlag.ItemsSource = bsmd.database.CREW.NationalityDict; this.comboBoxFlag.SelectedValue = this.IsDeparture ? this.TOWD.TowageOnDepartureFlag : this.TOWA.TowageOnArrivalFlag; + this.comboBoxFlag.KeyUp += ComboBox_KeyUp; this.doubleUpDownBeam.Value = this.IsDeparture ? this.TOWD.TowageOnDepartureBeam_MTR : this.TOWA.TowageOnArrivalBeam_MTR; this.textBoxOperatorName.Text = this.IsDeparture ? this.TOWD.TowageOnDepartureOperatorCompanyName : this.TOWA.TowageOnArrivalOperatorCompanyName; diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs index e4192837..c4e1bc18 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs +++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs @@ -671,6 +671,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Bulk cargo shipping name. + /// + public static string textBulkCargoShippingName { + get { + return ResourceManager.GetString("textBulkCargoShippingName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Bunker on arrival. /// @@ -824,6 +833,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Cargo volume. + /// + public static string textCargoVolume { + get { + return ResourceManager.GetString("textCargoVolume", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Category. + /// + public static string textCategory { + get { + return ResourceManager.GetString("textCategory", resourceCulture); + } + } + /// /// Looks up a localized string similar to Changed. /// @@ -878,6 +905,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Columns "o" of OBC Code (value 15.19). + /// + public static string textColumsOfIBC { + get { + return ResourceManager.GetString("textColumsOfIBC", resourceCulture); + } + } + /// /// Looks up a localized string similar to Comment. /// @@ -932,6 +968,51 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Container No.. + /// + public static string textContainerNo { + get { + return ResourceManager.GetString("textContainerNo", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Container position (Bay). + /// + public static string textContainerPositionBay { + get { + return ResourceManager.GetString("textContainerPositionBay", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Container position (Row). + /// + public static string textContainerPositionRow { + get { + return ResourceManager.GetString("textContainerPositionRow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Container position (Tier). + /// + public static string textContainerPositionTier { + get { + return ResourceManager.GetString("textContainerPositionTier", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Control temperature. + /// + public static string textControlTemperature { + get { + return ResourceManager.GetString("textControlTemperature", resourceCulture); + } + } + /// /// Looks up a localized string similar to Copy data. /// @@ -1022,6 +1103,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Critical safety index (CSI). + /// + public static string textCriticalSafetyIndex { + get { + return ResourceManager.GetString("textCriticalSafetyIndex", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cruise ship. /// @@ -1049,6 +1139,33 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Dangerous goods arrival. + /// + public static string textDangerousGoodsArrival { + get { + return ResourceManager.GetString("textDangerousGoodsArrival", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dangerous goods departure. + /// + public static string textDangerousGoodsDeparture { + get { + return ResourceManager.GetString("textDangerousGoodsDeparture", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dangerous goods on board. + /// + public static string textDangerousGoodsOnBoard { + get { + return ResourceManager.GetString("textDangerousGoodsOnBoard", resourceCulture); + } + } + /// /// Looks up a localized string similar to Date from. /// @@ -1157,6 +1274,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to DG manifest on board. + /// + public static string textDGManifestOnBoard { + get { + return ResourceManager.GetString("textDGManifestOnBoard", resourceCulture); + } + } + /// /// Looks up a localized string similar to Discharge. /// @@ -1247,6 +1373,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Emergency temperature. + /// + public static string textEmergencyTemperature { + get { + return ResourceManager.GetString("textEmergencyTemperature", resourceCulture); + } + } + /// /// Looks up a localized string similar to Empty. /// @@ -1328,6 +1463,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Excepted quantities. + /// + public static string textExceptedQuantities { + get { + return ResourceManager.GetString("textExceptedQuantities", resourceCulture); + } + } + /// /// Looks up a localized string similar to Exit. /// @@ -1382,6 +1526,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Flashpoint. + /// + public static string textFlashpoint { + get { + return ResourceManager.GetString("textFlashpoint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Flashpoint information. + /// + public static string textFlashpointInformation { + get { + return ResourceManager.GetString("textFlashpointInformation", resourceCulture); + } + } + /// /// Looks up a localized string similar to Full. /// @@ -1409,6 +1571,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to General cargo. + /// + public static string textGeneralCargo { + get { + return ResourceManager.GetString("textGeneralCargo", resourceCulture); + } + } + /// /// Looks up a localized string similar to General cargo description. /// @@ -1427,6 +1598,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Gross quantity. + /// + public static string textGrossQuantity { + get { + return ResourceManager.GetString("textGrossQuantity", resourceCulture); + } + } + /// /// Looks up a localized string similar to Gross tonnage. /// @@ -1454,6 +1634,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to IBC item. + /// + public static string textIBCItem { + get { + return ResourceManager.GetString("textIBCItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IBC items. + /// + public static string textIBCItems { + get { + return ResourceManager.GetString("textIBCItems", resourceCulture); + } + } + /// /// Looks up a localized string similar to ID doc. number. /// @@ -1472,6 +1670,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Identifier. + /// + public static string textIdentifier { + get { + return ResourceManager.GetString("textIdentifier", resourceCulture); + } + } + /// /// Looks up a localized string similar to Identity card. /// @@ -1481,6 +1688,42 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to IGC item. + /// + public static string textIGCItem { + get { + return ResourceManager.GetString("textIGCItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IGC items. + /// + public static string textIGCItems { + get { + return ResourceManager.GetString("textIGCItems", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IMDG item. + /// + public static string textIMDGItem { + get { + return ResourceManager.GetString("textIMDGItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IMDG items. + /// + public static string textIMDGItems { + get { + return ResourceManager.GetString("textIMDGItems", resourceCulture); + } + } + /// /// Looks up a localized string similar to IMO number. /// @@ -1490,6 +1733,42 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to IMO class / division / (compatibility group). + /// + public static string textIMOClassDivision { + get { + return ResourceManager.GetString("textIMOClassDivision", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IMO class / subclass. + /// + public static string textIMOClassSubclass { + get { + return ResourceManager.GetString("textIMOClassSubclass", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IMSBC item. + /// + public static string textIMSBCItem { + get { + return ResourceManager.GetString("textIMSBCItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IMSBC items. + /// + public static string textIMSBCItems { + get { + return ResourceManager.GetString("textIMSBCItems", resourceCulture); + } + } + /// /// Looks up a localized string similar to Incoming journey to port of call - ETA NOK. /// @@ -1760,6 +2039,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Limited quantity. + /// + public static string textLimitedQuantity { + get { + return ResourceManager.GetString("textLimitedQuantity", resourceCulture); + } + } + /// /// Looks up a localized string similar to Loading. /// @@ -1868,6 +2156,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Marine pollutant. + /// + public static string textMarinePollutant { + get { + return ResourceManager.GetString("textMarinePollutant", resourceCulture); + } + } + /// /// Looks up a localized string similar to Maritime health declaration. /// @@ -1877,6 +2174,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to MARPOL Annex I item. + /// + public static string textMARPOLItem { + get { + return ResourceManager.GetString("textMARPOLItem", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MARPOL Annex I items. + /// + public static string textMARPOLItems { + get { + return ResourceManager.GetString("textMARPOLItems", resourceCulture); + } + } + /// /// Looks up a localized string similar to Master. /// @@ -1886,6 +2201,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Material hazardous only in bulk. + /// + public static string textMaterialHazard { + get { + return ResourceManager.GetString("textMaterialHazard", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Max acitivity. + /// + public static string textMaxActivity { + get { + return ResourceManager.GetString("textMaxActivity", resourceCulture); + } + } + /// /// Looks up a localized string similar to Maritime health declaration. /// @@ -1913,6 +2246,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to MoU Baltic RoRo vessel. + /// + public static string textMoUBalticRoRo { + get { + return ResourceManager.GetString("textMoUBalticRoRo", resourceCulture); + } + } + /// /// Looks up a localized string similar to Muster book. /// @@ -1949,6 +2291,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Net explosive mass. + /// + public static string textNetExplosiveMass { + get { + return ResourceManager.GetString("textNetExplosiveMass", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Net quantity. + /// + public static string textNetQuantity { + get { + return ResourceManager.GetString("textNetQuantity", resourceCulture); + } + } + /// /// Looks up a localized string similar to Create new id. /// @@ -2003,6 +2363,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Number of packages. + /// + public static string textNumberOfPackages { + get { + return ResourceManager.GetString("textNumberOfPackages", resourceCulture); + } + } + /// /// Looks up a localized string similar to Operations. /// @@ -2057,6 +2426,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Package type. + /// + public static string textPackageType { + get { + return ResourceManager.GetString("textPackageType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Packing group. + /// + public static string textPackingGroup { + get { + return ResourceManager.GetString("textPackingGroup", resourceCulture); + } + } + /// /// Looks up a localized string similar to Passenger. /// @@ -2192,6 +2579,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Pollution category. + /// + public static string textPollutionCategory { + get { + return ResourceManager.GetString("textPollutionCategory", resourceCulture); + } + } + /// /// Looks up a localized string similar to Port area. /// @@ -2264,6 +2660,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Port of discharge. + /// + public static string textPortOfDischarge { + get { + return ResourceManager.GetString("textPortOfDischarge", resourceCulture); + } + } + /// /// Looks up a localized string similar to Port of disembarkation. /// @@ -2300,6 +2705,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Port of loading. + /// + public static string textPortOfLoading { + get { + return ResourceManager.GetString("textPortOfLoading", resourceCulture); + } + } + /// /// Looks up a localized string similar to Port of registry. /// @@ -2354,6 +2768,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Product name. + /// + public static string textProductName { + get { + return ResourceManager.GetString("textProductName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Proper shipping name. + /// + public static string textProperShippingName { + get { + return ResourceManager.GetString("textProperShippingName", resourceCulture); + } + } + /// /// Looks up a localized string similar to PSC 72h. /// @@ -2372,6 +2804,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Quantity. + /// + public static string textQuantity { + get { + return ResourceManager.GetString("textQuantity", resourceCulture); + } + } + /// /// Looks up a localized string similar to Check status. /// @@ -2399,6 +2840,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Radionuclide name. + /// + public static string textRadioNuclideName { + get { + return ResourceManager.GetString("textRadioNuclideName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Reason for invalid ISSC. /// @@ -2462,6 +2912,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Risks. + /// + public static string textRisks { + get { + return ResourceManager.GetString("textRisks", resourceCulture); + } + } + /// /// Looks up a localized string similar to Sanitary control exemption or certificate on board?. /// @@ -2813,6 +3272,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Stowage position. + /// + public static string textStowagePosition { + get { + return ResourceManager.GetString("textStowagePosition", resourceCulture); + } + } + /// /// Looks up a localized string similar to Stowaways on board. /// @@ -2849,6 +3317,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Subsidiary risks. + /// + public static string textSubsidiaryRisk { + get { + return ResourceManager.GetString("textSubsidiaryRisk", resourceCulture); + } + } + /// /// Looks up a localized string similar to Border police. /// @@ -2921,6 +3398,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Technical name. + /// + public static string textTechnicalName { + get { + return ResourceManager.GetString("textTechnicalName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Ticket No. /// @@ -2984,6 +3470,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Transport index. + /// + public static string textTransportIndex { + get { + return ResourceManager.GetString("textTransportIndex", resourceCulture); + } + } + /// /// Looks up a localized string similar to Transport mode. /// @@ -3011,6 +3506,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to UN number. + /// + public static string textUNNumber { + get { + return ResourceManager.GetString("textUNNumber", resourceCulture); + } + } + /// /// Looks up a localized string similar to Username. /// @@ -3056,6 +3560,24 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Vehicle licence plate. + /// + public static string textVehicleLicensePlate { + get { + return ResourceManager.GetString("textVehicleLicensePlate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Vessel class. + /// + public static string textVesselClass { + get { + return ResourceManager.GetString("textVesselClass", resourceCulture); + } + } + /// /// Looks up a localized string similar to Vessel name. /// diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx index 487c37d2..69c8448b 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.resx +++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx @@ -1165,4 +1165,178 @@ Towage on departure + + Bulk cargo shipping name + + + Cargo volume + + + Category + + + Columns "o" of OBC Code (value 15.19) + + + Container No. + + + Container position (Bay) + + + Container position (Row) + + + Container position (Tier) + + + Control temperature + + + Critical safety index (CSI) + + + Dangerous goods arrival + + + Dangerous goods departure + + + Dangerous goods on board + + + DG manifest on board + + + Emergency temperature + + + Excepted quantities + + + Flashpoint + + + Flashpoint information + + + General cargo + + + Gross quantity + + + IBC items + + + IGC items + + + IMDG items + + + IMO class / division / (compatibility group) + + + IMO class / subclass + + + IMSBC items + + + Limited quantity + + + Marine pollutant + + + MARPOL Annex I items + + + Material hazardous only in bulk + + + Max acitivity + + + MoU Baltic RoRo vessel + + + Net explosive mass + + + Net quantity + + + Number of packages + + + Package type + + + Packing group + + + Pollution category + + + Port of discharge + + + Port of loading + + + Product name + + + Proper shipping name + + + Quantity + + + Radionuclide name + + + Risks + + + Stowage position + + + Subsidiary risks + + + Technical name + + + Transport index + + + UN number + + + Vehicle licence plate + + + Vessel class + + + Identifier + + + IBC item + + + IGC item + + + IMDG item + + + IMSBC item + + + MARPOL Annex I item + \ 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 74d0921d..4fcb3db6 100644 --- a/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs +++ b/ENI-2/ENI2/ENI2/Util/GlobalStructures.cs @@ -31,7 +31,7 @@ namespace ENI2.Util Properties.Resources.textOtherLegalIdentityDocument }; - public static string[] ShipSecurityLevels = { "1", "2", "3" }; + public static byte[] ShipSecurityLevels = { 1, 2, 3 }; public static string[] edifact8025Codes = { @@ -61,6 +61,42 @@ namespace ENI2.Util "Waste disposal" }; + public static string[] vesselClasses = + { + "INF1", + "INF2", + "INF3" + }; + + public static string[] packingGroups = + { + "NONE", + "I", + "II", + "III" + }; + + public static string[] pollutionCategories = + { + "X", + "Y", + "Z", + "OS" + }; + + public static string[] hazards = + { + "P", + "S", + "S/P" + }; + + public static string[] flashpointInformations = + { + "Not flammable", + "Above 60°", + "Less than 60°" + }; public static List EdiCodes { diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index 1845ae11..34441a54 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs index 04cfeb8e..761869f7 100644 --- a/nsw/Source/bsmd.ExcelReadService/Util.cs +++ b/nsw/Source/bsmd.ExcelReadService/Util.cs @@ -2201,12 +2201,12 @@ namespace bsmd.ExcelReadService } crew.CrewMemberLastName = lastName; - reader.Conf.ConfirmText(crewLastName, lastName, crew.CrewMemberLastName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewLastName, lastName, crew.CrewMemberLastName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberFirstName = firstName; - reader.Conf.ConfirmText(crewFirstName, crew.CrewMemberFirstName, crew.CrewMemberFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewFirstName, crew.CrewMemberFirstName, crew.CrewMemberFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberGender = reader.ReadGender(crewGender); crew.CrewMemberDuty = reader.ReadText(crewDuty); - reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberNationality = reader.ReadNationality(crewNationality); crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth); @@ -2216,10 +2216,10 @@ namespace bsmd.ExcelReadService crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType); crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId); - reader.Conf.ConfirmText(crewIdentDocId, crew.CrewMemberIdentityDocumentId, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewIdentDocId, crew.CrewMemberIdentityDocumentId, crew.CrewMemberIdentityDocumentId.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberVisaNumber = reader.ReadText(crewVisaNo); - reader.Conf.ConfirmText(crewVisaNo, crew.CrewMemberVisaNumber, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewVisaNo, crew.CrewMemberVisaNumber, crew.CrewMemberVisaNumber.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); } } @@ -2253,12 +2253,12 @@ namespace bsmd.ExcelReadService crew.IsDeparture = true; crew.CrewMemberLastName = lastName; - reader.Conf.ConfirmText(crewLastName, lastName, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewLastName, lastName, lastName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberFirstName = reader.ReadText(crewFirstName); reader.Conf.ConfirmText(crewFirstName, crew.CrewMemberFirstName, crew.CrewMemberFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberGender = reader.ReadGender(crewGender); crew.CrewMemberDuty = reader.ReadText(crewDuty); - reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, crew.CrewMemberDuty.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberNationality = reader.ReadNationality(crewNationality); crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth); @@ -2268,10 +2268,10 @@ namespace bsmd.ExcelReadService crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType); crew.CrewMemberIdentityDocumentId = reader.ReadText(crewIdentDocId); - reader.Conf.ConfirmText(crewIdentDocId, crew.CrewMemberIdentityDocumentId, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewIdentDocId, crew.CrewMemberIdentityDocumentId, crew.CrewMemberIdentityDocumentId.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); crew.CrewMemberVisaNumber = reader.ReadText(crewVisaNo); - reader.Conf.ConfirmText(crewVisaNo, crew.CrewMemberVisaNumber, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(crewVisaNo, crew.CrewMemberVisaNumber, crew.CrewMemberVisaNumber.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); } } @@ -2316,25 +2316,25 @@ namespace bsmd.ExcelReadService } pas.PassengerLastName = lastName; - reader.Conf.ConfirmText(pasLastName, lastName, lastName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasLastName, lastName, lastName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerFirstName = firstName; - reader.Conf.ConfirmText(pasFirstName, pas.PassengerFirstName, pas.PassengerFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasFirstName, pas.PassengerFirstName, pas.PassengerFirstName.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerGender = reader.ReadGender(pasGender); pas.PassengerNationality = reader.ReadNationality(pasNationality); // TODO: Nicht klar ob hier LOCODEs kommen oder nicht pas.PassengerPortOfEmbarkation = reader.ReadTextNoWhitespace(pasEmbarkation); - reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, pas.PassengerPortOfEmbarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerPortOfDisembarkation = reader.ReadTextNoWhitespace(pasDebarkation); - reader.Conf.ConfirmText(pasDebarkation, pas.PassengerPortOfDisembarkation, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasDebarkation, pas.PassengerPortOfDisembarkation, pas.PassengerPortOfDisembarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerInTransit = reader.ReadBoolean(pasTransit); pas.PassengerPlaceOfBirth = reader.ReadText(pasPlaceOfBirth); - reader.Conf.ConfirmText(pasPlaceOfBirth, pas.PassengerPlaceOfBirth, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasPlaceOfBirth, pas.PassengerPlaceOfBirth, pas.PassengerPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL: ExcelReader.ReadState.OK); pas.PassengerDateOfBirth = reader.ReadBirthDate(pasDateOfBirth); pas.PassengerIdentityDocumentType = reader.ReadIdentityDocumentType(pasIdentDocType); pas.PassengerIdentityDocumentId = reader.ReadText(pasIdentDocId); - reader.Conf.ConfirmText(pasIdentDocId, pas.PassengerIdentityDocumentId, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasIdentDocId, pas.PassengerIdentityDocumentId, pas.PassengerIdentityDocumentId.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerVisaNumber = reader.ReadText(pasVisaNo); - reader.Conf.ConfirmText(pasVisaNo, pas.PassengerVisaNumber, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasVisaNo, pas.PassengerVisaNumber, pas.PassengerVisaNumber.IsNullOrEmpty() ? ExcelReader.ReadState.WARN :ExcelReader.ReadState.OK); } } @@ -2377,18 +2377,18 @@ namespace bsmd.ExcelReadService pas.PassengerNationality = reader.ReadNationality(pasNationality); // TODO: Nicht klar ob hier LOCODEs kommen oder nicht pas.PassengerPortOfEmbarkation = reader.ReadTextNoWhitespace(pasEmbarkation); - reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasEmbarkation, pas.PassengerPortOfEmbarkation, pas.PassengerPortOfEmbarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerPortOfDisembarkation = reader.ReadTextNoWhitespace(pasDebarkation); - reader.Conf.ConfirmText(pasDebarkation, pas.PassengerPortOfDisembarkation, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasDebarkation, pas.PassengerPortOfDisembarkation, pas.PassengerPortOfDisembarkation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerInTransit = reader.ReadBoolean(pasTransit); pas.PassengerPlaceOfBirth = reader.ReadText(pasPlaceOfBirth); - reader.Conf.ConfirmText(pasPlaceOfBirth, pas.PassengerPlaceOfBirth, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasPlaceOfBirth, pas.PassengerPlaceOfBirth, pas.PassengerPlaceOfBirth.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerDateOfBirth = reader.ReadBirthDate(pasDateOfBirth); pas.PassengerIdentityDocumentType = reader.ReadIdentityDocumentType(pasIdentDocType); pas.PassengerIdentityDocumentId = reader.ReadText(pasIdentDocId); - reader.Conf.ConfirmText(pasIdentDocId, pas.PassengerIdentityDocumentId, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasIdentDocId, pas.PassengerIdentityDocumentId, pas.PassengerIdentityDocumentId.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK); pas.PassengerVisaNumber = reader.ReadText(pasVisaNo); - reader.Conf.ConfirmText(pasVisaNo, pas.PassengerVisaNumber, ExcelReader.ReadState.OK); + reader.Conf.ConfirmText(pasVisaNo, pas.PassengerVisaNumber, pas.PassengerVisaNumber.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK); } } @@ -2715,21 +2715,7 @@ namespace bsmd.ExcelReadService return result; } - #endregion - - /* - private static DateTime ConstructDate(string etaDateString, string etaTime) - { - DateTime result = DateTime.Now; - if (DateTime.TryParse(etaDateString, out result)) - { - TimeSpan sp; - if (TimeSpan.TryParse(etaTime, out sp)) - result += sp; - } - return result; - } - */ + #endregion #region GetMessageWithType diff --git a/nsw/Source/bsmd.database/IMDGPosition.cs b/nsw/Source/bsmd.database/IMDGPosition.cs index 54aa095b..6d5732fb 100644 --- a/nsw/Source/bsmd.database/IMDGPosition.cs +++ b/nsw/Source/bsmd.database/IMDGPosition.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; +using System.Text; namespace bsmd.database { @@ -154,6 +155,74 @@ namespace bsmd.database public List SubsidiaryRiskList { get { return this.subsidiaryRisksList; } } + /// + /// Hilfsproperty, um subsidiary risks als kommaseparierte Liste anzuzeigen (ENI-2) + /// + public string SubsidiaryRiskText + { + get + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < this.subsidiaryRisksList.Count; i++) + { + if (i > 0) + sb.Append(", "); + sb.Append(this.subsidiaryRisksList[i].SubsidiaryRisk); + } + return sb.ToString(); + } + set + { + if (value.IsNullOrEmpty()) + { + foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList) + DBManager.Instance.Delete(sr); + this.SubsidiaryRiskList.Clear(); + } + else + { + string[] risks = value.Split(','); + List foundList = new List(); + + for (int i = 0; i < risks.Length; i++) + { + string risk = risks[i].Trim(); + if (risk.Length > 0) + { + SubsidiaryRisks matchingRisk = null; + foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList) + { + if (sr.SubsidiaryRisk.Equals(risk, StringComparison.OrdinalIgnoreCase)) + { + matchingRisk = sr; + break; + } + } + if (matchingRisk != null) + { + foundList.Add(matchingRisk); + this.SubsidiaryRiskList.Remove(matchingRisk); + } + else + { + SubsidiaryRisks newRisk = new SubsidiaryRisks(); + newRisk.IMDGPosition = this; + newRisk.SubsidiaryRisk = risk; + foundList.Add(newRisk); + } + } + } + + // remove remaining risk (no longer valid) + foreach (SubsidiaryRisks remainingRisk in this.SubsidiaryRiskList) + DBManager.Instance.Delete(remainingRisk); + this.subsidiaryRisksList.Clear(); + // add existing and new risk + this.subsidiaryRisksList.AddRange(foundList); + } + } + } + public string Identifier { get; set; } #endregion diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index ddac88d7..49a5bc15 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.6.7")] +[assembly: AssemblyInformationalVersion("3.6.8")] [assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index 66df411b..41122445 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("3.6.7.*")] +[assembly: AssemblyVersion("3.6.8.*")] diff --git a/nsw/Source/bsmd.database/Waste.cs b/nsw/Source/bsmd.database/Waste.cs index 4090bbcc..8a744757 100644 --- a/nsw/Source/bsmd.database/Waste.cs +++ b/nsw/Source/bsmd.database/Waste.cs @@ -75,6 +75,14 @@ namespace bsmd.database } } } + + public string WasteTypeDisplayGrid + { + get + { + return string.Format("{0} {1}", WasteType, WasteTypeDisplayV4); + } + } [Validation(ValidationCode.NOT_NULL)] public int? WasteType { get; set; } @@ -160,6 +168,7 @@ namespace bsmd.database break; } + query += " ORDER BY WasteType"; cmd.CommandText = query; }