From 9e110a467a28b1d1df4dc6bdb356eddd8b0944a6 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Thu, 12 Nov 2026 10:58:05 +0100 Subject: [PATCH] =?UTF-8?q?=C2=96Upgrade=20to=20.NET=2011?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Elwig/Elwig.csproj | 22 ++--- Elwig/Helpers/Billing/BillingData.cs | 16 ++-- Elwig/Helpers/Utils.cs | 2 +- .../PublishProfiles/FolderProfile.pubxml | 2 +- Elwig/Windows/MailWindow.xaml.cs | 2 +- Setup/Setup.wixproj | 4 +- Tests/E2ETests/Utils.cs | 2 +- Tests/Tests.csproj | 6 +- .../UnitTests/HelperTests/BillingDataTest.cs | 84 +++++++++---------- 9 files changed, 70 insertions(+), 70 deletions(-) diff --git a/Elwig/Elwig.csproj b/Elwig/Elwig.csproj index ea29138..1936bb7 100644 --- a/Elwig/Elwig.csproj +++ b/Elwig/Elwig.csproj @@ -2,7 +2,7 @@ WinExe - net10.0-windows + net11.0-windows x64 enable true @@ -23,21 +23,21 @@ - + - - - - - - + + + + + + - - - + + + diff --git a/Elwig/Helpers/Billing/BillingData.cs b/Elwig/Helpers/Billing/BillingData.cs index 2288bdc..3c29732 100644 --- a/Elwig/Helpers/Billing/BillingData.cs +++ b/Elwig/Helpers/Billing/BillingData.cs @@ -251,23 +251,23 @@ namespace Elwig.Helpers.Billing { try { return new JsonObject() { - ["15kmw"] = Math.Round(y.Distinct().Single(), prec) + ["15kmw"] = Math.Round((decimal)y.Distinct().Single(), prec) }; } catch { } var data = new JsonObject(); if (y[0] != y[1]) { - data[$"{x[0]}{mode}"] = Math.Round(y[0], prec); + data[$"{x[0]}{mode}"] = Math.Round((decimal)y[0], prec); } for (int i = 1; i < x.Length - 1; i++) { - var d1 = Math.Round(y[i] - y[i - 1], prec); - var d2 = Math.Round(y[i + 1] - y[i], prec); + var d1 = Math.Round((decimal)(y[i] - y[i - 1]), prec); + var d2 = Math.Round((decimal)(y[i + 1] - y[i]), prec); if (d1 != d2) { - data[$"{x[i]}{mode}"] = Math.Round(y[i], prec); + data[$"{x[i]}{mode}"] = Math.Round((decimal)y[i], prec); } } if (y[^1] != y[^2]) { - data[$"{x[^1]}{mode}"] = Math.Round(y[^1], prec); + data[$"{x[^1]}{mode}"] = Math.Round((decimal)y[^1], prec); } return data; } @@ -275,7 +275,7 @@ namespace Elwig.Helpers.Billing { protected static JsonNode GraphEntryToJson(GraphEntry entry) { try { if (entry.ContractedFlatBonus == null) { - return JsonValue.Create((decimal)entry.DataGraph.DataY.Distinct().Single()); + return JsonValue.Create(Math.Round((decimal)entry.DataGraph.DataY.Distinct().Single(), entry.DataGraph.Precision)); } } catch { } @@ -287,7 +287,7 @@ namespace Elwig.Helpers.Billing { curve["data"] = GraphToJson(entry.DataGraph, entry.Mode.ToString().ToLower()); if (entry.ContractedFlatBonus != null) { - curve["ctrd"] = (decimal)entry.ContractedFlatBonus; + curve["ctrd"] = Math.Round((decimal)entry.ContractedFlatBonus, entry.ContractedGraph?.Precision ?? entry.DataGraph.Precision); } else if (entry.ContractedGraph != null) { curve["ctrd"] = GraphToJson(entry.ContractedGraph, entry.Mode.ToString().ToLower()); } diff --git a/Elwig/Helpers/Utils.cs b/Elwig/Helpers/Utils.cs index 6d415a7..1047e76 100644 --- a/Elwig/Helpers/Utils.cs +++ b/Elwig/Helpers/Utils.cs @@ -579,7 +579,7 @@ namespace Elwig.Helpers { body.Add(doc.AsEmailAttachment($"{name}.pdf")); } msg.Body = body; - await client!.SendAsync(msg); + await client!.SendAsync(new SmtpSendRequest(msg)); await AddSentMails([( "email", member.MgNr, member.AdministrativeName, member.EmailAddresses.OrderBy(a => a.Nr).Select(a => a.Address).ToArray(), diff --git a/Elwig/Properties/PublishProfiles/FolderProfile.pubxml b/Elwig/Properties/PublishProfiles/FolderProfile.pubxml index f488827..f8aa9a8 100644 --- a/Elwig/Properties/PublishProfiles/FolderProfile.pubxml +++ b/Elwig/Properties/PublishProfiles/FolderProfile.pubxml @@ -9,7 +9,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. bin\Publish FileSystem <_TargetId>Folder - net10.0-windows + net11.0-windows win-x64 true false diff --git a/Elwig/Windows/MailWindow.xaml.cs b/Elwig/Windows/MailWindow.xaml.cs index 25e3f31..4b2226d 100644 --- a/Elwig/Windows/MailWindow.xaml.cs +++ b/Elwig/Windows/MailWindow.xaml.cs @@ -954,7 +954,7 @@ namespace Elwig.Windows { body.Add(doc.AsEmailAttachment($"{name}.pdf")); } msg.Body = body; - await client!.SendAsync(msg); + await client!.SendAsync(new SmtpSendRequest(msg)); await Utils.AddSentMails([( "email", m.MgNr, m.AdministrativeName, m.EmailAddresses.OrderBy(a => a.Nr).Select(a => a.Address).ToArray(), diff --git a/Setup/Setup.wixproj b/Setup/Setup.wixproj index 34e9897..674858a 100644 --- a/Setup/Setup.wixproj +++ b/Setup/Setup.wixproj @@ -14,7 +14,7 @@ - - + + \ No newline at end of file diff --git a/Tests/E2ETests/Utils.cs b/Tests/E2ETests/Utils.cs index 46e7d90..047fcb9 100644 --- a/Tests/E2ETests/Utils.cs +++ b/Tests/E2ETests/Utils.cs @@ -6,7 +6,7 @@ namespace Tests.E2ETests { public const int WINDOW_OPEN_SLEEP = 2000; - public static readonly string ApplicationPath = Path.GetFullPath(@"..\..\..\..\Elwig\bin\Debug\net10.0-windows\Elwig.exe"); + public static readonly string ApplicationPath = Path.GetFullPath(@"..\..\..\..\Elwig\bin\Debug\net11.0-windows\Elwig.exe"); public static readonly string ConfigPath = Path.GetFullPath(@"..\..\..\..\Tests\config.test.ini"); public static readonly string TestDatabasePath = Path.GetFullPath(@"..\..\..\..\Tests\ElwigTestDB.sqlite3"); diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 0930f14..bb85cc1 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -1,7 +1,7 @@ - net10.0-windows + net11.0-windows enable enable false @@ -19,11 +19,11 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Tests/UnitTests/HelperTests/BillingDataTest.cs b/Tests/UnitTests/HelperTests/BillingDataTest.cs index 75be612..8f7e1dc 100644 --- a/Tests/UnitTests/HelperTests/BillingDataTest.cs +++ b/Tests/UnitTests/HelperTests/BillingDataTest.cs @@ -545,8 +545,8 @@ namespace Tests.UnitTests.HelperTests { "id": 2, "mode": "oe", "data": { - "73oe": 0.65, - "84oe": 1.2 + "73oe": 0.6500, + "84oe": 1.2000 } } ] @@ -593,8 +593,8 @@ namespace Tests.UnitTests.HelperTests { "id": 2, "mode": "oe", "data": { - "73oe": 0.65, - "84oe": 1.2 + "73oe": 0.6500, + "84oe": 1.2000 } } ] @@ -624,14 +624,14 @@ namespace Tests.UnitTests.HelperTests { "payment": { "GV": "curve:1", "ZW": 0.75, - "BP": 0.8 + "BP": 0.8000 }, "curves": [ { "id": 1, "mode": "oe", "data": { - "73oe": 0.6, + "73oe": 0.6000, "84oe": 1 } } @@ -660,7 +660,7 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "default": 0.8, + "default": 0.8000, "GV": "curve:1", "GV-B": "curve:1", "-B": 0.75 @@ -670,7 +670,7 @@ namespace Tests.UnitTests.HelperTests { "id": 1, "mode": "oe", "data": { - "73oe": 0.6, + "73oe": 0.6000, "84oe": 1 } } @@ -702,9 +702,9 @@ namespace Tests.UnitTests.HelperTests { "version": 1, "payment": { "default": 0.75, - "/S": 0.3, - "/S-B": 0.4, - "-B": 0.2 + "/S": 0.3000, + "/S-B": 0.4000, + "-B": 0.2000 }, "curves": [] } @@ -727,9 +727,9 @@ namespace Tests.UnitTests.HelperTests { { "mode": "elwig", "version": 1, - "payment": 0.2, + "payment": 0.2000, "quality": { - "WEI": 0.1 + "WEI": 0.1000 }, "curves": [] } @@ -752,8 +752,8 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "default": 0.1, - "GV-B": 0.2 + "default": 0.1000, + "GV-B": 0.2000 }, "curves": [] } @@ -779,11 +779,11 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "default": 0.1, - "GV-B": 0.2, - "FV-B": 0.2, - "ZW-B": 0.3, - "WR-B": 0.3 + "default": 0.1000, + "GV-B": 0.2000, + "FV-B": 0.2000, + "ZW-B": 0.3000, + "WR-B": 0.3000 }, "curves": [] } @@ -806,8 +806,8 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "default": 0.1, - "WR-B": 0.2 + "default": 0.1000, + "WR-B": 0.2000 }, "curves": [] } @@ -830,9 +830,9 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "default": 0.1, - "-B": 0.2, - "GV-B": 0.1 + "default": 0.1000, + "-B": 0.2000, + "GV-B": 0.1000 }, "curves": [] } @@ -858,11 +858,11 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "GV/S-B": 0.2, - "/S": 0.2, - "/S-B": 0.3, - "GV": 0.1, - "ZW": 0.1 + "GV/S-B": 0.2000, + "/S": 0.2000, + "/S-B": 0.3000, + "GV": 0.1000, + "ZW": 0.1000 }, "curves": [] } @@ -886,9 +886,9 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "default": 0.1, - "RR-B": 0.1, - "RR": 0.2 + "default": 0.1000, + "RR-B": 0.1000, + "RR": 0.2000 }, "curves": [] } @@ -914,10 +914,10 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "RR/K-B": 0.2, - "RR/K": 0.3, - "default": 0.1, - "/K": 0.2 + "RR/K-B": 0.2000, + "RR/K": 0.3000, + "default": 0.1000, + "/K": 0.2000 }, "curves": [] } @@ -940,8 +940,8 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "WR/S": 0.2, - "default": 0.1 + "WR/S": 0.2000, + "default": 0.1000 }, "curves": [] } @@ -964,9 +964,9 @@ namespace Tests.UnitTests.HelperTests { "mode": "elwig", "version": 1, "payment": { - "default": 0.1, - "/S": 0.2, - "GV/S": 0.1 + "default": 0.1000, + "/S": 0.2000, + "GV/S": 0.1000 }, "curves": [] }