diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index 28c02a4d..04e71963 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -364,24 +364,9 @@ namespace VEPROMS.CSLA.Library } if (_MyItemInfo != null && ROsShouldBeAdjusted) // B2017-019 - added check for ROsShouldBeAdjusted so that these token are not "cooked" on property pages { - text = Regex.Replace(text, @"\", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)ID)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)NAME)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_Name, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)TEXT)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_Text, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)NUMBER)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase); - //B2021-148 removed space character after OTHER - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERID)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_ID, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERNAME)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_Name, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERTEXT)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_Text, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERNUMBER)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_Number, RegexOptions.IgnoreCase); - //B2022-023 also check for other followed by a space - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER ID)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_ID, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER NAME)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_Name, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER TEXT)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_Text, RegexOptions.IgnoreCase); - text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER NUMBER)\>", _MyItemInfo.MyDocVersion.DocVersionConfig.Other_Unit_Number, RegexOptions.IgnoreCase); - //text = DoSearchAndReplace(text, "", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_ID); + // B2022-035: resolve unit specific designators - moved code to ResolveUnitSpecific so other objects can use it. + text = ResolveUnitSpecific(_MyItemInfo.MyDocVersion, text); text = text.Replace(@"", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_ProcedureSetID); - //text = text.Replace("", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_Number); } // Adjust RO display if (ROsShouldBeAdjusted) @@ -482,6 +467,29 @@ namespace VEPROMS.CSLA.Library ProfileTimer.Pop(profileDepth); return text; } + // B2022-035: resolve unit specific designators - moved code to here so that other objects can use it + public static string ResolveUnitSpecific(DocVersionInfo mydocversion, string text) + { + if (mydocversion == null) return text; + text = Regex.Replace(text, @"\", mydocversion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)ID)\>", mydocversion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)NAME)\>", mydocversion.DocVersionConfig.Unit_Name, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)TEXT)\>", mydocversion.DocVersionConfig.Unit_Text, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)NUMBER)\>", mydocversion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase); + //B2021-148 removed space character after OTHER + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERID)\>", mydocversion.DocVersionConfig.Other_Unit_ID, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERNAME)\>", mydocversion.DocVersionConfig.Other_Unit_Name, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERTEXT)\>", mydocversion.DocVersionConfig.Other_Unit_Text, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHERNUMBER)\>", mydocversion.DocVersionConfig.Other_Unit_Number, RegexOptions.IgnoreCase); + //B2022-023 also check for other followed by a space + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER ID)\>", mydocversion.DocVersionConfig.Other_Unit_ID, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER NAME)\>", mydocversion.DocVersionConfig.Other_Unit_Name, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER TEXT)\>", mydocversion.DocVersionConfig.Other_Unit_Text, RegexOptions.IgnoreCase); + text = Regex.Replace(text, @"\<(U(-|\\u8209\?)OTHER NUMBER)\>", mydocversion.DocVersionConfig.Other_Unit_Number, RegexOptions.IgnoreCase); + + return text; + } + // F2019-065: Upper case if step format has flag private string UpCaseStep(string text) { diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 73a9fba8..c073a287 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2765,11 +2765,8 @@ namespace VEPROMS.CSLA.Library get { string str = MyContent.Text; - str = Regex.Replace(str, @"\<[uU]\>", MyDocVersion.DocVersionConfig.Unit_Number); - //if (str.Contains("")) - // str = str.Replace("", MyDocVersion.DocVersionConfig.Unit_Number); - //if (str.Contains("")) - // str = str.Replace("", MyDocVersion.DocVersionConfig.Unit_Number); + // B2022-035: resolve unit specific designators + if (str.ToUpper().Contains(@"", MyDocVersion.DocVersionConfig.Unit_Number); + // B2022-035: resolve unit specific designators + if (str.ToUpper().Contains("