B2021-076: Proms search results are not presented in order when printed to PDF

This commit is contained in:
Jake 2022-08-18 11:34:46 +00:00
parent 3a633071ec
commit d35222e6bc
6 changed files with 104 additions and 10 deletions

View File

@ -330,6 +330,9 @@ namespace VEPROMS.CSLA.Library
} }
} }
public string SearchPath { get { return ""; } } public string SearchPath { get { return ""; } }
// B2021-076: Proms search results are not presented in order when printed to PDF
public string SearchDefaultSort { get { return string.Empty; } }
#endregion #endregion
#region UnlinkEnhancedDocVersion #region UnlinkEnhancedDocVersion

View File

@ -125,7 +125,11 @@ namespace VEPROMS.CSLA.Library
} }
} }
public string SearchPath { get { return ""; } } public string SearchPath { get { return ""; } }
#endregion
// B2021-076: Proms search results are not presented in order when printed to PDF
public string SearchDefaultSort { get { return string.Empty; } }
#endregion
#region Folder Config (Read-Only) #region Folder Config (Read-Only)
[NonSerialized] [NonSerialized]
private FolderConfig _FolderConfig; private FolderConfig _FolderConfig;

View File

@ -2716,6 +2716,33 @@ namespace VEPROMS.CSLA.Library
} }
} }
// B2021-076: Proms search results are not presented in order when printed to PDF
internal string _SearchDefaultSort;
public string SearchDefaultSort
{
get
{
if (_SearchDefaultSort == null)
{
if (IsProcedure)
_SearchDefaultSort = "FLD" + MyDocVersion.MyFolder.ManualOrder.ToString().PadLeft(5, '0') + string.Format(".PRC{0}", Ordinal.ToString().PadLeft(5, '0'));
else if (IsSection)
_SearchDefaultSort = ActiveParent.SearchDefaultSort + string.Format(".SEC{0}", Ordinal.ToString().PadLeft(5, '0'));
else
{
PartInfo myPart = FirstSibling.ItemPartCount > 0 ? FirstSibling.ItemParts[0] : null;
if (myPart != null)
_SearchDefaultSort = string.Format("{0}{1}", myPart.SearchDefaultSort, Ordinal.ToString().PadLeft(5, '0'));
else
_SearchDefaultSort = ActiveParent.SearchDefaultSort + string.Format(".SUB{0}", Ordinal.ToString().PadLeft(5, '0'));
}
}
return _SearchDefaultSort;
}
}
internal int _SearchAnnotationID; internal int _SearchAnnotationID;
public int SearchAnnotationID public int SearchAnnotationID
{ {

View File

@ -114,6 +114,47 @@ namespace VEPROMS.CSLA.Library
return _SearchPath; return _SearchPath;
} }
} }
// B2021-076: Proms search results are not presented in order when printed to PDF
private string _SearchDefaultSort;
public string SearchDefaultSort
{
get
{
if (_SearchDefaultSort == null)
{
string partText = String.Empty;
switch ((E_FromType)FromType)
{
case E_FromType.Caution:
partText = ".Caution";
break;
case E_FromType.Note:
partText = ".Note";
break;
case E_FromType.RNO:
partText = ".RNO";
break;
case E_FromType.Table:
partText = ".Table";
break;
default:
partText = ".";
break;
}
_SearchDefaultSort = ActiveParent.SearchDefaultSort + partText;
}
return _SearchDefaultSort;
}
}
internal PartInfo(SafeDataReader dr, ItemInfo itemInfo) internal PartInfo(SafeDataReader dr, ItemInfo itemInfo)
{ {

View File

@ -16,6 +16,8 @@ namespace VEPROMS.CSLA.Library
FormatInfo LocalFormat { get; } FormatInfo LocalFormat { get; }
string SearchDVPath { get; } string SearchDVPath { get; }
string SearchPath { get; } string SearchPath { get; }
// B2021-076: Proms search results are not presented in order when printed to PDF
string SearchDefaultSort { get; }
string ToString(); string ToString();
ConfigDynamicTypeDescriptor MyConfig { get; } ConfigDynamicTypeDescriptor MyConfig { get; }
bool IsFolder { get; } bool IsFolder { get; }

View File

@ -1612,7 +1612,8 @@ namespace Volian.Controls.Library
else lbSrchResultsIncTrans.DisplayMember = _DisplayMember; else lbSrchResultsIncTrans.DisplayMember = _DisplayMember;
if (_SearchResults != null) if (_SearchResults != null)
{ {
if (cbSorted.Checked) // B2021-076: Proms search results are not presented in order when printed to PDF
if (cbSorted.Checked && _DisplayMember != "SearchPath" && _DisplayMember == "ShortSearchPath")
{ {
Csla.SortedBindingList<ItemInfo> sortedResults = new Csla.SortedBindingList<ItemInfo>(_SearchResults); Csla.SortedBindingList<ItemInfo> sortedResults = new Csla.SortedBindingList<ItemInfo>(_SearchResults);
sortedResults.ApplySort(_DisplayMember, ListSortDirection.Ascending); sortedResults.ApplySort(_DisplayMember, ListSortDirection.Ascending);
@ -1621,10 +1622,13 @@ namespace Volian.Controls.Library
} }
else else
{ {
//PopulatelbSrcResults(_SearchResults); // B2021-076: Proms search results are not presented in order when printed to PDF
if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DataSource = _SearchResults; var sortedResults = _SearchResults.OrderBy(x => x.SearchDefaultSort).ToList();
else lbSrchResultsIncTrans.DataSource = _SearchResults;
if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DataSource = sortedResults;
else lbSrchResultsIncTrans.DataSource = sortedResults;
} }
grpPanSearchResults.Text = string.Format("Search Results Found: {0}", _SearchResults.Count); grpPanSearchResults.Text = string.Format("Search Results Found: {0}", _SearchResults.Count);
grpPanSearchResults.Style.BackColor = Color.LightGreen;// Color.YellowGreen; Color.DarkSeaGreen; grpPanSearchResults.Style.BackColor = Color.LightGreen;// Color.YellowGreen; Color.DarkSeaGreen;
} }
@ -1633,6 +1637,7 @@ namespace Volian.Controls.Library
grpPanSearchResults.Text = "Search Results"; grpPanSearchResults.Text = "Search Results";
grpPanSearchResults.Style.BackColor = saveGrpPanSearchResults; grpPanSearchResults.Style.BackColor = saveGrpPanSearchResults;
} }
// Turn Print and Results display style on/off based on whether there are search results // Turn Print and Results display style on/off based on whether there are search results
if (_SearchResults != null && _SearchResults.Count > 0) if (_SearchResults != null && _SearchResults.Count > 0)
{ {
@ -1650,6 +1655,17 @@ namespace Volian.Controls.Library
btnSaveSearchResults.Enabled = false; btnSaveSearchResults.Enabled = false;
cmbResultsStyle.Enabled = false; cmbResultsStyle.Enabled = false;
} }
// B2021-076: Proms search results are not presented in order when printed to PDF
if (_DisplayMember == "SearchPath" || _DisplayMember == "ShortSearchPath")
{
cbSorted.Checked = false;
cbSorted.Enabled = false;
}
else
{
cbSorted.Enabled = true;
}
lbSrchResults.SelectedIndex = -1; lbSrchResults.SelectedIndex = -1;
lbSrchResultsIncTrans.SelectedIndex = -1; lbSrchResultsIncTrans.SelectedIndex = -1;
@ -1832,25 +1848,26 @@ namespace Volian.Controls.Library
private string GetROsToSearch(ROFSTLookup.rochild[] chld) private string GetROsToSearch(ROFSTLookup.rochild[] chld)
{ {
string rtnstr = string.Empty; string rtnstr = string.Empty;
// B2022-026 RO Memory Reduction code - check chilren length
// B2022-026 RO Memory Reduction code - check children length
if (chld == null || chld.Length <= 0) // get a single ROID if (chld == null || chld.Length <= 0) // get a single ROID
{ {
ROFSTLookup.rochild ro = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag; ROFSTLookup.rochild ro = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
rtnstr += string.Format("{0}", ro.roid); rtnstr += ROFSTLookup.FormatRoidKey(ro.roid, true);
if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values
} }
else else
{ // spin through the child list and get the ROIDs. { // spin through the child list and get the ROIDs.
// if the child has children, then call this function recursivly // if the child has children, then call this function recursively
foreach (ROFSTLookup.rochild roc in chld) foreach (ROFSTLookup.rochild roc in chld)
{ {
// B2022-026 RO Memory Reduction code - check children length // B2022-026 RO Memory Reduction code - check children length
if (roc.children != null && roc.children.Length > 0) if (roc.children != null && roc.children.Length > 0)
rtnstr += GetROsToSearch(roc.children); rtnstr += GetROsToSearch(roc.children);
else else
rtnstr += string.Format("{0},", roc.roid); rtnstr += ROFSTLookup.FormatRoidKey(roc.roid, false);
} }
} }
return rtnstr; return rtnstr;
} }