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 ""; } }
// B2021-076: Proms search results are not presented in order when printed to PDF
public string SearchDefaultSort { get { return string.Empty; } }
#endregion
#region UnlinkEnhancedDocVersion

View File

@ -125,6 +125,10 @@ namespace VEPROMS.CSLA.Library
}
}
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
#region Folder Config (Read-Only)
[NonSerialized]

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;
public int SearchAnnotationID
{

View File

@ -115,6 +115,47 @@ namespace VEPROMS.CSLA.Library
}
}
// 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)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());

View File

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

View File

@ -1612,7 +1612,8 @@ namespace Volian.Controls.Library
else lbSrchResultsIncTrans.DisplayMember = _DisplayMember;
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);
sortedResults.ApplySort(_DisplayMember, ListSortDirection.Ascending);
@ -1621,10 +1622,13 @@ namespace Volian.Controls.Library
}
else
{
//PopulatelbSrcResults(_SearchResults);
if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DataSource = _SearchResults;
else lbSrchResultsIncTrans.DataSource = _SearchResults;
// B2021-076: Proms search results are not presented in order when printed to PDF
var sortedResults = _SearchResults.OrderBy(x => x.SearchDefaultSort).ToList();
if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4]) lbSrchResults.DataSource = sortedResults;
else lbSrchResultsIncTrans.DataSource = sortedResults;
}
grpPanSearchResults.Text = string.Format("Search Results Found: {0}", _SearchResults.Count);
grpPanSearchResults.Style.BackColor = Color.LightGreen;// Color.YellowGreen; Color.DarkSeaGreen;
}
@ -1633,6 +1637,7 @@ namespace Volian.Controls.Library
grpPanSearchResults.Text = "Search Results";
grpPanSearchResults.Style.BackColor = saveGrpPanSearchResults;
}
// Turn Print and Results display style on/off based on whether there are search results
if (_SearchResults != null && _SearchResults.Count > 0)
{
@ -1651,6 +1656,17 @@ namespace Volian.Controls.Library
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;
lbSrchResultsIncTrans.SelectedIndex = -1;
LastResultsMouseOverIndex = -1;
@ -1832,25 +1848,26 @@ namespace Volian.Controls.Library
private string GetROsToSearch(ROFSTLookup.rochild[] chld)
{
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
{
ROFSTLookup.rochild ro = (ROFSTLookup.rochild)cmboTreeROs.SelectedNode.Tag;
rtnstr += string.Format("{0}", ro.roid);
if (rtnstr.Length == 12) rtnstr += "0000"; // last four digits are used for multiple return values
rtnstr += ROFSTLookup.FormatRoidKey(ro.roid, true);
}
else
{ // 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)
{
// B2022-026 RO Memory Reduction code - check children length
if (roc.children != null && roc.children.Length > 0)
rtnstr += GetROsToSearch(roc.children);
else
rtnstr += string.Format("{0},", roc.roid);
rtnstr += ROFSTLookup.FormatRoidKey(roc.roid, false);
}
}
return rtnstr;
}