C2025-022-Remove-UCF-2
This commit is contained in:
@@ -213,14 +213,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class Flags
|
||||
{
|
||||
private bool? _CheckOffUCF;
|
||||
[DisplayName("UCF CheckOffs")]
|
||||
[Description("Additional UCF Check Offs and Sign Offs")]
|
||||
public bool? CheckOffUCF
|
||||
{
|
||||
get { return _CheckOffUCF; }
|
||||
set { _CheckOffUCF = value; }
|
||||
}
|
||||
//private bool? _CheckOffUCF;
|
||||
//[DisplayName("UCF CheckOffs")]
|
||||
//[Description("Additional UCF Check Offs and Sign Offs")]
|
||||
//public bool? CheckOffUCF
|
||||
//{
|
||||
// get { return _CheckOffUCF; }
|
||||
// set { _CheckOffUCF = value; }
|
||||
//}
|
||||
private bool? _PartialStepCompression;
|
||||
[DisplayName("Partial Step Compression")]
|
||||
[Description("Automatically compress last sub-steps to fit on page")]
|
||||
@@ -272,41 +272,42 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion ReplaceStrData
|
||||
#region ReplaceStr
|
||||
[Flags]
|
||||
public enum E_ReplaceFlagsUCF : uint
|
||||
{
|
||||
High = 0x0001, // Do ReplaceWords in HIGH LEVEL STEPS
|
||||
RNO = 0x0002, // Do ReplaceWords in RNOS
|
||||
Caution = 0x0004, // Do ReplaceWords in CAUTIONS
|
||||
Note = 0x0008, // Do ReplaceWords in NOTES
|
||||
Table = 0x0010, // Do ReplaceWords in TABLES
|
||||
Substep = 0x0020, // Do ReplaceWords in SUBSTEPS
|
||||
Attach = 0x0040, // Do ReplaceWords in ATTACHMENTS
|
||||
Bkgd = 0x0080, // Do ReplaceWords in BACKGROUNDS
|
||||
DiffUnit = 0x0100, // Do ReplaceWords ONLY for different UNIT #
|
||||
TOC = 0x0200, // Do in auto table-of-contents
|
||||
StatTree = 0x0400,
|
||||
HLSSetpnt = 0x0800, // Do ReplaceWords in HighLevelStep SETPoiNTs
|
||||
Trans = 0x1000, // Do ReplaceWords in TRANSITIONS
|
||||
Setpoint = 0x2000, // Do ReplaceWords in SETPOINTS
|
||||
//[Flags]
|
||||
//public enum
|
||||
//: uint
|
||||
//{
|
||||
// High = 0x0001, // Do ReplaceWords in HIGH LEVEL STEPS
|
||||
// RNO = 0x0002, // Do ReplaceWords in RNOS
|
||||
// Caution = 0x0004, // Do ReplaceWords in CAUTIONS
|
||||
// Note = 0x0008, // Do ReplaceWords in NOTES
|
||||
// Table = 0x0010, // Do ReplaceWords in TABLES
|
||||
// Substep = 0x0020, // Do ReplaceWords in SUBSTEPS
|
||||
// Attach = 0x0040, // Do ReplaceWords in ATTACHMENTS
|
||||
// Bkgd = 0x0080, // Do ReplaceWords in BACKGROUNDS
|
||||
// DiffUnit = 0x0100, // Do ReplaceWords ONLY for different UNIT #
|
||||
// TOC = 0x0200, // Do in auto table-of-contents
|
||||
// StatTree = 0x0400,
|
||||
// HLSSetpnt = 0x0800, // Do ReplaceWords in HighLevelStep SETPoiNTs
|
||||
// Trans = 0x1000, // Do ReplaceWords in TRANSITIONS
|
||||
// Setpoint = 0x2000, // Do ReplaceWords in SETPOINTS
|
||||
|
||||
// Case Sensitivity Flags - default is off (Case Sensitive Replace)
|
||||
CaseInsens = 0x0000C000, // Do ReplaceWords for all words thatmatch, regardless of case,
|
||||
// and replace with the ReplaceWith string as is
|
||||
// B2019-022: do not support CaseInsensFirst & CaseInsensAll - there is no supporting replace word code:
|
||||
//CaseInsensFirst = 0x4000, // Do ReplaceWords for all words thatexactly match the ReplaceWord,
|
||||
// except the case of the first character may be different
|
||||
//CaseInsensAll = 0x8000, // Do ReplaceWords for all words that match the ReplaceWord, regardless of case
|
||||
// // Case Sensitivity Flags - default is off (Case Sensitive Replace)
|
||||
// CaseInsens = 0x0000C000, // Do ReplaceWords for all words thatmatch, regardless of case,
|
||||
// // and replace with the ReplaceWith string as is
|
||||
// // B2019-022: do not support CaseInsensFirst & CaseInsensAll - there is no supporting replace word code:
|
||||
// //CaseInsensFirst = 0x4000, // Do ReplaceWords for all words thatexactly match the ReplaceWord,
|
||||
// // except the case of the first character may be different
|
||||
// //CaseInsensAll = 0x8000, // Do ReplaceWords for all words that match the ReplaceWord, regardless of case
|
||||
|
||||
Partials = 0x10000, // Do replace even on partial matches
|
||||
Plackeep = 0x20000, // Do replace in PlaceKeepers
|
||||
InSecTitle = 0x40000,
|
||||
BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
|
||||
BeforeList = 0x100000, // C2021-045 Only if the text ends with a colon ":"
|
||||
PageList = 0x200000, // F2021-053 Do replace words for PageList items that are ROs
|
||||
FirstWord = 0x400000, // C2021-056 Do only if is the first word in the text
|
||||
NotInRO = 0x800000 // B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied
|
||||
}
|
||||
// Partials = 0x10000, // Do replace even on partial matches
|
||||
// Plackeep = 0x20000, // Do replace in PlaceKeepers
|
||||
// InSecTitle = 0x40000,
|
||||
// BeforeTrans = 0x80000, // Only do replace if the string occurs immediately before a transition.
|
||||
// BeforeList = 0x100000, // C2021-045 Only if the text ends with a colon ":"
|
||||
// PageList = 0x200000, // F2021-053 Do replace words for PageList items that are ROs
|
||||
// FirstWord = 0x400000, // C2021-056 Do only if is the first word in the text
|
||||
// NotInRO = 0x800000 // B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied
|
||||
//}
|
||||
[Serializable]
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class ReplaceStr
|
||||
|
@@ -1755,165 +1755,88 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
#endregion
|
||||
|
||||
#region UCF Fix FormatId After Import
|
||||
private class FixFormatIDAfterImportCriteria
|
||||
{
|
||||
private string _DocVersionList;
|
||||
public string DocVersionList
|
||||
{
|
||||
get { return _DocVersionList; }
|
||||
set { _DocVersionList = value; }
|
||||
}
|
||||
private int _OldFormatID;
|
||||
public int OldFormatID
|
||||
{
|
||||
get { return _OldFormatID; }
|
||||
set { _OldFormatID = value; }
|
||||
}
|
||||
private int _NewFormatID;
|
||||
public int NewFormatID
|
||||
{
|
||||
get { return _NewFormatID; }
|
||||
set { _NewFormatID = value; }
|
||||
}
|
||||
public FixFormatIDAfterImportCriteria(string dvlst, int oldfid, int newfid)
|
||||
{
|
||||
_DocVersionList = dvlst;
|
||||
_OldFormatID = oldfid;
|
||||
_NewFormatID = newfid;
|
||||
}
|
||||
}
|
||||
|
||||
private void DataPortal_Fetch(FixFormatIDAfterImportCriteria criteria)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "vesp_UpdateVersionFormatForUCF";
|
||||
cm.Parameters.AddWithValue("@VersionList", criteria.DocVersionList);
|
||||
cm.Parameters.AddWithValue("@OldFormatID", criteria.OldFormatID);
|
||||
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("FixFormatIDAfterImport.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("FixFormatIDAfterImport.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
//#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; }
|
||||
// }
|
||||
//}
|
||||
|
||||
public static ContentInfoList FixFormatIDAfterImport(string dvlst, int oldfid, int newfid)
|
||||
{
|
||||
try
|
||||
{
|
||||
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new FixFormatIDAfterImportCriteria(dvlst, oldfid, newfid));
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new DbCslaException("Error on ContentInfoList.FixFormatIDAfterImport", ex);
|
||||
}
|
||||
}
|
||||
//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);
|
||||
// }
|
||||
//}
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
//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
|
||||
{
|
||||
@@ -2077,7 +2000,6 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Enhanced
|
||||
|
||||
|
@@ -2195,12 +2195,12 @@ namespace VEPROMS.CSLA.Library
|
||||
//int profileDepth = ProfileTimer.Push(">>>> DoReplaceWords2.ForLoop");
|
||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
||||
{
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.Partials) == E_ReplaceFlags.Partials;
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
||||
if (!dopartial) // F2021-093: Partials moved into their own method and done first
|
||||
{
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.FirstWord) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||
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
|
||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||
|
||||
@@ -2228,7 +2228,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (!dicReplaceRegex.ContainsKey(rs))
|
||||
{
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == 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;
|
||||
@@ -2274,12 +2274,12 @@ namespace VEPROMS.CSLA.Library
|
||||
Dictionary<E_ReplaceFlags?, bool> shouldReplace = new Dictionary<E_ReplaceFlags?, bool>();
|
||||
foreach (FormatConfig.ReplaceStr rs in rsl)
|
||||
{
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.Partials) == E_ReplaceFlags.Partials;
|
||||
bool dopartial = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.Partials;
|
||||
if (dopartial)
|
||||
{
|
||||
bool onlyDoList = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.BeforeList) == E_ReplaceFlags.BeforeList; // C2021-045
|
||||
bool onlyIfFirstWord = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.FirstWord) == E_ReplaceFlags.FirstWord; // C2021-056
|
||||
bool doInPagelist = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.PageList) == E_ReplaceFlags.PageList; // B2021-132
|
||||
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
|
||||
if (_DoReplWordInPageList && !doInPagelist) continue;
|
||||
|
||||
@@ -2304,7 +2304,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (!dicReplaceRegex.ContainsKey(rs))
|
||||
{
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag & FormatConfig.E_ReplaceFlagsUCF.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
RegexOptions myOptions = (E_ReplaceFlags)(rs.Flag) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase : RegexOptions.None;
|
||||
dicReplaceRegex.Add(rs, new Regex(rs.ReplaceWord, myOptions));
|
||||
}
|
||||
try
|
||||
@@ -2563,12 +2563,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 & FormatConfig.E_ReplaceFlagsUCF.NotInRO) != 0) ? VerifyWithinLink(text, foundMatch, offset) : false;
|
||||
bool InLinkAndNotInRoFlag = ((foundMatch.MyWord.Flag) != 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 & FormatConfig.E_ReplaceFlagsUCF.DiffUnit) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
||||
if (((foundMatch.MyWord.Flag) == 0) || DiffUnit(foundMatch.MyWord.ReplaceWord, _MyItemInfo, "UNIT "))
|
||||
{
|
||||
string with = foundMatch.MyWord.ReplaceWith;
|
||||
if (offset == 0 && with.StartsWith(@"{\par}"))
|
||||
|
@@ -596,68 +596,68 @@ public partial class FormatInfo : IFormatOrFormatInfo
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
//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;
|
||||
|
@@ -6067,7 +6067,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// To determine if the section has a checkoff...
|
||||
// Section won't have checkoffs if there is no checkofflist, or
|
||||
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
|
||||
int maxindx = pd.CheckOffUCF ? pd.CheckOffData.CheckOffList.MaxIndex : pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
|
||||
int maxindx = pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
|
||||
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || maxindx <= 0) return false;
|
||||
if (pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.MaxIndex <= 1) return true;
|
||||
//if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return false;
|
||||
@@ -6099,7 +6099,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private int SectionDefaultCheckOffIndex()
|
||||
{
|
||||
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
|
||||
int maxindx = pd.CheckOffUCF ? pd.CheckOffData.CheckOffList.MaxIndex : pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
|
||||
int maxindx = pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
|
||||
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && maxindx == 2) return 0; // if only two items, first is macro - use it.
|
||||
SectionConfig sc = ActiveSection.MyConfig as SectionConfig;
|
||||
return sc.Section_CheckoffListSelection;
|
||||
@@ -6111,23 +6111,23 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!SectionHasCheckOffs()) return null;
|
||||
int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined
|
||||
if (stpCoIndx == -1) return null;
|
||||
if (stpCoIndx > 1)
|
||||
{
|
||||
if (ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffUCF && stpCoIndx >= 100)
|
||||
{
|
||||
// get index, if greater than 100, store that - otherwise store index down list.
|
||||
// if this format does not have ucf signoffs, indx is just the selected index from the combo box.
|
||||
foreach (CheckOff co in ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList)
|
||||
{
|
||||
if (stpCoIndx == co.Index)
|
||||
{
|
||||
stpCoIndx = (int)co.Index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx]; // DO override of CheckOffList[] to get ucf
|
||||
}
|
||||
//if (stpCoIndx > 1)
|
||||
//{
|
||||
// if (ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffUCF && stpCoIndx >= 100)
|
||||
// {
|
||||
// // get index, if greater than 100, store that - otherwise store index down list.
|
||||
// // if this format does not have ucf signoffs, indx is just the selected index from the combo box.
|
||||
// foreach (CheckOff co in ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList)
|
||||
// {
|
||||
// if (stpCoIndx == co.Index)
|
||||
// {
|
||||
// stpCoIndx = (int)co.Index;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx]; // DO override of CheckOffList[] to get ucf
|
||||
//}
|
||||
int sectCoIndx = SectionDefaultCheckOffIndex(); // no checkoff on step, see if there is a section default.
|
||||
if (sectCoIndx == -1) return null;
|
||||
if ((ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffOnHLSOnly && IsHigh)
|
||||
@@ -6161,7 +6161,7 @@ namespace VEPROMS.CSLA.Library
|
||||
get
|
||||
{
|
||||
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
|
||||
int maxindx = pd.CheckOffUCF ? pd.CheckOffData.CheckOffList.MaxIndex : pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
|
||||
int maxindx = pd.CheckOffData.CheckOffList.MaxIndexNoInherit;
|
||||
if (pd.CheckOffData != null && pd.CheckOffData.CheckOffList != null && maxindx == 2 && pd.CheckOffData.CheckOffList[0].MenuItem == "Enabled")
|
||||
return true; // if only two items, first is macro - use it.
|
||||
return false;
|
||||
|
@@ -126,19 +126,19 @@ namespace VEPROMS.CSLA.Library
|
||||
XmlNodeList nl = XmlDoc.SelectNodes(xpath);
|
||||
return nl.Count > 0;
|
||||
}
|
||||
private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
|
||||
private FormatConfig.ReplaceStrData _UCFandOrigReplaceStrData = null;
|
||||
// This will return a complete list of ReplaceWords, combining those in the original plant format
|
||||
// with the ones added by the user via User Control of Format (UCF)
|
||||
public FormatConfig.ReplaceStrData UCFandOrigReplaceStrData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
|
||||
_UCFandOrigReplaceStrData = GetMergedReplaceList(this);
|
||||
return _UCFandOrigReplaceStrData;
|
||||
}
|
||||
}
|
||||
private FormatConfig.ReplaceStrData GetMergedReplaceList(PlantFormat OriginalPlantFormat)
|
||||
public FormatConfig.ReplaceStrData UCFandOrigReplaceStrData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_UCFandOrigReplaceStrData != null) return _UCFandOrigReplaceStrData;
|
||||
_UCFandOrigReplaceStrData = GetMergedReplaceList(this);
|
||||
return _UCFandOrigReplaceStrData;
|
||||
}
|
||||
}
|
||||
private FormatConfig.ReplaceStrData GetMergedReplaceList(PlantFormat OriginalPlantFormat)
|
||||
{
|
||||
// need to compare the original format list with the list as it is stored for working with property grid.
|
||||
FormatConfig.ReplaceStrData retlist = new FormatConfig.ReplaceStrData(); // merged list
|
||||
@@ -1579,25 +1579,6 @@ namespace VEPROMS.CSLA.Library
|
||||
return _PSI == null ? _PSI = new PSI(SelectSingleNode("PSI")) : _PSI;
|
||||
}
|
||||
}
|
||||
private LazyLoad<bool> _CheckOffUCF;
|
||||
public bool CheckOffUCF
|
||||
{
|
||||
get
|
||||
{
|
||||
// The following line is used in UCF (User Control of Format).
|
||||
// This needs to be able to control a change in setting in UCF versus its use:
|
||||
// - This is a special case since the original format, using the value in BaseAll, is always 'false'. And the value
|
||||
// should never be set in original volian plant format files, if the additional UCF checkoffs are to be used, this must
|
||||
// be set in the UCF user interface.
|
||||
if (PlantFormat.DoingUCFCheckOffs) return PlantFormat.DoingUCFCheckOffsUse;
|
||||
|
||||
if (PlantFormat.IgnoreUCF) return LazyLoad(ref _CheckOffUCF, "@CheckOffUCF");
|
||||
bool? localvalue = null; // comes to here if in edit or print - use any UCF data before going to original format.
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (fc != null) localvalue = fc.PlantFormat.FormatData.Flags.CheckOffUCF;
|
||||
return localvalue ?? LazyLoad(ref _CheckOffUCF, "@CheckOffUCF");
|
||||
}
|
||||
}
|
||||
|
||||
// specifies the maxiumn length of the procedure title before PROMS considers to wrap the title
|
||||
// this is used with the {PROCTITLE} PageStyle toekn
|
||||
@@ -1955,25 +1936,25 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
// UseCheckOffUCF is false or there is no FormatConfig (UCF) data:
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc==null)
|
||||
{
|
||||
_CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"), MyFormat);
|
||||
// B2019-100: If Ignoring the UCF data, just return the entire list. Also, return entire list if there is no UCF data (fc == null)
|
||||
if (PlantFormat.IgnoreUCF || fc == null) return _CheckOffList;
|
||||
// If not ignoring UCF settings, only return those that are active
|
||||
foreach (FormatConfig.CheckOff co in fc.PlantFormat.FormatData.CheckOffList)
|
||||
{
|
||||
foreach (CheckOff coo in _CheckOffList)
|
||||
{
|
||||
if ((int)coo.Index == Convert.ToInt32(co.Index) && !(bool)co.Active)
|
||||
{
|
||||
_CheckOffList.Remove(coo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _CheckOffList;
|
||||
}
|
||||
//if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc==null)
|
||||
//{
|
||||
// _CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"), MyFormat);
|
||||
// // B2019-100: If Ignoring the UCF data, just return the entire list. Also, return entire list if there is no UCF data (fc == null)
|
||||
// if (PlantFormat.IgnoreUCF || fc == null) return _CheckOffList;
|
||||
// // If not ignoring UCF settings, only return those that are active
|
||||
// foreach (FormatConfig.CheckOff co in fc.PlantFormat.FormatData.CheckOffList)
|
||||
// {
|
||||
// foreach (CheckOff coo in _CheckOffList)
|
||||
// {
|
||||
// if ((int)coo.Index == Convert.ToInt32(co.Index) && !(bool)co.Active)
|
||||
// {
|
||||
// _CheckOffList.Remove(coo);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return _CheckOffList;
|
||||
//}
|
||||
// UseCheckOfffUCF is true:
|
||||
// merge the checkoff list from the current format and the checkoff list from the base format
|
||||
_CheckOffList = new CheckOffList(SelectNodes("CheckOffList/CheckOff"), MyFormat);
|
||||
@@ -2008,26 +1989,26 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_CheckOffHeaderList != null) return _CheckOffHeaderList;
|
||||
FormatConfig fc = PlantFormat.GetFormatConfig(MyFormat);
|
||||
if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc == null)
|
||||
{
|
||||
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
// Depending on the IgnoreUCF flag, either return this list with UCF Inactive flags set or return the
|
||||
// list as is.
|
||||
if (PlantFormat.IgnoreUCF || fc == null) return _CheckOffHeaderList;
|
||||
// If not ignoring UCF settings, only return those that are active
|
||||
foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
|
||||
{
|
||||
foreach (CheckOffHeader coo in _CheckOffHeaderList)
|
||||
{
|
||||
if ((int)coo.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
|
||||
{
|
||||
_CheckOffHeaderList.Remove(coo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _CheckOffHeaderList;
|
||||
}
|
||||
//if (!MyFormat.PlantFormat.FormatData.ProcData.CheckOffUCF || fc == null)
|
||||
//{
|
||||
// _CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
// // Depending on the IgnoreUCF flag, either return this list with UCF Inactive flags set or return the
|
||||
// // list as is.
|
||||
// if (PlantFormat.IgnoreUCF || fc == null) return _CheckOffHeaderList;
|
||||
// // If not ignoring UCF settings, only return those that are active
|
||||
// foreach (FormatConfig.CheckOffHeader coh in fc.PlantFormat.FormatData.CheckOffHeaderList)
|
||||
// {
|
||||
// foreach (CheckOffHeader coo in _CheckOffHeaderList)
|
||||
// {
|
||||
// if ((int)coo.Index == Convert.ToInt32(coh.Index) && !(bool)coh.Active)
|
||||
// {
|
||||
// _CheckOffHeaderList.Remove(coo);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return _CheckOffHeaderList;
|
||||
//}
|
||||
// merge the checkoff header lists from the current format and the list from the base
|
||||
_CheckOffHeaderList = new CheckOffHeaderList(SelectNodes("CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
CheckOffHeaderList retlist2 = new CheckOffHeaderList(SelectNodes("../CheckOffDataUCF/CheckOffHeaderList/CheckOffHeader"), MyFormat);
|
||||
|
Reference in New Issue
Block a user