~Added option for selecting all procedure sets when performing a global search

This commit is contained in:
Chris Glavan 2023-07-07 15:08:48 -04:00
parent 50d462e806
commit 97d5956c02

View File

@ -40,6 +40,9 @@ namespace Volian.Controls.Library
// B2022-026 RO Memeory reduction logic change - defined dummy node text variable to ensure consistancy // B2022-026 RO Memeory reduction logic change - defined dummy node text variable to ensure consistancy
private const string DummyNodeText = "VLN_DUMMY_NODE"; private const string DummyNodeText = "VLN_DUMMY_NODE";
// B2023-076: Adding option to select all procedure sets
private const string SelectAllProcedureSetsText = "Select All Procedure Sets";
// B2019-161 When tracking timing time this action // B2019-161 When tracking timing time this action
private static VolianTimer _TimeActivity = new VolianTimer("DisplaySearch _TmrRefresh_Tick", 399); private static VolianTimer _TimeActivity = new VolianTimer("DisplaySearch _TmrRefresh_Tick", 399);
private Timer _TmrRefresh = null; private Timer _TmrRefresh = null;
@ -402,7 +405,7 @@ namespace Volian.Controls.Library
public void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e) public void tabSearchTypes_SelectedTabChanged(object sender, TabStripTabChangedEventArgs e)
{ {
if(wordSectionTreeNode != null) //B2020-070 NULL reference check if (wordSectionTreeNode != null) //B2020-070 NULL reference check
wordSectionTreeNode.Enabled = true; wordSectionTreeNode.Enabled = true;
btnSearch.Enabled = true; btnSearch.Enabled = true;
xpSetToSearch.Enabled = true; xpSetToSearch.Enabled = true;
@ -433,7 +436,7 @@ namespace Volian.Controls.Library
wordSectionTreeNode.Checked = false; wordSectionTreeNode.Checked = false;
} }
btnSearch.Enabled = (cbxTranCategory.Items.Count > 0); // B2017-038 disable search button if no format selected btnSearch.Enabled = (cbxTranCategory.Items.Count > 0); // B2017-038 disable search button if no format selected
//enable-disable doc version nodes based on version type if selected //enable-disable doc version nodes based on version type if selected
if (cbxTranVersion.SelectedIndex > -1) if (cbxTranVersion.SelectedIndex > -1)
{ {
if (dicExpandedFolderNodes.Count > 0) if (dicExpandedFolderNodes.Count > 0)
@ -570,12 +573,12 @@ namespace Volian.Controls.Library
List<DevComponents.AdvTree.Node> uncheckNodes = new List<Node>(); List<DevComponents.AdvTree.Node> uncheckNodes = new List<Node>();
foreach (DevComponents.AdvTree.Node n in dicSelectedFolderNodes.Keys) foreach (DevComponents.AdvTree.Node n in dicSelectedFolderNodes.Keys)
{ {
FolderInfo fi = (FolderInfo)n.Tag; // this was crashing in old version of code FolderInfo fi = (FolderInfo)n.Tag; // this was crashing in old version of code
// if this folder has a docversion, use its id: // if this folder has a docversion, use its id:
string svid = null; string svid = null;
if (fi.FolderDocVersionCount > 0) if (fi.FolderDocVersionCount > 0)
svid = fi.FolderDocVersions[0].VersionID.ToString(); svid = fi.FolderDocVersions[0].VersionID.ToString();
if (svid !=null && !versionList.Contains(svid)) if (svid != null && !versionList.Contains(svid))
uncheckNodes.Add(n); uncheckNodes.Add(n);
else else
n.Enabled = true; n.Enabled = true;
@ -780,6 +783,16 @@ namespace Volian.Controls.Library
buildStepTypePannelTitle(); buildStepTypePannelTitle();
} }
private void AllProcedureSets_clicked(object sender, EventArgs e)
{
Node pNode = sender as Node;
foreach (Node node in advTreeProcSets.Nodes)
{
node.Checked = pNode.Checked;
CheckTreeNodeChildren(node.Nodes);
}
}
private void AllSectionTypes_clicked(object sender, EventArgs e) private void AllSectionTypes_clicked(object sender, EventArgs e)
{ {
Node pNode = sender as Node; Node pNode = sender as Node;
@ -816,6 +829,14 @@ namespace Volian.Controls.Library
advTreeProcSets.Nodes.Add(topnode); advTreeProcSets.Nodes.Add(topnode);
//advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert); //advTreeProcSets.AfterNodeInsert += new TreeNodeCollectionEventHandler(advTreeProcSets_AfterNodeInsert);
//B2023-076: Adding option to select all procedure sets
DevComponents.AdvTree.Node selectAllNode = new Node();
selectAllNode.Text = SelectAllProcedureSetsText;
selectAllNode.Tag = SelectAllProcedureSetsText;
selectAllNode.CheckBoxVisible = true;
selectAllNode.NodeClick += new EventHandler(AllProcedureSets_clicked);
topnode.Nodes.Add(selectAllNode);
if (fi.SortedChildFolders != null) if (fi.SortedChildFolders != null)
{ {
foreach (FolderInfo fic in fi.SortedChildFolders) foreach (FolderInfo fic in fi.SortedChildFolders)
@ -1087,7 +1108,7 @@ namespace Volian.Controls.Library
newnode.CheckBoxVisible = chxbxvisable; newnode.CheckBoxVisible = chxbxvisable;
// Set newnode.Checked = parent.Checked // Set newnode.Checked = parent.Checked
if(newnode.Parent != null) if (newnode.Parent != null)
newnode.Checked = newnode.Parent.Checked; newnode.Checked = newnode.Parent.Checked;
} }
@ -1313,9 +1334,9 @@ namespace Volian.Controls.Library
private void LoadROComboTree() private void LoadROComboTree()
{ {
lblSrchRoMsg.Visible = false; // C2019-041: start out with no message about rofsts and folder(s) compatibility lblSrchRoMsg.Visible = false; // C2019-041: start out with no message about rofsts and folder(s) compatibility
// if only one docversion selected, this RoFst can be used. If more than one or none (none is all docversions), then check if they // if only one docversion selected, this RoFst can be used. If more than one or none (none is all docversions), then check if they
// use the same RO fst. If not, put a message as the first tree node and return, otherwise, load the tree. // use the same RO fst. If not, put a message as the first tree node and return, otherwise, load the tree.
List<DocVersionInfo> dvilTmp = new List<DocVersionInfo>(); List<DocVersionInfo> dvilTmp = new List<DocVersionInfo>();
if (lstCheckedDocVersions == null || lstCheckedDocVersions.Count == 0) if (lstCheckedDocVersions == null || lstCheckedDocVersions.Count == 0)
@ -1330,7 +1351,7 @@ namespace Volian.Controls.Library
bool same = true; bool same = true;
// get the first rofstId for comparing to the rest: // get the first rofstId for comparing to the rest:
int rofstId = (dvilTmp.Count > 0)? (dvilTmp[0].DocVersionAssociations != null && dvilTmp[0].DocVersionAssociations.Count > 0) ? dvilTmp[0].DocVersionAssociations[0].ROFstID: -1 : -1; int rofstId = (dvilTmp.Count > 0) ? (dvilTmp[0].DocVersionAssociations != null && dvilTmp[0].DocVersionAssociations.Count > 0) ? dvilTmp[0].DocVersionAssociations[0].ROFstID : -1 : -1;
// for remaining folder/docversions in the list, check if they have an associated rofst & if so, if it is the same as the first in list. // for remaining folder/docversions in the list, check if they have an associated rofst & if so, if it is the same as the first in list.
for (int i = 1; i < dvilTmp.Count; i++) for (int i = 1; i < dvilTmp.Count; i++)
@ -1874,10 +1895,10 @@ namespace Volian.Controls.Library
string rtnVal = str; string rtnVal = str;
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", @"\line "); //B2018-020 SQL content record has "\line " for the hard return rtnVal = rtnVal.Replace("\n", @"\line "); //B2018-020 SQL content record has "\line " for the hard return
// Bug fix B2014-057 // Bug fix B2014-057
// if we are searching for a symbol character in all procedure sets MyDocVersion is null // 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) // 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; FormatData fmtdata = (_MyDocVersion != null) ? _MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
if (fmtdata != null && fmtdata.SymbolList != null) if (fmtdata != null && fmtdata.SymbolList != null)
{ {
SymbolList sl = fmtdata.SymbolList; SymbolList sl = fmtdata.SymbolList;
@ -1937,7 +1958,7 @@ namespace Volian.Controls.Library
SearchResults = null; SearchResults = null;
bool includeRTFformat = false; bool includeRTFformat = false;
bool includeSpecialChars = (TextSearchString != @"\?"); // true; bool includeSpecialChars = (TextSearchString != @"\?"); // true;
// Build list of selected types that were searched // Build list of selected types that were searched
string typstr = null; string typstr = null;
foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s; foreach (string s in lstCheckedStepTypesStr) typstr = typstr == null ? s : typstr + ", " + s;
TypesSelected = "Filtered By: " + ((typstr != null) ? typstr : "All Step Types"); TypesSelected = "Filtered By: " + ((typstr != null) ? typstr : "All Step Types");
@ -1945,7 +1966,7 @@ namespace Volian.Controls.Library
//TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "all step types"); //TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "all step types");
//TypesSelected = (typstr != null) ? "Searched Step Types: " + typstr : "Searched All Step Types"; //TypesSelected = (typstr != null) ? "Searched Step Types: " + typstr : "Searched All Step Types";
string unitPrefix = string.Empty; string unitPrefix = string.Empty;
if(Mydocversion != null) if (Mydocversion != null)
unitPrefix = Mydocversion.DocVersionConfig.Unit_ProcedureNumber; unitPrefix = Mydocversion.DocVersionConfig.Unit_ProcedureNumber;
if (unitPrefix.EndsWith("#")) if (unitPrefix.EndsWith("#"))
unitPrefix = unitPrefix.Replace("#", string.Empty); unitPrefix = unitPrefix.Replace("#", string.Empty);
@ -2017,7 +2038,7 @@ namespace Volian.Controls.Library
//TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "All Step Types"); //TypesSelected = "Searched Step Types: " + ((typstr != null) ? typstr : "All Step Types");
SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, byWordPrefix, byWordSuffix); SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, TextSearchString /*.Replace(@"\",@"\u9586?")*/, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxIncROTextSrch.Checked ? ItemSearchIncludeLinks.Value : ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, byWordPrefix, byWordSuffix);
cmbResultsStyleIndex = 3; // display step text in results cmbResultsStyleIndex = 3; // display step text in results
//} //}
} }
// C2019-001: Search in RNO steps only // C2019-001: Search in RNO steps only
if (cbxRnoOnly.Checked) GetInRNOResults(); if (cbxRnoOnly.Checked) GetInRNOResults();
@ -2044,7 +2065,7 @@ namespace Volian.Controls.Library
SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked, unitPrefix); SearchResults = ItemInfoList.GetListFromAnnotationSearch(DVISearchList, TypeSearchList, AnnotationSearchType, cbxTextSearchAnnotation.Text, cbxCaseSensitiveAnnoText.Checked, unitPrefix);
//UpdateAnnotationSearchResults(); //UpdateAnnotationSearchResults();
cmbResultsStyleIndex = 2; // display annotation text in results cmbResultsStyleIndex = 2; // display annotation text in results
// C2019-001: Search in RNO steps only // C2019-001: Search in RNO steps only
if (cbxRnoOnlyAnnot.Checked) GetInRNOResults(); if (cbxRnoOnlyAnnot.Checked) GetInRNOResults();
} }
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) // RO Search else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[2]) // RO Search
@ -2088,7 +2109,7 @@ namespace Volian.Controls.Library
// added TypeSearchList for bug fix B2015-055 // added TypeSearchList for bug fix B2015-055
SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem.ToString() == "All" ? string.Empty : cbxTranCategory.SelectedItem.ToString(), TypeSearchList); SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem.ToString() == "All" ? string.Empty : cbxTranCategory.SelectedItem.ToString(), TypeSearchList);
cmbResultsStyleIndex = 3; // display step text in results cmbResultsStyleIndex = 3; // display step text in results
// C2019-001: Search in RNO steps only // C2019-001: Search in RNO steps only
if (cbxRnoOnlyTrans.Checked) GetInRNOResults(); if (cbxRnoOnlyTrans.Checked) GetInRNOResults();
} }
else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) else if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4])
@ -2116,7 +2137,7 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show("No Matches Found.", "Search"); FlexibleMessageBox.Show("No Matches Found.", "Search");
} }
} }
btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); // C2020-033: does user have access to at least one item btnTranCvtAllToTxt.Enabled = IncTransCvtAllToTextPerm(); // C2020-033: does user have access to at least one item
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -2137,7 +2158,7 @@ namespace Volian.Controls.Library
// MessageBox.Show(string.Format("{0} Milliseconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalMilliseconds)); // MessageBox.Show(string.Format("{0} Milliseconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalMilliseconds));
} }
private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click) private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click)
{ {
if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4])
{ {
@ -2179,7 +2200,7 @@ namespace Volian.Controls.Library
if (SearchResults == null || SearchResults.Count == 0) if (SearchResults == null || SearchResults.Count == 0)
{ {
FlexibleMessageBox.Show("No Matches Found.", "Search"); FlexibleMessageBox.Show("No Matches Found.", "Search");
ClearResults(); // B2021-103 Clear results list if none found. ClearResults(); // B2021-103 Clear results list if none found.
} }
} }
@ -2304,14 +2325,17 @@ namespace Volian.Controls.Library
} }
// if the selected folder has a docversion, handle it: // if the selected folder has a docversion, handle it:
FolderInfo fi = (FolderInfo)n.Tag; if (n.Tag != SelectAllProcedureSetsText)
RefreshLstCheckedDocVersions();
RefreshStepTypes();// Refresh Step Types after Working Draft is checked.
if (lstCheckedDocVersions.Count == 1 && fi.FolderDocVersions != null && fi.FolderDocVersions.Count > 0)
{ {
Mydocversion = fi.FolderDocVersions[0]; FolderInfo fi = (FolderInfo)n.Tag;
StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel RefreshLstCheckedDocVersions();
RefreshStepTypes();// Refresh Step Types after Working Draft is checked.
if (lstCheckedDocVersions.Count == 1 && fi.FolderDocVersions != null && fi.FolderDocVersions.Count > 0)
{
Mydocversion = fi.FolderDocVersions[0];
StartAdvTreeStepTypesFillIn();// B2016-258 Hang after selecting a procedure if the Step Type panel is open on the search panel
}
} }
SetupContextMenu(); SetupContextMenu();
@ -2335,8 +2359,8 @@ namespace Volian.Controls.Library
private void RefreshLstCheckedDocVersions() private void RefreshLstCheckedDocVersions()
{ {
lstCheckedDocVersions.Clear(); lstCheckedDocVersions.Clear();
AddFromTreeNodes(advTreeProcSets.Nodes); // add docversions to the list AddFromTreeNodes(advTreeProcSets.Nodes); // add docversions to the list
LoadROComboTree(); // reset the ro tree based on docversion selections. LoadROComboTree(); // reset the ro tree based on docversion selections.
} }
private void AddFromTreeNodes(NodeCollection nodeCollection) private void AddFromTreeNodes(NodeCollection nodeCollection)
@ -2361,7 +2385,9 @@ namespace Volian.Controls.Library
} }
else // it has not been expanded process all below. else // it has not been expanded process all below.
{ {
AddAllChildVersions(fi); //B2023-076: Do not process the "Select All" node
if (tn.Text != SelectAllProcedureSetsText)
AddAllChildVersions(fi);
} }
} }
else // not checked, set style so no background color else // not checked, set style so no background color
@ -2643,7 +2669,7 @@ namespace Volian.Controls.Library
else //lstCheckedStepTypes.Count > 0 else //lstCheckedStepTypes.Count > 0
{ {
// show how many selected whether panel is expanded or not // show how many selected whether panel is expanded or not
xpStepTypes.TitleText = string.Format("{0} Step Element{1} Selected", lstCheckedStepTypes.Count, (lstCheckedStepTypes.Count > 1)?"s":string.Empty); // B2018-132 changed second {0} to {1} xpStepTypes.TitleText = string.Format("{0} Step Element{1} Selected", lstCheckedStepTypes.Count, (lstCheckedStepTypes.Count > 1) ? "s" : string.Empty); // B2018-132 changed second {0} to {1}
xpStepTypes.TitleStyle.BackColor1.Color = Color.PapayaWhip; xpStepTypes.TitleStyle.BackColor1.Color = Color.PapayaWhip;
} }
} }
@ -3278,23 +3304,23 @@ namespace Volian.Controls.Library
ICollection<ItemInfo> srchres = lbSrchResults.DataSource as ICollection<ItemInfo>; ICollection<ItemInfo> srchres = lbSrchResults.DataSource as ICollection<ItemInfo>;
// C2020-033: If on the Incoming Transitions tab, use that list. // C2020-033: If on the Incoming Transitions tab, use that list.
if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) srchres = lbSrchResultsIncTrans.DataSource as ICollection<ItemInfo>; if (tabSearchTypes.SelectedTab == tabSearchTypes.Tabs[4]) srchres = lbSrchResultsIncTrans.DataSource as ICollection<ItemInfo>;
OnPrintRequest(new DisplaySearchEventArgs(ReportTitle, TypesSelected, SearchString, srchres,sortedBy)); OnPrintRequest(new DisplaySearchEventArgs(ReportTitle, TypesSelected, SearchString, srchres, sortedBy));
} }
private void panSearchButtons_Resize(object sender, EventArgs e) private void panSearchButtons_Resize(object sender, EventArgs e)
{ {
cmbResultsStyle.Left = labelX1.Right + 3; cmbResultsStyle.Left = labelX1.Right + 3;
cmbResultsStyle.Width = btnClearSearchResults.Left - cmbResultsStyle.Left - 3; cmbResultsStyle.Width = btnClearSearchResults.Left - cmbResultsStyle.Left - 3;
} }
// C2020-033: Convert All (that have permissions) Incoming Transitions to text // C2020-033: Convert All (that have permissions) Incoming Transitions to text
private void btnTranCvtAllToTxt_Click(object sender, EventArgs e) private void btnTranCvtAllToTxt_Click(object sender, EventArgs e)
{ {
List<int> itmsEditable = TranCvtCheckPermission(true); // Get list based on permissions List<int> itmsEditable = TranCvtCheckPermission(true); // Get list based on permissions
if (itmsEditable == null || itmsEditable.Count == 0) return; if (itmsEditable == null || itmsEditable.Count == 0) return;
TranCvtToTxt(itmsEditable); TranCvtToTxt(itmsEditable);
fromTranCvtBtn = true; fromTranCvtBtn = true;
UpdateSearchIncTransResults(); // B2021-009: Research after convert transitions to text UpdateSearchIncTransResults(); // B2021-009: Research after convert transitions to text
fromTranCvtBtn = false; fromTranCvtBtn = false;
} }
@ -3322,26 +3348,26 @@ namespace Volian.Controls.Library
// this class is used to generate the list of annotations to search. // this class is used to generate the list of annotations to search.
// this also allow us to add a dummy type which is used to search for all annotations // this also allow us to add a dummy type which is used to search for all annotations
public class AnnotationTypeSearch public class AnnotationTypeSearch
{ {
private string _Name; private string _Name;
public string Name public string Name
{ {
get { return _Name; } get { return _Name; }
set { _Name = value; } set { _Name = value; }
} }
private string _ID; private string _ID;
public string ID public string ID
{ {
get { return _ID; } get { return _ID; }
set { _ID = value; } set { _ID = value; }
} }
public AnnotationTypeSearch(string name, string id) public AnnotationTypeSearch(string name, string id)
{ {
_Name = name; _Name = name;
_ID = id; _ID = id;
} }
} }
#endregion #endregion