From 6f68a01ca9ed51c789e0c34773e0a6674f2c3c19 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 20 Aug 2015 18:59:16 +0000 Subject: [PATCH] Initialize static variable containing the BASEall.xml format information Added a static variable for the BASEall.xml format information Added parameters to allow a transition search in selected step elements. (B2015-055) Make symbol list available without first selecting a procedure set, fixed searching for symbols bug (B2014-057), fix for transition search by type (B2015-055), --- PROMS/VEPROMS User Interface/frmVEPROMS.cs | 4 ++++ .../Extension/FormatExt.cs | 14 +++++++++++ .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 13 ++++++++--- .../Volian.Controls.Library/DisplaySearch.cs | 23 +++++++++++++------ 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 473efe71..202d5d4c 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -228,6 +228,10 @@ namespace VEPROMS throw new Exception("Inconsistent Formats"); if (!ItemAuditInfo.IsChangeManagerVersion()) throw new Exception("Inconsistent Data"); + // set a static variable to the PROMS Base format (BASEall.xml) + // this is used to resolve Global Search bug B2014-057 so that we can get to the symbol list when no DocVersion is selected + if (FormatInfo.PROMSBaseFormat == null) + throw new Exception("Could not set PROMSBaseFormat"); if ((Database.LastDatabase ?? "") != (Database.SelectedDatabase ?? "")) { Properties.Settings.Default.MRIList = null; diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs index a2ddcd21..51ccd203 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/FormatExt.cs @@ -403,6 +403,20 @@ namespace VEPROMS.CSLA.Library return true; } } + // return the base PROMS format (BASEall.xml) + // this was but in for bug fix B2014-057 so that we can get to the symbol list when no DocVersion is selected (Search All Procedure Sets) + private static PlantFormat _PROMSBaseFormat = null; + public static PlantFormat PROMSBaseFormat + { + get + { + if (_PROMSBaseFormat == null) + { + _PROMSBaseFormat = FormatList.ToFormat("Default (base)").PlantFormat; + } + return _PROMSBaseFormat; + } + } public static FormatInfo Get(string name) { try diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 09b5bdbc..d0dbb495 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -5291,11 +5291,12 @@ namespace VEPROMS.CSLA.Library } #endregion #region Transition Search - public static ItemInfoList GetListFromTransitionSearch(string docVersionList, int tranType, string tranCategory) + // added stepTypeList parameter to allow a transition search is selected step elements (B2015-055) + public static ItemInfoList GetListFromTransitionSearch(string docVersionList, int tranType, string tranCategory, string stepTypeList) { try { - ItemInfoList tmp = DataPortal.Fetch(new ItemListTransitionSearchCriteria(docVersionList, tranType, tranCategory)); + ItemInfoList tmp = DataPortal.Fetch(new ItemListTransitionSearchCriteria(docVersionList, tranType, tranCategory, stepTypeList)); ItemInfo.AddList(tmp); tmp.AddEvents(); return tmp; @@ -5314,11 +5315,15 @@ namespace VEPROMS.CSLA.Library public int TranType { get { return _TranType; } } private string _TranCategory; public string TranCategory { get { return _TranCategory; } } - public ItemListTransitionSearchCriteria(string docVersionList, int tranType, string tranCategory) + // added stepTypeList parameter to allow a transition search is selected step elements (B2015-055) + private string _StepTypeList; + public string StepTypeList { get { return _StepTypeList;} } + public ItemListTransitionSearchCriteria(string docVersionList, int tranType, string tranCategory, string stepTypeList) { _DocVersionList = docVersionList; _TranType = tranType; _TranCategory = tranCategory; + _StepTypeList = stepTypeList; } } private void DataPortal_Fetch(ItemListTransitionSearchCriteria criteria) @@ -5335,6 +5340,8 @@ namespace VEPROMS.CSLA.Library cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList); cm.Parameters.AddWithValue("@TranType", criteria.TranType); cm.Parameters.AddWithValue("@TranCategory", criteria.TranCategory); + // added stepTypeList parameter to allow a transition search is selected step elements (B2015-055) + cm.Parameters.AddWithValue("@StepTypeList", criteria.StepTypeList); cm.CommandTimeout = Database.DefaultTimeout; using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) { diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index db338ce0..a3404411 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -144,6 +144,7 @@ namespace Volian.Controls.Library gpSrchAnnoText.Enabled = true; cmbResultsStyle.Enabled = false; tabSearchTypes.SelectedTabChanged += new TabStrip.SelectedTabChangedEventHandler(tabSearchTypes_SelectedTabChanged); + SetupContextMenu(); // so that the symbol list is available without selecting a procedure set or procedure } void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e) @@ -1140,17 +1141,20 @@ namespace Volian.Controls.Library private string ConvertSpecialChars(string str) { string rtnVal = str; - if (_MyDocVersion != null) - { rtnVal = rtnVal.Replace("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field) rtnVal = rtnVal.Replace("\n", ""); - FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData; + // Bug fix B2014-057 + // if we are searching for a symbol character in all procedure sets MyDocVersion is null + // when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml) + FormatData fmtdata = (_MyDocVersion != null) ? _MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData; + if (fmtdata != null && fmtdata.SymbolList != null) + { SymbolList sl = fmtdata.SymbolList; if (sl != null) { foreach (Symbol sym in sl) { - string rplace = string.Format(sym.Unicode < 256 ? @"\'{0:X2}" : @"\u{0}", sym.Unicode); + string rplace = string.Format(sym.Unicode < 256 ? @"\'{0:X2}" : @"\u{0}?", sym.Unicode); // bug fix B2014-057 we were not including the ? in the replace rtnVal = rtnVal.Replace(((char)sym.Unicode).ToString(), rplace); } } @@ -1306,7 +1310,8 @@ namespace Volian.Controls.Library sep = ","; } } - SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem.ToString() == "All" ? "" : cbxTranCategory.SelectedItem.ToString()); + // added TypeSearchList for bug fix B2015-055 + SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem.ToString() == "All" ? "" : cbxTranCategory.SelectedItem.ToString(), TypeSearchList); cmbResultsStyleIndex = 3; // display step text in results } AddMessageForEmptyAnnotations(); @@ -1660,9 +1665,13 @@ namespace Volian.Controls.Library private void SetupContextMenu() { galSymbols.SubItems.Clear(); - if (_MyDocVersion != null) + // Bug fix B2014-057 + // if we are searching for a symbol character in all procedure sets MyDocVersion is null + // when MyDocVersion is null, get the symbol list directly from the PROMS base format (BaseAll.xml) + // this will populate the context menu of the Search text entry field so that a symbol can be selected without first selecting a procedure set + FormatData fmtdata = (_MyDocVersion != null) ? _MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData; + if (fmtdata != null && fmtdata.SymbolList != null) { - FormatData fmtdata = _MyDocVersion.ActiveFormat.PlantFormat.FormatData; SymbolList sl = fmtdata.SymbolList; if (sl == null || sl.Count <= 0) {