diff --git a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs index 9611f6aa..5e0300bc 100644 --- a/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs +++ b/ENI-2/ENI2/ENI2/Controls/ENIDataGrid.cs @@ -68,6 +68,7 @@ namespace ENI2.Controls { this.MouseDoubleClick += dataGrid_MouseDoubleClick; + this.PreviewKeyDown += ENIDataGrid_PreviewKeyDown; this.ContextMenu = new ContextMenu(); this.CanUserAddRows = false; @@ -112,6 +113,16 @@ namespace ENI2.Controls } + private void ENIDataGrid_PreviewKeyDown(object sender, KeyEventArgs e) + { + if(sender is ENIDataGrid) + { + var grid = sender as ENIDataGrid; + if (Key.Delete == e.Key) + this.deleteItem(null, null); + } + } + #region public public DataGridRow GetRow(int index) diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 16fd4f11..5c0f6c0a 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -94,6 +94,24 @@ namespace ENI2 #endregion + #region public methods + + public void CoreChanged(MessageCore newCore) + { + this._core = newCore; + Application.Current.Dispatcher.Invoke(delegate + { + if(controlCache.ContainsKey(Properties.Resources.textOverview)) + { + OverViewDetailControl ovdc = controlCache[Properties.Resources.textOverview] as OverViewDetailControl; + ovdc.Core = newCore; + ovdc.UpdateCore(); + } + }); + } + + #endregion + #region class MessageGroup /// diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index 324202e2..f908c96b 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -373,7 +373,16 @@ namespace ENI2.DetailViewControls { MessageBox.Show("Reporting party empty, cannot show locked by!", "Notification", MessageBoxButton.OK, MessageBoxImage.Error); } - } + } + + public void UpdateCore() + { + this.textBoxDisplayId.DataContext = null; + this.textBoxDisplayId.DataContext = this.Core; + this.labelBSMDStatusInternal.DataContext = null; + this.labelBSMDStatusInternal.DataContext = this.Core; + MessageBox.Show("Visit/Transit ID updated!"); + } #endregion diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml index ff7f0fdd..3d1481eb 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml @@ -93,7 +93,7 @@ + AutoGenerateColumns="False" Margin="0,5,0,0"> diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs index 09716051..65c18c31 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs @@ -327,6 +327,10 @@ namespace ENI2.DetailViewControls this.comboBoxISSCType.IsEnabled = enable; this.datePickerISSCDateOfExpiration.IsEnabled = enable; + + this.dataGridLast10PortFacilities.IsEnabled = enable; + this.dataGridShip2ShipActivities.IsEnabled = enable; + } #endregion diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index fbf09ba8..e67ed48e 100644 --- a/ENI-2/ENI2/ENI2/ENI2.csproj +++ b/ENI-2/ENI2/ENI2/ENI2.csproj @@ -36,7 +36,7 @@ true publish.html 1 - 3.8.9.%2a + 3.8.10.%2a false true true diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs index 2b6bf2ee..ac7bc136 100644 --- a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs +++ b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs @@ -66,6 +66,7 @@ namespace ENI2 this.mainPanel.LayoutTransform = this._transform; this._dbWatchDog = new DatabaseEntityWatchdog(); this._dbWatchDog.DatabaseEntityChanged += _dbWatchDog_DatabaseEntityChanged; + this._dbWatchDog.VisitTransitIdUpdated += _dbWatchDog_VisitTransitIdUpdated; App.SplashScreen.ShowMessage("done"); Thread.Sleep(500); App.SplashScreen.LoadComplete(); @@ -461,6 +462,23 @@ namespace ENI2 } } + private void _dbWatchDog_VisitTransitIdUpdated(DatabaseEntity entity) + { + MessageCore changedCore = entity as MessageCore; + if (changedCore != null) + { + TabItem tabitem = this.openTabs[changedCore.Id.Value]; + this.Dispatcher.BeginInvoke(new Action(() => + { + DetailRootControl drc = tabitem.Content as DetailRootControl; + if (drc != null) + { + drc.CoreChanged(changedCore); + } + })); + } + } + #endregion #region mouse wheel / zooming events diff --git a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs index 00039679..89ae909f 100644 --- a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs +++ b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs @@ -21,6 +21,7 @@ namespace ENI2.Util public delegate void DatabaseEntityChangedHandler (DatabaseEntity entity); public event DatabaseEntityChangedHandler DatabaseEntityChanged; + public event DatabaseEntityChangedHandler VisitTransitIdUpdated; public DatabaseEntityWatchdog() { @@ -45,6 +46,24 @@ namespace ENI2.Util OnDatabaseEntityChanged(entity); changedCores.Add(entity); } + + if(entity.IsTransit) + { + if (!entity.TransitId.Equals(watchedEntity.TransitId)) + { + OnVisitTransitIdUpdated(entity); + watchedEntity.TransitId = entity.TransitId; + } + } + else + { + if (!entity.VisitId.Equals(watchedEntity.VisitId)) + { + OnVisitTransitIdUpdated(entity); + watchedEntity.VisitId = entity.VisitId; + } + } + } } @@ -85,6 +104,11 @@ namespace ENI2.Util this.DatabaseEntityChanged?.Invoke(entity); } + protected void OnVisitTransitIdUpdated(DatabaseEntity entity) + { + this.VisitTransitIdUpdated?.Invoke(entity); + } + #endregion } diff --git a/nsw/Source/bsmd.database/NOA_NOD.cs b/nsw/Source/bsmd.database/NOA_NOD.cs index 1dd39e66..33cb211d 100644 --- a/nsw/Source/bsmd.database/NOA_NOD.cs +++ b/nsw/Source/bsmd.database/NOA_NOD.cs @@ -220,11 +220,11 @@ namespace bsmd.database { if(this.ETDFromPortOfCall.HasValue && this.ETAToPortOfCall.HasValue && (this.ETDFromPortOfCall < this.ETAToPortOfCall)) - errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromPortOfCall", this.ETDFromPortOfCall.ToString(), this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromPortOfCall", this.ETDFromPortOfCall.ToString(), this.Title, this.Tablename)); if(this.CallPurposes.IsNullOrEmpty()) { - errors.Add(RuleEngine.CreateError(ValidationCode.LIST_EMPTY, null, "CallPurpose", this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.LIST_EMPTY, null, "CallPurpose", this.Title, this.Tablename)); } } @@ -232,24 +232,24 @@ namespace bsmd.database { if (this.ETDFromKielCanal.HasValue && this.ETAToKielCanal.HasValue && (this.ETDFromKielCanal < this.ETAToKielCanal)) - errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromKielCanal", this.ETDFromKielCanal.ToString(), this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromKielCanal", this.ETDFromKielCanal.ToString(), this.Title, this.Tablename)); } if((this.LastPort != null) && !this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETDFromLastPort", null, this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETDFromLastPort", null, this.Title, this.Tablename)); if((this.LastPort != null) && this.LastPort.Equals("ZZUKN") && this.ETDFromLastPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "ETDFromLastPort", null, this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETDFromLastPort", null, this.Title, this.Tablename)); if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue && this.ETAToNextPort < ETDFromPortOfCall) - errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETAToNextPort", null, this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETAToNextPort", null, this.Title, this.Tablename)); if ((this.NextPort != null) && !this.NextPort.Equals("ZZUKN") && !this.ETAToNextPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETAToNextPort", null, this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETAToNextPort", null, this.Title, this.Tablename)); if((this.NextPort != null) && this.NextPort.Equals("ZZUKN") && this.ETAToNextPort.HasValue) - errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "ETAToNextPort", null, this.Title, null)); + errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETAToNextPort", null, this.Title, this.Tablename)); } diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 9bb96f47..923b2e0c 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.8.9")] +[assembly: AssemblyInformationalVersion("3.8.10")] [assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")] [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 12da5502..e2cf4434 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.8.9.*")] +[assembly: AssemblyVersion("3.8.10.*")] diff --git a/nsw/Source/bsmd.database/ValidationAttribute.cs b/nsw/Source/bsmd.database/ValidationAttribute.cs index 47ef27b0..09b23eb7 100644 --- a/nsw/Source/bsmd.database/ValidationAttribute.cs +++ b/nsw/Source/bsmd.database/ValidationAttribute.cs @@ -31,6 +31,7 @@ namespace bsmd.database STRING_EXACT_LEN, LIST_EMPTY, IMPLAUSIBLE, + IMPLAUSIBLE_ZZUKN, POSITION_COUNT = 22, STRING_UNNUMBER = 23, STRING_IMOCLASS = 24, diff --git a/nsw/Source/bsmd.database/WAS.cs b/nsw/Source/bsmd.database/WAS.cs index 507d612c..6db8af81 100644 --- a/nsw/Source/bsmd.database/WAS.cs +++ b/nsw/Source/bsmd.database/WAS.cs @@ -23,7 +23,7 @@ namespace bsmd.database private ObservableCollection waste = new ObservableCollection(); private static readonly int[] dkWasteCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2300, 2309, 3000, 5100, 5200, 5300, 2300 }; - private static readonly int[] requiredCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2313, 2309, 3000, 5100, 5200, 5300 }; + private static readonly int[] requiredCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2309, 3000, 5100, 5200, 5300 }; private static readonly string[] dkWasteTypes = { "Waste oils - Sludge", "Waste oils - Bilge water", "Waste oils - Other", "Garbage - Food waste", "Garbage - Plastic", "Garbage - Other", "Garbage - Other - Cooking oil", "Garbage - Other - Incinerator ashes and clinkers", "Operational wastes", "Garbage - Other", "Garbage - Other - Animal carcasses", "Sewage", "Cargo residues - Marpol Annex I - Other", "Cargo residues - Marpol Annex II - Other", "Cargo residues - Marpol Annex V - Other", "Garbage - Other" }; private static readonly string[] requiredTypes = { "Oily Residues (sludge)", "Oily Bilge Water", "Waste oil - others (specify)", "Food waste", "Plastics", "Domestic wastes", "Cooking oil", "Incinerator ashes", "Operational wastes", "Animal carcass(es)", "Sewage", "Cargo residues - Marpol Annex I", "Cargo residues - Marpol Annex II", "Cargo residues - Marpol Annex V" };