From 8e5a5b2d62ce76baca233886a07592b92be47a43 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sun, 15 Jun 2025 13:58:33 +0200 Subject: [PATCH 01/11] Added echolot tool --- bsmd.Tool/App.config | 78 ++++++-- bsmd.Tool/Echolot.cs | 224 ++++++++++++++++++++++ bsmd.Tool/Options.cs | 12 ++ bsmd.Tool/Program.cs | 16 +- bsmd.Tool/Properties/Settings.Designer.cs | 41 +++- bsmd.Tool/Properties/Settings.settings | 14 +- bsmd.Tool/bsmd.Tool.csproj | 51 ++++- bsmd.Tool/bsmd.Tool.csproj.user | 4 +- bsmd.Tool/bsmd.Tool.licenseheader | 14 ++ bsmd.Tool/packages.config | 18 +- 10 files changed, 432 insertions(+), 40 deletions(-) create mode 100644 bsmd.Tool/Echolot.cs create mode 100644 bsmd.Tool/bsmd.Tool.licenseheader diff --git a/bsmd.Tool/App.config b/bsmd.Tool/App.config index ec50e784..9a2087dd 100644 --- a/bsmd.Tool/App.config +++ b/bsmd.Tool/App.config @@ -1,36 +1,72 @@ - + -
- -
+
+ +
- - + + - - - - - - + + + + + + - + - + - - - - replace me! - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + replace me! + + + + + + 4 + + + C:\temp\hisnord + + + C:\temp\dbh + + + diff --git a/bsmd.Tool/Echolot.cs b/bsmd.Tool/Echolot.cs new file mode 100644 index 00000000..1e3dcf88 --- /dev/null +++ b/bsmd.Tool/Echolot.cs @@ -0,0 +1,224 @@ +// Copyright (c) 2020- schick Informatik +// Description: The purpose of this tool is to evaluate files sent both through HIS-Nord and dbh +// to evaluate how many classes were sent at what time and by whom to the purpose of improved employee +// time planning + + +using ClosedXML.Excel; +using log4net; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace bsmd.Tool +{ + internal static class Echolot + { + + private static readonly ILog _log = LogManager.GetLogger(typeof(Echolot)); + + static readonly HashSet ValidGroupingKeys = new HashSet + { + "VISIT", + "TRANSIT", + "NOA_NOD", + "NOANOD", + "ATA", + "ATD", + "SEC", + "POBA", + "POBD", + "NAME", + "TIEFA", + "TIEFD", + "BKRA", + "BKRD", + "STAT", + "LADG", + "INFO", + "SERV", + "PRE72H", + "MDH", + "WAS", + "CREWA", + "PASA", + "BPOL", + "TOWA", + "TOWD", + "HAZA", + "HAZD", + "AGNT", + "STO", + "CREWD", + "PASD", + "WAS_RCPT" + }; + + static readonly HashSet IgnoreGroupingKeys = new HashSet + { + "VISIT", + "TRANSIT", + "ATA", + "ATD" + }; + + internal static void Evaluate(string outputFolder, int maxThreads) + { + DateTime executionTime = DateTime.Now; + + #region first scan: dbh files + + string inputFolder = Properties.Settings.Default.DBH_Folder; + var files = Directory.GetFiles(inputFolder, "*.xml"); + var results = new ConcurrentBag(); + + Parallel.ForEach(files, new ParallelOptions { MaxDegreeOfParallelism = maxThreads }, file => + { + try + { + var doc = XDocument.Load(file); + + // Look for a valid grouping key at the root level + var groupingElem = doc.Root.Elements() + .FirstOrDefault(x => ValidGroupingKeys.Contains(x.Name.LocalName) && !IgnoreGroupingKeys.Contains(x.Name.LocalName)); + + if (groupingElem == null) + { + _log.InfoFormat("skipping {0}", file); + return; // Skip file + } + + var lastName = doc.Descendants("RPLastName").FirstOrDefault()?.Value?.Trim(); + var firstName = doc.Descendants("RPFirstName").FirstOrDefault()?.Value?.Trim(); + var timestampStr = doc.Descendants("Timestamp").FirstOrDefault()?.Value?.Trim(); + + DateTime timestamp = DateTime.Parse(timestampStr); + + results.Add(new ResultRow + { + FirstName = firstName, + LastName = lastName, + Timestamp = timestamp, + WeekStart = GetWeekStart(timestamp, executionTime.DayOfWeek), + Provider = "DBH" + }); + } + catch (Exception ex) + { + _log.Error(ex.ToString()); + } + }); + + #endregion + + #region second scan: his-nord files + + var inputFolder2 = Properties.Settings.Default.HISNORD_Folder; + var files2 = Directory.GetFiles(inputFolder2, "*.xml"); + + Parallel.ForEach(files2, new ParallelOptions { MaxDegreeOfParallelism = maxThreads }, file => + { + try + { + var doc = XDocument.Load(file); + + var match = Regex.Match(file, @"-([A-Z0-9_]+)\.xml$", RegexOptions.None); + + string key = ""; + if (match.Success) + { + key = match.Groups[1].Value; + } + + if((key.Length == 0) || IgnoreGroupingKeys.Contains(key)) + { + _log.InfoFormat("skipping {0}", file); + return; // Skip file + } + + var username = doc.Descendants("firstname").FirstOrDefault()?.Value?.Trim(); + if(username == null) + { + _log.WarnFormat("Username not found in file {0}", file); + return; + } + var splitname = username.Split(' '); + var lastName = splitname[1].Trim(); + var firstName = splitname[0].Trim(); + + DateTime timestamp = File.GetCreationTime(file); + + results.Add(new ResultRow + { + FirstName = firstName, + LastName = lastName, + Timestamp = timestamp, + WeekStart = GetWeekStart(timestamp, executionTime.DayOfWeek), + Provider = "HIS-NORD" + }); + } + catch (Exception ex) + { + _log.Error(ex.ToString()); + } + }); + + + #endregion + + var grouped = results + .GroupBy(r => r.WeekStart) + .OrderBy(g => g.Key); + + + // Write Excel + string excelFile = Path.Combine(outputFolder, $"echolot_{executionTime:yyyyMMdd_HHmmss}.xlsx"); + using (var workbook = new XLWorkbook()) + { + foreach (var weekGroup in grouped) + { + var ws = workbook.Worksheets.Add(weekGroup.Key.ToString("yyyy-MM-dd")); + ws.Cell(1, 1).Value = "Firstname"; + ws.Cell(1, 2).Value = "Lastname"; + ws.Cell(1, 3).Value = "Count"; + int row = 2; + + var orderedGroups = weekGroup + .GroupBy(x => new { x.FirstName, x.LastName }) + .OrderByDescending(g => g.Count()); // Use OrderBy for ascending + + + foreach (var nameGroup in orderedGroups) + { + ws.Cell(row, 1).Value = nameGroup.Key.FirstName; + ws.Cell(row, 2).Value = nameGroup.Key.LastName; + ws.Cell(row, 3).Value = nameGroup.Count(); + row++; + } + } + workbook.SaveAs(excelFile); + } + } + + static DateTime GetWeekStart(DateTime date, DayOfWeek weekStart) + { + int diff = (7 + (date.DayOfWeek - weekStart)) % 7; + return date.Date.AddDays(-1 * diff); + } + + class ResultRow + { + public string FirstName { get; set; } + public string LastName { get; set; } + public DateTime Timestamp { get; set; } + public DateTime WeekStart { get; set; } + public string Provider { get; set; } + } + + } +} diff --git a/bsmd.Tool/Options.cs b/bsmd.Tool/Options.cs index 026e703c..ae1a507d 100644 --- a/bsmd.Tool/Options.cs +++ b/bsmd.Tool/Options.cs @@ -25,6 +25,18 @@ namespace bsmd.Tool [Option("locodes", HelpText = "use this flag if you want to import locodes")] public bool ImportLocodes { get; set; } + [Option("echolot", HelpText = "use this flag to run the echolot output file evaluation")] + public bool Echolot { get; set; } + + [Option('i', "input_folder", HelpText = "Input folder")] + public string InputFolder { get; set; } + + [Option('o', "output_folder", HelpText = "Output folder")] + public string OutputFolder { get; set; } + + [Option("max_threads", HelpText = "Maximum amount of parallelism for folder parsing")] + public int? MaxThreads { get; set; } + [Option('s', "staledays", Default = 30, HelpText ="Delete files older than X days")] public int StaleDays { get; set; } diff --git a/bsmd.Tool/Program.cs b/bsmd.Tool/Program.cs index 54909cb8..82e2b3ac 100644 --- a/bsmd.Tool/Program.cs +++ b/bsmd.Tool/Program.cs @@ -1,4 +1,5 @@ -using CommandLine; +using bsmd.database; +using CommandLine; using log4net; using System; @@ -40,15 +41,24 @@ namespace bsmd.Tool LocodeSQliteImport.Import(o.LocodeDB, o.LocodeCSV); } } + if(o.Echolot) + { + string outputFolder = Properties.Settings.Default.EcholotOutputFolder; + if (!o.OutputFolder.IsNullOrEmpty()) + outputFolder = o.OutputFolder; + int maxThreads = 2; + if (o.MaxThreads.HasValue) maxThreads = o.MaxThreads.Value; + Echolot.Evaluate(outputFolder, maxThreads); + } }); } catch (Exception ex) { log.Fatal(ex.ToString()); + Console.WriteLine(ex.Message); result = 1; - } - Console.Read(); + } return result; } } diff --git a/bsmd.Tool/Properties/Settings.Designer.cs b/bsmd.Tool/Properties/Settings.Designer.cs index 4d40f00d..a26903d7 100644 --- a/bsmd.Tool/Properties/Settings.Designer.cs +++ b/bsmd.Tool/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace bsmd.Tool.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -23,15 +23,48 @@ namespace bsmd.Tool.Properties { } } - [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("replace me!")] public string ConnectionString { get { return ((string)(this["ConnectionString"])); } - set { - this["ConnectionString"] = value; + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string EcholotOutputFolder { + get { + return ((string)(this["EcholotOutputFolder"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("4")] + public int EcholotMaxThreads { + get { + return ((int)(this["EcholotMaxThreads"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\temp\\hisnord")] + public string HISNORD_Folder { + get { + return ((string)(this["HISNORD_Folder"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\temp\\dbh")] + public string DBH_Folder { + get { + return ((string)(this["DBH_Folder"])); } } } diff --git a/bsmd.Tool/Properties/Settings.settings b/bsmd.Tool/Properties/Settings.settings index 07cf4d90..3785f743 100644 --- a/bsmd.Tool/Properties/Settings.settings +++ b/bsmd.Tool/Properties/Settings.settings @@ -2,8 +2,20 @@ - + replace me! + + + + + 4 + + + C:\temp\hisnord + + + C:\temp\dbh + \ No newline at end of file diff --git a/bsmd.Tool/bsmd.Tool.csproj b/bsmd.Tool/bsmd.Tool.csproj index 92d23e99..877acf69 100644 --- a/bsmd.Tool/bsmd.Tool.csproj +++ b/bsmd.Tool/bsmd.Tool.csproj @@ -44,25 +44,62 @@ ..\bsmd.database\bin\Debug\bsmd.database.dll + + ..\packages\ClosedXML.0.105.0\lib\netstandard2.0\ClosedXML.dll + + + ..\packages\ClosedXML.Parser.2.0.0\lib\netstandard2.0\ClosedXML.Parser.dll + ..\packages\CommandLineParser.2.9.1\lib\net461\CommandLine.dll - - ..\packages\log4net.2.0.15\lib\net45\log4net.dll + + ..\packages\DocumentFormat.OpenXml.3.1.1\lib\net46\DocumentFormat.OpenXml.dll + + + ..\packages\DocumentFormat.OpenXml.Framework.3.1.1\lib\net46\DocumentFormat.OpenXml.Framework.dll + + + ..\packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll + + + ..\packages\log4net.3.1.0\lib\net462\log4net.dll + + + ..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll + + + ..\packages\RBush.Signed.4.0.0\lib\net47\RBush.dll + + + ..\packages\SixLabors.Fonts.1.0.0\lib\netstandard2.0\SixLabors.Fonts.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + - - ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.117.0\lib\net46\System.Data.SQLite.dll + + ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + @@ -76,6 +113,7 @@ + @@ -89,6 +127,7 @@ + SettingsSingleFileGenerator @@ -96,12 +135,12 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/bsmd.Tool/packages.config b/bsmd.Tool/packages.config index 31f24d70..6fb49e25 100644 --- a/bsmd.Tool/packages.config +++ b/bsmd.Tool/packages.config @@ -1,7 +1,19 @@  + + - - - + + + + + + + + + + + + + \ No newline at end of file From 37ee8e1edf2685845a57da93ea82b1de6718872b Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 7 Jul 2025 13:39:37 +0200 Subject: [PATCH 02/11] Version bump and package updates --- ENI2/ENI2.csproj | 93 +++++++++++-------- ENI2/packages.config | 24 +++-- .../bsmd.LockingService.csproj | 4 +- bsmd.LockingService/packages.config | 2 +- .../Properties/AssemblyProductInfo.cs | 2 +- .../Properties/AssemblyProjectInfo.cs | 2 +- bsmd.database/bsmd.database.csproj | 4 +- bsmd.database/packages.config | 2 +- 8 files changed, 78 insertions(+), 55 deletions(-) diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 924e8882..63e712ac 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -37,7 +37,7 @@ true publish.html 1 - 7.2.8.1 + 7.2.9.0 false true true @@ -137,60 +137,72 @@ packages\ExcelDataReader.3.7.0\lib\net462\ExcelDataReader.dll - - packages\log4net.3.0.4\lib\net462\log4net.dll + + packages\log4net.3.1.0\lib\net462\log4net.dll - - packages\Microsoft.Bcl.AsyncInterfaces.9.0.4\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + packages\Microsoft.Bcl.AsyncInterfaces.9.0.6\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll - - packages\Microsoft.Extensions.DependencyInjection.9.0.4\lib\net462\Microsoft.Extensions.DependencyInjection.dll + + packages\Microsoft.Bcl.Cryptography.9.0.6\lib\net462\Microsoft.Bcl.Cryptography.dll - - packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.4\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + packages\Microsoft.Extensions.DependencyInjection.9.0.6\lib\net462\Microsoft.Extensions.DependencyInjection.dll - - packages\Microsoft.Extensions.Logging.9.0.4\lib\net462\Microsoft.Extensions.Logging.dll + + packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.6\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - packages\Microsoft.Extensions.Logging.Abstractions.9.0.4\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll + + packages\Microsoft.Extensions.Logging.9.0.6\lib\net462\Microsoft.Extensions.Logging.dll - - packages\Microsoft.Extensions.Options.9.0.4\lib\net462\Microsoft.Extensions.Options.dll + + packages\Microsoft.Extensions.Logging.Abstractions.9.0.6\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll - - packages\Microsoft.Extensions.Primitives.9.0.4\lib\net462\Microsoft.Extensions.Primitives.dll + + packages\Microsoft.Extensions.Options.9.0.6\lib\net462\Microsoft.Extensions.Options.dll + + + packages\Microsoft.Extensions.Primitives.9.0.6\lib\net462\Microsoft.Extensions.Primitives.dll packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll True - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll + + packages\PDFsharp-MigraDoc.6.2.0\lib\netstandard2.0\MigraDoc.DocumentObjectModel.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\MigraDoc.Rendering.dll + + packages\PDFsharp-MigraDoc.6.2.0\lib\netstandard2.0\MigraDoc.Rendering.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\MigraDoc.RtfRendering.dll + + packages\PDFsharp-MigraDoc.6.2.0\lib\netstandard2.0\MigraDoc.RtfRendering.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\PdfSharp.dll + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\PdfSharp.Charting.dll + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.BarCodes.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\PdfSharp.Quality.dll + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.Charting.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\PdfSharp.Snippets.dll + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.Cryptography.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\PdfSharp.System.dll + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.Quality.dll - - packages\PDFsharp-MigraDoc.6.1.1\lib\netstandard2.0\PdfSharp.WPFonts.dll + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.Shared.dll + + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.Snippets.dll + + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.System.dll + + + packages\PDFsharp.6.2.0\lib\netstandard2.0\PdfSharp.WPFonts.dll @@ -202,10 +214,13 @@ packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll - - packages\System.Diagnostics.DiagnosticSource.9.0.4\lib\net462\System.Diagnostics.DiagnosticSource.dll + + packages\System.Diagnostics.DiagnosticSource.9.0.6\lib\net462\System.Diagnostics.DiagnosticSource.dll + + packages\System.Formats.Asn1.9.0.6\lib\net462\System.Formats.Asn1.dll + packages\System.Memory.4.6.3\lib\net462\System.Memory.dll @@ -218,6 +233,10 @@ packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll + + + packages\System.Security.Cryptography.Pkcs.9.0.6\lib\net462\System.Security.Cryptography.Pkcs.dll + diff --git a/ENI2/packages.config b/ENI2/packages.config index 14b54d2b..a24d5db7 100644 --- a/ENI2/packages.config +++ b/ENI2/packages.config @@ -2,23 +2,27 @@ - - - - - - - - + + + + + + + + + - + + - + + + \ No newline at end of file diff --git a/bsmd.LockingService/bsmd.LockingService.csproj b/bsmd.LockingService/bsmd.LockingService.csproj index 18d2d500..d56c3074 100644 --- a/bsmd.LockingService/bsmd.LockingService.csproj +++ b/bsmd.LockingService/bsmd.LockingService.csproj @@ -46,8 +46,8 @@ 4 - - ..\ENI2\packages\log4net.3.0.4\lib\net462\log4net.dll + + ..\ENI2\packages\log4net.3.1.0\lib\net462\log4net.dll diff --git a/bsmd.LockingService/packages.config b/bsmd.LockingService/packages.config index fbd6f896..362ab867 100644 --- a/bsmd.LockingService/packages.config +++ b/bsmd.LockingService/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/bsmd.database/Properties/AssemblyProductInfo.cs b/bsmd.database/Properties/AssemblyProductInfo.cs index 992ffe9a..fddc156f 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.2.8")] +[assembly: AssemblyInformationalVersion("7.2.9")] [assembly: AssemblyCopyright("Copyright © 2014-2025 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 cf4fdec9..92c6d524 100644 --- a/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("7.2.8.*")] +[assembly: AssemblyVersion("7.2.9.*")] diff --git a/bsmd.database/bsmd.database.csproj b/bsmd.database/bsmd.database.csproj index cdc95517..1fbac158 100644 --- a/bsmd.database/bsmd.database.csproj +++ b/bsmd.database/bsmd.database.csproj @@ -89,8 +89,8 @@ False - - ..\ENI2\packages\log4net.3.0.4\lib\net462\log4net.dll + + ..\ENI2\packages\log4net.3.1.0\lib\net462\log4net.dll ..\ENI2\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll diff --git a/bsmd.database/packages.config b/bsmd.database/packages.config index 21dbfcbd..fbfa0890 100644 --- a/bsmd.database/packages.config +++ b/bsmd.database/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file From 37122c4144cb9ff443e5526bd8395cdca6807c42 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 7 Jul 2025 13:58:48 +0200 Subject: [PATCH 03/11] Removing CREW effects from validation --- bsmd.database/CREW.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsmd.database/CREW.cs b/bsmd.database/CREW.cs index f576d7b4..d061f246 100644 --- a/bsmd.database/CREW.cs +++ b/bsmd.database/CREW.cs @@ -137,8 +137,8 @@ namespace bsmd.database } } - [ENI2Validation] - [MaxLength(256)] + //[ENI2Validation] + //[MaxLength(256)] public string Effects { get; set; } [ENI2Validation] From a4a74da6f947c343438af967dea14e6280788f96 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 7 Jul 2025 14:31:04 +0200 Subject: [PATCH 04/11] Layout changed in INFO, classic mode --- .../PortNotificationDetailControl.xaml | 50 +++++++++++++------ ENI2/Properties/Resources.Designer.cs | 11 +++- ENI2/Properties/Resources.resx | 3 ++ 3 files changed, 48 insertions(+), 16 deletions(-) diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml index 62f1dbc3..bae2fbf6 100644 --- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml +++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml @@ -28,7 +28,7 @@ - + @@ -57,35 +57,55 @@ - diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs index 571d7a40..f3772511 100644 --- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs @@ -16,6 +16,8 @@ using ENI2.EditControls; using ENI2.Util; using bsmd.database; +using System.Threading.Tasks; +using System.Diagnostics; namespace ENI2.DetailViewControls { @@ -25,12 +27,18 @@ namespace ENI2.DetailViewControls public partial class PortNotificationDetailControl : DetailBaseControl { + #region Fields + private Message _nameMessage; private Message _infoMessage; private Message _servMessage; private Message _ladgMessage; private Message _crewaMessage; private Dictionary portAreas = null; + private static List _servTemplates = null; + private SERV_Template _currentTemplate; + + #endregion private static readonly string[] shippingAreas = { Properties.Resources.textShippingAreaNORTHBALTIC, @@ -60,7 +68,7 @@ namespace ENI2.DetailViewControls this.dataGridLADG.CellEditEnding += (obj, ev) => { this.OnNotificationClassChanged(Message.NotificationClass.LADG); }; } - public override void Initialize() + public override async void Initialize() { base.Initialize(); @@ -157,16 +165,22 @@ namespace ENI2.DetailViewControls this.dataGridLADG.DeleteRequested += DataGridLADG_DeleteRequested; this.dataGridLADG.CreateRequested += DataGridLADG_CreateRequested; - #endregion + #endregion - #region init helper Maersk / SeaGo Field + #region init SERV templates - if (this.Core.IsFlagSet(MessageCore.CoreFlags.MAERSK_BHV)) this.comboBoxGroup.SelectedIndex = 1; - if (this.Core.IsFlagSet(MessageCore.CoreFlags.SEAGO_BHV)) this.comboBoxGroup.SelectedIndex = 2; - if (this.Core.IsFlagSet(MessageCore.CoreFlags.SEAGO_WHV)) this.comboBoxGroup.SelectedIndex = 3; - if (this.Core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.comboBoxGroup.SelectedIndex = 4; - if (this.Core.IsFlagSet(MessageCore.CoreFlags.ELBE_BULK)) this.comboBoxGroup.SelectedIndex = 5; - if (this.Core.IsFlagSet(MessageCore.CoreFlags.FCT_JUNGE)) this.comboBoxGroup.SelectedIndex = 6; + if(_servTemplates == null) + { + _servTemplates = await DBManagerAsync.GetSERVTemplatesAsync(); // initial load + _servTemplates.Sort(); + Trace.WriteLine($"{_servTemplates.Count} SERV templates loaded"); + } + + this.comboBoxGroup.ItemsSource = _servTemplates; + + this.buttonDeleteTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden; + this.buttonEditTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden; + this.buttonNewTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden; #endregion @@ -371,35 +385,93 @@ namespace ENI2.DetailViewControls private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e) { - // clear all - this.Core.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV); - this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV); - this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV); - this.Core.SetFlag(false, MessageCore.CoreFlags.HOEGH); - this.Core.SetFlag(false, MessageCore.CoreFlags.ELBE_BULK); - this.Core.SetFlag(false, MessageCore.CoreFlags.FCT_JUNGE); - - if (this.comboBoxGroup.SelectedItem == null) - { - this.comboBoxGroup.SelectedIndex = 0; - DBManager.Instance.Save(this.Core); + if(this.comboBoxGroup.SelectedItem is SERV_Template st) + { + this.buttonDeleteTemplate.IsEnabled = true; + this.buttonSetTemplate.IsEnabled = true; + this._currentTemplate = st; } - else + } + + private void buttonSetTemplate_Click(object sender, RoutedEventArgs e) + { + if (this.comboBoxGroup.SelectedItem is SERV_Template st) { - DictionaryEntry selectedItem = (DictionaryEntry)this.comboBoxGroup.SelectedItem; - if (Int32.TryParse((string)selectedItem.Value, out int selectedValue)) + bool found = false; + foreach (SERV serv in _servMessage.Elements.Cast()) { - if (selectedValue == (int)MessageCore.CoreFlags.MAERSK_BHV) CheckServiceEntryMaerskBHV(); - if (selectedValue == (int)MessageCore.CoreFlags.SEAGO_BHV) CheckServiceEntrySeaGoBHV(); - if (selectedValue == (int)MessageCore.CoreFlags.HOEGH) CheckServiceEntryHoegh(); - if (selectedValue == (int)MessageCore.CoreFlags.ELBE_BULK) CheckServiceEntryElbeBulk(); - if (selectedValue == (int)MessageCore.CoreFlags.FCT_JUNGE) CheckServiceEntryFctJunge(); - this.Core.SetFlag(true, (MessageCore.CoreFlags)selectedValue); - DBManager.Instance.Save(this.Core); + if (serv.ServiceName.Equals(st.ServiceName)) + { + found = true; break; + } + } + + if (!found) + { + SERV newServ = new SERV(); + newServ.ServiceName = st.ServiceName; + newServ.ServiceBeneficiary = st.ServiceBeneficiary; + newServ.ServiceInvoiceRecipient = st.ServiceInvoiceRecipient; + + newServ.MessageHeader = this._servMessage; + newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); + this._servMessage.Elements.Add(newServ); + this.dataGridSERV.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.SERV); } } } + private void buttonNewTemplate_Click(object sender, RoutedEventArgs e) + { + SERV_Template newTemplate = new SERV_Template(); + EditSERVDialog esd = new EditSERVDialog(); + esd.AddVisible = false; + esd.SERV_Template = newTemplate; + if(esd.ShowDialog() ?? false) + { + _ = DBManagerAsync.SaveAsync(esd.SERV_Template); + this.comboBoxGroup.ItemsSource = null; + _servTemplates.Add(newTemplate); + _servTemplates.Sort(); + this.comboBoxGroup.ItemsSource = _servTemplates; + } + } + + private void buttonEditTemplate_Click(object sender, RoutedEventArgs e) + { + if (this.comboBoxGroup.SelectedItem is SERV_Template st) + { + EditSERVDialog editSERVDialog = new EditSERVDialog(); + editSERVDialog.AddVisible = false; + editSERVDialog.SERV_Template = st; + if (editSERVDialog.ShowDialog() ?? false) + { + _ = DBManagerAsync.SaveAsync(st); + this.comboBoxGroup.ItemsSource = null; + _servTemplates.Sort(); + this.comboBoxGroup.ItemsSource = _servTemplates; + } + } + } + + private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e) + { + if (_currentTemplate != null) + { + if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes) + { + this.comboBoxGroup.SelectedItem = null; + this.comboBoxGroup.ItemsSource = null; + _ = DBManagerAsync.DeleteAsync(_currentTemplate); + _servTemplates.Remove(_currentTemplate); + this.buttonDeleteTemplate.IsEnabled = false; + this.comboBoxGroup.ItemsSource = _servTemplates; + this.buttonSetTemplate.IsEnabled = false; + } + } + } + #endregion #region special entry ship service check @@ -538,17 +610,7 @@ namespace ENI2.DetailViewControls } } - #endregion - - private void MenuItem_Click(object sender, RoutedEventArgs e) - { - - } - - private void contextMenuClearMaersk_Click(object sender, RoutedEventArgs e) - { - - } + #endregion private void buttonCopyNameFromCREWA_Click(object sender, RoutedEventArgs e) { @@ -568,5 +630,6 @@ namespace ENI2.DetailViewControls this.SublistElementChanged(Message.NotificationClass.NAME); } } + } } diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index c7fad5c7..df77abc1 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -1047,6 +1047,7 @@ PreserveNewest + Always diff --git a/ENI2/EditControls/EditSERVDialog.xaml.cs b/ENI2/EditControls/EditSERVDialog.xaml.cs index c2284d7f..e66f03a5 100644 --- a/ENI2/EditControls/EditSERVDialog.xaml.cs +++ b/ENI2/EditControls/EditSERVDialog.xaml.cs @@ -1,5 +1,5 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: Edit SERV and SERV_template entities // using System.Windows; @@ -14,36 +14,78 @@ namespace ENI2.EditControls /// public partial class EditSERVDialog : EditWindowBase { + + #region Construction + public EditSERVDialog() { InitializeComponent(); Loaded += EditSERVDialog_Loaded; } + #endregion + + #region Properties + + public SERV SERV { get; set; } + + public SERV_Template SERV_Template { get; set; } + + #endregion + + #region event handler + private void EditSERVDialog_Loaded(object sender, RoutedEventArgs e) { this.OKClicked += EditSERVDialog_OKClicked; // copy into fields - this.textBoxServiceName.Text = this.SERV.ServiceName; - this.textBoxServiceBeneficiary.Text = this.SERV.ServiceBeneficiary; - this.textBoxServiceInvoiceRecipient.Text = this.SERV.ServiceInvoiceRecipient; - this.AddVisible = true; + if (this.SERV != null) + { + this.textBoxServiceName.Text = this.SERV.ServiceName; + this.textBoxServiceBeneficiary.Text = this.SERV.ServiceBeneficiary; + this.textBoxServiceInvoiceRecipient.Text = this.SERV.ServiceInvoiceRecipient; + this.AddVisible = true; + } + + if (this.SERV_Template != null) + { + this.textBoxServiceName.Text = this.SERV_Template.ServiceName; + this.textBoxServiceBeneficiary.Text = this.SERV_Template.ServiceBeneficiary; + this.textBoxServiceInvoiceRecipient.Text = this.SERV_Template.ServiceInvoiceRecipient; + } } + private void EditSERVDialog_OKClicked() + { + this.CopyValuesToEntity(); + } + + #endregion + + #region public methods public void CopyValuesToEntity() { - // copy back - this.SERV.ServiceName = this.textBoxServiceName.Text.Trim(); - this.SERV.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim(); - this.SERV.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim(); + + if (this.SERV != null) + { + // copy back + this.SERV.ServiceName = this.textBoxServiceName.Text.Trim(); + this.SERV.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim(); + this.SERV.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim(); + } + + if (this.SERV_Template != null) + { + // copy back + this.SERV_Template.ServiceName = this.textBoxServiceName.Text.Trim(); + this.SERV_Template.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim(); + this.SERV_Template.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim(); + } + } - private void EditSERVDialog_OKClicked() - { - this.CopyValuesToEntity(); - } - - public SERV SERV { get; set; } + #endregion + } } diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs index 326852b9..86c7a834 100644 --- a/ENI2/Properties/Resources.Designer.cs +++ b/ENI2/Properties/Resources.Designer.cs @@ -750,6 +750,16 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap pencil { + get { + object obj = ResourceManager.GetObject("pencil", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx index 5d43fddf..89059ac3 100644 --- a/ENI2/Properties/Resources.resx +++ b/ENI2/Properties/Resources.resx @@ -2242,4 +2242,7 @@ SERV-Template + + ..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ENI2/Resources/pencil.png b/ENI2/Resources/pencil.png new file mode 100644 index 0000000000000000000000000000000000000000..68f3504835dfe717209746463a9dcb69d50e2c44 GIT binary patch literal 1172 zcmV;F1Z(?=P)>%Q?|+dQo5DWf|CgY5fBhI_UwgZUl)oz$@%(w&w28m^CxXYlBLqk zVWwuH6Prlm*)$ST94Ot=ecKOj2p%tqH_t05P*=#lfQn8+>t1tc{14%>kLwGm6Vv0R za7mKHJSYF-p|-w$EP=@KUoc3bFd7#OZ4evM9hA0p|6Z)NeDs4w+^?2HIcCTGz_;N=xJP^$b6y;=jVWu1XPiIiXz9us6@ntd`{ zee?1j3^a4FJY9n4gM54{=HSaqN_uCu)b*d73 z^fh>6X{s1Ax+THX#c-G7Lpq9Q{^Muri%ucbxOar%f#!9Z`LFBT_@@k}cq zmOq~BLon3pftK=}C_C$j#KcrXT3Wj0+G`0UQzS9;N7V`&^xfqU_<212l~1fAm?rAc zwYsC}%63#Lm=H#ifAV#vnywi??oXp6$6Al7R&gF)Ov*8-;bUTek7;7}x(9B!Tjq$0 zVh4yK$iHw{q_yKQ{4LaMDR-jsJRLm^K3Etp!k=m`#`}4gB6dIcqZ=B(WfHhOL}BDM z_xFsz#c|%W)Htj0Dmjhl+z$(5G6Lpetd~oiK!D$x-$nh`4ycgZK^Q^q;JK2_){Mu7 z?xW>r22EATtc9Tbh~Tb+7jG18Bd_U+sLf z%L|X%y$GBGbpso>F4{n)utRD*T^G$WH4Z=QNw@eU#ci=H*&6LNVbHb&;&B&e^#uL( zF1UGtf$Cygq@LKS4-YV<8b6VQo-X-``*BO*iDuLi(H=ZhadH0&3r*j=gBy7cs4LoqDupeQq9`K~z9yFIogJ@42D=X{ z3%&4jISW (AGNT_Template)x); } + public static async Task> GetSERVTemplatesAsync() + { + SqlCommand cmd = new SqlCommand(); + SERV_Template st = new SERV_Template(); + st.PrepareLoadCommand(cmd, Message.LoadFilter.ALL); + SqlDataReader reader = await PerformCommandAsync(cmd); + return (await st.LoadListAsync(reader)).ConvertAll(x => (SERV_Template)x); + } + + public static async Task> GetWastDisposalServiceProviderTemplatesAsync() { SqlCommand cmd = new SqlCommand(); diff --git a/bsmd.database/SERV_Template.cs b/bsmd.database/SERV_Template.cs new file mode 100644 index 00000000..8e47d51a --- /dev/null +++ b/bsmd.database/SERV_Template.cs @@ -0,0 +1,128 @@ +// Copyright (c) 2024-present schick Informatik +// Description: + +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bsmd.database +{ + public class SERV_Template : DatabaseEntityAsync, IComparable + { + #region Construction + + public SERV_Template() + { + this.tablename = "[dbo].[SERV_template]"; + } + + #endregion + + #region Properties + + [MaxLength(99)] + public string ServiceName { get; set; } + + [MaxLength(255)] + public string ServiceBeneficiary { get; set; } + + [MaxLength(255)] + public string ServiceInvoiceRecipient { get; set; } + + #endregion + + #region DatabaseEntity implementation + + public override void PrepareSave(IDbCommand cmd) + { + SqlCommand scmd = cmd as SqlCommand; + + if (this.ServiceName != null) scmd.Parameters.AddWithValue("@P1", this.ServiceName); + else scmd.Parameters.AddWithValue("@P1", DBNull.Value); + if (this.ServiceBeneficiary != null) scmd.Parameters.AddWithValue(@"P2", this.ServiceBeneficiary); + else scmd.Parameters.AddWithValue("@P2", DBNull.Value); + if (this.ServiceInvoiceRecipient != null) scmd.Parameters.AddWithValue("@P3", this.ServiceInvoiceRecipient); + else scmd.Parameters.AddWithValue("@P3", DBNull.Value); + + if (this.IsNew) + { + this.CreateId(); + cmd.CommandText = string.Format("INSERT INTO {0} (Id, ServiceName, ServiceBeneficiary, ServiceInvoiceRecipient) VALUES " + + "(@ID, @P1, @P2, @P3)", this.Tablename); + } + else + { + cmd.CommandText = string.Format("UPDATE {0} SET ServiceName = @P1, ServiceBeneficiary = @P2, ServiceInvoiceRecipient = @P3 WHERE Id = @ID", this.Tablename); + } + scmd.Parameters.AddWithValue("@ID", this.Id); + } + + public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria) + { + string query = string.Format("SELECT Id, ServiceName, ServiceBeneficiary, ServiceInvoiceRecipient FROM {0}", this.Tablename); + + switch (filter) + { + case Message.LoadFilter.ALL: + default: + + break; + } + cmd.CommandText = query; + } + + public override List LoadList(System.Data.IDataReader reader) + { + List result = new List(); + + while (reader.Read()) + { + SERV_Template serv_t = new SERV_Template(); + serv_t.id = reader.GetGuid(0); + if (!reader.IsDBNull(1)) serv_t.ServiceName = reader.GetString(1); + if (!reader.IsDBNull(2)) serv_t.ServiceBeneficiary = reader.GetString(2); + if (!reader.IsDBNull(3)) serv_t.ServiceInvoiceRecipient = reader.GetString(3); + + result.Add(serv_t); + } + reader.Close(); + return result; + } + + protected override DatabaseEntityAsync ReadRowFromReader(IDataReader reader) + { + SERV_Template serv_t = null; + if (reader != null) + { + serv_t = new SERV_Template(); + serv_t.id = reader.GetGuid(0); + if (!reader.IsDBNull(1)) serv_t.ServiceName = reader.GetString(1); + if (!reader.IsDBNull(2)) serv_t.ServiceBeneficiary = reader.GetString(2); + if (!reader.IsDBNull(3)) serv_t.ServiceInvoiceRecipient = reader.GetString(3); + + } + return serv_t; + } + + #endregion + + + #region IComparable implementation + + public int CompareTo(object obj) + { + if (obj is SERV_Template template) + { + return this.ServiceName.CompareTo(template.ServiceName); + } + return 0; + } + + #endregion + + } +} diff --git a/bsmd.database/bsmd.database.csproj b/bsmd.database/bsmd.database.csproj index 1fbac158..a947e177 100644 --- a/bsmd.database/bsmd.database.csproj +++ b/bsmd.database/bsmd.database.csproj @@ -173,6 +173,7 @@ + From ef96795bbfc7feae2bc033ad196c2845df079502 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 9 Jul 2025 07:33:23 +0200 Subject: [PATCH 07/11] Fixed saving of name of master after programmatic update --- .../PortNotificationDetailControl.xaml.cs | 127 +----------------- ENI2/ENI2.csproj | 2 +- .../CrewPreArrivalControl.xaml.cs | 2 + 3 files changed, 8 insertions(+), 123 deletions(-) diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs index f3772511..28adf8ea 100644 --- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs @@ -470,125 +470,6 @@ namespace ENI2.DetailViewControls this.buttonSetTemplate.IsEnabled = false; } } - } - - #endregion - - #region special entry ship service check - - private void CheckServiceEntryMaerskBHV() - { - bool found = false; - foreach(SERV serv in _servMessage.Elements.Cast()) - { - if (serv.ServiceBeneficiary.Equals("Maersk A/S, Esplanaden 50, DK-1263 Copenhagen K, VAT-ID: DK53139655")) - found = true; - } - - if(!found) - { - SERV newServ = new SERV(); - newServ.ServiceBeneficiary = "Maersk A/S, Esplanaden 50, DK-1263 Copenhagen K, VAT-ID: DK53139655"; - newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co.KG, Johanniswall 7, 20095 Hamburg"; - newServ.ServiceName = "Maersk BHV"; - newServ.MessageHeader = this._servMessage; - newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); - this._servMessage.Elements.Add(newServ); - this.dataGridSERV.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.SERV); - } - } - - private void CheckServiceEntrySeaGoBHV() - { - bool found = false; - foreach (SERV serv in _servMessage.Elements.Cast()) - { - if (serv.ServiceBeneficiary.Equals("Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655")) - found = true; - } - - if (!found) - { - SERV newServ = new SERV(); - newServ.ServiceBeneficiary = "Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655"; - newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co. KG on behalf of Sealand Europe A/S, Johanniswall 7, 20095 Hamburg"; - newServ.ServiceName = "SeaGo BHV"; - newServ.MessageHeader = this._servMessage; - newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); - this._servMessage.Elements.Add(newServ); - this.dataGridSERV.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.SERV); - } - } - - private void CheckServiceEntryHoegh() - { - bool found = false; - foreach (SERV serv in _servMessage.Elements.Cast()) - { - if (serv.ServiceBeneficiary.Equals("Höegh Autoliners AS, Oslo, Norway")) - found = true; - } - - if (!found) - { - SERV newServ = new SERV(); - newServ.ServiceBeneficiary = "Höegh Autoliners AS, Oslo, Norway"; - newServ.ServiceInvoiceRecipient = " PWL Port Services GmbH & Co. KG"; - newServ.ServiceName = "HOEGH BHV"; - newServ.MessageHeader = this._servMessage; - newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); - this._servMessage.Elements.Add(newServ); - this.dataGridSERV.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.SERV); - } - } - - private void CheckServiceEntryFctJunge() - { - bool found = false; - foreach (SERV serv in _servMessage.Elements.Cast()) - { - if (serv.ServiceName.Equals("Fct Junge - Hamburg")) - found = true; - } - - if (!found) - { - SERV newServ = new SERV(); - newServ.ServiceBeneficiary = ""; - newServ.ServiceInvoiceRecipient = " Frachtcontor Junge & Co. GmbH"; - newServ.ServiceName = "Fct Junge - Hamburg"; - newServ.MessageHeader = this._servMessage; - newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); - this._servMessage.Elements.Add(newServ); - this.dataGridSERV.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.SERV); - } - } - - private void CheckServiceEntryElbeBulk() - { - bool found = false; - foreach (SERV serv in _servMessage.Elements.Cast()) - { - if (serv.ServiceName.Equals("Elbe Bulk Schiffe - Hamburg")) - found = true; - } - - if (!found) - { - SERV newServ = new SERV(); - newServ.ServiceBeneficiary = ""; - newServ.ServiceInvoiceRecipient = " Division Elbe Bulk, Frachtcontor Junge & Co. GmbH"; - newServ.ServiceName = "Elbe Bulk Schiffe - Hamburg"; - newServ.MessageHeader = this._servMessage; - newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); - this._servMessage.Elements.Add(newServ); - this.dataGridSERV.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.SERV); - } } private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e) @@ -610,8 +491,6 @@ namespace ENI2.DetailViewControls } } - #endregion - private void buttonCopyNameFromCREWA_Click(object sender, RoutedEventArgs e) { CREW crewA = null; @@ -628,8 +507,12 @@ namespace ENI2.DetailViewControls { this.textBox_NameMaster.Text = $"{crewA.CrewMemberFirstName} {crewA.CrewMemberLastName}"; this.SublistElementChanged(Message.NotificationClass.NAME); + var binding = textBox_NameMaster.GetBindingExpression(TextBox.TextProperty); + binding?.UpdateSource(); } } - + + #endregion + } } diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index df77abc1..13fe120e 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -37,7 +37,7 @@ true publish.html 1 - 7.2.9.0 + 7.2.9.1 false true true diff --git a/ENI2/SheetDisplayControls/CrewPreArrivalControl.xaml.cs b/ENI2/SheetDisplayControls/CrewPreArrivalControl.xaml.cs index 62966b81..8678b30c 100644 --- a/ENI2/SheetDisplayControls/CrewPreArrivalControl.xaml.cs +++ b/ENI2/SheetDisplayControls/CrewPreArrivalControl.xaml.cs @@ -249,6 +249,8 @@ namespace ENI2.SheetDisplayControls { this.textBox_NameMaster.Text = $"{crewA.CrewMemberFirstName} {crewA.CrewMemberLastName}"; this.SublistElementChanged(Message.NotificationClass.NAME); + var binding = textBox_NameMaster.GetBindingExpression(TextBox.TextProperty); + binding?.UpdateSource(); } } From d1e2e67d5f68d212070d8735d19379ecba89f6e9 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 9 Jul 2025 08:19:12 +0200 Subject: [PATCH 08/11] added SERV templates to the sheet display --- .../PortNotificationDetailControl.xaml.cs | 6 +- ENI2/SheetDisplayControls/PortControl.xaml | 36 ++++- ENI2/SheetDisplayControls/PortControl.xaml.cs | 152 ++++++++++++++---- 3 files changed, 156 insertions(+), 38 deletions(-) diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs index 28adf8ea..7f827aeb 100644 --- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs @@ -381,7 +381,7 @@ namespace ENI2.DetailViewControls #endregion - #region Spezialbalkon für die Gruppenauswahl im Core (Maersk BHV / Seago usw.) + #region SERV template event handler private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e) { @@ -472,6 +472,10 @@ namespace ENI2.DetailViewControls } } + #endregion + + #region other event handler + private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e) { if (portAreas != null) diff --git a/ENI2/SheetDisplayControls/PortControl.xaml b/ENI2/SheetDisplayControls/PortControl.xaml index 387783a2..44a96aea 100644 --- a/ENI2/SheetDisplayControls/PortControl.xaml +++ b/ENI2/SheetDisplayControls/PortControl.xaml @@ -178,8 +178,40 @@ -