Automated renaming of paths and transition sequences, part 1.
This commit is contained in:
parent
65124248cd
commit
3deb24f89a
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,8 +11,9 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string OriName { get; set; } /// Not mapped to database
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string TempMtrUp { get; set; }
|
||||
public virtual string TempMtrDown { get; set; }
|
||||
public virtual string PressMtrUp { get; set; }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,6 +11,7 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string OriName { get; set; } /// Not mapped to database
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string Pump { get; set; }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
|
||||
@ -10,6 +10,7 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string OriName { get; set; } /// Not mapped to database
|
||||
|
||||
public virtual float TempWarmFrom { get; set; } /// Warm temperature range from [°C]
|
||||
public virtual float TempWarmTo { get; set; } /// Warm temperature range to [°C]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,6 +11,7 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string OriName { get; set; } /// Not mapped to database
|
||||
|
||||
/// Sensors
|
||||
public virtual string Sensor1 { get; set; }
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,6 +11,7 @@ namespace Config.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual string OriName { get; set; } /// Not mapped to database
|
||||
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow in [m3/h]
|
||||
public virtual string RegulValve { get; set; }
|
||||
|
||||
@ -259,5 +259,14 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
parent.UpdateButtonStates(TBF.UiControls.SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -7,6 +7,7 @@ using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using NHibernate;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.UiControls;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Resources;
|
||||
@ -34,6 +35,8 @@ namespace TBF
|
||||
public IList<IValve> Valves;
|
||||
public IList<IRegulValve> FeedingRegulValves;
|
||||
public ISession Session; /// One common DB session passed also to the controls inside tab pages
|
||||
public IList<Procedure> Procedures;
|
||||
public IList<Test> Tests;
|
||||
|
||||
#if HEAT_METERS
|
||||
private System.Windows.Forms.TabPage heatMetersTabPage;
|
||||
@ -79,6 +82,9 @@ namespace TBF
|
||||
/// Create the database session for paths
|
||||
Session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
|
||||
|
||||
Procedures = Session.QueryOver<Procedure>().List();
|
||||
Tests = Session.QueryOver<Test>().List();
|
||||
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.Feeding].Tag = pathsFeedingCtrl;
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.Bench].Tag = pathsBenchCtrl;
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.Output].Tag = pathsOutputCtrl;
|
||||
@ -118,7 +124,6 @@ namespace TBF
|
||||
this.heatMetersTabPage.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.HeatMeters].Text = Strings.Heat_meter_sensors; /// Localization
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.HeatMeters].Tag = pathsHeatMetersCtrl;
|
||||
|
||||
// Requires 'Session' to be created
|
||||
@ -143,6 +148,9 @@ namespace TBF
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.Bench].Text = Strings.BenchTabPageTitle;
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.Output].Text = Strings.OutputTabPageTitle;
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.WaterMeters].Text = Strings.MetersTabPageTitle;
|
||||
#if HEAT_METERS
|
||||
pathsTabControl.TabPages[(int)PathsDlgTabs.HeatMeters].Text = Strings.Heat_meter_sensors; /// Localization
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Unlocked(object sender, EventArgs e)
|
||||
@ -155,11 +163,43 @@ namespace TBF
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string warnings = string.Empty;
|
||||
foreach (TabPage tab in pathsTabControl.TabPages)
|
||||
{
|
||||
if (tab.Tag is ITabWithListViewEx)
|
||||
{
|
||||
warnings += (tab.Tag as ITabWithListViewEx).GetWarningsBeforeSaving();
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(warnings))
|
||||
{
|
||||
string message = string.Format("{0}{1}{2}", warnings, Environment.NewLine, Strings.Do_you_want_to_rename_related_tests);
|
||||
DialogResult dr = MessageBox.Show(message, Strings.Warning, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
|
||||
if (dr == DialogResult.Cancel)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
return;
|
||||
}
|
||||
else if (dr == DialogResult.Yes)
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
foreach (TabPage tab in pathsTabControl.TabPages)
|
||||
{
|
||||
if (tab.Tag is ITabWithListViewEx) (tab.Tag as ITabWithListViewEx).UpdateRelatedItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
foreach (TabPage tab in pathsTabControl.TabPages)
|
||||
{
|
||||
(tab.Tag as ITabWithListViewEx).OkBtnClicked();
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
|
||||
Program.LocalSettings.PathsDlgLeft = Location.X;
|
||||
Program.LocalSettings.PathsDlgTop = Location.Y;
|
||||
Program.LocalSettings.PathsDlgWidth = Size.Width;
|
||||
|
||||
36
TestBenchFramework/Resources/Strings.Designer.cs
generated
36
TestBenchFramework/Resources/Strings.Designer.cs
generated
@ -78,6 +78,24 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} path '{1}' used by {2} tests will be removed.{3}.
|
||||
/// </summary>
|
||||
internal static string _0_path_1_used_by_2_tests_will_be_removed_3 {
|
||||
get {
|
||||
return ResourceManager.GetString("_0_path_1_used_by_2_tests_will_be_removed_3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} path '{1}' used by {2} tests will be renamed.{3}.
|
||||
/// </summary>
|
||||
internal static string _0_path_1_used_by_2_tests_will_be_renamed_3 {
|
||||
get {
|
||||
return ResourceManager.GetString("_0_path_1_used_by_2_tests_will_be_renamed_3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} - wait until the tank is empty.
|
||||
/// </summary>
|
||||
@ -1158,6 +1176,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you want to rename related tests?.
|
||||
/// </summary>
|
||||
internal static string Do_you_want_to_rename_related_tests {
|
||||
get {
|
||||
return ResourceManager.GetString("Do_you_want_to_rename_related_tests", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you want to save changes?.
|
||||
/// </summary>
|
||||
@ -1752,6 +1779,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Heat meters.
|
||||
/// </summary>
|
||||
internal static string HeatMetersTabPageTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("HeatMetersTabPageTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to History of changes.
|
||||
/// </summary>
|
||||
|
||||
@ -1765,4 +1765,16 @@
|
||||
<data name="Batch_nr" xml:space="preserve">
|
||||
<value>Batch nr.</value>
|
||||
</data>
|
||||
<data name="HeatMetersTabPageTitle" xml:space="preserve">
|
||||
<value>Heat meters</value>
|
||||
</data>
|
||||
<data name="_0_path_1_used_by_2_tests_will_be_removed_3" xml:space="preserve">
|
||||
<value>{0} path '{1}' used by {2} tests will be removed.{3}</value>
|
||||
</data>
|
||||
<data name="_0_path_1_used_by_2_tests_will_be_renamed_3" xml:space="preserve">
|
||||
<value>{0} path '{1}' used by {2} tests will be renamed.{3}</value>
|
||||
</data>
|
||||
<data name="Do_you_want_to_rename_related_tests" xml:space="preserve">
|
||||
<value>Do you want to rename related tests?</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -17,5 +17,7 @@ namespace TBF.UiControls
|
||||
void RemoveSelected();
|
||||
void MoveUpSelected();
|
||||
void MoveDownSelected();
|
||||
}
|
||||
string GetWarningsBeforeSaving();
|
||||
void UpdateRelatedItems();
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,5 +346,14 @@ namespace TBF.UiControls
|
||||
correctedTextBox.Text = corrected.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,5 +105,14 @@ namespace TBF.UiControls
|
||||
public void MoveDownSelected()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,5 +327,14 @@ namespace TBF.UiControls
|
||||
correctedTextBox.Text = corrected.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,6 +217,15 @@ namespace TBF.UiControls
|
||||
|
||||
public void MoveDownSelected()
|
||||
{
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,5 +277,14 @@ namespace TBF.UiControls
|
||||
correctedTextBox.Text = corrected.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
@ -9,6 +10,7 @@ using log4net;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using NHibernate;
|
||||
|
||||
namespace TBF.UiControls
|
||||
{
|
||||
@ -54,6 +56,8 @@ namespace TBF.UiControls
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List();
|
||||
|
||||
foreach (var path in MyItems) path.OriName = path.Name;
|
||||
|
||||
SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
@ -272,32 +276,6 @@ namespace TBF.UiControls
|
||||
entity.ValvesClose = valvesClose;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.BenchColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.BenchColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
Config.Entities.BenchPath entity;
|
||||
@ -331,5 +309,86 @@ namespace TBF.UiControls
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
string warnings = string.Empty;
|
||||
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName))
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.BenchPath) && tst.BenchPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_removed_3, Strings.BenchTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.BenchPath) && tst.BenchPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_renamed_3, Strings.BenchTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.BenchPath) && tst.BenchPath.Equals(entity.OriName))
|
||||
{
|
||||
tst.BenchPath = entity.Name;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.BenchColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.BenchColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
@ -51,6 +52,8 @@ namespace TBF.UiControls
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List();
|
||||
|
||||
foreach (var path in MyItems) path.OriName = path.Name;
|
||||
|
||||
SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
@ -281,33 +284,6 @@ namespace TBF.UiControls
|
||||
entity.ValvesClose = valvesClose;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
parent.Session.Flush();
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.FeedingColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.FeedingColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
Config.Entities.FeedingPath entity;
|
||||
@ -341,5 +317,87 @@ namespace TBF.UiControls
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
string warnings = string.Empty;
|
||||
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName))
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.FeedingPath) && tst.FeedingPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_removed_3, Strings.FeedingTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.FeedingPath) && tst.FeedingPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_renamed_3, Strings.FeedingTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.FeedingPath) && tst.FeedingPath.Equals(entity.OriName))
|
||||
{
|
||||
tst.FeedingPath = entity.Name;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
parent.Session.Flush();
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.FeedingColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.FeedingColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
@ -57,6 +58,8 @@ namespace TBF.UiControls
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List();
|
||||
|
||||
foreach (var path in MyItems) path.OriName = path.Name;
|
||||
|
||||
SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
@ -220,34 +223,6 @@ namespace TBF.UiControls
|
||||
entity.TMeterWorkCold2 = lvi.SubItems[(int)Column.TMWrkC2].Text == "---" ? null : lvi.SubItems[(int)Column.TMWrkC2].Text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
#if HEAT_METERS
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.HeatMetersColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.HeatMetersColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
/// Find an unused test name
|
||||
@ -273,5 +248,91 @@ namespace TBF.UiControls
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
string warnings = string.Empty;
|
||||
|
||||
#if HEAT_METERS
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName))
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.HeatMetersPath) && tst.HeatMetersPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_removed_3, Strings.Heat_meter_sensors, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.HeatMetersPath) && tst.HeatMetersPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_renamed_3, Strings.Heat_meter_sensors, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
#if HEAT_METERS
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.HeatMetersPath) && tst.HeatMetersPath.Equals(entity.OriName))
|
||||
{
|
||||
tst.HeatMetersPath = entity.Name;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
#if HEAT_METERS
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.HeatMetersColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.HeatMetersColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
@ -44,6 +45,8 @@ namespace TBF.UiControls
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List();
|
||||
|
||||
foreach (var path in MyItems) path.OriName = path.Name;
|
||||
|
||||
SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
@ -157,32 +160,6 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.MetersColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.MetersColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
/// Find an unused test name
|
||||
@ -208,5 +185,86 @@ namespace TBF.UiControls
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
string warnings = string.Empty;
|
||||
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName))
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.MetersPath) && tst.MetersPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_removed_3, Strings.MetersTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.MetersPath) && tst.MetersPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_renamed_3, Strings.MetersTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.MetersPath) && tst.MetersPath.Equals(entity.OriName))
|
||||
{
|
||||
tst.MetersPath = entity.Name;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.MetersColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.MetersColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
@ -54,6 +55,8 @@ namespace TBF.UiControls
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List();
|
||||
|
||||
foreach (var path in MyItems) path.OriName = path.Name;
|
||||
|
||||
SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
|
||||
SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
|
||||
SubItemEndEditing += new Results.Forms.SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
|
||||
@ -279,32 +282,6 @@ namespace TBF.UiControls
|
||||
entity.ValvesClose = valvesClose;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.OutputColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.OutputColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
public void AddOne()
|
||||
{
|
||||
Config.Entities.OutputPath entity;
|
||||
@ -338,5 +315,86 @@ namespace TBF.UiControls
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
string warnings = string.Empty;
|
||||
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName))
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.OutputPath) && tst.OutputPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_removed_3, Strings.OutputTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var tst in parent.Tests) if (!string.IsNullOrEmpty(tst.OutputPath) && tst.OutputPath.Equals(entity.OriName)) occurances++;
|
||||
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format(Strings._0_path_1_used_by_2_tests_will_be_renamed_3, Strings.OutputTabPageTitle, entity.Name, occurances, Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.OutputPath) && tst.OutputPath.Equals(entity.OriName))
|
||||
{
|
||||
tst.OutputPath = entity.Name;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
/// </summary>
|
||||
public new void OkBtnClicked()
|
||||
{
|
||||
base.OkBtnClicked();
|
||||
|
||||
/// Update the database
|
||||
foreach (var entity in ToBeRemovedItems)
|
||||
{
|
||||
Config.FluentCommon.DeleteFromDb(parent.Session, entity);
|
||||
}
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
Config.FluentCommon.SaveToDb(parent.Session, entity);
|
||||
}
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.OutputColumnWidths = new int[Columns.Count];
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.OutputColumnWidths[i] = Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,6 +358,15 @@ namespace TBF.UiControls
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -503,5 +503,14 @@ namespace TBF.UiControls
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,5 +258,14 @@ namespace TBF.UiControls
|
||||
parent.UpdateButtonStates(SharedButtons.SelectedItemPos.None);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user