diff options
author | emkael <emkael@tlen.pl> | 2018-04-13 16:56:44 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-04-13 16:56:44 +0200 |
commit | bc1eb7582b69794bc519a086a306bcf9e9bd6a9c (patch) | |
tree | 11d6ad5e65fe2ea2e60043f58bfa94de375d6d7d | |
parent | 7b2f2c9e74a0e00f1fb12cba23fb218e470998eb (diff) |
Detecting different hand records between sections
-rw-r--r-- | Aktywator/Bws.cs | 25 |
1 files changed, 25 insertions, 0 deletions
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 |