DB 3.6 -> 3.7, PulsesPerLtrAux added to WaterMeterData and to Results items, MainSeqUtils and ProcedureDlg changes, ver. 3.7.2088

This commit is contained in:
Milan Hanajik
2023-08-17 19:57:58 +02:00
parent bc0de96ad9
commit eaf60f3292
10 changed files with 133 additions and 34 deletions
+13 -1
View File
@@ -36,6 +36,7 @@
this.upgradeDb_303_304_Button = new System.Windows.Forms.Button();
this.upgradeDb_304_305_Button = new System.Windows.Forms.Button();
this.upgradeDb_305_306_Button = new System.Windows.Forms.Button();
this.upgradeDb_306_307_Button = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// upgradeConfigDBCheckBox
@@ -119,11 +120,22 @@
this.upgradeDb_305_306_Button.UseVisualStyleBackColor = true;
this.upgradeDb_305_306_Button.Click += new System.EventHandler(this.upgradeDb_305_306_Button_Click);
//
// upgradeDb_306_307_Button
//
this.upgradeDb_306_307_Button.Location = new System.Drawing.Point(12, 189);
this.upgradeDb_306_307_Button.Name = "upgradeDb_306_307_Button";
this.upgradeDb_306_307_Button.Size = new System.Drawing.Size(260, 22);
this.upgradeDb_306_307_Button.TabIndex = 28;
this.upgradeDb_306_307_Button.Text = "Upgrade DB from v.3.6 to v.3.7";
this.upgradeDb_306_307_Button.UseVisualStyleBackColor = true;
this.upgradeDb_306_307_Button.Click += new System.EventHandler(this.upgradeDb_306_307_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_306_307_Button);
this.Controls.Add(this.upgradePipesButton);
this.Controls.Add(this.upgradeDb_305_306_Button);
this.Controls.Add(this.upgradeDb_304_305_Button);
@@ -149,6 +161,6 @@
private System.Windows.Forms.Button upgradeDb_303_304_Button;
private System.Windows.Forms.Button upgradeDb_304_305_Button;
private System.Windows.Forms.Button upgradeDb_305_306_Button;
private System.Windows.Forms.Button upgradeDb_306_307_Button;
}
}
+28
View File
@@ -386,5 +386,33 @@ namespace TBF.UI.Settings
upgradeDb_305_306_Button.Enabled = false;
}
}
private void upgradeDb_306_307_Button_Click(object sender, EventArgs e)
{
string[] configDbCommands = new string[] { };
string[] resultsDbCommands = new string[]
{
"ALTER TABLE `watermeterdata` ADD `PulsesPerLtrAux` DOUBLE NOT NULL DEFAULT '1' AFTER `ApprovalInfoAux`;",
};
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_306_307_Button.Enabled = false;
}
}
}
}