UpgradeSelectionDlg : 2.18 -> 2.22 and 2.22 -> 2.24
This commit is contained in:
+30
-17
@@ -41,8 +41,9 @@
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.pressureRepresentationButton = new System.Windows.Forms.Button();
|
||||
this.upgradeDb_24_29_Button = new System.Windows.Forms.Button();
|
||||
this.upgradeDb_218_220_Button = new System.Windows.Forms.Button();
|
||||
this.upgradeDb_218_222_Button = new System.Windows.Forms.Button();
|
||||
this.upgradeDb_NFC_button = new System.Windows.Forms.Button();
|
||||
this.upgradeDb_222_224_Button = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// upgradeDb_215_216_Button
|
||||
@@ -118,7 +119,7 @@
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBox1.Location = new System.Drawing.Point(94, 418);
|
||||
this.textBox1.Location = new System.Drawing.Point(94, 431);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox1.TabIndex = 11;
|
||||
@@ -126,7 +127,7 @@
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.textBox2.Location = new System.Drawing.Point(94, 444);
|
||||
this.textBox2.Location = new System.Drawing.Point(94, 457);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox2.TabIndex = 13;
|
||||
@@ -135,7 +136,7 @@
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 421);
|
||||
this.label1.Location = new System.Drawing.Point(12, 434);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(70, 13);
|
||||
this.label1.TabIndex = 10;
|
||||
@@ -145,7 +146,7 @@
|
||||
//
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 447);
|
||||
this.label2.Location = new System.Drawing.Point(12, 460);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(60, 13);
|
||||
this.label2.TabIndex = 12;
|
||||
@@ -154,7 +155,7 @@
|
||||
// pressureRepresentationButton
|
||||
//
|
||||
this.pressureRepresentationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 418);
|
||||
this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 431);
|
||||
this.pressureRepresentationButton.Name = "pressureRepresentationButton";
|
||||
this.pressureRepresentationButton.Size = new System.Drawing.Size(65, 42);
|
||||
this.pressureRepresentationButton.TabIndex = 14;
|
||||
@@ -172,15 +173,15 @@
|
||||
this.upgradeDb_24_29_Button.UseVisualStyleBackColor = true;
|
||||
this.upgradeDb_24_29_Button.Click += new System.EventHandler(this.upgradeDb_24_29_Button_Click);
|
||||
//
|
||||
// upgradeDb_218_220_Button
|
||||
// upgradeDb_218_222_Button
|
||||
//
|
||||
this.upgradeDb_218_220_Button.Location = new System.Drawing.Point(12, 337);
|
||||
this.upgradeDb_218_220_Button.Name = "upgradeDb_218_220_Button";
|
||||
this.upgradeDb_218_220_Button.Size = new System.Drawing.Size(260, 34);
|
||||
this.upgradeDb_218_220_Button.TabIndex = 9;
|
||||
this.upgradeDb_218_220_Button.Text = "Upgrade database from ver. 2.18 to ver. 2.20";
|
||||
this.upgradeDb_218_220_Button.UseVisualStyleBackColor = true;
|
||||
this.upgradeDb_218_220_Button.Click += new System.EventHandler(this.upgradeDb_218_220_Button_Click);
|
||||
this.upgradeDb_218_222_Button.Location = new System.Drawing.Point(12, 337);
|
||||
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.TabIndex = 9;
|
||||
this.upgradeDb_218_222_Button.Text = "Upgrade database from ver. 2.18 to ver. 2.22";
|
||||
this.upgradeDb_218_222_Button.UseVisualStyleBackColor = true;
|
||||
this.upgradeDb_218_222_Button.Click += new System.EventHandler(this.upgradeDb_218_222_Button_Click);
|
||||
//
|
||||
// upgradeDb_NFC_button
|
||||
//
|
||||
@@ -192,13 +193,24 @@
|
||||
this.upgradeDb_NFC_button.UseVisualStyleBackColor = true;
|
||||
this.upgradeDb_NFC_button.Click += new System.EventHandler(this.upgradeDb_NFC_button_Click);
|
||||
//
|
||||
// upgradeDb_222_224_Button
|
||||
//
|
||||
this.upgradeDb_222_224_Button.Location = new System.Drawing.Point(12, 377);
|
||||
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.TabIndex = 15;
|
||||
this.upgradeDb_222_224_Button.Text = "Upgrade database from ver. 2.22 to ver. 2.24";
|
||||
this.upgradeDb_222_224_Button.UseVisualStyleBackColor = true;
|
||||
this.upgradeDb_222_224_Button.Click += new System.EventHandler(this.upgradeDb_222_224_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, 480);
|
||||
this.ClientSize = new System.Drawing.Size(284, 493);
|
||||
this.Controls.Add(this.upgradeDb_222_224_Button);
|
||||
this.Controls.Add(this.upgradeDb_NFC_button);
|
||||
this.Controls.Add(this.upgradeDb_218_220_Button);
|
||||
this.Controls.Add(this.upgradeDb_218_222_Button);
|
||||
this.Controls.Add(this.upgradeDb_24_29_Button);
|
||||
this.Controls.Add(this.pressureRepresentationButton);
|
||||
this.Controls.Add(this.label2);
|
||||
@@ -234,8 +246,9 @@
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button pressureRepresentationButton;
|
||||
private System.Windows.Forms.Button upgradeDb_24_29_Button;
|
||||
private System.Windows.Forms.Button upgradeDb_218_220_Button;
|
||||
private System.Windows.Forms.Button upgradeDb_218_222_Button;
|
||||
private System.Windows.Forms.Button upgradeDb_NFC_button;
|
||||
private System.Windows.Forms.Button upgradeDb_222_224_Button;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -560,7 +560,7 @@ namespace TBF.UI.Settings
|
||||
}
|
||||
|
||||
///---------------------------------------------------------------------
|
||||
private void upgradeDb_218_220_Button_Click(object sender, EventArgs e)
|
||||
private void upgradeDb_218_222_Button_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked)
|
||||
{
|
||||
@@ -568,20 +568,60 @@ namespace TBF.UI.Settings
|
||||
return;
|
||||
}
|
||||
|
||||
string[] commands = new string[]
|
||||
string[] resultsDbCommands = new string[]
|
||||
{
|
||||
"ALTER TABLE `metertestrslt` ADD `RegReaderType` INT NOT NULL DEFAULT '0' AFTER `CompoundMeterId`;",
|
||||
"ALTER TABLE `testrslt` ADD `MethodClass` VARCHAR(255) NULL DEFAULT NULL AFTER `RepetitionNr`, ADD `ConstMasterRaw` DOUBLE NOT NULL DEFAULT '1' AFTER `PulsesMaster`, ADD `ConstMasterCorr` DOUBLE NOT NULL DEFAULT '1' AFTER `ConstMasterRaw`;",
|
||||
"ALTER TABLE `testrslt` ADD `MethodClass` VARCHAR(255) NULL DEFAULT NULL AFTER `RepetitionNr`, ADD `TimeBtwnMassMsrmnts` INT NOT NULL DEFAULT '0' AFTER `FlowSetTime`, ADD `TestTimeCorrection` DOUBLE NOT NULL DEFAULT '0' AFTER `TestTime`, ADD `ConstMasterRaw` DOUBLE NOT NULL DEFAULT '1' AFTER `PulsesMaster`, ADD `ConstMasterCorr` DOUBLE NOT NULL DEFAULT '1' AFTER `ConstMasterRaw`;",
|
||||
"ALTER TABLE `watermeterdata` ADD `Medium` VARCHAR(255) NULL DEFAULT NULL AFTER `ApprovalInfoAux`;",
|
||||
"ALTER TABLE `batch` ADD `Counter1` INT NOT NULL DEFAULT '0' AFTER `Custom3`, ADD `Counter2` INT NOT NULL DEFAULT '0' AFTER `Counter1`, ADD `Counter3` INT NOT NULL DEFAULT '0' AFTER `Counter2`, ADD `Counter4` INT NOT NULL DEFAULT '0' AFTER `Counter3`, ADD `Counter5` INT NOT NULL DEFAULT '0' AFTER `Counter4`, ADD `Counter6` INT NOT NULL DEFAULT '0' AFTER `Counter5`, ADD `Counter7` INT NOT NULL DEFAULT '0' AFTER `Counter6`, ADD `Counter8` INT NOT NULL DEFAULT '0' AFTER `Counter7`, ADD `Counter9` INT NOT NULL DEFAULT '0' AFTER `Counter8`, ADD `Counter10` INT NOT NULL DEFAULT '0' AFTER `Counter9`;",
|
||||
};
|
||||
|
||||
ActivityStart();
|
||||
|
||||
if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), commands))
|
||||
if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(DB.ConnectionString), resultsDbCommands))
|
||||
{
|
||||
ActivityEnd();
|
||||
MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
upgradeDb_218_220_Button.Enabled = false;
|
||||
upgradeDb_218_222_Button.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void upgradeDb_222_224_Button_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked)
|
||||
{
|
||||
MessageBox.Show("No database selected");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] configDbCommands = new string[]
|
||||
{
|
||||
"ALTER TABLE `user` ADD `Password2` VARCHAR(255) NULL DEFAULT NULL AFTER `Password`, ADD `Password3` VARCHAR(255) NULL DEFAULT NULL AFTER `Password2`;",
|
||||
"CREATE TABLE IF NOT EXISTS `uncertainty` (" +
|
||||
" `Id` int(11) NOT NULL AUTO_INCREMENT," +
|
||||
" `Measurement` float NOT NULL DEFAULT '0'," +
|
||||
" `MainUncertainty` float NOT NULL DEFAULT '0'," +
|
||||
" `Resolution` float NOT NULL DEFAULT '0'," +
|
||||
" `DriftPerYr` float NOT NULL DEFAULT '0'," +
|
||||
" `Conditions` float NOT NULL DEFAULT '0'," +
|
||||
" `UncertaintyOfCorrection` float NOT NULL DEFAULT '0'," +
|
||||
" `Component_id` int(11) DEFAULT NULL," +
|
||||
" PRIMARY KEY (`Id`)," +
|
||||
" KEY `Component_id` (`Component_id`)" +
|
||||
") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;",
|
||||
};
|
||||
|
||||
ActivityStart();
|
||||
|
||||
if (!upgradeConfigDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands))
|
||||
{
|
||||
ActivityEnd();
|
||||
MessageBox.Show("DB succesfully upgraded." + Environment.NewLine +
|
||||
"Please, create Density and Buoyancy components.",
|
||||
"Confirmation",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
upgradeDb_222_224_Button.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user