diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index fa3a36c5..0ca5cbfe 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -7279,33 +7279,10 @@ namespace VEPROMS.CSLA.Library _ByWordSuffix = byWordSuffix; } } - private string checkPercentChar(string SearchString) - { - string ss = ""; - string pattern = "%"; // Pattern to match the percentage sign - Match match = Regex.Match(SearchString, pattern); - if (match.Success) - { - int sl = SearchString.Length; - int precentIdx = SearchString.IndexOf('%'); - int startIndex = 0; - if (sl == precentIdx + 1) // % the last char. - { - ss = SearchString.Substring(startIndex, sl - 1); - var isNumeric = int.TryParse(ss, out int n); - if (isNumeric == true) // other that a % are the rest of the characters numbers. - { - ss = ' ' + SearchString; //add a space prefix; - } - } - } - return ss; - } private void DataPortal_Fetch(ItemListSearchCriteria criteria) { this.RaiseListChangedEvents = false; - //criteria.SearchString = checkPercentChar(criteria.SearchString); try { using (SqlConnection cn = Database.VEPROMS_SqlConnection) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index f30c8bb2..6f569b4e 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -2078,8 +2078,9 @@ namespace Volian.Controls.Library if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked) { + string ROSearchList2 = checkPercentChar(ROSearchList); // match exact string // B2022-031 - added a cbxProcSectSrch to filter out procedure and section titles from global search results. - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, string.Empty, string.Empty); + SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList2, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, string.Empty, string.Empty); cmbResultsStyleIndex = 3; // display step text in results } else @@ -2190,6 +2191,34 @@ namespace Volian.Controls.Library OnSearchComplete(new DisplaySearchEventArgs(TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks))); } + private string checkPercentChar(string SearchString) + { + string ss = ""; + string pattern = "%"; // Pattern to match the percentage sign + Match match = Regex.Match(SearchString, pattern); + if (match.Success) // Special case for percents. + { + int sl = SearchString.Length; + int precentIdx = SearchString.IndexOf('%'); + int startIndex = 0; + if (sl == precentIdx + 1) // % the last char. + { + ss = SearchString.Substring(startIndex, sl - 1); + var isNumeric = int.TryParse(ss, out int n); + if (isNumeric == true) // other that a % are the rest of the characters numbers. + { + ss = ' ' + SearchString; //add a space prefix to make the search exact. If search is 5% this makes it excult 25% 55% etc.; + } + } + } + else + { + ss = ' ' + SearchString + ' '; // Exact match add spaces before and after search string. + + } + return ss; + } + private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click) { if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4])