summaryrefslogtreecommitdiff
path: root/Aktywator/ParyTournament.cs
diff options
context:
space:
mode:
authorMichał Zimniewicz <michzimny@users.noreply.github.com>2017-12-06 23:57:31 +0100
committerGitHub <noreply@github.com>2017-12-06 23:57:31 +0100
commit80cd31c1c8e7cef2cfbf6148df3d9ec2d2a23279 (patch)
tree4071e574a3e611cf4d8a19e231ff7ecc659949fa /Aktywator/ParyTournament.cs
parent83e064ccb67f0b68b1f947026301cd3905d06a3c (diff)
parentf12d2b996b165d66f4c32eef4a3bdfb89309670d (diff)
Merge pull request #29 from michzimny/1.1-beta
Scalenie gałęzi beta do master
Diffstat (limited to 'Aktywator/ParyTournament.cs')
-rw-r--r--Aktywator/ParyTournament.cs56
1 files changed, 56 insertions, 0 deletions
diff --git a/Aktywator/ParyTournament.cs b/Aktywator/ParyTournament.cs
new file mode 100644
index 0000000..0c9209f
--- /dev/null
+++ b/Aktywator/ParyTournament.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using MySql.Data.MySqlClient;
+
+namespace Aktywator
+{
+ class ParyTournament: MySQLTournament
+ {
+ public ParyTournament(string name, int type = Tournament.TYPE_PARY)
+ : base(name, type)
+ {
+ this._type = Tournament.TYPE_PARY;
+ }
+
+ override internal string getTypeLabel()
+ {
+ return "Pary";
+ }
+
+ override public string getSectionsNum()
+ {
+ return this.mysql.selectOne("SELECT COUNT(DISTINCT seknum) FROM sektory;");
+ }
+
+ override public string getTablesNum()
+ {
+ return this.mysql.selectOne("SELECT COUNT(*) FROM sektory;");
+ }
+
+ 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");
+ while (dbData.Read())
+ {
+ int pairNo = dbData.GetInt32(0);
+ if (!pairs.ContainsKey(pairNo))
+ {
+ pairs.Add(pairNo, new List<string>());
+ }
+ pairs[pairNo].Add(dbData.IsDBNull(1) ? " " : dbData.GetString(1));
+ }
+ foreach (KeyValuePair<int, List<string>> pair in pairs)
+ {
+ while (pair.Value.Count < 2)
+ {
+ pair.Value.Add(" ");
+ }
+ }
+ dbData.Close();
+ return pairs;
+ }
+
+ }
+}