diff options
Diffstat (limited to 'Aktywator')
-rw-r--r-- | Aktywator/Bws.cs | 8 | ||||
-rw-r--r-- | Aktywator/MainForm.cs | 30 | ||||
-rw-r--r-- | Aktywator/Setting.cs | 13 |
3 files changed, 49 insertions, 2 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index e89996f..c112158 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -250,7 +250,7 @@ namespace Aktywator settings = new List<Setting>(); settings.Add(new Setting("ShowResults", main.xShowResults, this, new Version(2, 0, 0), new Version(1, 3, 1))); settings.Add(new Setting("RepeatResults", main.xRepeatResults, this, null, null)); - settings.Add(new Setting("ShowPercentage", main.xShowPercentage, this, null, null)); + settings.Add(new Setting("ShowPercentage", main.xShowPercentage, this, new Version(3, 6, 0), new Version(3, 0, 1))); settings.Add(new Setting("GroupSections", main.xGroupSections, this, new Version(2, 1, 10), new Version(1, 3, 1))); settings.Add(new Setting("ShowPairNumbers", main.xShowPairNumbers, this, null, null)); settings.Add(new Setting("IntermediateResults", main.xIntermediateResults, this, null, new Version(1, 4, 1))); @@ -347,6 +347,7 @@ namespace Aktywator settings.Add(new Setting("BM2ValidateLeadCard", "bit", "false")); settings.Add(new Setting("BM2TDCall", "bit", "false")); settings.Add(new Setting("BM2ShowPlayerNames", "integer", "0")); + settings.Add(new Setting("ScoringType", "integer", "1", "`Section`")); foreach (Setting s in settings) { @@ -525,6 +526,10 @@ namespace Aktywator int.TryParse(Setting.load("BM2ResultsOverview", this, errors, section), out resultsOverview); main.xResultsOverview.SelectedIndex = resultsOverview; + int scoringType = 1; + Int32.TryParse(Setting.load("ScoringType", this, errors, section, "`Section`", "`ID`"), out scoringType); + main.setScoringType(scoringType); + main.checkRecordsForSectionGroups(); if (section == null && main.cbSettingsSection.Items.Count > 2) @@ -584,6 +589,7 @@ namespace Aktywator Setting.save("BM2PINcode", "'" + main.xPINcode.Text + "'", this, errors, section); Setting.save("BM2ResultsOverview", main.xResultsOverview.SelectedIndex.ToString(), this, errors, section); Setting.saveSectionGroups(this.sql, main.xGroupSections.Checked, (this.getMySQLDatabaseForSection() != null) ? Convert.ToInt32(main.numTeamsTableOffset.Value) : 0); + Setting.saveScoringType(this.sql, main.getScoringType(), section); this.loadSettings(); } diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs index ecf52c5..0f456ea 100644 --- a/Aktywator/MainForm.cs +++ b/Aktywator/MainForm.cs @@ -26,6 +26,8 @@ namespace Aktywator public static Version requiredBCSVersion; public static Version requiredFWVersion; + private Dictionary<RadioButton, int> _scoringType; + public MainForm() { InitializeComponent(); @@ -34,6 +36,11 @@ namespace Aktywator private void MainForm_Load(object sender, EventArgs e) { if (!MySQL.getConfigured()) (new MysqlSettings()).ShowDialog(); + this._scoringType = new Dictionary<RadioButton, int>(); + this._scoringType.Add(this.rbMatchpoints, 1); + this._scoringType.Add(this.rbIMPCavendish, 2); + this._scoringType.Add(this.rbIMPButler, 3); + this._scoringType.Add(this.rbIMPTeams, 4); } private void MainForm_Shown(object sender, EventArgs e) @@ -97,7 +104,6 @@ namespace Aktywator { syncToolStrip.Visible = false; namesPanel.Visible = false; - this.rbMatchpoints.Checked = true; } this.WindowState = FormWindowState.Normal; @@ -744,5 +750,27 @@ namespace Aktywator this.rbIMPTeams.Enabled = xShowPercentage.Checked && teamsTournament; } + internal int getScoringType() + { + if (this.xShowPercentage.Checked) + { + foreach (KeyValuePair<RadioButton, int> type in this._scoringType) + { + if (type.Key.Checked) + { + return type.Value; + } + } + } + return 0; + } + + internal void setScoringType(int scoringType) + { + foreach (KeyValuePair<RadioButton, int> type in this._scoringType) + { + type.Key.Checked = (type.Value == scoringType); + } + } } } diff --git a/Aktywator/Setting.cs b/Aktywator/Setting.cs index 2cf1120..657c822 100644 --- a/Aktywator/Setting.cs +++ b/Aktywator/Setting.cs @@ -174,6 +174,19 @@ namespace Aktywator } } + public static void saveScoringType(Sql sql, int value, string section) + { + StringBuilder sb = new StringBuilder("UPDATE `Section` SET `ScoringType` = "); + sb.Append(value); + if (section != null) + { + sb.Append(" WHERE `ID` = "); + sb.Append(section); + } + sb.Append(";"); + sql.query(sb.ToString()); + } + public static void saveSectionGroups(Sql sql, bool value, int teamTableOffset = 0) { if (teamTableOffset == 0) |