diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs b/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs index 3c9d45cdb..bd050548d 100644 --- a/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs +++ b/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs @@ -49,13 +49,20 @@ this.label3 = new System.Windows.Forms.Label(); this.upgradeDb_225_226_Button = new System.Windows.Forms.Button(); this.customButton = new System.Windows.Forms.Button(); + this.upgradeDb_226_227_Button = new System.Windows.Forms.Button(); + this.upgradeDb_227_228_Button = new System.Windows.Forms.Button(); + this.upgradeDb_228_229_Button = new System.Windows.Forms.Button(); + this.upgradeDb_229_230_Button = new System.Windows.Forms.Button(); + this.upgradeDb_230_231_Button = new System.Windows.Forms.Button(); + this.upgradeDb_231_232_Button = new System.Windows.Forms.Button(); + this.upgradeDb_232_233_Button = new System.Windows.Forms.Button(); this.SuspendLayout(); // // upgradeDb_215_216_Button // - this.upgradeDb_215_216_Button.Location = new System.Drawing.Point(12, 217); + this.upgradeDb_215_216_Button.Location = new System.Drawing.Point(12, 205); this.upgradeDb_215_216_Button.Name = "upgradeDb_215_216_Button"; - this.upgradeDb_215_216_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_215_216_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_215_216_Button.TabIndex = 6; this.upgradeDb_215_216_Button.Text = "Upgrade DB from v.2.15 to v.2.16"; this.upgradeDb_215_216_Button.UseVisualStyleBackColor = true; @@ -63,9 +70,9 @@ // // upgradeDb_216_217_Button // - this.upgradeDb_216_217_Button.Location = new System.Drawing.Point(12, 257); + this.upgradeDb_216_217_Button.Location = new System.Drawing.Point(12, 230); this.upgradeDb_216_217_Button.Name = "upgradeDb_216_217_Button"; - this.upgradeDb_216_217_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_216_217_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_216_217_Button.TabIndex = 7; this.upgradeDb_216_217_Button.Text = "Upgrade DB from v.2.16 to v.2.17"; this.upgradeDb_216_217_Button.UseVisualStyleBackColor = true; @@ -73,9 +80,9 @@ // // upgradeDb_212_215_Button // - this.upgradeDb_212_215_Button.Location = new System.Drawing.Point(12, 177); + this.upgradeDb_212_215_Button.Location = new System.Drawing.Point(12, 180); this.upgradeDb_212_215_Button.Name = "upgradeDb_212_215_Button"; - this.upgradeDb_212_215_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_212_215_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_212_215_Button.TabIndex = 5; this.upgradeDb_212_215_Button.Text = "Upgrade DB from v.2.12 to v.2.15"; this.upgradeDb_212_215_Button.UseVisualStyleBackColor = true; @@ -83,9 +90,9 @@ // // upgradeDb_217_218_Button // - this.upgradeDb_217_218_Button.Location = new System.Drawing.Point(12, 297); + this.upgradeDb_217_218_Button.Location = new System.Drawing.Point(12, 255); this.upgradeDb_217_218_Button.Name = "upgradeDb_217_218_Button"; - this.upgradeDb_217_218_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_217_218_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_217_218_Button.TabIndex = 8; this.upgradeDb_217_218_Button.Text = "Upgrade DB from v.2.17 to v.2.18"; this.upgradeDb_217_218_Button.UseVisualStyleBackColor = true; @@ -93,9 +100,9 @@ // // upgradeDb_29_212_Button // - this.upgradeDb_29_212_Button.Location = new System.Drawing.Point(12, 137); + this.upgradeDb_29_212_Button.Location = new System.Drawing.Point(12, 155); this.upgradeDb_29_212_Button.Name = "upgradeDb_29_212_Button"; - this.upgradeDb_29_212_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_29_212_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_29_212_Button.TabIndex = 4; this.upgradeDb_29_212_Button.Text = "Upgrade DB from v.2.9 to v.2.12"; this.upgradeDb_29_212_Button.UseVisualStyleBackColor = true; @@ -125,7 +132,7 @@ // this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.textBox1.Enabled = false; - this.textBox1.Location = new System.Drawing.Point(94, 535); + this.textBox1.Location = new System.Drawing.Point(94, 109); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 11; @@ -134,7 +141,7 @@ // this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.textBox2.Enabled = false; - this.textBox2.Location = new System.Drawing.Point(94, 561); + this.textBox2.Location = new System.Drawing.Point(94, 130); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(100, 20); this.textBox2.TabIndex = 13; @@ -144,7 +151,7 @@ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.AutoSize = true; this.label1.Enabled = false; - this.label1.Location = new System.Drawing.Point(12, 538); + this.label1.Location = new System.Drawing.Point(12, 112); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(70, 13); this.label1.TabIndex = 10; @@ -155,7 +162,7 @@ this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label2.AutoSize = true; this.label2.Enabled = false; - this.label2.Location = new System.Drawing.Point(12, 564); + this.label2.Location = new System.Drawing.Point(12, 133); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(60, 13); this.label2.TabIndex = 12; @@ -165,7 +172,7 @@ // this.pressureRepresentationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.pressureRepresentationButton.Enabled = false; - this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 535); + this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 108); this.pressureRepresentationButton.Name = "pressureRepresentationButton"; this.pressureRepresentationButton.Size = new System.Drawing.Size(65, 42); this.pressureRepresentationButton.TabIndex = 14; @@ -175,9 +182,9 @@ // // upgradeDb_24_29_Button // - this.upgradeDb_24_29_Button.Location = new System.Drawing.Point(12, 97); + this.upgradeDb_24_29_Button.Location = new System.Drawing.Point(12, 82); this.upgradeDb_24_29_Button.Name = "upgradeDb_24_29_Button"; - this.upgradeDb_24_29_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_24_29_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_24_29_Button.TabIndex = 3; this.upgradeDb_24_29_Button.Text = "Upgrade DB from v.2.4 to v.2.9"; this.upgradeDb_24_29_Button.UseVisualStyleBackColor = true; @@ -185,9 +192,9 @@ // // upgradeDb_218_222_Button // - this.upgradeDb_218_222_Button.Location = new System.Drawing.Point(12, 337); + this.upgradeDb_218_222_Button.Location = new System.Drawing.Point(12, 280); this.upgradeDb_218_222_Button.Name = "upgradeDb_218_222_Button"; - this.upgradeDb_218_222_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_218_222_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_218_222_Button.TabIndex = 9; this.upgradeDb_218_222_Button.Text = "Upgrade DB from v.2.18 to v.2.22"; this.upgradeDb_218_222_Button.UseVisualStyleBackColor = true; @@ -197,7 +204,7 @@ // this.upgradeDb_NFC_button.Location = new System.Drawing.Point(12, 57); this.upgradeDb_NFC_button.Name = "upgradeDb_NFC_button"; - this.upgradeDb_NFC_button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_NFC_button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_NFC_button.TabIndex = 2; this.upgradeDb_NFC_button.Text = "Upgrade database for NFC tags"; this.upgradeDb_NFC_button.UseVisualStyleBackColor = true; @@ -205,9 +212,9 @@ // // upgradeDb_222_224_Button // - this.upgradeDb_222_224_Button.Location = new System.Drawing.Point(12, 404); + this.upgradeDb_222_224_Button.Location = new System.Drawing.Point(12, 331); this.upgradeDb_222_224_Button.Name = "upgradeDb_222_224_Button"; - this.upgradeDb_222_224_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_222_224_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_222_224_Button.TabIndex = 15; this.upgradeDb_222_224_Button.Text = "Upgrade DB from v.2.22 to v.2.24"; this.upgradeDb_222_224_Button.UseVisualStyleBackColor = true; @@ -215,9 +222,9 @@ // // upgradeDb_224_225_Button // - this.upgradeDb_224_225_Button.Location = new System.Drawing.Point(12, 444); + this.upgradeDb_224_225_Button.Location = new System.Drawing.Point(12, 356); this.upgradeDb_224_225_Button.Name = "upgradeDb_224_225_Button"; - this.upgradeDb_224_225_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_224_225_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_224_225_Button.TabIndex = 16; this.upgradeDb_224_225_Button.Text = "Upgrade DB from v.2.24 to v.2.25 (users)"; this.upgradeDb_224_225_Button.UseVisualStyleBackColor = true; @@ -225,7 +232,7 @@ // // errorFlagsComponentsTextBox // - this.errorFlagsComponentsTextBox.Location = new System.Drawing.Point(94, 378); + this.errorFlagsComponentsTextBox.Location = new System.Drawing.Point(94, 305); this.errorFlagsComponentsTextBox.Name = "errorFlagsComponentsTextBox"; this.errorFlagsComponentsTextBox.Size = new System.Drawing.Size(178, 20); this.errorFlagsComponentsTextBox.TabIndex = 17; @@ -233,7 +240,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 381); + this.label3.Location = new System.Drawing.Point(12, 308); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(71, 13); this.label3.TabIndex = 18; @@ -241,9 +248,9 @@ // // upgradeDb_225_226_Button // - this.upgradeDb_225_226_Button.Location = new System.Drawing.Point(13, 484); + this.upgradeDb_225_226_Button.Location = new System.Drawing.Point(12, 381); this.upgradeDb_225_226_Button.Name = "upgradeDb_225_226_Button"; - this.upgradeDb_225_226_Button.Size = new System.Drawing.Size(260, 34); + this.upgradeDb_225_226_Button.Size = new System.Drawing.Size(260, 22); this.upgradeDb_225_226_Button.TabIndex = 19; this.upgradeDb_225_226_Button.Text = "Upgrade DB from v.2.25 to v.2.26 (calendar)"; this.upgradeDb_225_226_Button.UseVisualStyleBackColor = true; @@ -259,11 +266,88 @@ this.customButton.UseVisualStyleBackColor = true; this.customButton.Click += new System.EventHandler(this.customButton_Click); // + // upgradeDb_226_227_Button + // + this.upgradeDb_226_227_Button.Location = new System.Drawing.Point(12, 406); + this.upgradeDb_226_227_Button.Name = "upgradeDb_226_227_Button"; + this.upgradeDb_226_227_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_226_227_Button.TabIndex = 21; + this.upgradeDb_226_227_Button.Text = "Upgrade DB from v.2.26 to v.2.27"; + this.upgradeDb_226_227_Button.UseVisualStyleBackColor = true; + this.upgradeDb_226_227_Button.Click += new System.EventHandler(this.upgradeDb_226_227_Button_Click); + // + // upgradeDb_227_228_Button + // + this.upgradeDb_227_228_Button.Location = new System.Drawing.Point(12, 431); + this.upgradeDb_227_228_Button.Name = "upgradeDb_227_228_Button"; + this.upgradeDb_227_228_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_227_228_Button.TabIndex = 22; + this.upgradeDb_227_228_Button.Text = "Upgrade DB from v.2.27 to v.2.28"; + this.upgradeDb_227_228_Button.UseVisualStyleBackColor = true; + this.upgradeDb_227_228_Button.Click += new System.EventHandler(this.upgradeDb_227_228_Button_Click); + // + // upgradeDb_228_229_Button + // + this.upgradeDb_228_229_Button.Location = new System.Drawing.Point(12, 456); + this.upgradeDb_228_229_Button.Name = "upgradeDb_228_229_Button"; + this.upgradeDb_228_229_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_228_229_Button.TabIndex = 23; + this.upgradeDb_228_229_Button.Text = "Upgrade DB from v.2.28 to v.2.29"; + this.upgradeDb_228_229_Button.UseVisualStyleBackColor = true; + this.upgradeDb_228_229_Button.Click += new System.EventHandler(this.upgradeDb_228_229_Button_Click); + // + // upgradeDb_229_230_Button + // + this.upgradeDb_229_230_Button.Location = new System.Drawing.Point(12, 481); + this.upgradeDb_229_230_Button.Name = "upgradeDb_229_230_Button"; + this.upgradeDb_229_230_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_229_230_Button.TabIndex = 24; + this.upgradeDb_229_230_Button.Text = "Upgrade DB from v.2.29 to v.2.30"; + this.upgradeDb_229_230_Button.UseVisualStyleBackColor = true; + this.upgradeDb_229_230_Button.Click += new System.EventHandler(this.upgradeDb_229_230_Button_Click); + // + // upgradeDb_230_231_Button + // + this.upgradeDb_230_231_Button.Location = new System.Drawing.Point(12, 507); + this.upgradeDb_230_231_Button.Name = "upgradeDb_230_231_Button"; + this.upgradeDb_230_231_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_230_231_Button.TabIndex = 25; + this.upgradeDb_230_231_Button.Text = "Upgrade DB from v.2.30 to v.2.31"; + this.upgradeDb_230_231_Button.UseVisualStyleBackColor = true; + this.upgradeDb_230_231_Button.Click += new System.EventHandler(this.upgradeDb_230_231_Button_Click); + // + // upgradeDb_231_232_Button + // + this.upgradeDb_231_232_Button.Location = new System.Drawing.Point(12, 532); + this.upgradeDb_231_232_Button.Name = "upgradeDb_231_232_Button"; + this.upgradeDb_231_232_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_231_232_Button.TabIndex = 26; + this.upgradeDb_231_232_Button.Text = "Upgrade DB from v.2.31 to v.2.32"; + this.upgradeDb_231_232_Button.UseVisualStyleBackColor = true; + this.upgradeDb_231_232_Button.Click += new System.EventHandler(this.upgradeDb_231_232_Button_Click); + // + // upgradeDb_232_233_Button + // + this.upgradeDb_232_233_Button.Location = new System.Drawing.Point(12, 557); + this.upgradeDb_232_233_Button.Name = "upgradeDb_232_233_Button"; + this.upgradeDb_232_233_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_232_233_Button.TabIndex = 27; + this.upgradeDb_232_233_Button.Text = "Upgrade DB from v.2.32 to v.2.33"; + this.upgradeDb_232_233_Button.UseVisualStyleBackColor = true; + this.upgradeDb_232_233_Button.Click += new System.EventHandler(this.upgradeDb_232_233_Button_Click); + // // UpgradeSelectionDlg // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 597); + this.Controls.Add(this.upgradeDb_232_233_Button); + this.Controls.Add(this.upgradeDb_231_232_Button); + this.Controls.Add(this.upgradeDb_230_231_Button); + this.Controls.Add(this.upgradeDb_229_230_Button); + this.Controls.Add(this.upgradeDb_228_229_Button); + this.Controls.Add(this.upgradeDb_227_228_Button); + this.Controls.Add(this.upgradeDb_226_227_Button); this.Controls.Add(this.customButton); this.Controls.Add(this.upgradeDb_225_226_Button); this.Controls.Add(this.label3); @@ -315,6 +399,13 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Button upgradeDb_225_226_Button; private System.Windows.Forms.Button customButton; + private System.Windows.Forms.Button upgradeDb_226_227_Button; + private System.Windows.Forms.Button upgradeDb_227_228_Button; + private System.Windows.Forms.Button upgradeDb_228_229_Button; + private System.Windows.Forms.Button upgradeDb_229_230_Button; + private System.Windows.Forms.Button upgradeDb_230_231_Button; + private System.Windows.Forms.Button upgradeDb_231_232_Button; + private System.Windows.Forms.Button upgradeDb_232_233_Button; } } \ No newline at end of file diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.cs b/TBF/UI/Settings/UpgradeSelectionDlg.cs index 0222b1dfb..5a255f4e1 100644 --- a/TBF/UI/Settings/UpgradeSelectionDlg.cs +++ b/TBF/UI/Settings/UpgradeSelectionDlg.cs @@ -1076,5 +1076,220 @@ namespace TBF.UI.Settings "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } + + private void upgradeDb_226_227_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] + { + /// TODO + }; + + string[] resultsDbCommands = new string[] + { + /// TODO + }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_226_227_Button.Enabled = false; + } + } + + private void upgradeDb_227_228_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] + { + /// TODO + }; + + string[] resultsDbCommands = new string[] + { + /// TODO + }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_227_228_Button.Enabled = false; + } + } + + private void upgradeDb_228_229_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] + { + /// TODO + }; + + string[] resultsDbCommands = new string[] + { + /// TODO + }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_228_229_Button.Enabled = false; + } + } + + private void upgradeDb_229_230_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] + { + /// TODO + }; + + string[] resultsDbCommands = new string[] + { + /// TODO + }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_229_230_Button.Enabled = false; + } + } + + private void upgradeDb_230_231_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] + { + /// TODO + }; + + string[] resultsDbCommands = new string[] + { + /// TODO + }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_230_231_Button.Enabled = false; + } + } + + private void upgradeDb_231_232_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] { }; + + string[] resultsDbCommands = new string[] + { + "ALTER TABLE `batch` CHANGE `StartTime` `StartTime` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00';", + "ALTER TABLE `batch` CHANGE `EndTime` `EndTime` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00';", + "ALTER TABLE `batch` ADD `SaveTime` DATETIME NOT NULL DEFAULT '0001-01-01 00:00:00' AFTER `EndTime`;" + }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_231_232_Button.Enabled = false; + } + } + + private void upgradeDb_232_233_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] { }; + + string[] resultsDbCommands = new string[] + { + "ALTER TABLE `watermeterdata` ADD `Qnames` TINYINT(4) NOT NULL DEFAULT '1' AFTER `Mounting`;", + "ALTER TABLE `watermeterdata` ADD `ErrLimHiQ` DOUBLE NOT NULL DEFAULT '2' AFTER `Q1_Qmin`," + + " ADD `ErrLimLoQ` DOUBLE NOT NULL DEFAULT '5' AFTER `ErrLimHiQ`;" + }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_232_233_Button.Enabled = false; + } + } } }