summaryrefslogtreecommitdiff
path: root/Aktywator/MySQLTournament.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Aktywator/MySQLTournament.cs')
-rw-r--r--Aktywator/MySQLTournament.cs17
1 files changed, 13 insertions, 4 deletions
diff --git a/Aktywator/MySQLTournament.cs b/Aktywator/MySQLTournament.cs
index f745a91..3bc9acc 100644
--- a/Aktywator/MySQLTournament.cs
+++ b/Aktywator/MySQLTournament.cs
@@ -21,19 +21,28 @@ namespace Aktywator
mysql = new MySQL(name);
}
+ public static string getLabel(string name, int type)
+ {
+ return name + " [" + (type == Tournament.TYPE_PARY ? 'P' : 'T') + "]";
+ }
+
public override string ToString()
{
- return this.name + " [" + (this.type == Tournament.TYPE_PARY ? 'P' : 'T') + "]";
+ return MySQLTournament.getLabel(this.name, this.type);
}
- public static List<MySQLTournament> getTournaments()
+ public static List<TournamentListItem> getTournaments()
{
- List<MySQLTournament> list = new List<MySQLTournament>();
+ List<TournamentListItem> list = new List<TournamentListItem>();
MySQL c = new MySQL("");
data dbs = c.select("SELECT TABLE_SCHEMA, COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_NAME = 'admin' AND COLUMN_NAME IN ('dnazwa', 'teamcnt') ORDER BY TABLE_SCHEMA;");
while (dbs.Read())
{
- list.Add(new MySQLTournament(dbs.GetString(0), "dnazwa".Equals(dbs.GetString(1)) ? Tournament.TYPE_PARY : Tournament.TYPE_TEAMY));
+ TournamentListItem item = new TournamentListItem();
+ item.Name = dbs.GetString(0);
+ item.Type = "dnazwa".Equals(dbs.GetString(1)) ? Tournament.TYPE_PARY : Tournament.TYPE_TEAMY;
+ item.Label = MySQLTournament.getLabel(item.Name, item.Type);
+ list.Add(item);
}
dbs.Close();
return list;