diff options
author | emkael <emkael@tlen.pl> | 2017-07-30 00:55:33 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-07-30 00:57:40 +0200 |
commit | f14238e95bf1a10789585bf7632c5506daecc630 (patch) | |
tree | 8008c7d455fa1c4a77de167afb8f731c4170c3d8 /Aktywator | |
parent | c826889695c08a76c0e4c4f5d8ae126a3eb09ab6 (diff) |
Refactoring Tournament as MySQLTournament
Diffstat (limited to 'Aktywator')
-rw-r--r-- | Aktywator/Aktywator.csproj | 2 | ||||
-rw-r--r-- | Aktywator/Bws.cs | 2 | ||||
-rw-r--r-- | Aktywator/ChooseTournament.cs | 10 | ||||
-rw-r--r-- | Aktywator/MainForm.cs | 6 | ||||
-rw-r--r-- | Aktywator/MySQLTournament.cs (renamed from Aktywator/Tournament.cs) | 26 |
5 files changed, 23 insertions, 23 deletions
diff --git a/Aktywator/Aktywator.csproj b/Aktywator/Aktywator.csproj index edee3c0..97fa090 100644 --- a/Aktywator/Aktywator.csproj +++ b/Aktywator/Aktywator.csproj @@ -107,7 +107,7 @@ <Compile Include="Setting.cs" /> <Compile Include="Settings.cs" /> <Compile Include="Sql.cs" /> - <Compile Include="Tournament.cs" /> + <Compile Include="MySQLTournament.cs" /> <EmbeddedResource Include="ChooseTournament.resx"> <DependentUpon>ChooseTournament.cs</DependentUpon> </EmbeddedResource> diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 6a3b394..24e707c 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -344,7 +344,7 @@ namespace Aktywator else return 0; } - public void syncNames(Tournament tournament, bool interactive, string startRounds) + public void syncNames(MySQLTournament tournament, bool interactive, string startRounds) { int count = 0, countNew = 0, SKOK_STOLOW = 100; data d; diff --git a/Aktywator/ChooseTournament.cs b/Aktywator/ChooseTournament.cs index 2bc2ded..155624b 100644 --- a/Aktywator/ChooseTournament.cs +++ b/Aktywator/ChooseTournament.cs @@ -10,8 +10,8 @@ namespace Aktywator { public partial class ChooseTournament : Form { - private Tournament[] turns; - public Tournament chosenTournament; + private MySQLTournament[] turns; + public MySQLTournament chosenTournament; public ChooseTournament() { @@ -20,10 +20,10 @@ namespace Aktywator private void ChooseTournament_Load(object sender, EventArgs e) { - List<Tournament> list = Tournament.getTournaments(); - turns = new Tournament[list.Count]; + List<MySQLTournament> list = MySQLTournament.getTournaments(); + turns = new MySQLTournament[list.Count]; int c = 0; - foreach (Tournament t in list) + foreach (MySQLTournament t in list) { turns[c++] = t; listBox.Items.Add(t.ToString()); diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index 55e2f53..96d965b 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -15,7 +15,7 @@ namespace Aktywator public string date = "28.06.2017"; private Bws bws; - private Tournament tournament; + private MySQLTournament tournament; public MainForm() { @@ -181,7 +181,7 @@ namespace Aktywator } } - private void updateTournamentInfo(Tournament tournament) + private void updateTournamentInfo(MySQLTournament tournament) { if (tournament != null) { @@ -194,7 +194,7 @@ namespace Aktywator bSync.Enabled = true; bAutoSync.Enabled = true; eInterval.Enabled = true; - if (tournament.type == Tournament.TYPE_TEAMY) + if (tournament.type == MySQLTournament.TYPE_TEAMY) { lSkok.Visible = true; lNazwyTeamow.Visible = true; diff --git a/Aktywator/Tournament.cs b/Aktywator/MySQLTournament.cs index ec45c15..54f3f7b 100644 --- a/Aktywator/Tournament.cs +++ b/Aktywator/MySQLTournament.cs @@ -6,7 +6,7 @@ using data = MySql.Data.MySqlClient.MySqlDataReader; namespace Aktywator { - public class Tournament + public class MySQLTournament { public const int TYPE_PARY = 1; public const int TYPE_TEAMY = 2; @@ -26,7 +26,7 @@ namespace Aktywator public MySQL mysql; - public Tournament(string name) + public MySQLTournament(string name) { this._name = name; mysql = new MySQL(name); @@ -38,28 +38,28 @@ namespace Aktywator if ((mysql.selectOne("SHOW TABLES LIKE 'admin'") == "admin") && (mysql.selectOne("SHOW FIELDS IN admin LIKE 'dnazwa'") == "dnazwa") && (mysql.selectOne("SHOW TABLES LIKE 'zawodnicy'") == "zawodnicy")) - _type = Tournament.TYPE_PARY; + _type = MySQLTournament.TYPE_PARY; else if ((mysql.selectOne("SHOW TABLES LIKE 'admin'") == "admin") && (mysql.selectOne("SHOW FIELDS IN admin LIKE 'teamcnt'") == "teamcnt") && (mysql.selectOne("SHOW TABLES LIKE 'players'") == "players")) - _type = Tournament.TYPE_TEAMY; - else _type = Tournament.TYPE_UNKNOWN; + _type = MySQLTournament.TYPE_TEAMY; + else _type = MySQLTournament.TYPE_UNKNOWN; } public override string ToString() { - return this.name + " [" + (this.type == Tournament.TYPE_PARY ? 'P' : 'T') + "]"; + return this.name + " [" + (this.type == MySQLTournament.TYPE_PARY ? 'P' : 'T') + "]"; } - public static List<Tournament> getTournaments() + public static List<MySQLTournament> getTournaments() { - List<Tournament> list = new List<Tournament>(); + List<MySQLTournament> list = new List<MySQLTournament>(); MySQL c = new MySQL(""); data dbs = c.select("SHOW DATABASES;"); while (dbs.Read()) { - Tournament t = new Tournament(dbs.GetString(0)); - if (t.type > Tournament.TYPE_UNKNOWN) + MySQLTournament t = new MySQLTournament(dbs.GetString(0)); + if (t.type > MySQLTournament.TYPE_UNKNOWN) list.Add(t); t.mysql.close(); } @@ -68,7 +68,7 @@ namespace Aktywator public string getSectionsNum() { - if (type == Tournament.TYPE_PARY) + if (type == MySQLTournament.TYPE_PARY) return mysql.selectOne("SELECT COUNT(DISTINCT seknum) FROM sektory;"); else return "1"; @@ -76,7 +76,7 @@ namespace Aktywator public string getTablesNum() { - if (type == Tournament.TYPE_PARY) + if (type == MySQLTournament.TYPE_PARY) return mysql.selectOne("SELECT COUNT(*) FROM sektory;"); else return mysql.selectOne("SELECT teamcnt FROM admin;"); @@ -99,7 +99,7 @@ namespace Aktywator internal string getTypeLabel() { - return this._type == Tournament.TYPE_PARY ? "Pary" : "Teamy"; + return this._type == MySQLTournament.TYPE_PARY ? "Pary" : "Teamy"; } } } |