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),
This commit is contained in:
John Jenko 2015-08-20 18:59:16 +00:00
parent d5b30b523f
commit 6f68a01ca9
4 changed files with 44 additions and 10 deletions

View File

@ -228,6 +228,10 @@ namespace VEPROMS
throw new Exception("Inconsistent Formats"); throw new Exception("Inconsistent Formats");
if (!ItemAuditInfo.IsChangeManagerVersion()) if (!ItemAuditInfo.IsChangeManagerVersion())
throw new Exception("Inconsistent Data"); 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 ?? "")) if ((Database.LastDatabase ?? "") != (Database.SelectedDatabase ?? ""))
{ {
Properties.Settings.Default.MRIList = null; Properties.Settings.Default.MRIList = null;

View File

@ -403,6 +403,20 @@ namespace VEPROMS.CSLA.Library
return true; 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) public static FormatInfo Get(string name)
{ {
try try

View File

@ -5291,11 +5291,12 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
#region Transition Search #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 try
{ {
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListTransitionSearchCriteria(docVersionList, tranType, tranCategory)); ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListTransitionSearchCriteria(docVersionList, tranType, tranCategory, stepTypeList));
ItemInfo.AddList(tmp); ItemInfo.AddList(tmp);
tmp.AddEvents(); tmp.AddEvents();
return tmp; return tmp;
@ -5314,11 +5315,15 @@ namespace VEPROMS.CSLA.Library
public int TranType { get { return _TranType; } } public int TranType { get { return _TranType; } }
private string _TranCategory; private string _TranCategory;
public string TranCategory { get { return _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; _DocVersionList = docVersionList;
_TranType = tranType; _TranType = tranType;
_TranCategory = tranCategory; _TranCategory = tranCategory;
_StepTypeList = stepTypeList;
} }
} }
private void DataPortal_Fetch(ItemListTransitionSearchCriteria criteria) private void DataPortal_Fetch(ItemListTransitionSearchCriteria criteria)
@ -5335,6 +5340,8 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList); cm.Parameters.AddWithValue("@DocVersionList", criteria.DocVersionList);
cm.Parameters.AddWithValue("@TranType", criteria.TranType); cm.Parameters.AddWithValue("@TranType", criteria.TranType);
cm.Parameters.AddWithValue("@TranCategory", criteria.TranCategory); 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; cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{ {

View File

@ -144,6 +144,7 @@ namespace Volian.Controls.Library
gpSrchAnnoText.Enabled = true; gpSrchAnnoText.Enabled = true;
cmbResultsStyle.Enabled = false; cmbResultsStyle.Enabled = false;
tabSearchTypes.SelectedTabChanged += new TabStrip.SelectedTabChangedEventHandler(tabSearchTypes_SelectedTabChanged); 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) void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e)
@ -1140,17 +1141,20 @@ namespace Volian.Controls.Library
private string ConvertSpecialChars(string str) private string ConvertSpecialChars(string str)
{ {
string rtnVal = 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("\u00A0", @"\u160?"); //convert \u00A0 to a hard space (\u00A0 shows as a blank in the search text field)
rtnVal = rtnVal.Replace("\n", ""); 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; SymbolList sl = fmtdata.SymbolList;
if (sl != null) if (sl != null)
{ {
foreach (Symbol sym in sl) 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); rtnVal = rtnVal.Replace(((char)sym.Unicode).ToString(), rplace);
} }
} }
@ -1306,7 +1310,8 @@ namespace Volian.Controls.Library
sep = ","; 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 cmbResultsStyleIndex = 3; // display step text in results
} }
AddMessageForEmptyAnnotations(); AddMessageForEmptyAnnotations();
@ -1660,9 +1665,13 @@ namespace Volian.Controls.Library
private void SetupContextMenu() private void SetupContextMenu()
{ {
galSymbols.SubItems.Clear(); 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; SymbolList sl = fmtdata.SymbolList;
if (sl == null || sl.Count <= 0) if (sl == null || sl.Count <= 0)
{ {