UpgradeSelectionDlg contains pressure representation upgrade, ver. 2.18.839
This commit is contained in:
parent
82e71f6779
commit
d0c27c4fe0
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.18.796.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.796.0")]
|
||||
[assembly: AssemblyVersion("2.18.838.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.838.0")]
|
||||
|
||||
59
TBF/Forms/UpgradeSelectionDlg.Designer.cs
generated
59
TBF/Forms/UpgradeSelectionDlg.Designer.cs
generated
@ -35,6 +35,11 @@
|
||||
this.upgradeDb_29_212_Button = new System.Windows.Forms.Button();
|
||||
this.upgradeConfigDBCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.upgradeResultsDBCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.pressureRepresentationButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// upgradeDb_215_216_Button
|
||||
@ -107,11 +112,58 @@
|
||||
this.upgradeResultsDBCheckBox.Text = "Upgrade Results database";
|
||||
this.upgradeResultsDBCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(94, 297);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox1.TabIndex = 7;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(94, 323);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox2.TabIndex = 8;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 300);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(70, 13);
|
||||
this.label1.TabIndex = 9;
|
||||
this.label1.Text = "From batch #";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 326);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(60, 13);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "To batch #";
|
||||
//
|
||||
// pressureRepresentationButton
|
||||
//
|
||||
this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 297);
|
||||
this.pressureRepresentationButton.Name = "pressureRepresentationButton";
|
||||
this.pressureRepresentationButton.Size = new System.Drawing.Size(65, 42);
|
||||
this.pressureRepresentationButton.TabIndex = 11;
|
||||
this.pressureRepresentationButton.Text = "Upgrade pressure";
|
||||
this.pressureRepresentationButton.UseVisualStyleBackColor = true;
|
||||
this.pressureRepresentationButton.Click += new System.EventHandler(this.pressureRepresentationButton_Click);
|
||||
//
|
||||
// UpgradeSelectionDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 262);
|
||||
this.ClientSize = new System.Drawing.Size(284, 383);
|
||||
this.Controls.Add(this.pressureRepresentationButton);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.upgradeResultsDBCheckBox);
|
||||
this.Controls.Add(this.upgradeConfigDBCheckBox);
|
||||
this.Controls.Add(this.upgradeDb_29_212_Button);
|
||||
@ -135,6 +187,11 @@
|
||||
private System.Windows.Forms.Button upgradeDb_29_212_Button;
|
||||
private System.Windows.Forms.CheckBox upgradeConfigDBCheckBox;
|
||||
private System.Windows.Forms.CheckBox upgradeResultsDBCheckBox;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button pressureRepresentationButton;
|
||||
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,8 @@ using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using MySql.Data.MySqlClient;
|
||||
using NHibernate;
|
||||
using Results.Entities;
|
||||
using TBF.Forms;
|
||||
using TBF.Resources;
|
||||
|
||||
@ -13,12 +15,21 @@ namespace TBF.Forms
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(UpgradeSelectionDlg));
|
||||
|
||||
int batchFrom;
|
||||
int batchTo;
|
||||
|
||||
TBF.Forms.ModelessActivityForm form;
|
||||
System.Threading.Thread formThread;
|
||||
|
||||
public UpgradeSelectionDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
batchFrom = 1;
|
||||
batchTo = Program.LocalSettings.BatchNr - 1;
|
||||
|
||||
textBox1.Text = batchFrom.ToString();
|
||||
textBox2.Text = batchTo.ToString();
|
||||
}
|
||||
|
||||
void ActivityStart()
|
||||
@ -433,5 +444,74 @@ namespace TBF.Forms
|
||||
|
||||
ActivityEnd();
|
||||
}
|
||||
|
||||
private void pressureRepresentationButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
batchFrom = int.Parse(textBox1.Text);
|
||||
batchTo = int.Parse(textBox2.Text);
|
||||
if (batchFrom < 1 || batchFrom > batchTo) throw new Exception();
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Wrong 'From batch #' or 'To batch #'", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Are you sure ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;
|
||||
|
||||
ActivityStart();
|
||||
|
||||
try
|
||||
{
|
||||
ISession session = Results.DB.CreateSession();
|
||||
|
||||
IList<Batch> bFrom = session.QueryOver<Batch>().Where(x => (x.BatchNr == batchFrom)).List<Batch>();
|
||||
IList<Batch> bTo = session.QueryOver<Batch>().Where(x => (x.BatchNr == batchTo)).List<Batch>();
|
||||
|
||||
if (bFrom.Count != 1) throw new Exception("No start batch");
|
||||
if (bTo.Count != 1) throw new Exception("No end batch");
|
||||
|
||||
IList<TestRslt> testResults = session.QueryOver<TestRslt>()
|
||||
.WhereRestrictionOn(x => x.StartTime)
|
||||
.IsBetween(bFrom[0].StartTime)
|
||||
.And(bTo[0].EndTime)
|
||||
.List<TestRslt>();
|
||||
|
||||
foreach (var tr in testResults)
|
||||
{
|
||||
Text = string.Format("Batch # = {0}", tr.Batch.BatchNr);
|
||||
|
||||
float factor1 = 0.01f;
|
||||
|
||||
tr.PressUpMean *= factor1;
|
||||
tr.PressUpStart *= factor1;
|
||||
tr.PressUpEnd *= factor1;
|
||||
tr.PressUpMin *= factor1;
|
||||
tr.PressUpMax *= factor1;
|
||||
|
||||
tr.PressDownMean *= factor1;
|
||||
tr.PressDownStart *= factor1;
|
||||
tr.PressDownEnd *= factor1;
|
||||
tr.PressDownMin *= factor1;
|
||||
tr.PressDownMax *= factor1;
|
||||
|
||||
tr.AmbPressMean *= 0.001f;
|
||||
|
||||
session.SaveOrUpdate(tr);
|
||||
}
|
||||
|
||||
session.Flush();
|
||||
ActivityEnd();
|
||||
MessageBox.Show("Upgrade completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
ActivityEnd();
|
||||
MessageBox.Show(string.Format("Upgrade failed:\r\n{0}", exc.Message),
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.18.838.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.838.0")]
|
||||
[assembly: AssemblyVersion("2.18.839.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.839.0")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user