Automated renaming of paths and transitions, parts 2,3,4.
This commit is contained in:
@@ -13,6 +13,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 string Description { get; set; } /// Short description
|
||||
public virtual IList<TransitionStep> TransitionSteps { get; set; }
|
||||
|
||||
|
||||
@@ -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 string Description { get; set; } /// Short description
|
||||
public virtual IList<VirtualBenchStep> VirtualBenchSteps { get; set; }
|
||||
|
||||
|
||||
@@ -260,12 +260,12 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,17 +164,20 @@ namespace TBF
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string warnings = string.Empty;
|
||||
Dictionary<string, string> renameInfo = new Dictionary<string, string>();
|
||||
|
||||
foreach (TabPage tab in pathsTabControl.TabPages)
|
||||
{
|
||||
if (tab.Tag is ITabWithListViewEx)
|
||||
{
|
||||
warnings += (tab.Tag as ITabWithListViewEx).GetWarningsBeforeSaving();
|
||||
warnings += (tab.Tag as ITabWithListViewEx).GetWarningsBeforeSaving(ref renameInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(warnings))
|
||||
{
|
||||
string message = string.Format("{0}{1}{2}", warnings, Environment.NewLine, Strings.Do_you_want_to_rename_related_tests);
|
||||
string message = string.Format("{0}{1}{2}", warnings, Environment.NewLine,
|
||||
Strings.Do_you_want_to_update_related_tests_and_procedures);
|
||||
DialogResult dr = MessageBox.Show(message, Strings.Warning, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
|
||||
if (dr == DialogResult.Cancel)
|
||||
{
|
||||
@@ -186,7 +189,7 @@ namespace TBF
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
foreach (TabPage tab in pathsTabControl.TabPages)
|
||||
{
|
||||
if (tab.Tag is ITabWithListViewEx) (tab.Tag as ITabWithListViewEx).UpdateRelatedItems();
|
||||
if (tab.Tag is ITabWithListViewEx) (tab.Tag as ITabWithListViewEx).UpdateRelatedItems(renameInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -1176,15 +1176,6 @@ 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>
|
||||
@@ -1203,6 +1194,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you want to update related tests and procedures?.
|
||||
/// </summary>
|
||||
internal static string Do_you_want_to_update_related_tests_and_procedures {
|
||||
get {
|
||||
return ResourceManager.GetString("Do_you_want_to_update_related_tests_and_procedures", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Down.
|
||||
/// </summary>
|
||||
|
||||
@@ -1774,7 +1774,7 @@
|
||||
<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 name="Do_you_want_to_update_related_tests_and_procedures" xml:space="preserve">
|
||||
<value>Do you want to update related tests and procedures?</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -28,6 +28,12 @@ namespace TBF
|
||||
/// </summary>
|
||||
public ISession Session;
|
||||
|
||||
IList<Procedure> procedures;
|
||||
IList<Test> tests;
|
||||
|
||||
Dictionary<string, string> renameInfo; /// Pairs original name / new name
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Transition sequences to be updated by this dialog.
|
||||
/// Set by the constructor or updated by the parent after creation and before loading.
|
||||
@@ -96,13 +102,24 @@ namespace TBF
|
||||
/// Note: Each sequence (in both sequences together) has a unique ItemNr (0 .. N-1)
|
||||
TransitionSequences = Session.QueryOver<TransitionSequence>().OrderBy(x => x.ItemNr).Asc.List();
|
||||
VirtualBenchSequences = Session.QueryOver<VirtualBenchSequence>().OrderBy(x => x.ItemNr).Asc.List();
|
||||
procedures = Session.QueryOver<Procedure>().List();
|
||||
tests = Session.QueryOver<Test>().List();
|
||||
|
||||
RemovedTransitionSequences = new List<TransitionSequence>();
|
||||
RemovedVirtualBenchSequences = new List<VirtualBenchSequence>();
|
||||
|
||||
/// Create a tab with sequence steps for each sequence ordered by ItemNr.
|
||||
foreach (var transSeq in TransitionSequences) AddTransitionSeqTab(transSeq);
|
||||
foreach (var vBenchSeq in VirtualBenchSequences) AddVirtualBenchSeqTab(vBenchSeq);
|
||||
foreach (var transSeq in TransitionSequences)
|
||||
{
|
||||
transSeq.OriName = transSeq.Name;
|
||||
AddTransitionSeqTab(transSeq);
|
||||
}
|
||||
|
||||
foreach (var vBenchSeq in VirtualBenchSequences)
|
||||
{
|
||||
vBenchSeq.OriName = vBenchSeq.Name;
|
||||
AddVirtualBenchSeqTab(vBenchSeq);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTransitionSeqTab(TransitionSequence sequence)
|
||||
@@ -271,14 +288,175 @@ namespace TBF
|
||||
}
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
void RetrieveData()
|
||||
{
|
||||
if (seqStepsCtrls.Count > slctdTab) seqStepsCtrls[slctdTab].OkBtnClicked();
|
||||
}
|
||||
|
||||
string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
string warnings = string.Empty;
|
||||
renmInfo = new Dictionary<string, string>();
|
||||
|
||||
foreach (var seq in RemovedTransitionSequences)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(seq.OriName))
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var test in tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
|
||||
}
|
||||
foreach (var proc in procedures)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
|
||||
}
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format("Deleting transition sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
|
||||
renmInfo.Add(seq.OriName, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var seq in RemovedVirtualBenchSequences)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(seq.OriName))
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var test in tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
|
||||
}
|
||||
foreach (var proc in procedures)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
|
||||
}
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format("Deleting virtual bench sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
|
||||
renmInfo.Add(seq.OriName, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var seq in TransitionSequences)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(seq.OriName) && seq.OriName != seq.Name)
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var test in tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
|
||||
}
|
||||
foreach (var proc in procedures)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
|
||||
}
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format("Renaming transition sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
|
||||
renmInfo.Add(seq.OriName, seq.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var seq in VirtualBenchSequences)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(seq.OriName) && seq.OriName != seq.Name)
|
||||
{
|
||||
int occurances = 0;
|
||||
foreach (var test in tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(test.RelTransBefore) && test.RelTransBefore == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(test.TransitionAfter) && test.TransitionAfter == seq.OriName) occurances++;
|
||||
}
|
||||
foreach (var proc in procedures)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(proc.TransitionStart) && proc.TransitionStart == seq.OriName) occurances++;
|
||||
if (!string.IsNullOrEmpty(proc.TransitionEnd) && proc.TransitionEnd == seq.OriName) occurances++;
|
||||
}
|
||||
if (occurances > 0)
|
||||
{
|
||||
warnings += string.Format("Renaming virtual bench sequence {0} used in {1} tests and procedures{2}", seq.OriName, occurances, Environment.NewLine);
|
||||
renmInfo.Add(seq.OriName, seq.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
RetrieveData();
|
||||
|
||||
string warnings = GetWarningsBeforeSaving(ref renameInfo);
|
||||
|
||||
bool updateRelatedItems = false;
|
||||
if (!string.IsNullOrEmpty(warnings))
|
||||
{
|
||||
string message = string.Format("{0}{1}{2}", warnings, Environment.NewLine,
|
||||
Strings.Do_you_want_to_update_related_tests_and_procedures);
|
||||
DialogResult dr = MessageBox.Show(message, Strings.Warning, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
|
||||
if (dr == DialogResult.Cancel)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
return;
|
||||
}
|
||||
else if (dr == DialogResult.Yes)
|
||||
{
|
||||
updateRelatedItems = true;
|
||||
}
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
using (var transaction = Session.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (updateRelatedItems)
|
||||
{
|
||||
foreach (var item in tests)
|
||||
{
|
||||
bool updated = false;
|
||||
string newSeqName;
|
||||
if (!string.IsNullOrEmpty(item.RelTransBefore) && renameInfo.TryGetValue(item.RelTransBefore, out newSeqName))
|
||||
{
|
||||
item.RelTransBefore = newSeqName;
|
||||
updated = true;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.TransitionAfter) && renameInfo.TryGetValue(item.TransitionAfter, out newSeqName))
|
||||
{
|
||||
item.TransitionAfter = newSeqName;
|
||||
updated = true;
|
||||
}
|
||||
if (updated) Session.SaveOrUpdate(item);
|
||||
}
|
||||
|
||||
foreach (var item in procedures)
|
||||
{
|
||||
bool updated = false;
|
||||
string newSeqName;
|
||||
if (!string.IsNullOrEmpty(item.TransitionStart) && renameInfo.TryGetValue(item.TransitionStart, out newSeqName))
|
||||
{
|
||||
item.TransitionStart = newSeqName;
|
||||
updated = true;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.TransitionEnd) && renameInfo.TryGetValue(item.TransitionEnd, out newSeqName))
|
||||
{
|
||||
item.TransitionEnd = newSeqName;
|
||||
updated = true;
|
||||
}
|
||||
if (updated) Session.SaveOrUpdate(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var transSeq in RemovedTransitionSequences)
|
||||
{
|
||||
foreach (var step in transSeq.TransitionSteps) Session.Delete(step);
|
||||
@@ -307,11 +485,14 @@ namespace TBF
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
Cursor.Current = Cursors.Default;
|
||||
MessageBox.Show(Strings.Cannot_save_changes, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
log.ErrorFormat("Update of sequences in the database failed: {0}", e2.Message);
|
||||
}
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
|
||||
Program.LocalSettings.TransitionsDlgLeft = Location.X;
|
||||
Program.LocalSettings.TransitionsDlgTop = Location.Y;
|
||||
Program.LocalSettings.TransitionsDlgWidth = Size.Width;
|
||||
@@ -336,6 +517,8 @@ namespace TBF
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slctdTab;
|
||||
|
||||
private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,7 +17,7 @@ namespace TBF.UiControls
|
||||
void RemoveSelected();
|
||||
void MoveUpSelected();
|
||||
void MoveDownSelected();
|
||||
string GetWarningsBeforeSaving();
|
||||
void UpdateRelatedItems();
|
||||
string GetWarningsBeforeSaving(ref Dictionary<string, string> renameInfo);
|
||||
void UpdateRelatedItems(Dictionary<string, string> renameInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,12 +347,12 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,12 +106,12 @@ namespace TBF.UiControls
|
||||
{
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,12 +328,12 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,12 +219,12 @@ namespace TBF.UiControls
|
||||
{
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,12 +278,12 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
@@ -347,23 +347,18 @@ namespace TBF.UiControls
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.BenchPath) && tst.BenchPath.Equals(entity.OriName))
|
||||
string newPathName;
|
||||
if (!string.IsNullOrEmpty(tst.BenchPath) && renameInfo.TryGetValue(tst.BenchPath, out newPathName))
|
||||
{
|
||||
tst.BenchPath = entity.Name;
|
||||
tst.BenchPath = newPathName;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
@@ -334,6 +334,7 @@ namespace TBF.UiControls
|
||||
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);
|
||||
renmInfo.Add(entity.OriName, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,6 +349,7 @@ namespace TBF.UiControls
|
||||
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);
|
||||
renmInfo.Add(entity.OriName, entity.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,23 +357,18 @@ namespace TBF.UiControls
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.FeedingPath) && tst.FeedingPath.Equals(entity.OriName))
|
||||
string newPathName;
|
||||
if (!string.IsNullOrEmpty(tst.FeedingPath) && renameInfo.TryGetValue(tst.FeedingPath, out newPathName))
|
||||
{
|
||||
tst.FeedingPath = entity.Name;
|
||||
tst.FeedingPath = newPathName;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
@@ -287,23 +287,18 @@ namespace TBF.UiControls
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
#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))
|
||||
string newPathName;
|
||||
if (!string.IsNullOrEmpty(tst.HeatMetersPath) && renameInfo.TryGetValue(tst.HeatMetersPath, out newPathName))
|
||||
{
|
||||
tst.HeatMetersPath = entity.Name;
|
||||
tst.HeatMetersPath = newPathName;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
@@ -223,23 +223,18 @@ namespace TBF.UiControls
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.MetersPath) && tst.MetersPath.Equals(entity.OriName))
|
||||
string newPathName;
|
||||
if (!string.IsNullOrEmpty(tst.MetersPath) && renameInfo.TryGetValue(tst.MetersPath, out newPathName))
|
||||
{
|
||||
tst.MetersPath = entity.Name;
|
||||
tst.MetersPath = newPathName;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
|
||||
@@ -9,6 +9,7 @@ using Config.Entities;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.UiControls
|
||||
{
|
||||
@@ -316,7 +317,7 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
base.OkBtnClicked(); /// = UpdateAll()
|
||||
|
||||
@@ -353,23 +354,18 @@ namespace TBF.UiControls
|
||||
return warnings;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
{
|
||||
foreach (var entity in MyItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.OriName) && entity.OriName != entity.Name)
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
foreach (var tst in parent.Tests)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tst.OutputPath) && tst.OutputPath.Equals(entity.OriName))
|
||||
string newPathName;
|
||||
if (!string.IsNullOrEmpty(tst.OutputPath) && renameInfo.TryGetValue(tst.OutputPath, out newPathName))
|
||||
{
|
||||
tst.OutputPath = entity.Name;
|
||||
tst.OutputPath = newPathName;
|
||||
Config.FluentCommon.SaveToDb(parent.Session, tst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the entities and save them to the database
|
||||
|
||||
@@ -360,12 +360,12 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,12 +504,12 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,12 +259,12 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWarningsBeforeSaving()
|
||||
public string GetWarningsBeforeSaving(ref Dictionary<string, string> renmInfo)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public void UpdateRelatedItems()
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user