diff --git a/CoreDeleteTool/App.config b/CoreDeleteTool/App.config index cac142d6..b967fdd4 100644 --- a/CoreDeleteTool/App.config +++ b/CoreDeleteTool/App.config @@ -6,7 +6,7 @@ - + diff --git a/CoreDeleteTool/CoreDeleteTool.csproj b/CoreDeleteTool/CoreDeleteTool.csproj index 09b4a4c2..292d9e4d 100644 --- a/CoreDeleteTool/CoreDeleteTool.csproj +++ b/CoreDeleteTool/CoreDeleteTool.csproj @@ -9,7 +9,7 @@ Properties CoreDeleteTool CoreDeleteTool - v4.5 + v4.8 512 true @@ -80,6 +80,7 @@ True Resources.resx + True SettingsSingleFileGenerator diff --git a/CoreDeleteTool/Main.cs b/CoreDeleteTool/Main.cs index 1311e32c..c6e75e9e 100644 --- a/CoreDeleteTool/Main.cs +++ b/CoreDeleteTool/Main.cs @@ -8,7 +8,8 @@ namespace CoreDeleteTool { public partial class Main : Form { - SortableBindingList messageCores = new SortableBindingList(); + + private readonly SortableBindingList messageCores = new SortableBindingList(); public Main() { @@ -49,8 +50,7 @@ namespace CoreDeleteTool for (int i = 0; i < this.dataGridView.SelectedRows.Count; i++) { - MessageCore selectedCore = this.dataGridView.SelectedRows[i].DataBoundItem as MessageCore; - if (selectedCore != null) + if (this.dataGridView.SelectedRows[i].DataBoundItem is MessageCore selectedCore) { DBManager.Instance.DeleteCore(selectedCore); this.messageCores.Remove(selectedCore); diff --git a/CoreDeleteTool/Properties/Resources.Designer.cs b/CoreDeleteTool/Properties/Resources.Designer.cs index 139fb477..576b51f9 100644 --- a/CoreDeleteTool/Properties/Resources.Designer.cs +++ b/CoreDeleteTool/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace CoreDeleteTool.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/CoreDeleteTool/Properties/Settings.Designer.cs b/CoreDeleteTool/Properties/Settings.Designer.cs index 9d5cddf2..45b61c4c 100644 --- a/CoreDeleteTool/Properties/Settings.Designer.cs +++ b/CoreDeleteTool/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace CoreDeleteTool.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/CoreDeleteTool/application_delete.ico b/CoreDeleteTool/application_delete.ico new file mode 100644 index 00000000..5317eaa3 Binary files /dev/null and b/CoreDeleteTool/application_delete.ico differ diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index 72deed89..71480c7b 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -14,6 +14,7 @@ using ENI2.DetailViewControls; using ENI2.Util; using ENI2.EditControls; +using System.Windows.Input; namespace ENI2 { @@ -135,14 +136,31 @@ namespace ENI2 this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" }); - this.listBoxMessages.ItemsSource = this._listBoxList; - + this.listBoxMessages.ItemsSource = this._listBoxList; + _messages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(Core, DBManager.MessageLoad.ALL); List missingMessages = bsmd.database.Util.CreateMessagesForCore(Core, _messages, this.LockedBy); _messages.AddRange(missingMessages); BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock); - Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0)); + Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0)); + + RoutedCommand saveCmd = new RoutedCommand(); + saveCmd.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control)); + CommandBindings.Add(new CommandBinding(saveCmd, this.buttonSave_Click)); + + RoutedCommand saveAllCmd = new RoutedCommand(); + saveAllCmd.InputGestures.Add(new KeyGesture(Key.A, ModifierKeys.Control)); + CommandBindings.Add(new CommandBinding(saveAllCmd, this.buttonSaveAll_Click)); + + RoutedCommand reloadCmd = new RoutedCommand(); + reloadCmd.InputGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control)); + CommandBindings.Add(new CommandBinding(reloadCmd, this.ShortCutReload)); + + RoutedCommand validateCmd = new RoutedCommand(); + validateCmd.InputGestures.Add(new KeyGesture(Key.F, ModifierKeys.Control)); + CommandBindings.Add(new CommandBinding(validateCmd, this.ShortCutValidate)); + } #endregion @@ -541,6 +559,16 @@ namespace ENI2 } */ + private void ShortCutReload(object sender, ExecutedRoutedEventArgs e) + { + this.DetailControl_RequestReload(this.Core.Id.Value); + } + + private void ShortCutValidate(object sender, ExecutedRoutedEventArgs e) + { + this.DetailControl_RequestValidate(); + } + private void DetailControl_RequestReload(Guid id) { /// core und messages neu laden diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index e3825e8f..c4c0d1e3 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 3 - 7.3.0.3 + 2 + 7.4.0.2 false true true @@ -84,7 +84,7 @@ - 9B5725EAD90F2E06094631407417EB2554E88941 + 62DE8527C377957850DB503DA52FF66F664BD459 true diff --git a/ENI2/Excel/ExcelComparer.cs b/ENI2/Excel/ExcelComparer.cs index 99eea7e0..9848fb9d 100644 --- a/ENI2/Excel/ExcelComparer.cs +++ b/ENI2/Excel/ExcelComparer.cs @@ -27,11 +27,20 @@ namespace ENI2.Excel { try { + // sheet.Columns.ClearFormats(); + // sheet.Rows.ClearFormats(); + Range usedRange = sheet.UsedRange; + lastUsedRow = usedRange.Rows.Count; + lastUsedColumn = usedRange.Columns.Count; + + /* Range last = sheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing); Range range = sheet.get_Range("A1", last); lastUsedRow = last.Row; lastUsedColumn = last.Column; + */ + return true; } catch(Exception) diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index 0e30232a..c2a4d28e 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -982,6 +982,9 @@ namespace ENI2.Excel } } + if (!stat.Flag.IsNullOrEmpty()) stat.Flag = stat.Flag.ToUpper(); + if (!stat.PortOfRegistry.IsNullOrEmpty()) stat.PortOfRegistry = stat.PortOfRegistry.ToUpper(); + stat.MMSINumber = reader.ReadTextNoWhitespace("STAT.MMSINumber"); stat.CallSign = reader.ReadTextNoWhitespace("STAT.CallSign"); stat.ISMCompanyId = reader.ReadTextNoWhitespace("STAT.ISMCompanyId"); diff --git a/ENI2/MainWindow.xaml.cs b/ENI2/MainWindow.xaml.cs index 483bc33a..3e2c9fb5 100644 --- a/ENI2/MainWindow.xaml.cs +++ b/ENI2/MainWindow.xaml.cs @@ -135,7 +135,7 @@ namespace ENI2 { Dispatcher.BeginInvoke((Action)(() => this.mainFrame.SelectedItem = openTabs[aMessageCore.Id.Value])); } - } + } } private void Drc_ReloadCoreRequested(Guid obj) diff --git a/bsmd.database/DBManager.cs b/bsmd.database/DBManager.cs index 94603d3c..a37ceff9 100644 --- a/bsmd.database/DBManager.cs +++ b/bsmd.database/DBManager.cs @@ -792,6 +792,31 @@ namespace bsmd.database } } } + + // Stupid workaround to find HAZA's that are attached to a HAZD message header + if(message.MessageNotificationClass == Message.NotificationClass.HAZD) + { + using (SqlCommand cmd2 = new SqlCommand()) + { + DatabaseEntity dummyHAZA = DBManager.CreateMessage(Message.NotificationClass.HAZA); + + if (dummyHAZA != null) + { + dummyHAZA.PrepareLoadCommand(cmd2, Message.LoadFilter.MESSAGEHEADER, message.Id); + SqlDataReader reader = this.PerformCommand(cmd2); + if (reader != null) + { + List statList = dummyHAZA.LoadList(reader); + foreach (DatabaseEntity derivedMessage in statList) + { + message.Elements.Add(derivedMessage); + derivedMessage.MessageHeader = message; + this.LoadDependingLists(derivedMessage); + } + } + } + } + } } } } diff --git a/bsmd.database/Properties/AssemblyProductInfo.cs b/bsmd.database/Properties/AssemblyProductInfo.cs index ee133160..755d98db 100644 --- a/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("7.3.0")] +[assembly: AssemblyInformationalVersion("7.4.0")] [assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/bsmd.database/Properties/AssemblyProjectInfo.cs b/bsmd.database/Properties/AssemblyProjectInfo.cs index 1d4cc244..005d4965 100644 --- a/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("7.3.0.*")] +[assembly: AssemblyVersion("7.4.0.*")] diff --git a/bsmd.database/RuleEngine.cs b/bsmd.database/RuleEngine.cs index d22adbf5..40b2c78f 100644 --- a/bsmd.database/RuleEngine.cs +++ b/bsmd.database/RuleEngine.cs @@ -356,11 +356,11 @@ namespace bsmd.database break; case ValidationCode.PAST_DATE: { - if (value.Length == 0) errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, property.Name, value, entity.Title, identifier, entity.Tablename)); + if (value.Length == 0) violations.Add(RuleEngine.CreateViolation(ValidationCode.NOT_NULL, property.Name, value, entity.Title, identifier, entity.Tablename)); if (DateTime.TryParse(value, out DateTime aTime)) { if (aTime < DateTime.UtcNow) - errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + violations.Add(RuleEngine.CreateViolation(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); } } break;