From d69bfc78e07d881f908bc12e35e7da07c736a8a8 Mon Sep 17 00:00:00 2001 From: Stoyan Zlatev Date: Fri, 31 Jan 2025 12:47:19 +0100 Subject: [PATCH] Stichproben regeln activated for pcbs --- Common/CordonelAssemblyLine/App.config | 3 --- Common/CordonelAssemblyLine/Leak.xaml.cs | 7 +++++-- Common/CordonelAssemblyLine/Model/LeakViewModel.cs | 2 +- Common/Stichproben/Cordonel/Stichproben.cs | 2 +- .../Stichproben/Cordonel/StichprobenDbContext.cs | 14 +++++++------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Common/CordonelAssemblyLine/App.config b/Common/CordonelAssemblyLine/App.config index 205eeb10..0e0d29cc 100644 --- a/Common/CordonelAssemblyLine/App.config +++ b/Common/CordonelAssemblyLine/App.config @@ -16,8 +16,5 @@ - - - \ No newline at end of file diff --git a/Common/CordonelAssemblyLine/Leak.xaml.cs b/Common/CordonelAssemblyLine/Leak.xaml.cs index 2e7997a6..752e21dc 100644 --- a/Common/CordonelAssemblyLine/Leak.xaml.cs +++ b/Common/CordonelAssemblyLine/Leak.xaml.cs @@ -33,8 +33,11 @@ namespace CordonelAssemblyLine private void BtnPresueOk_Click(Object sender, RoutedEventArgs e) { var ret = ViewModel.StoreData(true); - - ShouldBePressureTestedModal.Check(123); + + if (ret && int.TryParse($"{ViewModel?.CurrentPcbID}", out var pcbId)) + { + ShouldBePressureTestedModal.Check(pcbId); + } } private void LockForPressureTest() diff --git a/Common/CordonelAssemblyLine/Model/LeakViewModel.cs b/Common/CordonelAssemblyLine/Model/LeakViewModel.cs index 3d3fd360..3ce1872d 100644 --- a/Common/CordonelAssemblyLine/Model/LeakViewModel.cs +++ b/Common/CordonelAssemblyLine/Model/LeakViewModel.cs @@ -355,8 +355,8 @@ namespace CordonelAssemblyLine.Model Task.Run(() => { var url = ServiceUrls.MeterProcessStateUrl(); - var status = DisplayCodes.PressureTestedFailed; + if (successfull) { status = DisplayCodes.PressureTested; diff --git a/Common/Stichproben/Cordonel/Stichproben.cs b/Common/Stichproben/Cordonel/Stichproben.cs index 9cbc57e1..3bc927cf 100644 --- a/Common/Stichproben/Cordonel/Stichproben.cs +++ b/Common/Stichproben/Cordonel/Stichproben.cs @@ -8,7 +8,7 @@ public Stichproben(string assemblyLocation) { this.stichprobenRules = new StichprobenRules(assemblyLocation); - this.stichprobenDb = new StichprobenDbContext(assemblyLocation); + this.stichprobenDb = new StichprobenDbContext("Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;"/*TODO: assemblyLocation*/); } public StichprobeResult ShouldBePressureTested(int pcbId) diff --git a/Common/Stichproben/Cordonel/StichprobenDbContext.cs b/Common/Stichproben/Cordonel/StichprobenDbContext.cs index 29ce3191..f6b0b3be 100644 --- a/Common/Stichproben/Cordonel/StichprobenDbContext.cs +++ b/Common/Stichproben/Cordonel/StichprobenDbContext.cs @@ -3,19 +3,19 @@ using LaaPackages.SqlClient; using System; - using System.Configuration; internal class StichprobenDbContext { private readonly SqlConnection sqlConnection; - public StichprobenDbContext(string assemblyLocation) + public StichprobenDbContext(string connectionString/*string assemblyLocation*/) { - var connectionString = ConfigurationManager - .OpenExeConfiguration(assemblyLocation) - .ConnectionStrings - .ConnectionStrings["auftrag"] - .ConnectionString; + //TODO: Get connection string from the config + //var connectionString = ConfigurationManager + // .OpenExeConfiguration(assemblyLocation) + // .ConnectionStrings + // .ConnectionStrings["auftrag"] + // .ConnectionString; this.sqlConnection = SqlConnection.CreateSqlConnection(connectionString, error => { Console.WriteLine(error);