Bug fixes : 1. UpgradeSelectionDlg (Counter1..5), 2. DataContainer component factories, ver. 2.33.2134
This commit is contained in:
parent
a1df68b888
commit
e0d10bed71
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.33.2127.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2127.0")]
|
||||
[assembly: AssemblyVersion("2.33.2134.0")]
|
||||
[assembly: AssemblyFileVersion("2.33.2134.0")]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
@ -14,7 +14,7 @@ namespace TBF.Rig.DataContainers.Buoyancy
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(this.GetType().Namespace.Substring(32), this); }
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(GetType().Namespace.Substring(23), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
@ -14,7 +14,7 @@ namespace TBF.Rig.DataContainers.Density
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(this.GetType().Namespace.Substring(32), this); }
|
||||
public IComponentCfg DefaultConfig() { return new ComponentCfg(GetType().Namespace.Substring(23), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
@ -16,7 +16,7 @@ namespace TBF.Rig.DataContainers.Evaporation
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EvaporationCfg(this.GetType().Namespace.Substring(32), this); }
|
||||
public IComponentCfg DefaultConfig() { return new EvaporationCfg(GetType().Namespace.Substring(23), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@ -827,7 +827,12 @@ namespace TBF.UI.Settings
|
||||
{
|
||||
dbConn = new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString);
|
||||
dbConn.Open();
|
||||
|
||||
#if !IPERL
|
||||
cmd = dbConn.CreateCommand();
|
||||
cmd.CommandText = "ALTER TABLE `user` ADD `Tag` VARCHAR(255) NULL DEFAULT NULL AFTER `Number`;";
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Dispose();
|
||||
#endif
|
||||
cmd = dbConn.CreateCommand();
|
||||
cmd.CommandText = "CREATE TABLE IF NOT EXISTS `usersgroups` ( `Group_id` int(11) NOT NULL, `User_id` int(11) NOT NULL );";
|
||||
cmd.ExecuteNonQuery();
|
||||
@ -850,9 +855,10 @@ namespace TBF.UI.Settings
|
||||
{
|
||||
int groupId = dr.GetInt32(0);
|
||||
Common.GID gid = (Common.GID)dr.GetInt32(1);
|
||||
int userId = dr.GetInt32(2);
|
||||
|
||||
groupTable.Add(new GroupTableRow(groupId, gid, userId));
|
||||
int userId = 0;
|
||||
try { userId = dr.GetInt32(2); } catch { } /// Cope with User_id == null
|
||||
if (userId != 0) groupTable.Add(new GroupTableRow(groupId, gid, userId));
|
||||
|
||||
if ((gid >= 0) && (gid < Common.GID.NrOfGroups) && (groupIdsToKeep[(int)gid] == 0))
|
||||
{
|
||||
@ -955,6 +961,13 @@ namespace TBF.UI.Settings
|
||||
|
||||
string[] resultsDbCommands = new string[]
|
||||
{
|
||||
"ALTER TABLE `batch` DROP `Counter1`, DROP `Counter2`, DROP `Counter3`, DROP `Counter4`, DROP `Counter5`;",
|
||||
"ALTER TABLE `testrslt`" +
|
||||
" ADD `Counter1` INT NOT NULL DEFAULT '0' AFTER `Custom8`," +
|
||||
" 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`;",
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
"ALTER TABLE `testrslt` ADD `ConductMean` FLOAT NULL DEFAULT NULL AFTER `FlowMax`," +
|
||||
" ADD `ConductStart` FLOAT NULL DEFAULT NULL AFTER `ConductMean`," +
|
||||
@ -1266,13 +1279,13 @@ namespace TBF.UI.Settings
|
||||
private void upgradeDb_232_233_Button_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[] configDbCommands = new string[]
|
||||
{
|
||||
"ALTER TABLE `test` CHANGE `Qtg` `Qtg` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `Qfrom` `Qfrom` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `Qto` `Qto` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `Volume` `Volume` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `TstTime` `TstTime` DOUBLE NOT NULL DEFAULT '0';"
|
||||
};
|
||||
{
|
||||
"ALTER TABLE `test` CHANGE `Qtg` `Qtg` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `Qfrom` `Qfrom` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `Qto` `Qto` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `Volume` `Volume` DOUBLE NOT NULL DEFAULT '0';",
|
||||
"ALTER TABLE `test` CHANGE `TstTime` `TstTime` DOUBLE NOT NULL DEFAULT '0';"
|
||||
};
|
||||
|
||||
string[] resultsDbCommands = new string[]
|
||||
{
|
||||
@ -1296,44 +1309,7 @@ namespace TBF.UI.Settings
|
||||
{
|
||||
if (upgradeConfigDBCheckBox.Checked)
|
||||
{
|
||||
ISession session = null;
|
||||
try
|
||||
{
|
||||
session = TBF.DB.ConfigDBSessionFactory.OpenSession();
|
||||
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);
|
||||
|
||||
singlePrecStr = Convert.ToSingle(t.Volume).ToString();
|
||||
if (t.Volume.ToString().Length > 2 * singlePrecStr.Length) t.Volume = double.Parse(singlePrecStr);
|
||||
|
||||
singlePrecStr = Convert.ToSingle(t.TestTime).ToString();
|
||||
if (t.TestTime.ToString().Length > 2 * singlePrecStr.Length) t.TestTime = 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();
|
||||
}
|
||||
RoundFlowsAfterConversionToDbl();
|
||||
}
|
||||
|
||||
ActivityEnd();
|
||||
@ -1341,5 +1317,59 @@ namespace TBF.UI.Settings
|
||||
upgradeDb_232_233_Button.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void RoundFlowsAfterConversionToDbl()
|
||||
{
|
||||
ISession session = null;
|
||||
try
|
||||
{
|
||||
session = TBF.DB.ConfigDBSessionFactory.OpenSession();
|
||||
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);
|
||||
|
||||
singlePrecStr = Convert.ToSingle(t.Volume).ToString();
|
||||
if (t.Volume.ToString().Length > 2 * singlePrecStr.Length) t.Volume = double.Parse(singlePrecStr);
|
||||
|
||||
singlePrecStr = Convert.ToSingle(t.TestTime).ToString();
|
||||
if (t.TestTime.ToString().Length > 2 * singlePrecStr.Length) t.TestTime = double.Parse(singlePrecStr);
|
||||
|
||||
session.SaveOrUpdate(t);
|
||||
}
|
||||
|
||||
var mcorrections = session.QueryOver<Config.Entities.MeasurementCorrection>().List();
|
||||
foreach (var mc in mcorrections)
|
||||
{
|
||||
string singlePrecStr = Convert.ToSingle(mc.Measurement).ToString();
|
||||
if (mc.Measurement.ToString().Length > 2 * singlePrecStr.Length) mc.Measurement = double.Parse(singlePrecStr);
|
||||
|
||||
singlePrecStr = Convert.ToSingle(mc.Correction).ToString();
|
||||
if (mc.Correction.ToString().Length > 2 * singlePrecStr.Length) mc.Correction = double.Parse(singlePrecStr);
|
||||
|
||||
session.SaveOrUpdate(mc);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user