From 3e413b0f171ac15e60e1d74405aacf2c8528a896 Mon Sep 17 00:00:00 2001 From: Rich Date: Mon, 16 Feb 2015 20:22:57 +0000 Subject: [PATCH] Changed SubSection.Edit Section Config property to correctly be defaulted to "No" Base MyConfig on the type of item (Procedure, Section or Step) Keep the code from crashing iff the user selects a result in the search window that points to non-editable text --- .../Config/SectionConfig.cs | 44 +++++++++++++++---- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 9 ++-- PROMS/Volian.Controls.Library/StepTabPanel.cs | 1 + 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs index e0bf0622..2cffeaf9 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs @@ -101,11 +101,11 @@ namespace VEPROMS.CSLA.Library _Xp = new XMLProperties(xml); if (_SectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); } - public SectionConfig(string xml) - { - if (xml == string.Empty) xml = ""; - _Xp = new XMLProperties(xml); - } + //public SectionConfig(string xml) + //{ + // if (xml == string.Empty) xml = ""; + // _Xp = new XMLProperties(xml); + //} public SectionConfig() { _Xp = new XMLProperties(); @@ -761,7 +761,7 @@ namespace VEPROMS.CSLA.Library #region SubSectionCategory // from sequence number in 16-bit database. [Category("SubSection")] //PROPGRID: Hide SubSection Edit - [Browsable(false)] + [Browsable(true)] [DisplayName("SubSection Edit")] [RefreshProperties(RefreshProperties.All)] [Description("SubSection Edit")] @@ -779,20 +779,48 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("SubSection_Edit"); } } + [Category("SubSection")] + //PROPGRID: Hide SubSection Edit + [Browsable(true)] + [DisplayName("DefaultSubSection Edit")] + [RefreshProperties(RefreshProperties.All)] + [Description("DefaultSubSection Edit")] public string DefaultSubSectionEdit { get { - if (_SectionInfo != null && _SectionInfo.Sections.Count > 0 && _SectionInfo.Steps.Count > 0) + //if (_SectionInfo != null && _SectionInfo.Sections != null && _SectionInfo.Sections.Count > 0 && _SectionInfo.Steps != null && _SectionInfo.Steps.Count > 0) + if (_SectionInfo != null && _SectionInfo.Sections != null && _SectionInfo.Sections.Count > 0) + return "N"; + if (_Section != null && HasSubsections) return "N"; //if (_Section != null && _Section.MyContent.cont .Sections.Count > 0 && _Section.Steps.Count > 0) // return "N"; return "Y"; } } + private bool HasSubsections + { + get + { + //int result = 0; + foreach (ContentPart cp in _Section.MyContent.ContentParts) + { + if (cp.FromType == 2) + return true; + //if (cp.FromType == 2) result += 1; + //if (cp.FromType == 6) result += 2; + //if (result == 3) + //{ + // return true; + //} + } + return false; + } + } [Category("SubSection")] //PROPGRID: Hide Subsection AutoIndent - [Browsable(false)] + [Browsable(true)] [DisplayName("SubSection AutoIndent")] [RefreshProperties(RefreshProperties.All)] [Description("SubSection AutoIndent")] diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 1f8c24d5..47d46012 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -3017,13 +3017,16 @@ namespace VEPROMS.CSLA.Library switch (MyContent.Type / 10000) { case 0: - _MyConfig = new ProcedureConfig(MyContent.Config); + //_MyConfig = new ProcedureConfig(MyContent.Config); + _MyConfig = new ProcedureConfig(this as ProcedureInfo ?? ProcedureInfo.Get(ItemID)); break; case 1: - _MyConfig = new SectionConfig(MyContent.Config); + //_MyConfig = new SectionConfig(MyContent.Config); + _MyConfig = new SectionConfig(this as SectionInfo ?? SectionInfo.Get(ItemID)); break; case 2: - _MyConfig = new StepConfig(MyContent.Config); + //_MyConfig = new StepConfig(MyContent.Config); + _MyConfig = new StepConfig(this as StepInfo ?? StepInfo.Get(ItemID)); break; } } diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs index e451ca8c..8ac58e5f 100644 --- a/PROMS/Volian.Controls.Library/StepTabPanel.cs +++ b/PROMS/Volian.Controls.Library/StepTabPanel.cs @@ -90,6 +90,7 @@ namespace Volian.Controls.Library } public void FindSearchString() { + if (SelectedEditItem == null) return;// Uneditable Data if (SelectedEditItem.MyItemInfo.IsTable) { // if not ro table, just make the mysteprtb active.