1. TestWizard.FlowSelection fixed: float avoided, 2. Rounding of test flows after conversion, ver. 2.33.2034
This commit is contained in:
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("2.33.2033.0")]
|
[assembly: AssemblyVersion("2.33.2034.0")]
|
||||||
[assembly: AssemblyFileVersion("2.33.2033.0")]
|
[assembly: AssemblyFileVersion("2.33.2034.0")]
|
||||||
|
|||||||
@@ -101,20 +101,20 @@ namespace TBF.UI.Procedures.TestWizard
|
|||||||
case QSpec.Q_dQ:
|
case QSpec.Q_dQ:
|
||||||
var Q = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(q2TextBox.Text));
|
var Q = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(q2TextBox.Text));
|
||||||
var dQ = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(dQTextBox.Text));
|
var dQ = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(dQTextBox.Text));
|
||||||
qFrom = (Q - dQ);
|
qFrom = Q - dQ;
|
||||||
qTo = (Q + dQ);
|
qTo = Q + dQ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QSpec.Q_dPct:
|
case QSpec.Q_dPct:
|
||||||
var Q2 = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(q3TextBox.Text));
|
var Q2 = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(q3TextBox.Text));
|
||||||
var dQpct = Utils.ParseUDouble(dQpctTextBox.Text);
|
var dQpct = Utils.ParseUDouble(dQpctTextBox.Text);
|
||||||
qFrom = (float)(Q2 * (1 - dQpct / 100.0));
|
qFrom = Q2 * (1 - dQpct / 100.0);
|
||||||
qTo = (float)(Q2 * (1 + dQpct / 100.0));
|
qTo = Q2 * (1 + dQpct / 100.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
test.Qfrom = (float)qFrom;
|
test.Qfrom = qFrom;
|
||||||
test.Qto = (float)qTo;
|
test.Qto = qTo;
|
||||||
test.FlowUnit = flowUnit;
|
test.FlowUnit = flowUnit;
|
||||||
|
|
||||||
if (sensorsComboBox.Items.Contains(sensorsComboBox.Text))
|
if (sensorsComboBox.Items.Contains(sensorsComboBox.Text))
|
||||||
@@ -125,25 +125,25 @@ namespace TBF.UI.Procedures.TestWizard
|
|||||||
|
|
||||||
bool IsFormValid()
|
bool IsFormValid()
|
||||||
{
|
{
|
||||||
float dummy;
|
double dummy;
|
||||||
switch (qSpec)
|
switch (qSpec)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case QSpec.Qfrom_Qto:
|
case QSpec.Qfrom_Qto:
|
||||||
return Utils.TryParseUFloat(qFromTextBox.Text, out dummy) &&
|
return Utils.TryParseUDouble(qFromTextBox.Text, out dummy) &&
|
||||||
Utils.TryParseUFloat(qToTextBox.Text, out dummy) &&
|
Utils.TryParseUDouble(qToTextBox.Text, out dummy) &&
|
||||||
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
||||||
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
||||||
|
|
||||||
case QSpec.Q_dQ:
|
case QSpec.Q_dQ:
|
||||||
return Utils.TryParseUFloat(q2TextBox.Text, out dummy) &&
|
return Utils.TryParseUDouble(q2TextBox.Text, out dummy) &&
|
||||||
Utils.TryParseUFloat(dQTextBox.Text, out dummy) &&
|
Utils.TryParseUDouble(dQTextBox.Text, out dummy) &&
|
||||||
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
||||||
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
||||||
|
|
||||||
case QSpec.Q_dPct:
|
case QSpec.Q_dPct:
|
||||||
return Utils.TryParseUFloat(q3TextBox.Text, out dummy) &&
|
return Utils.TryParseUDouble(q3TextBox.Text, out dummy) &&
|
||||||
Utils.TryParseUFloat(dQpctTextBox.Text, out dummy) &&
|
Utils.TryParseUDouble(dQpctTextBox.Text, out dummy) &&
|
||||||
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
||||||
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ namespace TBF.UI.Procedures.TestWizard
|
|||||||
|
|
||||||
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
double Q1,Q2;
|
double Q1, Q2;
|
||||||
|
|
||||||
switch ((QSpec)tabControl1.SelectedIndex)
|
switch ((QSpec)tabControl1.SelectedIndex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1293,6 +1293,42 @@ namespace TBF.UI.Settings
|
|||||||
(!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 ||
|
(!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 ||
|
||||||
ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands)))
|
ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands)))
|
||||||
{
|
{
|
||||||
|
if (upgradeConfigDBCheckBox.Checked)
|
||||||
|
{
|
||||||
|
ISession session = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
session = TBF.DB.CreateSession(Common.DBKind.Config);
|
||||||
|
var tests = session.QueryOver<Config.Entities.Test>().List();
|
||||||
|
|
||||||
|
foreach (var t in tests)
|
||||||
|
{
|
||||||
|
string singlePrecStr = Convert.ToSingle(t.Qtg).ToString();
|
||||||
|
if (t.Qtg.ToString().Length > 2 * singlePrecStr.Length) t.Qtg = double.Parse(singlePrecStr);
|
||||||
|
|
||||||
|
singlePrecStr = Convert.ToSingle(t.Qfrom).ToString();
|
||||||
|
if (t.Qfrom.ToString().Length > 2 * singlePrecStr.Length) t.Qfrom = double.Parse(singlePrecStr);
|
||||||
|
|
||||||
|
singlePrecStr = Convert.ToSingle(t.Qto).ToString();
|
||||||
|
if (t.Qto.ToString().Length > 2 * singlePrecStr.Length) t.Qto = double.Parse(singlePrecStr);
|
||||||
|
|
||||||
|
session.SaveOrUpdate(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
session.Flush();
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
ActivityEnd();
|
||||||
|
MessageBox.Show(string.Format("Test flow rounding after a conversion to double failed:\r\n{0}", exc.Message),
|
||||||
|
"Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (session != null && session.IsOpen) session.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ActivityEnd();
|
ActivityEnd();
|
||||||
MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
upgradeDb_232_233_Button.Enabled = false;
|
upgradeDb_232_233_Button.Enabled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user