C2025-022-Remove-UCF-2
This commit is contained in:
@@ -1756,88 +1756,6 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
|
||||
|
||||
//#region UCF Clear Overwridden Formats
|
||||
//private class ClearOverrideFormatsByFolderCriteria
|
||||
//{
|
||||
// public ClearOverrideFormatsByFolderCriteria(int folderID, int? formatID, int? newformatID)
|
||||
// {
|
||||
// _FormatID = formatID;
|
||||
// _FolderID = folderID;
|
||||
// _NewFormatID = newformatID;
|
||||
// }
|
||||
// private int? _FormatID;
|
||||
// public int? FormatID
|
||||
// {
|
||||
// get { return _FormatID; }
|
||||
// set { _FormatID = value; }
|
||||
// }
|
||||
// private int? _NewFormatID;
|
||||
// public int? NewFormatID
|
||||
// {
|
||||
// get { return _NewFormatID; }
|
||||
// set { _NewFormatID = value; }
|
||||
// }
|
||||
// private int _FolderID;
|
||||
// public int FolderID
|
||||
// {
|
||||
// get { return _FolderID; }
|
||||
// set { _FolderID = value; }
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void DataPortal_Fetch(ClearOverrideFormatsByFolderCriteria criteria)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
// {
|
||||
// using (SqlCommand cm = cn.CreateCommand())
|
||||
// {
|
||||
// cm.CommandType = CommandType.StoredProcedure;
|
||||
// cm.CommandText = "vesp_ClearOverrideFormatsByFolder";
|
||||
// cm.Parameters.AddWithValue("@FolderID", criteria.FolderID);
|
||||
// if (criteria.FormatID == null)
|
||||
// cm.Parameters.AddWithValue("@FormatID", DBNull.Value);
|
||||
// else
|
||||
// cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||
// if (criteria.NewFormatID == null)
|
||||
// cm.Parameters.AddWithValue("@NewFormatID", DBNull.Value);
|
||||
// else
|
||||
// cm.Parameters.AddWithValue("@NewFormatID", criteria.NewFormatID);
|
||||
// cm.CommandTimeout = Database.DefaultTimeout;
|
||||
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
// {
|
||||
// IsReadOnly = false;
|
||||
// while (dr.Read())
|
||||
// {
|
||||
// ContentInfo contentInfo = new ContentInfo(dr);
|
||||
// this.Add(contentInfo);
|
||||
// }
|
||||
// IsReadOnly = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Database.LogException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
||||
// throw new DbCslaException("ClearOverrideFormatsByFolderCriteria.DataPortal_Fetch", ex);
|
||||
// }
|
||||
//}
|
||||
|
||||
//public static ContentInfoList ClearOverrideFormatsByFolder(int folderID, int? formatID, int? newformatID)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ClearOverrideFormatsByFolderCriteria(folderID, formatID, newformatID));
|
||||
// return tmp;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw new DbCslaException("Error on ContentInfoList.ClearOverrideFormatsByFolder", ex);
|
||||
// }
|
||||
//}
|
||||
|
||||
private class ClearOverrideFormatsByDocVersionCriteria
|
||||
{
|
||||
public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int? newformatID)
|
||||
|
@@ -2153,7 +2153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// return Text;
|
||||
//}
|
||||
#endregion
|
||||
private static Dictionary<FormatConfig.ReplaceStr, Regex> dicReplaceRegex = new Dictionary<FormatConfig.ReplaceStr, Regex>();
|
||||
private static Dictionary<ReplaceStr, Regex> dicReplaceRegex = new Dictionary<ReplaceStr, Regex>();
|
||||
private static bool? _ProcessReplaceWords;
|
||||
public static bool ProcessReplaceWords
|
||||
{
|
||||
@@ -2178,7 +2178,8 @@ namespace VEPROMS.CSLA.Library
|
||||
// F2021-053: BNPP Alarm - need ability to have super/sub scripts in the text of Alarm Tables (ROs).
|
||||
// if doing replace words for Page List items, the current item is not a step, use _DoReplWordInPageList flags this
|
||||
if (_MyItemInfo.MyContent.Type < 20000 && !_DoReplWordInPageList) return Text; // for now only replace in steps.
|
||||
FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.UCFandOrigReplaceStrData;
|
||||
//FormatConfig.ReplaceStrData rsl = _MyFormat.PlantFormat.FormatConfig.UCFandReplaceStrData;
|
||||
ReplaceStrList rsl = _MyFormat.PlantFormat.FormatData.SectData.ReplaceStrList;
|
||||
if (rsl.Count == 1 && (rsl[0].ReplaceWord == null || rsl[0].ReplaceWord == "")) return Text;
|
||||
|
||||
// F2021-093: Handle partials first and then plain replace words. Need to do this so that the words don't get processed by plain replace
|
||||
@@ -2193,15 +2194,16 @@ namespace VEPROMS.CSLA.Library
|
||||
// Loop through text looking for words to be replaced
|
||||
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
||||
//int profileDepth = ProfileTimer.Push(">>>> DoReplaceWords2.ForLoop");
|
||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
||||
foreach (ReplaceStr rs in rsl)
|
||||
{
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
||||
if (!dopartial) // F2021-093: Partials moved into their own method and done first
|
||||
//bool dopartial = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.Partials; // save it may need to be changed back to this code.
|
||||
bool dopartial = (rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials; // from pre-UCF
|
||||
if (!dopartial) // F2021-093: Partials moved into their own method and done first
|
||||
{
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.PageList; // B2021-132
|
||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045, C2025-022 remove UFC
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.FirstWord) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||
|
||||
// note that the order of this check is important. Check in this order...
|
||||
@@ -2228,7 +2230,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (!dicReplaceRegex.ContainsKey(rs))
|
||||
{
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
//RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
//RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
//int profileDepth3 = ProfileTimer.Push(">>>> DoReplaceWords2.BuildMatch");
|
||||
// CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is
|
||||
//RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase & RegexOptions.Singleline : RegexOptions.None & RegexOptions.Singleline;
|
||||
@@ -2268,18 +2272,18 @@ namespace VEPROMS.CSLA.Library
|
||||
// F2021-093: separate out partial replace words so that they can all be done before normal replace words. Partials read in the 'repword', use
|
||||
// it as-is as a dotnet regular expression to do replacement. Aside from the dotnet regular expression process, the rest of this
|
||||
// code is similar to plain regular expressions, in terms of processing flags for which steps, etc.
|
||||
private string DoReplacePartials(string Text, FormatConfig.ReplaceStrData rsl)
|
||||
private string DoReplacePartials(string Text, ReplaceStrList rsl)
|
||||
{
|
||||
Dictionary<FormatConfig.ReplaceStr, Regex> partialReplaceList = new Dictionary<FormatConfig.ReplaceStr, Regex>();
|
||||
Dictionary<ReplaceStr, Regex> partialReplaceList = new Dictionary<ReplaceStr, Regex>();
|
||||
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
||||
foreach (ReplaceStr rs in rsl)
|
||||
{
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials;
|
||||
if (dopartial)
|
||||
{
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.PageList; // B2021-132
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||
//B2021-132 only do replacewords in paglist if the replaceword pagelist flag is set
|
||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||
|
||||
@@ -2304,7 +2308,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (!dicReplaceRegex.ContainsKey(rs))
|
||||
{
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
dicReplaceRegex.Add(rs, new Regex(rs.ReplaceWord, myOptions));
|
||||
}
|
||||
try
|
||||
@@ -2320,7 +2324,7 @@ namespace VEPROMS.CSLA.Library
|
||||
Text = Text.Replace(@"\xA0", @"\u160?"); //replace hard space
|
||||
try
|
||||
{
|
||||
foreach (FormatConfig.ReplaceStr prs in partialReplaceList.Keys)
|
||||
foreach (ReplaceStr prs in partialReplaceList.Keys)
|
||||
Text = partialReplaceList[prs].Replace(Text, prs.ReplaceWith);
|
||||
//if (partialReplaceList.Count>0) GC.Collect(); // microsoft had a memory leak in regular expression code - this REALLY slows it down though
|
||||
}
|
||||
@@ -2486,7 +2490,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_Font = font;
|
||||
_MyItemInfo = myItemInfo;
|
||||
}
|
||||
public void Add(Regex myRegEx, FormatConfig.ReplaceStr myWord)
|
||||
public void Add(Regex myRegEx, ReplaceStr myWord)
|
||||
{
|
||||
MatchCollection myMatches = myRegEx.Matches(_Text);
|
||||
foreach (Match myMatch in myMatches)
|
||||
@@ -2529,7 +2533,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void Add(Match myMatch, FormatConfig.ReplaceStr myWord)
|
||||
public void Add(Match myMatch, ReplaceStr myWord)
|
||||
{
|
||||
// If one already exists for this location, then don't add another.
|
||||
if (ContainsKey(myMatch.Index)) return;
|
||||
@@ -2563,12 +2567,12 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
// B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied. InLinkAndNotInRoFlag checks
|
||||
// for flag on replace word item & checks that it is within and RO link
|
||||
bool InLinkAndNotInRoFlag = ((foundMatch.MyWord.Flag) != 0) ? VerifyWithinLink(text, foundMatch, offset) : false;
|
||||
bool InLinkAndNotInRoFlag = ((foundMatch.MyWord.Flag & E_ReplaceFlags.NotInRO) != 0) ? VerifyWithinLink(text, foundMatch, offset) : false;
|
||||
if (!InLinkAndNotInRoFlag && VerifyNoHardSpace(text, foundMatch, offset) && VerifyNoLink(text, foundMatch, offset))
|
||||
{
|
||||
//if(offset != 0 || foundMatch.MyMatch.Index != 0 || !foundMatch.MyWord.ReplaceWith.StartsWith(@"{\par}"))
|
||||
//{
|
||||
if (((foundMatch.MyWord.Flag) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
||||
if (((foundMatch.MyWord.Flag & E_ReplaceFlags.DiffUnit) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
||||
{
|
||||
string with = foundMatch.MyWord.ReplaceWith;
|
||||
if (offset == 0 && with.StartsWith(@"{\par}"))
|
||||
@@ -2723,13 +2727,13 @@ namespace VEPROMS.CSLA.Library
|
||||
get { return _MyMatch; }
|
||||
set { _MyMatch = value; }
|
||||
}
|
||||
private FormatConfig.ReplaceStr _MyWord;
|
||||
public FormatConfig.ReplaceStr MyWord
|
||||
private ReplaceStr _MyWord;
|
||||
public ReplaceStr MyWord
|
||||
{
|
||||
get { return _MyWord; }
|
||||
set { _MyWord = value; }
|
||||
}
|
||||
public FoundMatch(Match myMatch, FormatConfig.ReplaceStr myWord)
|
||||
public FoundMatch(Match myMatch, ReplaceStr myWord)
|
||||
{
|
||||
_MyMatch = myMatch;
|
||||
_MyWord = myWord;
|
||||
|
@@ -594,70 +594,7 @@ public partial class FormatInfo : IFormatOrFormatInfo
|
||||
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
// Get format data, but do not resolve the 'Data' and 'Genmac' fields, i.e. keep empty if they are
|
||||
// empty.
|
||||
//public static FormatInfo GetFormatNoUCFByFormatID(int formatID)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// FormatInfo tmp = DataPortal.Fetch<FormatInfo>(new FormatIDNoUCFCriteria(formatID));
|
||||
// if (tmp.ErrorMessage == "No Record Found")
|
||||
// {
|
||||
// tmp.Dispose(); // Clean-up FormatInfo
|
||||
// tmp = null;
|
||||
// }
|
||||
// return tmp;
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw new DbCslaException("Error on FormatInfo.GetFormatNoUCFByFormatID", ex);
|
||||
// }
|
||||
//}
|
||||
//protected class FormatIDNoUCFCriteria
|
||||
//{
|
||||
// private int _FormatID;
|
||||
// public int FormatID { get { return _FormatID; } }
|
||||
// public FormatIDNoUCFCriteria(int formatID)
|
||||
// {
|
||||
// _FormatID = formatID;
|
||||
// }
|
||||
//}
|
||||
//private void DataPortal_Fetch(FormatIDNoUCFCriteria criteria)
|
||||
//{
|
||||
// if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode());
|
||||
// try
|
||||
// {
|
||||
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
// {
|
||||
// ApplicationContext.LocalContext["cn"] = cn;
|
||||
// using (SqlCommand cm = cn.CreateCommand())
|
||||
// {
|
||||
// cm.CommandType = CommandType.StoredProcedure;
|
||||
// cm.CommandText = "getFormatNoUCF";
|
||||
// cm.Parameters.AddWithValue("@FormatID", criteria.FormatID);
|
||||
// cm.CommandTimeout = Database.DefaultTimeout;
|
||||
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
|
||||
// {
|
||||
// if (!dr.Read())
|
||||
// {
|
||||
// _ErrorMessage = "No Record Found";
|
||||
// return;
|
||||
// }
|
||||
// ReadData(dr);
|
||||
// }
|
||||
// }
|
||||
// // removing of item only needed for local data portal
|
||||
// if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
|
||||
// ApplicationContext.LocalContext.Remove("cn");
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfo.DataPortal_Fetch", ex);
|
||||
// _ErrorMessage = ex.Message;
|
||||
// throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
||||
// }
|
||||
//}
|
||||
|
||||
#region PlantFormat
|
||||
[NonSerialized]
|
||||
private PlantFormat _PlantFormat;
|
||||
|
Reference in New Issue
Block a user