1. TestWizard.FlowSelection fixed: float avoided, 2. Rounding of test flows after conversion, ver. 2.33.2034
This commit is contained in:
parent
aa10ea5c04
commit
fba8c52dfb
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.33.2033.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2033.0")]
|
||||
[assembly: AssemblyVersion("2.33.2034.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2034.0")]
|
||||
|
||||
@ -101,20 +101,20 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
case QSpec.Q_dQ:
|
||||
var Q = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(q2TextBox.Text));
|
||||
var dQ = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(dQTextBox.Text));
|
||||
qFrom = (Q - dQ);
|
||||
qTo = (Q + dQ);
|
||||
qFrom = Q - dQ;
|
||||
qTo = Q + dQ;
|
||||
break;
|
||||
|
||||
case QSpec.Q_dPct:
|
||||
var Q2 = Units.ConvertFrom(flowUnit, Utils.ParseUDouble(q3TextBox.Text));
|
||||
var dQpct = Utils.ParseUDouble(dQpctTextBox.Text);
|
||||
qFrom = (float)(Q2 * (1 - dQpct / 100.0));
|
||||
qTo = (float)(Q2 * (1 + dQpct / 100.0));
|
||||
qFrom = Q2 * (1 - dQpct / 100.0);
|
||||
qTo = Q2 * (1 + dQpct / 100.0);
|
||||
break;
|
||||
}
|
||||
|
||||
test.Qfrom = (float)qFrom;
|
||||
test.Qto = (float)qTo;
|
||||
test.Qfrom = qFrom;
|
||||
test.Qto = qTo;
|
||||
test.FlowUnit = flowUnit;
|
||||
|
||||
if (sensorsComboBox.Items.Contains(sensorsComboBox.Text))
|
||||
@ -125,25 +125,25 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
|
||||
bool IsFormValid()
|
||||
{
|
||||
float dummy;
|
||||
double dummy;
|
||||
switch (qSpec)
|
||||
{
|
||||
default:
|
||||
case QSpec.Qfrom_Qto:
|
||||
return Utils.TryParseUFloat(qFromTextBox.Text, out dummy) &&
|
||||
Utils.TryParseUFloat(qToTextBox.Text, out dummy) &&
|
||||
return Utils.TryParseUDouble(qFromTextBox.Text, out dummy) &&
|
||||
Utils.TryParseUDouble(qToTextBox.Text, out dummy) &&
|
||||
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
||||
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
||||
|
||||
case QSpec.Q_dQ:
|
||||
return Utils.TryParseUFloat(q2TextBox.Text, out dummy) &&
|
||||
Utils.TryParseUFloat(dQTextBox.Text, out dummy) &&
|
||||
return Utils.TryParseUDouble(q2TextBox.Text, out dummy) &&
|
||||
Utils.TryParseUDouble(dQTextBox.Text, out dummy) &&
|
||||
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
||||
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
||||
|
||||
case QSpec.Q_dPct:
|
||||
return Utils.TryParseUFloat(q3TextBox.Text, out dummy) &&
|
||||
Utils.TryParseUFloat(dQpctTextBox.Text, out dummy) &&
|
||||
return Utils.TryParseUDouble(q3TextBox.Text, out dummy) &&
|
||||
Utils.TryParseUDouble(dQpctTextBox.Text, out dummy) &&
|
||||
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
|
||||
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
|
||||
}
|
||||
@ -182,7 +182,7 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
|
||||
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
double Q1,Q2;
|
||||
double Q1, Q2;
|
||||
|
||||
switch ((QSpec)tabControl1.SelectedIndex)
|
||||
{
|
||||
|
||||
@ -1293,6 +1293,42 @@ namespace TBF.UI.Settings
|
||||
(!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 ||
|
||||
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();
|
||||
MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
upgradeDb_232_233_Button.Enabled = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user