B2022-035: <U-ID> not getting resolved in Auto Table of Contents and procedure titles

This commit is contained in:
2022-03-17 10:37:31 +00:00
parent 05610f12e7
commit d053ee5092
3 changed files with 31 additions and 23 deletions

View File

@@ -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, @"\<U\>", _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, "<U-ID>", _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(@"<S\u8209?ID>", _MyItemInfo.MyDocVersion.DocVersionConfig.Unit_ProcedureSetID);
//text = text.Replace("<U>", _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, @"\<U\>", 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)
{