summaryrefslogtreecommitdiff
path: root/Aktywator
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-03-20 20:52:41 +0100
committeremkael <emkael@tlen.pl>2018-03-20 20:52:41 +0100
commit04ddfb636057d72381ce8c69c3ab81422b1d11a4 (patch)
treeb1761b28113c63a46f2cd1253dba8925dd31b8bf /Aktywator
parentdb4fda7a0869ab88162b6bba231e8ad6b94036bf (diff)
Names for individual tournaments from JFR Pary
Fixes #30
Diffstat (limited to 'Aktywator')
-rw-r--r--Aktywator/ParyTournament.cs33
-rw-r--r--Aktywator/Resources/BuildDate.txt2
2 files changed, 32 insertions, 3 deletions
diff --git a/Aktywator/ParyTournament.cs b/Aktywator/ParyTournament.cs
index 0c9209f..2fdf360 100644
--- a/Aktywator/ParyTournament.cs
+++ b/Aktywator/ParyTournament.cs
@@ -2,20 +2,41 @@
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
+using System.Windows.Forms;
namespace Aktywator
{
class ParyTournament: MySQLTournament
{
+ private bool _indy = false;
+
public ParyTournament(string name, int type = Tournament.TYPE_PARY)
: base(name, type)
{
this._type = Tournament.TYPE_PARY;
+ this._indy = this.isIndy();
}
override internal string getTypeLabel()
{
- return "Pary";
+ string label = "Pary";
+ if (this._indy)
+ {
+ label += " (indywiduel)";
+ MessageBox.Show(
+ "Nazwiska w turnieju indywidualnym są wyświetlane PARAMI, według rozstawienia w pierwszej rundzie.\n" +
+ "Używać TYLKO dla turniejów typu Finał GPPP ze stałym skojarzeniem par!",
+ "Nazwiska w turnieju indywidualnym", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ return label;
+ }
+
+ private bool isIndy()
+ {
+ this.setup();
+ bool pary;
+ Boolean.TryParse(this.mysql.selectOne("SELECT pary FROM admin;"), out pary);
+ return !pary;
}
override public string getSectionsNum()
@@ -31,7 +52,15 @@ namespace Aktywator
override internal Dictionary<int, List<string>> getNameList()
{
Dictionary<int, List<String>> pairs = new Dictionary<int, List<string>>();
- MySqlDataReader dbData = this.mysql.select("SELECT idp, CONCAT(imie, ' ', nazw) name FROM zawodnicy ORDER BY idp");
+ string query = this._indy ?
+ "SELECT pairs.pair, CONCAT(zawodnicy.imie, ' ', zawodnicy.nazw) name FROM ( " +
+ "SELECT zN player, zN pair, 0 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN UNION " +
+ "SELECT zS player, zN pair, 1 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN UNION " +
+ "SELECT zE player, zE pair, 0 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN UNION " +
+ "SELECT zW player, zE pair, 1 in_pair FROM zapisy WHERE rnd = 1 GROUP BY zN " +
+ ") pairs JOIN zawodnicy ON pairs.player = zawodnicy.id ORDER BY pairs.pair, pairs.in_pair;" :
+ "SELECT idp, CONCAT(imie, ' ', nazw) name FROM zawodnicy ORDER BY idp";
+ MySqlDataReader dbData = this.mysql.select(query);
while (dbData.Read())
{
int pairNo = dbData.GetInt32(0);
diff --git a/Aktywator/Resources/BuildDate.txt b/Aktywator/Resources/BuildDate.txt
index fb76437..c28b5ac 100644
--- a/Aktywator/Resources/BuildDate.txt
+++ b/Aktywator/Resources/BuildDate.txt
@@ -1 +1 @@
-2018-02-04
+2018-03-20