From bc1eb7582b69794bc519a086a306bcf9e9bd6a9c Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 Apr 2018 16:56:44 +0200 Subject: Detecting different hand records between sections --- Aktywator/Bws.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Aktywator') diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 5695a00..19a2463 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -841,6 +841,7 @@ namespace Aktywator { sql.query("DELETE FROM HandRecord WHERE `Section` = " + section); sql.query("DELETE FROM HandEvaluation WHERE `Section` = " + section); + this._differentRecordsDetected = false; } public void clearHandRecords() @@ -922,6 +923,30 @@ namespace Aktywator return count; } + private bool _differentRecordsDetected = false; + private bool _differentRecordsInSections = false; + + public bool detectDifferentRecordsInSections() + { + if (!this._differentRecordsDetected) + { + this._differentRecordsInSections = false; + OleDbDataReader sections = sql.select("SELECT DISTINCT COUNT(`Section`) FROM HandRecord GROUP BY Board, NorthSpades, NorthHearts, NorthDiamonds, NorthClubs, EastSpades, EastHearts, EastDiamonds, EastClubs, SouthSpades, SouthHearts, SouthDiamonds, SouthClubs"); + while (sections.Read()) + { + int boardSections = this.getBWSNumber(sections, 0); + int bwsSections = main.gwSections.Rows.Count; + if (boardSections != bwsSections) + { + this._differentRecordsInSections = true; + break; + } + } + this._differentRecordsDetected = true; + } + return this._differentRecordsInSections; + } + internal string getMySQLDatabaseForSection() { try -- cgit v1.2.3