UpgradeSelectionDlg : upgradeDb_218_219_Button added.

This commit is contained in:
Milan Hanajik 2018-04-10 23:15:55 +02:00
parent efa5084d8b
commit c19802fa13
2 changed files with 45 additions and 6 deletions

View File

@ -41,6 +41,7 @@
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_219_Button = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// upgradeDb_215_216_Button
@ -116,7 +117,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, 328);
this.textBox1.Location = new System.Drawing.Point(94, 366);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 9;
@ -124,7 +125,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, 354);
this.textBox2.Location = new System.Drawing.Point(94, 392);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 11;
@ -133,7 +134,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, 331);
this.label1.Location = new System.Drawing.Point(12, 369);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 13);
this.label1.TabIndex = 8;
@ -143,7 +144,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, 357);
this.label2.Location = new System.Drawing.Point(12, 395);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 10;
@ -152,7 +153,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, 328);
this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 366);
this.pressureRepresentationButton.Name = "pressureRepresentationButton";
this.pressureRepresentationButton.Size = new System.Drawing.Size(65, 42);
this.pressureRepresentationButton.TabIndex = 12;
@ -170,11 +171,22 @@
this.upgradeDb_24_29_Button.UseVisualStyleBackColor = true;
this.upgradeDb_24_29_Button.Click += new System.EventHandler(this.upgradeDb_24_29_Button_Click);
//
// upgradeDb_218_219_Button
//
this.upgradeDb_218_219_Button.Location = new System.Drawing.Point(12, 301);
this.upgradeDb_218_219_Button.Name = "upgradeDb_218_219_Button";
this.upgradeDb_218_219_Button.Size = new System.Drawing.Size(260, 34);
this.upgradeDb_218_219_Button.TabIndex = 13;
this.upgradeDb_218_219_Button.Text = "Upgrade database from ver. 2.18 to ver. 2.19";
this.upgradeDb_218_219_Button.UseVisualStyleBackColor = true;
this.upgradeDb_218_219_Button.Click += new System.EventHandler(this.upgradeDb_218_219_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, 390);
this.ClientSize = new System.Drawing.Size(284, 428);
this.Controls.Add(this.upgradeDb_218_219_Button);
this.Controls.Add(this.upgradeDb_24_29_Button);
this.Controls.Add(this.pressureRepresentationButton);
this.Controls.Add(this.label2);
@ -210,6 +222,7 @@
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_219_Button;
}
}

View File

@ -530,6 +530,32 @@ namespace TBF.Forms
}
}
///---------------------------------------------------------------------
private void upgradeDb_218_219_Button_Click(object sender, EventArgs e)
{
if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked)
{
MessageBox.Show("No database selected");
return;
}
string[] commands = new string[]
{
"ALTER TABLE `testrslt` ADD `MethodClass` VARCHAR(255) NULL DEFAULT NULL AFTER `RepetitionNr`;",
"ALTER TABLE `metertestrslt` ADD `RegReaderType` INT NOT NULL DEFAULT '0' AFTER `CompoundMeterId`;",
//"ALTER TABLE `batch` ADD `WaterMetersCount` INT NOT NULL DEFAULT '0' AFTER `UserNumber`;",
};
ActivityStart();
if (!upgradeResultsDBCheckBox.Checked || ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), commands))
{
ActivityEnd();
MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
upgradeDb_218_219_Button.Enabled = false;
}
}
private void pressureRepresentationButton_Click(object sender, EventArgs e)
{
try