diff --git a/Config/Entities/User.cs b/Config/Entities/User.cs index 21c5bf6d6..3d0fb1595 100644 --- a/Config/Entities/User.cs +++ b/Config/Entities/User.cs @@ -3,10 +3,6 @@ /// using System; using System.Collections.Generic; -using System.Security.Cryptography; -using System.Text; -using System.Diagnostics; -using Config.Resources; using log4net; namespace Config.Entities diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs index 7a5e51eeb..592e57e2c 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs @@ -53,10 +53,11 @@ namespace TBF.BenchControl.Elde.RegulValve public string ToString(int i) { - return string.Format("Name={0}, Parent={1}, Idx1={2}, ADC-Closed={3}, ADC-Open={4}, StabTm={5}ms, FlowStable={6}s, PosReuse={7}, ReTryCmds={8}", + return string.Format("Name={0} ({1}), Idx1={2}, Cat.={3}, ADC-Closed={4}, ADC-Open={5}, StabTm={6}ms, FlowStable={7}s, PosReuse={8}, ReTryCmds={9}", Name, (string.IsNullOrEmpty(ParentName) ? "-" : ParentName), Idx1, + Category, AdcValueClosed, AdcValueOpen, StableTimeMs, diff --git a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs index 1bcbb4c58..c47d966e6 100644 --- a/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/Valve/ValveCfg.cs @@ -49,7 +49,7 @@ namespace TBF.BenchControl.Elde.Valve public string ToString(int i) { - return string.Format("Name={0}, Parent={1}, Bit={2}, Inv.={3}, Delay={4}s, Cat.={5}, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s", + return string.Format("Name={0} ({1}), Bit={2}, Cat.={5}, Inv.={3}, Delay={4}s, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s", Name, string.IsNullOrEmpty(ParentName) ? "-" : ParentName, BitPosition, diff --git a/TestBenchFramework/ComponentsManagerDlg.cs b/TestBenchFramework/ComponentsManagerDlg.cs index b869ab1eb..cda0ca30b 100644 --- a/TestBenchFramework/ComponentsManagerDlg.cs +++ b/TestBenchFramework/ComponentsManagerDlg.cs @@ -182,19 +182,32 @@ namespace TBF { IComponentCfg cmpCfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt); - if (cmpCfg != null) - { - ListViewItem lvi = new ListViewItem(cmpCfg.Name); - lvi.SubItems.Add(cmpCfg.Factory.ClassName); - lvi.SubItems.Add(cmpCfg.ParentName); - lvi.SubItems.Add(cmpCfg.DebugLevel.ToDescription()); - lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription()); - lvi.SubItems.Add(cmpCfg.ToString(1)); + if (cmpCfg != null) + { + ListViewItem lvi = new ListViewItem(cmpCfg.Name); + lvi.SubItems.Add(cmpCfg.Factory.ClassName); + lvi.SubItems.Add(cmpCfg.ParentName); + lvi.SubItems.Add(cmpCfg.DebugLevel.ToDescription()); + lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription()); + lvi.SubItems.Add(cmpCfg.ToString(1)); - lvi.Tag = cmpnt; + lvi.Tag = cmpnt; - listViewEx.Items.Add(lvi); - } + listViewEx.Items.Add(lvi); + } + else + { + ListViewItem lvi = new ListViewItem(cmpnt.Name); + lvi.SubItems.Add(string.IsNullOrEmpty(cmpnt.ClassName) ? string.Empty : cmpnt.ClassName); + lvi.SubItems.Add(string.IsNullOrEmpty(cmpnt.ParentName) ? string.Empty : cmpnt.ParentName); + lvi.SubItems.Add("---"); + lvi.SubItems.Add("---"); + lvi.SubItems.Add("Not a component"); + + lvi.Tag = cmpnt; + + listViewEx.Items.Add(lvi); + } } /// @@ -342,30 +355,33 @@ namespace TBF if (listViewEx.SelectedIndices.Count != 1) return; ListViewItem lvi = listViewEx.SelectedItems[0]; - ComponentParametersDlg cfgForm = new ComponentParametersDlg(); - cfgForm.TbfComponents = cmpntEntities; IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Component)lvi.Tag); - cfgForm.ComponentCfgCtrl = cfg.GetControl(); - cfgForm.ComponentCfgCtrl.Config = cfg; - DialogResult dr = cfgForm.ShowDialog(); - if (dr != DialogResult.OK) return; + if (cfg != null) + { + ComponentParametersDlg cfgForm = new ComponentParametersDlg(); + cfgForm.TbfComponents = cmpntEntities; + cfgForm.ComponentCfgCtrl = cfg.GetControl(); + cfgForm.ComponentCfgCtrl.Config = cfg; + DialogResult dr = cfgForm.ShowDialog(); + if (dr != DialogResult.OK) return; - flags |= cfgForm.Flags; + flags |= cfgForm.Flags; - sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled - unlocked = true; /// in the ComponentParametersDlg. + sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled + unlocked = true; /// in the ComponentParametersDlg. - Component modified = cfgForm.Config.CreateDbEntity(); - Component original = (Component)lvi.Tag; + Component modified = cfgForm.Config.CreateDbEntity(); + Component original = (Component)lvi.Tag; - original.Name = modified.Name; - original.ClassName = modified.ClassName; - original.ParentName = modified.ParentName; - original.Mode = modified.Mode; - original.Logging = modified.Logging; - original.Parameters = modified.Parameters; + original.Name = modified.Name; + original.ClassName = modified.ClassName; + original.ParentName = modified.ParentName; + original.Mode = modified.Mode; + original.Logging = modified.Logging; + original.Parameters = modified.Parameters; - RedrawAll(); + RedrawAll(); + } } private void upButton_Click(object sender, EventArgs e) diff --git a/Users/Entities/User.cs b/Users/Entities/User.cs index 086464865..bc1b13d4b 100644 --- a/Users/Entities/User.cs +++ b/Users/Entities/User.cs @@ -1,11 +1,10 @@ /// -/// Copyright (c) 2016 Sensus Metering Systems +/// Copyright (c) 2016-2017 Sensus Metering Systems /// using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; -using System.Diagnostics; using log4net; namespace Users.Entities @@ -117,7 +116,7 @@ namespace Users.Entities /// true = authorized public virtual bool Authorize(string userName, string password, Grp.GID requiredGroupMembership) { - if (Entities.User.IsPowerUser(userName, password)) + if (IsPowerUser(userName, password)) { GlobalData.CurrentUser = this; GlobalData.LastAuthorization = DateTime.Now;