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