From f95e958ffbb80252a82c4b01300a6a899cde03ce Mon Sep 17 00:00:00 2001 From: Bradley Relyea Date: Tue, 28 Oct 2025 16:13:05 +0000 Subject: [PATCH] V4.1 with excel stats changes --- AiQ_GUI.cs | 90 ++++++---------- Microsoft/StatsExcel.cs | 232 ++++++++++++++++++++-------------------- 2 files changed, 144 insertions(+), 178 deletions(-) diff --git a/AiQ_GUI.cs b/AiQ_GUI.cs index 7d6dce6..7c47f2f 100644 --- a/AiQ_GUI.cs +++ b/AiQ_GUI.cs @@ -1,5 +1,6 @@ using Newtonsoft.Json; using System.ComponentModel; +using System.Data.OleDb; using System.Diagnostics; using System.Reflection; @@ -226,7 +227,6 @@ namespace AiQ_GUI await TestPassed(PCTime); } - public void Stats(string TypeOfTest) { Stats([TypeOfTest]); @@ -234,7 +234,7 @@ namespace AiQ_GUI public void Stats(string[] TypeOfTest) { - using OleDbConnection conn = new(connString); // Opens connection to Access database + using OleDbConnection conn = new(Access.connString); // Opens connection to Access database try { conn.Open(); // Opens DB @@ -263,7 +263,7 @@ namespace AiQ_GUI public void StatsDiags(string redDiagLabels, string RhTxBxActionsText, string IsRMA, int RMA) { - using OleDbConnection conn = new(connString); + using OleDbConnection conn = new(Access.connString); conn.Open(); // Null checks @@ -288,8 +288,6 @@ namespace AiQ_GUI cmd.ExecuteNonQuery(); } - - private async void BtnPreTest_Click(object sender, EventArgs e) { // Show user test has started @@ -337,6 +335,8 @@ namespace AiQ_GUI await AllocateSerial(); else if (GoogleAPI.UpdateSpreadSheetRePreTest(CameraAccessInfo.SpreadsheetID, Vers) != "OK") // If rerun might be different values so update SS AddToActionsList("Failed to write to spreadsheet, please check manually"); + // else if (Excel.UpdateSpreadSheetPreTest(CameraAccessInfo.SpreadsheetID, Vers, CamOnTest.GetCamDesc(), CamOnTest.Model) != "OK") + // AddToActionsList("Failed to write to spreadsheet, please check manually"); } else // No serial or model so allocate one await AllocateSerial(); @@ -348,8 +348,8 @@ namespace AiQ_GUI { await PreTestFailed("Diagnostic Failure"); } - - + + } // ***** Pass/Fails ***** @@ -415,25 +415,23 @@ namespace AiQ_GUI Btn.BackColor = Color.Maroon; Btn.Text = "Test Failed"; + if (!(CamOnTest.RMANum != 0)) // Yap to check if it is not a RMA + { + Access.Stats(["Final Tests Failed", ErrMssg], CamOnTest.Model); + } + else + { + Access.Stats("RMA Final Tests Failed", CamOnTest.Model); + } + AddToActionsList(ErrMssg); + string RedLbls = string.Join(Environment.NewLine, PnlLbls.Controls .OfType