From 05d378536e21240abab085a2a07cbf99b1e882b8 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sun, 19 Jun 2022 16:34:21 +0200 Subject: [PATCH] =?UTF-8?q?fixes=20f=C3=BCr=20Fehlermeldungen=20von=20Chri?= =?UTF-8?q?stin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DangerousGoodsDetailControl.xaml.cs | 16 ++++++-------- ENI2/ENI2.csproj | 4 ++-- ENI2/Excel/ExcelBase.cs | 2 ++ ENI2/Excel/ExcelComparer.cs | 21 ++++++++++++------- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs index a3ae785c..1c28b2cb 100644 --- a/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/DangerousGoodsDetailControl.xaml.cs @@ -222,8 +222,7 @@ namespace ENI2.DetailViewControls target_haz.MARPOLPositions.Add(copyMARPOL); target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); - this.OnControlCacheReset(Properties.Resources.textDGDeparture); - this.SetHAZGlobalFlags(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -244,8 +243,7 @@ namespace ENI2.DetailViewControls target_haz.IMSBCPositions.Add(copyIMSBC); target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); - this.OnControlCacheReset(Properties.Resources.textDGDeparture); - this.SetHAZGlobalFlags(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -266,8 +264,7 @@ namespace ENI2.DetailViewControls target_haz.IMDGPositions.Add(copyIMDG); target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); - this.OnControlCacheReset(Properties.Resources.textDGDeparture); - this.SetHAZGlobalFlags(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -288,8 +285,7 @@ namespace ENI2.DetailViewControls target_haz.IGCPositions.Add(copyIGC); target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); - this.OnControlCacheReset(Properties.Resources.textDGDeparture); - this.SetHAZGlobalFlags(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -312,8 +308,7 @@ namespace ENI2.DetailViewControls target_haz.IBCPositions.Add(copyIBC); target_haz.NoDPGOnBoardOnArrival = false; this.SublistElementChanged(this.IsDeparture ? Message.NotificationClass.HAZA : Message.NotificationClass.HAZD); - this.OnControlCacheReset(Properties.Resources.textDGDeparture); - this.SetHAZGlobalFlags(); + this.OnControlCacheReset(this.IsDeparture ? Properties.Resources.textDGArrival : Properties.Resources.textDGDeparture); } } } @@ -327,6 +322,7 @@ namespace ENI2.DetailViewControls void SetHAZGlobalFlags() { HAZ haz = this.IsDeparture ? this.hazd : this.haza; + int totalCount = haz.MARPOLPositions.Count + haz.IMDGPositions.Count + haz.IGCPositions.Count + haz.IBCPositions.Count + haz.IMSBCPositions.Count; if(totalCount == 1) { diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 7642006e..a06b460f 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 1 - 7.3.0.1 + 2 + 7.3.0.2 false true true diff --git a/ENI2/Excel/ExcelBase.cs b/ENI2/Excel/ExcelBase.cs index 753ee783..71f55158 100644 --- a/ENI2/Excel/ExcelBase.cs +++ b/ENI2/Excel/ExcelBase.cs @@ -144,6 +144,8 @@ namespace ENI2.Excel { var range = _nameDict[lookup].RefersToRange; range.Interior.Color = color; + // range.Worksheet.Tab.ColorIndex = XlColorIndex.xlColorIndexAutomatic; + range.Worksheet.Tab.Color = color; } } diff --git a/ENI2/Excel/ExcelComparer.cs b/ENI2/Excel/ExcelComparer.cs index 93f30c47..9d93436c 100644 --- a/ENI2/Excel/ExcelComparer.cs +++ b/ENI2/Excel/ExcelComparer.cs @@ -12,6 +12,12 @@ using System.Drawing; namespace ENI2.Excel { + + /// + /// Diese Klasse beinhaltet den von Anmeldungen unabhängigen Vergleich von Excel Sheets. Damit + /// können dann Updates von "außen" einfacher abgearbeitet werden. Zellen und sheets werden bei + /// Aktualisierung bunt eingefärbt + /// public static class ExcelComparer { private static int diffColor = ColorTranslator.ToOle(Color.FromArgb(150, 150, 255)); // blue @@ -33,32 +39,33 @@ namespace ENI2.Excel { if (!source.NameDict.ContainsKey(name)) continue; string sourceText = source.ReadText(name); - string targetText = comparison.ReadText(name); + string targetText = comparison.ReadText(name); + if (sourceText == null) { if (targetText != null) { - comparison.Colorize(name, diffColor); + comparison.Colorize(name, diffColor); counter++; } } - if (targetText == null) + else if (targetText == null) { if (sourceText != null) { - comparison.Colorize(name, diffColor); + comparison.Colorize(name, diffColor); counter++; } } - if ((sourceText != null) && (targetText != null)) + else if ((sourceText != null) && (targetText != null)) { if (!sourceText.Equals(targetText)) { // turn cell blue - comparison.Colorize(name, diffColor); + comparison.Colorize(name, diffColor); counter++; } - } + } } comparison.Save(fileName); errorMessage = string.Format("{0} differences found", counter);