C2026 043 tech debt v1 #817

Open
mschill wants to merge 43 commits from C2026-043-Tech-Debt_v1 into Development
30 changed files with 2703 additions and 5680 deletions
Showing only changes of commit dab65dbfb6 - Show all commits
@@ -5,31 +5,22 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using Csla.Validation;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
public class ESP_FixHyphens : CommandBase public class ESP_FixHyphens : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int AffectedRows { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_DeletePDFs cmd = new ESP_DeletePDFs
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _AffectedRows; };
public int AffectedRows DataPortal.Execute<ESP_DeletePDFs>(cmd);
{
get { return _AffectedRows; }
set { _AffectedRows = value; }
}
public static int Execute(string storedProcedure)
{
ESP_DeletePDFs cmd = new ESP_DeletePDFs();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_DeletePDFs>(cmd);
return cmd.AffectedRows; return cmd.AffectedRows;
} }
#endregion #endregion
@@ -59,24 +50,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_DeletePDFs : CommandBase public class ESP_DeletePDFs : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int AffectedRows { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_DeletePDFs cmd = new ESP_DeletePDFs
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _AffectedRows; };
public int AffectedRows DataPortal.Execute<ESP_DeletePDFs>(cmd);
{
get { return _AffectedRows; }
set { _AffectedRows = value; }
}
public static int Execute(string storedProcedure)
{
ESP_DeletePDFs cmd = new ESP_DeletePDFs();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_DeletePDFs>(cmd);
return cmd.AffectedRows; return cmd.AffectedRows;
} }
#endregion #endregion
@@ -106,24 +89,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_IdentifyDisconnectedItems : CommandBase public class ESP_IdentifyDisconnectedItems : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int RowCount { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_IdentifyDisconnectedItems cmd = new ESP_IdentifyDisconnectedItems
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _RowCount; };
public int RowCount DataPortal.Execute<ESP_IdentifyDisconnectedItems>(cmd);
{
get { return _RowCount; }
set { _RowCount = value; }
}
public static int Execute(string storedProcedure)
{
ESP_IdentifyDisconnectedItems cmd = new ESP_IdentifyDisconnectedItems();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_IdentifyDisconnectedItems>(cmd);
return cmd.RowCount; return cmd.RowCount;
} }
#endregion #endregion
@@ -157,24 +132,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_PurgeDisconnectedItems : CommandBase public class ESP_PurgeDisconnectedItems : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int RowCount { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_PurgeDisconnectedItems cmd = new ESP_PurgeDisconnectedItems
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _RowCount; };
public int RowCount DataPortal.Execute<ESP_PurgeDisconnectedItems>(cmd);
{
get { return _RowCount; }
set { _RowCount = value; }
}
public static int Execute(string storedProcedure)
{
ESP_PurgeDisconnectedItems cmd = new ESP_PurgeDisconnectedItems();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_PurgeDisconnectedItems>(cmd);
return cmd.RowCount; return cmd.RowCount;
} }
#endregion #endregion
@@ -206,24 +173,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_GetROAssoc : CommandBase public class ESP_GetROAssoc : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int RowCount { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_GetROAssoc cmd = new ESP_GetROAssoc
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _RowCount; };
public int RowCount DataPortal.Execute<ESP_GetROAssoc>(cmd);
{
get { return _RowCount; }
set { _RowCount = value; }
}
public static int Execute(string storedProcedure)
{
ESP_GetROAssoc cmd = new ESP_GetROAssoc();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_GetROAssoc>(cmd);
return cmd.RowCount; return cmd.RowCount;
} }
#endregion #endregion
@@ -257,24 +216,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_CleanupROAssoc : CommandBase public class ESP_CleanupROAssoc : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int RowCount { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_CleanupROAssoc cmd = new ESP_CleanupROAssoc
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _RowCount; };
public int RowCount DataPortal.Execute<ESP_CleanupROAssoc>(cmd);
{
get { return _RowCount; }
set { _RowCount = value; }
}
public static int Execute(string storedProcedure)
{
ESP_CleanupROAssoc cmd = new ESP_CleanupROAssoc();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_CleanupROAssoc>(cmd);
return cmd.RowCount; return cmd.RowCount;
} }
#endregion #endregion
@@ -307,24 +258,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_GetUnusedRoFsts : CommandBase public class ESP_GetUnusedRoFsts : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int RowCount { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_GetUnusedRoFsts cmd = new ESP_GetUnusedRoFsts
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _RowCount; };
public int RowCount DataPortal.Execute<ESP_GetUnusedRoFsts>(cmd);
{
get { return _RowCount; }
set { _RowCount = value; }
}
public static int Execute(string storedProcedure)
{
ESP_GetUnusedRoFsts cmd = new ESP_GetUnusedRoFsts();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_GetUnusedRoFsts>(cmd);
return cmd.RowCount; return cmd.RowCount;
} }
#endregion #endregion
@@ -358,24 +301,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_GetUnusedFigures : CommandBase public class ESP_GetUnusedFigures : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int RowCount { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_GetUnusedFigures cmd = new ESP_GetUnusedFigures
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _RowCount; };
public int RowCount DataPortal.Execute<ESP_GetUnusedFigures>(cmd);
{
get { return _RowCount; }
set { _RowCount = value; }
}
public static int Execute(string storedProcedure)
{
ESP_GetUnusedFigures cmd = new ESP_GetUnusedFigures();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_GetUnusedFigures>(cmd);
return cmd.RowCount; return cmd.RowCount;
} }
#endregion #endregion
@@ -409,24 +344,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_PurgeUnusedRoFstsAndFigures : CommandBase public class ESP_PurgeUnusedRoFstsAndFigures : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public int RowCount { get; set; }
public static int Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_PurgeUnusedRoFstsAndFigures cmd = new ESP_PurgeUnusedRoFstsAndFigures
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private int _RowCount; };
public int RowCount DataPortal.Execute<ESP_PurgeUnusedRoFstsAndFigures>(cmd);
{
get { return _RowCount; }
set { _RowCount = value; }
}
public static int Execute(string storedProcedure)
{
ESP_PurgeUnusedRoFstsAndFigures cmd = new ESP_PurgeUnusedRoFstsAndFigures();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_PurgeUnusedRoFstsAndFigures>(cmd);
return cmd.RowCount; return cmd.RowCount;
} }
#endregion #endregion
@@ -458,24 +385,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_IdentifyNonEditableItems : CommandBase public class ESP_IdentifyNonEditableItems : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public List<ItemInfo> ItemInfoList { get; set; } = new List<ItemInfo>();
public static List<ItemInfo> Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_IdentifyNonEditableItems cmd = new ESP_IdentifyNonEditableItems
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private List<ItemInfo> _ItemInfoList = new List<ItemInfo>(); };
public List<ItemInfo> ItemInfoList DataPortal.Execute<ESP_IdentifyNonEditableItems>(cmd);
{
get { return _ItemInfoList; }
set { _ItemInfoList = value; }
}
public static List<ItemInfo> Execute(string storedProcedure)
{
ESP_IdentifyNonEditableItems cmd = new ESP_IdentifyNonEditableItems();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_IdentifyNonEditableItems>(cmd);
return cmd.ItemInfoList; return cmd.ItemInfoList;
} }
#endregion #endregion
@@ -508,24 +427,16 @@ namespace VEPROMS.CSLA.Library
public class ESP_GetDatabaseSessions : CommandBase public class ESP_GetDatabaseSessions : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods #region Factory Methods
private string _StoredProcedure; public string StoredProcedure { get; set; }
public string StoredProcedure public string ResultsString { get; set; }
public static string Execute(string storedProcedure)
{ {
get { return _StoredProcedure; } ESP_GetDatabaseSessions cmd = new ESP_GetDatabaseSessions
set { _StoredProcedure = value; } {
} StoredProcedure = storedProcedure
private string _ResultsString; };
public string ResultsString DataPortal.Execute<ESP_GetDatabaseSessions>(cmd);
{
get { return _ResultsString; }
set { _ResultsString = value; }
}
public static string Execute(string storedProcedure)
{
ESP_GetDatabaseSessions cmd = new ESP_GetDatabaseSessions();
cmd.StoredProcedure = storedProcedure;
DataPortal.Execute<ESP_GetDatabaseSessions>(cmd);
return cmd.ResultsString; return cmd.ResultsString;
} }
#endregion #endregion
@@ -579,7 +490,7 @@ namespace VEPROMS.CSLA.Library
} }
} }
} }
_ResultsString = sbs.ToString(); ResultsString = sbs.ToString();
} }
} }
} }
@@ -591,12 +502,4 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
} }
public class ESP_FindROProblems : CommandBase
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Factory Methods
#endregion
#region Server-Side Code
#endregion
}
} }
@@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Text.RegularExpressions;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
@@ -11,12 +9,9 @@ namespace VEPROMS.CSLA.Library
{ {
public partial class AnnotationInfo public partial class AnnotationInfo
{ {
public override string ToString() public override string ToString() => _SearchText;
{ #region JCB Annotation Status
return _SearchText; private bool _IsAnnotationNew = false;
}
#region JCB Annotation Status
private bool _IsAnnotationNew = false;
public bool IsAnnotationNew public bool IsAnnotationNew
{ {
@@ -49,11 +44,8 @@ namespace VEPROMS.CSLA.Library
} }
public partial class AnnotationType public partial class AnnotationType
{ {
public override string ToString() public override string ToString() => _Name;
{ [NonSerialized]
return _Name;
}
[NonSerialized]
private AnnotationTypeConfig _AnnotationTypeConfig; private AnnotationTypeConfig _AnnotationTypeConfig;
public AnnotationTypeConfig AnnotationTypeConfig public AnnotationTypeConfig AnnotationTypeConfig
{ {
@@ -83,79 +75,69 @@ namespace VEPROMS.CSLA.Library
return _AnnotationTypeConfig; return _AnnotationTypeConfig;
} }
} }
public static List<AnnotationTypeInfo> AllList() public static List<AnnotationTypeInfo> AllList() => AnnotationTypeInfo._CacheList;
public override string ToString() => _Name;
public static AnnotationTypeInfo GetByName(string name)
{ {
//return _AllList; try
return AnnotationTypeInfo._CacheList; {
AnnotationTypeInfo tmp = DataPortal.Fetch<AnnotationTypeInfo>(new GetByNameCriteria(name));
if (tmp.ErrorMessage == "No Record Found")
{
tmp.Dispose(); // Clean-up AnnotationTypeInfo
tmp = null;
}
return tmp;
}
catch (Exception ex)
{
throw new DbCslaException("Error on AnnotationTypeInfo.GetByName", ex);
}
} }
public override string ToString() [Serializable()]
protected class GetByNameCriteria
{ {
return _Name; private readonly string _Name;
public string Name => _Name;
public GetByNameCriteria(string name) => _Name = name;
} }
public static AnnotationTypeInfo GetByName(string name) private void DataPortal_Fetch(GetByNameCriteria criteria)
{ {
try if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.DataPortal_Fetch", GetHashCode());
{ try
AnnotationTypeInfo tmp = DataPortal.Fetch<AnnotationTypeInfo>(new GetByNameCriteria(name)); {
if (tmp.ErrorMessage == "No Record Found") using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{ {
tmp.Dispose(); // Clean-up AnnotationTypeInfo ApplicationContext.LocalContext["cn"] = cn;
tmp = null; using (SqlCommand cm = cn.CreateCommand())
} {
return tmp; cm.CommandType = CommandType.StoredProcedure;
} cm.CommandText = "getAnnotationTypeByName";
catch (Exception ex) cm.CommandTimeout = Database.SQLTimeout;
{ cm.Parameters.AddWithValue("@Name", criteria.Name);
throw new DbCslaException("Error on AnnotationTypeInfo.GetByName", ex); using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
} {
} if (!dr.Read())
[Serializable()] {
protected class GetByNameCriteria _ErrorMessage = "No Record Found";
{ return;
private string _Name; }
public string Name { get { return _Name; } } ReadData(dr);
public GetByNameCriteria(string name) }
{ }
_Name = name; // removing of item only needed for local data portal
} if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
} ApplicationContext.LocalContext.Remove("cn");
private void DataPortal_Fetch(GetByNameCriteria criteria) }
{ }
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.DataPortal_Fetch", GetHashCode()); catch (Exception ex)
try {
{ if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfo.DataPortal_Fetch", ex);
using (SqlConnection cn = Database.VEPROMS_SqlConnection) _ErrorMessage = ex.Message;
{ throw new DbCslaException("AnnotationTypeInfo.DataPortal_Fetch", ex);
ApplicationContext.LocalContext["cn"] = cn; }
using (SqlCommand cm = cn.CreateCommand()) }
{ }
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getAnnotationTypeByName";
cm.CommandTimeout = Database.SQLTimeout;
cm.Parameters.AddWithValue("@Name", criteria.Name);
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("AnnotationTypeInfo.DataPortal_Fetch", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("AnnotationTypeInfo.DataPortal_Fetch", ex);
}
}
}
public partial class AnnotationTypeInfoList public partial class AnnotationTypeInfoList
{ {
public static void Refresh() public static void Refresh()
@@ -177,44 +159,20 @@ namespace VEPROMS.CSLA.Library
_TypeID = anotypeid; _TypeID = anotypeid;
MarkDirty(); // force the record update MarkDirty(); // force the record update
Save(); Save();
//Update(); // commit record to database
} }
} }
public void CommitChanges() public void CommitChanges()
{ {
MarkDirty(); // force the record update MarkDirty(); // force the record update
Save(true); Save(true);
//Update();
} }
public static void DeleteAnnotation(AnnotationInfo obj) public static void DeleteAnnotation(AnnotationInfo obj)
{ {
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
try try
{ {
// ItemInfo nextItem = item.NextItem;
// ItemInfo prevItem = item.MyPrevious;
// item.OnBeforeDelete();
DataPortal.Delete(new DeleteCriteria(obj.AnnotationID, Volian.Base.Library.VlnSettings.UserID)); DataPortal.Delete(new DeleteCriteria(obj.AnnotationID, Volian.Base.Library.VlnSettings.UserID));
AnnotationInfo.StaticOnInfoChanged(); AnnotationInfo.StaticOnInfoChanged();
// if (nextItem != null) // Adjust PreviousID for NextItem
// {
// ItemInfo.RefreshPrevious(nextItem.ItemID, item.PreviousID);
// // The order of the next two methods was required to fix a null reference
// // when getting myparent. This bug was found when deleting a node from the
// // tree when the RTBItem was not open (i.e. in the step editor window).
// nextItem.RefreshItemParts();
// //nextItem.ResetOrdinal(); - UpdateTransitionText calls ResetOrdinal
// nextItem.UpdateTransitionText();
// }
// else if (prevItem != null)
// {
// prevItem.RefreshNextItems();
// if (prevItem.IsCaution || prevItem.IsNote) prevItem.ResetOrdinal();
// prevItem.UpdateTransitionText();
// }
// ItemInfo.DeleteItemInfoAndChildren(item.ItemID); // Dispose ItemInfo and Children
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -228,8 +186,6 @@ namespace VEPROMS.CSLA.Library
public static void DeleteAnnotationProcByType(int typID, string procList) public static void DeleteAnnotationProcByType(int typID, string procList)
{ {
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
try try
{ {
DataPortal.Delete(new DeleteAnnotationProcByTypeCriteria(typID, procList)); DataPortal.Delete(new DeleteAnnotationProcByTypeCriteria(typID, procList));
@@ -247,8 +203,6 @@ namespace VEPROMS.CSLA.Library
public static void DeleteAnnotationDocvByType(int typID, string versionID) public static void DeleteAnnotationDocvByType(int typID, string versionID)
{ {
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
try try
{ {
DataPortal.Delete(new DeleteAnnotationDocvByTypeCriteria(typID, versionID)); DataPortal.Delete(new DeleteAnnotationDocvByTypeCriteria(typID, versionID));
@@ -266,8 +220,6 @@ namespace VEPROMS.CSLA.Library
public static int getAnnotationProcCnt(int typID, string procList) public static int getAnnotationProcCnt(int typID, string procList)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
try try
{ {
Annotation ProcCnt = DataPortal.Fetch<Annotation>(new getAnnotationCountProcCriteria(typID, procList)); Annotation ProcCnt = DataPortal.Fetch<Annotation>(new getAnnotationCountProcCriteria(typID, procList));
@@ -287,8 +239,6 @@ namespace VEPROMS.CSLA.Library
public static int getAnnotationCountDocv(int typID, string procList) public static int getAnnotationCountDocv(int typID, string procList)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to remove a Annotation");
try try
{ {
Annotation DocvCnt = DataPortal.Fetch<Annotation>(new getAnnotationCountDocvCriteria(typID, procList)); Annotation DocvCnt = DataPortal.Fetch<Annotation>(new getAnnotationCountDocvCriteria(typID, procList));
@@ -319,10 +269,9 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class DeleteCriteria protected class DeleteCriteria
{ {
private int _AnnotationID; private readonly int _AnnotationID;
public int AnnotationID public int AnnotationID => _AnnotationID;
{ get { return _AnnotationID; } } private string _UserID;
private string _UserID;
public string UserID public string UserID
{ {
get { return _UserID; } get { return _UserID; }
@@ -364,14 +313,12 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class DeleteAnnotationProcByTypeCriteria protected class DeleteAnnotationProcByTypeCriteria
{ {
private int _typeID; private readonly int _typeID;
public int TypeID public int TypeID => _typeID;
{ get { return _typeID; } }
private string _procList; private readonly string _procList;
public string ProcList public string ProcList => _procList;
{ get { return _procList; } } public DeleteAnnotationProcByTypeCriteria(int typeID, string procList)
public DeleteAnnotationProcByTypeCriteria(int typeID, string procList)
{ {
_typeID = typeID; _typeID = typeID;
_procList = procList; _procList = procList;
@@ -407,14 +354,12 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class DeleteAnnotationDocvByTypeCriteria protected class DeleteAnnotationDocvByTypeCriteria
{ {
private int _typeID; private readonly int _typeID;
public int TypeID public int TypeID => _typeID;
{ get { return _typeID; } }
private string _versionID; private readonly string _versionID;
public string VersionID public string VersionID => _versionID;
{ get { return _versionID; } } public DeleteAnnotationDocvByTypeCriteria(int typeID, string versionID)
public DeleteAnnotationDocvByTypeCriteria(int typeID, string versionID)
{ {
_typeID = typeID; _typeID = typeID;
_versionID = versionID; _versionID = versionID;
@@ -459,16 +404,15 @@ namespace VEPROMS.CSLA.Library
{ {
private int _procCnt; private int _procCnt;
public int ProcCnt public int ProcCnt
{ get { return _procCnt; } {
set { _procCnt = value; } get { return _procCnt; }
set { _procCnt = value; }
} }
private int _typeID; private readonly int _typeID;
public int TypeID public int TypeID => _typeID;
{ get { return _typeID; } } private readonly string _procList;
private string _procList; public string ProcList => _procList;
public string ProcList public getAnnotationCountProcCriteria(int typeID, string procList, int procCnt = 0)
{ get { return _procList; } }
public getAnnotationCountProcCriteria(int typeID, string procList, int procCnt = 0)
{ {
_typeID = typeID; _typeID = typeID;
_procList = procList; _procList = procList;
@@ -517,16 +461,15 @@ namespace VEPROMS.CSLA.Library
{ {
private int _docvCnt; private int _docvCnt;
public int DocvCnt public int DocvCnt
{ get { return _docvCnt; } {
set { _docvCnt = value; } get { return _docvCnt; }
set { _docvCnt = value; }
} }
private int _TypeID; private readonly int _TypeID;
public int TypeID public int TypeID => _TypeID;
{ get { return _TypeID; } } private readonly string _docvList;
private string _docvList; public string DocvList => _docvList;
public string DocvList public getAnnotationCountDocvCriteria(int typeID, string docvList, int docvCnt = 0)
{ get { return _docvList; } }
public getAnnotationCountDocvCriteria(int typeID, string docvList, int docvCnt = 0)
{ {
_TypeID = typeID; _TypeID = typeID;
_docvList = docvList; _docvList = docvList;
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Volian.Base.Library; using Volian.Base.Library;
@@ -438,29 +437,29 @@ namespace VEPROMS.CSLA.Library
count += lst.Count; count += lst.Count;
if (count == 0) return ""; if (count == 0) return "";
string output = typeof(T).Name; string output = typeof(T).Name;
output += "\t" + cache.Count; output += $"\t{cache.Count}";
output += "\t" + count + "\r\n"; output += $"\t{count}\r\n";
return output; return output;
} }
private static string Counts<T>(int count) private static string Counts<T>(int count)
{ {
if (count == 0) return ""; if (count == 0) return "";
string output = typeof(T).Name; string output = typeof(T).Name;
output += "\t" + count + "\r\n"; output += $"\t{count}\r\n";
return output; return output;
} }
private static string Counts<T>(int countNotDisposed, int countNotFinalized) private static string Counts<T>(int countNotDisposed, int countNotFinalized)
{ {
if (countNotDisposed == 0 && countNotFinalized == 0) return ""; if (countNotDisposed == 0 && countNotFinalized == 0) return "";
string output = typeof(T).Name; string output = typeof(T).Name;
output += "\t" + countNotDisposed + "\t" + countNotFinalized + "\r\n"; output += $"\t{countNotDisposed}\t{countNotFinalized}\r\n";
return output; return output;
} }
private static string Counts<T>(int countCreated, int countNotDisposed, int countNotFinalized) private static string Counts<T>(int countCreated, int countNotDisposed, int countNotFinalized)
{ {
if (countCreated == 0) return ""; if (countCreated == 0) return "";
string output = typeof(T).Name; string output = typeof(T).Name;
output += "\t" + countCreated + "\t" + countNotDisposed + "\t" + countNotFinalized + "\r\n"; output += $"\t{countCreated}\t{countNotDisposed}\t{countNotFinalized}\r\n";
return output; return output;
} }
} }
@@ -475,7 +474,8 @@ namespace VEPROMS.CSLA.Library
#region Stack #region Stack
public partial class Content public partial class Content
{ {
private static List<string> _MyStack = new List<string>(); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<string> _MyStack = new List<string>();
public static string MyStack public static string MyStack
{ {
get get
@@ -519,15 +519,13 @@ namespace VEPROMS.CSLA.Library
return _MyStack.IndexOf(stk); return _MyStack.IndexOf(stk);
} }
} }
private int _StackIndex = StaticStackIndex; private readonly int _StackIndex = StaticStackIndex;
public int StackIndex public int StackIndex => _StackIndex;
{ }
get { return _StackIndex; }
}
}
public partial class ContentInfo public partial class ContentInfo
{ {
private static List<string> _MyStack = new List<string>(); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<string> _MyStack = new List<string>();
public static string MyStack public static string MyStack
{ {
get get
@@ -571,15 +569,13 @@ namespace VEPROMS.CSLA.Library
return _MyStack.IndexOf(stk); return _MyStack.IndexOf(stk);
} }
} }
private int _StackIndex = StaticStackIndex; private readonly int _StackIndex = StaticStackIndex;
public int StackIndex public int StackIndex => _StackIndex;
{ }
get { return _StackIndex; }
}
}
public partial class DocVersionInfo public partial class DocVersionInfo
{ {
private static List<string> _MyStack = new List<string>(); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<string> _MyStack = new List<string>();
public static string MyStack public static string MyStack
{ {
get get
@@ -623,12 +619,9 @@ namespace VEPROMS.CSLA.Library
return _MyStack.IndexOf(stk); return _MyStack.IndexOf(stk);
} }
} }
private int _StackIndex = StaticStackIndex; private readonly int _StackIndex = StaticStackIndex;
public int StackIndex public int StackIndex => _StackIndex;
{ }
get { return _StackIndex; }
}
}
public partial class PartInfo public partial class PartInfo
{ {
public static HashSet<int> CacheList public static HashSet<int> CacheList
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -21,26 +19,28 @@ namespace VEPROMS.CSLA.Library
// if the dictionary hasn't been set yet, // if the dictionary hasn't been set yet,
if (ColorIndx==null) if (ColorIndx==null)
{ {
ColorIndx = new Dictionary<string, int>(); ColorIndx = new Dictionary<string, int>
ColorIndx["black"] = 1; {
ColorIndx["blue"] = 2; ["black"] = 1,
ColorIndx["green"] = 3; ["blue"] = 2,
ColorIndx["cyan"] = 4; ["green"] = 3,
ColorIndx["red"] = 5; ["cyan"] = 4,
ColorIndx["magenta"] = 6; ["red"] = 5,
ColorIndx["brown"] = 7; ["magenta"] = 6,
ColorIndx["lightgray"] = 8; ["brown"] = 7,
ColorIndx["darkgray"] = 9; ["lightgray"] = 8,
ColorIndx["lightblue"] = 10; ["darkgray"] = 9,
ColorIndx["lightgreen"] = 11; ["lightblue"] = 10,
ColorIndx["lightcyan"] = 12; ["lightgreen"] = 11,
ColorIndx["lightred"] = 13; ["lightcyan"] = 12,
ColorIndx["lightmagenta"] = 14; ["lightred"] = 13,
ColorIndx["yellow"] = 15; ["lightmagenta"] = 14,
ColorIndx["white"] = 16; ["yellow"] = 15,
ColorIndx["ro"] = 17; ["white"] = 16,
ColorIndx["trans"] = 18; ["ro"] = 17,
ColorIndx["editbackground"] = 19; ["trans"] = 18,
["editbackground"] = 19
};
} }
return ColorIndx[color]; return ColorIndx[color];
} }
@@ -49,49 +49,49 @@ namespace VEPROMS.CSLA.Library
// This gets the rtf color table string for the input color. // This gets the rtf color table string for the input color.
public static string GetTableString(string color) public static string GetTableString(string color)
{ {
Dictionary<string, int> ColorIndx = new Dictionary<string, int>();
if (ColorRtf == null) if (ColorRtf == null)
{ {
ColorRtf = new Dictionary<string, string>(); ColorRtf = new Dictionary<string, string>
{
// color table, from 16-bit code, is defined as (in order): // color table, from 16-bit code, is defined as (in order):
// black=0,0,0 // black=0,0,0
// blue=0,0,255 // blue=0,0,255
// green=0,155,12 // green=0,155,12
// cyan=0,136,159 // cyan=0,136,159
// red=255,0,0 // red=255,0,0
// magenta=202,28,175 // magenta=202,28,175
// brown=128,64,0 // brown=128,64,0
// lightgray=0,0,0 // lightgray=0,0,0
// darkgray=0,0,0 // darkgray=0,0,0
// lightblue=0,0,255 // lightblue=0,0,255
// lightgreen=0,255,0 // lightgreen=0,255,0
// lightcyan=0,0,255 // lightcyan=0,0,255
// lightred=209,29,183 // lightred=209,29,183
// lightmagenta=255,0,255 // lightmagenta=255,0,255
// yellow=255,0,0 // yellow=255,0,0
// white=128,128,128 // white=128,128,128
// ro=255,128,0 // ro=255,128,0
// editbackground=192,192,192 // editbackground=192,192,192
ColorRtf["black"] = "\\red0\\green0\\blue0;"; ["black"] = "\\red0\\green0\\blue0;",
ColorRtf["blue"] = "\\red0\\green0\\blue255;"; ["blue"] = "\\red0\\green0\\blue255;",
ColorRtf["green"] = "\\red0\\green155\\blue12;"; ["green"] = "\\red0\\green155\\blue12;",
ColorRtf["cyan"] = "\\red0\\green136\\blue159;"; ["cyan"] = "\\red0\\green136\\blue159;",
ColorRtf["red"] = "\\red255\\green0\\blue0;"; ["red"] = "\\red255\\green0\\blue0;",
ColorRtf["magenta"] = "\\red202\\green28\\blue175;"; ["magenta"] = "\\red202\\green28\\blue175;",
ColorRtf["brown"] = "\\red128\\green64\\blue0;"; ["brown"] = "\\red128\\green64\\blue0;",
ColorRtf["lightgray"] = "\\red100\\green100\\blue100;"; ["lightgray"] = "\\red100\\green100\\blue100;",
ColorRtf["darkgray"] = "\\red10\\green10\\blue10;"; ["darkgray"] = "\\red10\\green10\\blue10;",
ColorRtf["lightblue"] = "\\red0\\green0\\blue255;"; ["lightblue"] = "\\red0\\green0\\blue255;",
ColorRtf["lightgreen"] = "\\red0\\green255\\blue0;"; ["lightgreen"] = "\\red0\\green255\\blue0;",
ColorRtf["lightcyan"] = "\\red0\\green0\\blue255;"; ["lightcyan"] = "\\red0\\green0\\blue255;",
ColorRtf["lightred"] = "\\red209\\green29\\blue183;"; ["lightred"] = "\\red209\\green29\\blue183;",
ColorRtf["lightmagenta"] = "\\red255\\green0\\blue255;"; ["lightmagenta"] = "\\red255\\green0\\blue255;",
ColorRtf["yellow"] = "\\red255\\green0\\blue0;"; ["yellow"] = "\\red255\\green0\\blue0;",
ColorRtf["white"] = "\\red128\\green128\\blue128;"; ["white"] = "\\red128\\green128\\blue128;",
ColorRtf["ro"] = "\\red255\\green128\\blue0;"; ["ro"] = "\\red255\\green128\\blue0;",
ColorRtf["trans"] = "\\red255\\green128\\blue0;"; ["trans"] = "\\red255\\green128\\blue0;",
ColorRtf["editbackground"] = "\\red192\\green192\\blue192;"; ["editbackground"] = "\\red192\\green192\\blue192;"
};
} }
return ColorRtf[color]; return ColorRtf[color];
} }
+140 -364
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using System.Xml;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Data; using System.Data;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -80,7 +79,7 @@ namespace VEPROMS.CSLA.Library
{ {
string rv = ConvertTransitionToText(tran, newvalue); string rv = ConvertTransitionToText(tran, newvalue);
//Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength); //Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength);
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myitem = ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060 myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
// B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text] // B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text]
@@ -161,13 +160,11 @@ namespace VEPROMS.CSLA.Library
else else
{ // look for rtf font command and insert it around the special char (i.e. symbol char) { // look for rtf font command and insert it around the special char (i.e. symbol char)
int ii = orgText.IndexOf(specChar); int ii = orgText.IndexOf(specChar);
int fnt1 = -1; if (ii > -1)
int fnt2 = -1;
if (ii > -1)
{ {
fnt1 = orgText.LastIndexOf(@"\f", ii); int fnt1 = orgText.LastIndexOf(@"\f", ii);
fnt2 = orgText.IndexOf(@"\f", ii); int fnt2 = orgText.IndexOf(@"\f", ii);
if (fnt1 != -1 && fnt2 != -1) if (fnt1 != -1 && fnt2 != -1)
newValue = newValue.Replace(specChar, orgText.Substring(fnt1, 3) + specChar + orgText.Substring(fnt2, 3) + " "); newValue = newValue.Replace(specChar, orgText.Substring(fnt1, 3) + specChar + orgText.Substring(fnt2, 3) + " ");
} }
} }
@@ -199,11 +196,8 @@ namespace VEPROMS.CSLA.Library
} }
else else
lookFor = string.Format(@"^&lt;START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END&gt;", tran.TranType, tran.TransitionID); lookFor = string.Format(@"^&lt;START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END&gt;", tran.TranType, tran.TransitionID);
int lastIndex = 0;
string newText = MyGrid.Data;
foreach (Match mm in ms) foreach (Match mm in ms)
{ {
int offset = mm.Index;
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline); Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
if (m != null && m.Groups.Count > 1) if (m != null && m.Groups.Count > 1)
{ {
@@ -228,8 +222,7 @@ namespace VEPROMS.CSLA.Library
} }
break; // Text has been processed break; // Text has been processed
} }
lastIndex = mm.Index + mm.Length; }
}
return; return;
} }
public string ConvertTransitionToText(TransitionInfo tran, string value) public string ConvertTransitionToText(TransitionInfo tran, string value)
@@ -554,13 +547,13 @@ namespace VEPROMS.CSLA.Library
} }
if (value == "?" || gg != newvalue) if (value == "?" || gg != newvalue)
{ {
MyGrid.Data = Content.ConvertGridROsToText(MyGrid.Data, mmg, mg, newvalue); // B2017-060 convert the RO in the grid (table) to text MyGrid.Data = ConvertGridROsToText(MyGrid.Data, mmg, mg, newvalue); // B2017-060 convert the RO in the grid (table) to text
} }
} }
} }
} }
} }
return retval == null ? "" : retval; return retval ?? "";
} }
// B2017-060 logic pulled from dlgExportImport to covert a RO in a table (grid) to text // B2017-060 logic pulled from dlgExportImport to covert a RO in a table (grid) to text
public static string ConvertGridROsToText(string data, Match mmg, Match mg, string ss) public static string ConvertGridROsToText(string data, Match mmg, Match mg, string ss)
@@ -601,8 +594,8 @@ namespace VEPROMS.CSLA.Library
string retval = null; string retval = null;
if (value == "?") if (value == "?")
{ {
retval = this.ConvertROToText(rousg, value, rotype, origROFstInfo, roidFrmImportStep); retval = ConvertROToText(rousg, value, rotype, origROFstInfo, roidFrmImportStep);
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myitem = ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060 myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
// B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text // B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
@@ -638,7 +631,7 @@ namespace VEPROMS.CSLA.Library
Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength); Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
if (!saveAnnotation) if (!saveAnnotation)
{ {
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myitem = ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060 myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
// B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text // B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
@@ -836,21 +829,17 @@ namespace VEPROMS.CSLA.Library
{ {
return str.Replace(@"\u8209?", "-").Replace(@"\u160?", " "); //dash and hard space return str.Replace(@"\u8209?", "-").Replace(@"\u160?", " "); //dash and hard space
} }
//C2022-028 (only used from Amin Tools) check the RO link text - compare with RO Usage information, annotate RO links that are bad //C2022-028 (only used from Admin Tools) check the RO link text - compare with RO Usage information, annotate RO links that are bad
public bool CheckROLinkTextandUsage(ref int BadROLinksCount, ref int CheckROLinksCount, ref int FixedROLinksCount) public bool CheckROLinkTextandUsage(ref int BadROLinksCount, ref int CheckROLinksCount)
{ {
/*** needed if we fix RO link text if (Text.Contains("#Link:ReferencedObject:"))
bool bFixedROLinks = false;
bool bFixedTableDataText = false;
***/
if (this.Text.Contains("#Link:ReferencedObject:"))
{ {
if (this.ContentRoUsageCount == 0) // Procedure text has one or more links but no RO Usage records if (ContentRoUsageCount == 0) // Procedure text has one or more links but no RO Usage records
{ {
CheckROLinksCount++; CheckROLinksCount++;
_MyLog.ErrorFormat(string.Format("No RO usage records for RO link(s) - ContentID = {0}", this.ContentID)); _MyLog.ErrorFormat(string.Format("No RO usage records for RO link(s) - ContentID = {0}", ContentID));
using (Item myItem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache using (Item myItem = ContentItems[0].MyItem) // so that myitem does not stay in cache
{ {
myItem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed myItem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed
Annotation.MakeAnnotation(myItem, AnnotationType.GetByNameOrCreate("Bad RO link"), "", "Incomplete RO Link Information for all RO References in this text - Relink RO References", null); Annotation.MakeAnnotation(myItem, AnnotationType.GetByNameOrCreate("Bad RO link"), "", "Incomplete RO Link Information for all RO References in this text - Relink RO References", null);
@@ -862,7 +851,6 @@ namespace VEPROMS.CSLA.Library
string findLink = @"<START\].*?\[END>"; string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink); // finds all the links (both RO and Transitions) MatchCollection ms = Regex.Matches(Text, findLink); // finds all the links (both RO and Transitions)
string lookFor = "#Link:ReferencedObject:"; string lookFor = "#Link:ReferencedObject:";
string fixedContentText = Text;
if (ms.Count > 0) if (ms.Count > 0)
{ {
int roCnt = 0; int roCnt = 0;
@@ -892,18 +880,17 @@ namespace VEPROMS.CSLA.Library
bool GoodROUsageID = false; bool GoodROUsageID = false;
bool GoodROID = false; bool GoodROID = false;
// Check each ContentRoUsages and look for a matching ROUsageID and ROID // Check each ContentRoUsages and look for a matching ROUsageID and ROID
if (iRousage > 0 && this.ContentRoUsageCount > 0) if (iRousage > 0 && ContentRoUsageCount > 0)
{ {
int lastROUsageID = -1; int lastROUsageID = -1;
string lastROID = ""; string lastROID = "";
RoUsageInfo badRoUsageInfo = null; RoUsageInfo badRoUsageInfo = null;
foreach (RoUsageInfo rui in this.ContentItems[0].MyItem.MyItemInfo.MyContent.ContentRoUsages) foreach (RoUsageInfo rui in ContentItems[0].MyItem.MyItemInfo.MyContent.ContentRoUsages)
{ {
GoodROID = rui.ROID.Equals(sROid); //does this usage record have a matching ROID with the link text? GoodROID = rui.ROID.Equals(sROid); //does this usage record have a matching ROID with the link text?
GoodROUsageID = rui.ROUsageID.Equals(iRousage); //does the usage record have a matching ROUsageID with the link text? GoodROUsageID = rui.ROUsageID.Equals(iRousage); //does the usage record have a matching ROUsageID with the link text?
if (GoodROID && GoodROUsageID) if (GoodROID && GoodROUsageID)
{ {
//myROUsages.RemoveAt(myROUsageCnt - 1);
break; // jump out loop - valid RO Usage record found break; // jump out loop - valid RO Usage record found
} }
if (GoodROID && !GoodROUsageID) if (GoodROID && !GoodROUsageID)
@@ -918,46 +905,24 @@ namespace VEPROMS.CSLA.Library
{ {
BadROLinksCount++; BadROLinksCount++;
// Add detail information to the error log // Add detail information to the error log
_MyLog.ErrorFormat(string.Format("Invalid ROID - ContentID = {0} Link - {1}", this.ContentID, mm.Value)); _MyLog.ErrorFormat(string.Format("Invalid ROID - ContentID = {0} Link - {1}", ContentID, mm.Value));
sAnnotationText += string.Format("Bad RO Instance {0} - RO Needs Relinked - RO Text different than RO Data\n", roCnt); sAnnotationText += string.Format("Bad RO Instance {0} - RO Needs Relinked - RO Text different than RO Data\n", roCnt);
} }
else if (!GoodROUsageID) // Link does not have a valid ROUsage record for that RO link - add annotation else if (!GoodROUsageID) // Link does not have a valid ROUsage record for that RO link - add annotation
{ {
BadROLinksCount++; BadROLinksCount++;
/********* // Add detail information to the error log
//** below is logic to replace the ROUsageID in the linked text with one (for this contentID) that has the same ROID _MyLog.ErrorFormat(string.Format("Invalid ROUsageID - ContentID = {0} Link - {1}", ContentID, mm.Value));
//** Commented out for now as this was test code for now - don't want to give to customers until we are comfortable sAnnotationText += string.Format("RO Instance {0} Needs Relinked - Value Not Able To Update\n", roCnt);
//if (lastROUsageID != -1)
//{
// // set the ROUsageID in the link text to last good ROUsageID found in ROUsage table
// linkText = linkText.Replace(string.Format("#Link:ReferencedObject:{0} ", sROusageID), string.Format("#Link:ReferencedObject:{0} ", lastROUsageID));
// fixedContentText = fixedContentText.Replace(string.Format("#Link:ReferencedObject:{0} ", sROusageID), string.Format("#Link:ReferencedObject:{0} ", lastROUsageID));
// bFixedROLinks = true; // set to true so we know to update content text
// _MyLog.InfoFormat(string.Format("Fixed Invalid RO Link - ContentID = {0} badLink - {1} goodLink - {2}",this.ContentID, mm.Value, linkText));
// FixedROLinksCount++;
// using (Item myItem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
// {
// myItem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
// //Annotation.MakeAnnotation(myItem, AnnotationType.GetByNameOrCreate("Bad RO link"), "", string.Format("Invalid RO Usage ID for RO Instance {0}",roCnt), null);
// Annotation.MakeAnnotation(myItem, AnnotationType.GetByNameOrCreate("Fixed Bad RO link"), "", string.Format("Fixed RO Instance {0} - Verify RO Value", roCnt), null);
// }
//}
*********/
//else
//{
// Add detail information to the error log
_MyLog.ErrorFormat(string.Format("Invalid ROUsageID - ContentID = {0} Link - {1}", this.ContentID, mm.Value));
sAnnotationText += string.Format("RO Instance {0} Needs Relinked - Value Not Able To Update\n", roCnt);
//}
} }
} }
} }
} }
if (roCnt < this.ContentRoUsageCount) if (roCnt < ContentRoUsageCount)
{ {
BadROLinksCount++; BadROLinksCount++;
// there are more RO Usage records then there links in the step // there are more RO Usage records then there links in the step
_MyLog.WarnFormat(string.Format("Possible missing RO links, more RO Usage records than Links - ContentID = {0}", this.ContentID)); _MyLog.WarnFormat(string.Format("Possible missing RO links, more RO Usage records than Links - ContentID = {0}", ContentID));
sAnnotationText += "Possible missing RO links.\n"; sAnnotationText += "Possible missing RO links.\n";
} }
// if any bad RO links were found, put the information in an Annotation // if any bad RO links were found, put the information in an Annotation
@@ -965,113 +930,15 @@ namespace VEPROMS.CSLA.Library
{ {
char[] newLine = { '\n' }; char[] newLine = { '\n' };
sAnnotationText = sAnnotationText.TrimEnd(newLine); sAnnotationText = sAnnotationText.TrimEnd(newLine);
using (Item myItem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 using (Item myItem = ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{ {
myItem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060 myItem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
//Annotation.MakeAnnotation(myItem, AnnotationType.GetByNameOrCreate("Bad RO link"), "", string.Format("Invalid RO Usage ID for RO Instance {0}",roCnt), null);
Annotation.MakeAnnotation(myItem, AnnotationType.GetByNameOrCreate("Bad RO link"), "", sAnnotationText, null); Annotation.MakeAnnotation(myItem, AnnotationType.GetByNameOrCreate("Bad RO link"), "", sAnnotationText, null);
} }
} }
/*** COMMENTED OUT BECAUSE WE NOT MAKING CHANGES TO THE DATA - FOR NOW
//if (bFixedROLinks)
//{
// // save content text
// Text = fixedContentText;
//}
*****/
/*******
// if we fix RO links in the RTF then see if there is a grid to update too.
// WE DON'T NEED TO ADD ANNOTATIONS AS THAT IS DONE ABOVE (FOR THE RTF OF THE TABLE - BELOW IS THE XML OF THE TABLE
// *** bFixedROLinks WILL REMAIN FALSE FOR NOW AS WE ARE NOT CHANGING LINK TEXT - THIS WILL PREVENT THE CHECKING OF THE XML TABLE
if (bFixedROLinks && MyGrid != null && MyGrid.Data.Length > 0)
{
string fixedTableDataText = MyGrid.Data;
// **** NEED LOGIC TO CHECK RO TABLES ****
//if (rotype == (int)E_ROValueType.Table) // if change in rotable data...
//{
// if (origROFstInfo != null)
// {
// List<string> retlist = origROFstInfo.OnROTableUpdate(this, new ROFstInfoROTableUpdateEventArgs(newvalue, MyGrid.Data));
// if (MyGrid.Data != retlist[1])
// {
// MyGrid.Data = retlist[1];
// retval = Text;
// if (Text != retlist[0])
// Text = retlist[0];
// }
// }
//}
//else
{
// if it's an ro within a table, need to process into an flex grid to save the grid data:
string findLinkXml = @"&lt;START\].*?\[END&gt;";
//string lookForXml = string.Format(@"^&lt;START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END&gt;$", rousg.ROUsageID);
string lookForXml = "#Link:ReferencedObject:";
MatchCollection msg = Regex.Matches(MyGrid.Data, findLinkXml);
foreach (Match mmg in msg)
{
Match mg = Regex.Match(mmg.Value, lookForXml);// look for Referenced Object link in linked text
if (mg != null && mg.Groups.Count > 1)
{
string tblLinkText = mmg.Value; // the link text in the table XML
int rousgidx = mg.Index + mg.Length;
int rousagid_len = mmg.Value.IndexOf(" ", rousgidx) - rousgidx;
string sROusageID = mmg.Value.Substring(rousgidx, rousagid_len); // ROUsageID from link text
int roidIdx = rousgidx + rousagid_len + 1;
int roid_Len = mmg.Value.IndexOf(" ", roidIdx) - roidIdx;
string sROid = mmg.Value.Substring(roidIdx, roid_Len);
// initialize to zero for cases where the ROUsage is <CROUSGID or <NEWID> to force a no match below
// -when a link has either of these, then the process of inserting that RO link did not complete for some reason
int iRousage = 0;
if (!sROusageID.StartsWith("<")) // don't try to convert if link has <CROUSGID or <NEWID> for the ROUsageID value
iRousage = Convert.ToInt32(sROusageID); //ROUsageID as interger
// see if there is a ContentID and ROUsage record match
// Both GoodROUsageID and GoodROUID must match in ROUsage record for link to be good
bool GoodROUsageID = false;
bool GoodROID = false;
// Check each ContentRoUsages and look for a matching ROUsageID and ROID
if (iRousage > 0 && this.ContentRoUsageCount > 0)
{
int lastROUsageID = -1;
string lastROID = "";
RoUsageInfo badRoUsageInfo = null;
foreach (RoUsageInfo rui in this.ContentItems[0].MyItem.MyItemInfo.MyContent.ContentRoUsages)
{
GoodROID = rui.ROID.Equals(sROid); //does this usage record have a matching ROID with the link text?
GoodROUsageID = rui.ROUsageID.Equals(iRousage); //does the usage record have a matching ROUsageID with the link text?
if (GoodROID && GoodROUsageID) break; // jump out loop - valid RO Usage record found
if (GoodROID && !GoodROUsageID)
{
lastROUsageID = rui.ROUsageID;
lastROID = rui.ROID;
}
else if (!GoodROID && GoodROUsageID)
badRoUsageInfo = rui;
}
if (!GoodROUsageID && GoodROID && lastROUsageID != -1) // Link does not have a valid ROUsage record for that RO link - add annotation
{
// set the ROUsageID in the link text to last good ROUsageID found in ROUsage table
tblLinkText = tblLinkText.Replace(string.Format("#Link:ReferencedObject:{0} ", sROusageID), string.Format("#Link:ReferencedObject:{0} ", lastROUsageID));
fixedTableDataText = fixedTableDataText.Replace(string.Format("#Link:ReferencedObject:{0} ", sROusageID), string.Format("#Link:ReferencedObject:{0} ", lastROUsageID));
bFixedTableDataText = true; // set to true so we know to update content text
}
if (bFixedTableDataText) // if we changed the table XML, then save it
{
this.MyGrid.Data = fixedTableDataText;
}
}
}
}
}
******* End modify table ****/
} }
} }
} }
/*** needed if we fix RO links
return (bFixedROLinks || bFixedTableDataText);
***/
return false; return false;
} }
} }
@@ -1079,29 +946,14 @@ namespace VEPROMS.CSLA.Library
public delegate void StaticContentInfoEvent(object sender, StaticContentInfoEventArgs args); public delegate void StaticContentInfoEvent(object sender, StaticContentInfoEventArgs args);
public class StaticContentInfoEventArgs public class StaticContentInfoEventArgs
{ {
string _OldValue; public string OldValue { get; set; }
public string OldValue public string NewValue { get; set; }
public string Type { get; set; }
public StaticContentInfoEventArgs(string oldValue, string newValue, string type)
{ {
get { return _OldValue; } OldValue = oldValue;
set { _OldValue = value; } NewValue = newValue;
} Type = type;
string _NewValue;
public string NewValue
{
get { return _NewValue; }
set { _NewValue = value; }
}
string _Type;
public string Type
{
get { return _Type; }
set { _Type = value; }
}
public StaticContentInfoEventArgs(string oldValue, string newValue, string type)
{
_OldValue = oldValue;
_NewValue = newValue;
_Type = type;
} }
} }
@@ -1119,27 +971,14 @@ namespace VEPROMS.CSLA.Library
return sb.ToString(); return sb.ToString();
} }
public string LastChangedString public string LastChangedString => FormatByteArray(_LastChanged);
{
get { return ContentInfo.FormatByteArray(_LastChanged); }
}
public Int64 LastChangedInt64 public long LastChangedInt64 => Convert.ToInt64(LastChangedString, 16);
{ public static bool IsInCache(int contentID) => _CacheByPrimaryKey.ContainsKey(contentID.ToString());
get { return Convert.ToInt64(LastChangedString, 16); } public static event StaticContentInfoEvent StaticContentInfoChange;
} // B2018-002 - Invalid Transitions - Changed to Public
public static bool IsInCache(int contentID) public static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args) => StaticContentInfoChange?.Invoke(sender, args);
{ public string MyContentMessage = string.Empty;
return _CacheByPrimaryKey.ContainsKey(contentID.ToString());
}
public static event StaticContentInfoEvent StaticContentInfoChange;
// B2018-002 - Invalid Transitions - Changed to Public
public static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
{
if (StaticContentInfoChange != null)
StaticContentInfoChange(sender, args);
}
public string MyContentMessage = string.Empty;
public string MyGridMessage = string.Empty; public string MyGridMessage = string.Empty;
public bool InList(params int[] IDs) public bool InList(params int[] IDs)
{ {
@@ -1150,22 +989,13 @@ namespace VEPROMS.CSLA.Library
return false; return false;
} }
public void FixTransitionText(TransitionInfo tran, TransitionLookup tranLookup, ItemInfo ii) public void FixTransitionText(TransitionInfo tran, TransitionLookup tranLookup, ItemInfo ii) => FixTransitionText(tran, tranLookup, ii, "");
{
FixTransitionText(tran, tranLookup, ii, "");
}
public void FixTransitionText(TransitionInfo tran, ItemInfo ii) public void FixTransitionText(TransitionInfo tran, ItemInfo ii) => FixTransitionText(tran, ii, "");
{
FixTransitionText(tran, ii, "");
}
public void FixTransitionText(TransitionInfo tran, ItemInfo ii, string forceConvertToText) public void FixTransitionText(TransitionInfo tran, ItemInfo ii, string forceConvertToText) => FixTransitionText(tran, null, ii, forceConvertToText);
{
FixTransitionText(tran, null, ii, forceConvertToText);
}
public void FixTransitionText(TransitionInfo tran, TransitionLookup tranLookup, ItemInfo ii, string forceConvertToText) public void FixTransitionText(TransitionInfo tran, TransitionLookup tranLookup, ItemInfo ii, string forceConvertToText)
{ {
string newvalue; string newvalue;
MyContentMessage = string.Empty; MyContentMessage = string.Empty;
@@ -1199,7 +1029,7 @@ namespace VEPROMS.CSLA.Library
myLength += m.Groups[3].Length; myLength += m.Groups[3].Length;
} }
string gg = Text.Substring(myIndex, myLength); string gg = Text.Substring(myIndex, myLength);
MyContentMessage = string.Format("ContentExt.ContentInfo:Content:{0}, {1}, {2}", this.ContentID, tran.TransitionID, gg); MyContentMessage = string.Format("ContentExt.ContentInfo:Content:{0}, {1}, {2}", ContentID, tran.TransitionID, gg);
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}"); newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\\")) != (newvalue.Replace("\\u8209?", "-").Replace(@"\u9586?", @"\\")) || newvalue == "?") // B2017-165 added check of newvalue if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9586?", @"\\")) != (newvalue.Replace("\\u8209?", "-").Replace(@"\u9586?", @"\\")) || newvalue == "?") // B2017-165 added check of newvalue
{ {
@@ -1230,66 +1060,57 @@ namespace VEPROMS.CSLA.Library
// see if there is a grid to update too. // see if there is a grid to update too.
if (tran.MyContent.MyGrid != null) if (tran.MyContent.MyGrid != null)
{ {
//string lookForXml = string.Format(@"&lt;START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END&gt;", tran.TranType, tran.TransitionID); MyGridMessage = string.Empty;
//Match mg = Regex.Match(MyGrid.Data, lookForXml); string findLinkXml = @"&lt;START\].*?\[END&gt;";
//if (mg != null && mg.Groups.Count > 1) string lookForXml = string.Format(@"^&lt;START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END&gt;", tran.TranType, tran.TransitionID);
//{ MatchCollection msg = Regex.Matches(MyGrid.Data, findLinkXml);
// System.Text.RegularExpressions.Group g = mg.Groups[3]; foreach (Match mmg in msg)
// //if (g.ToString() != transText) {
// // MyGrid.Data = MyGrid.Data.Substring(0, g.Index) + transText + MyGrid.Data.Substring(g.Index + g.Length); Match mg = Regex.Match(mmg.Value, lookForXml);
//} if (mg != null && mg.Groups.Count > 1)
MyGridMessage = string.Empty; {
string findLinkXml = @"&lt;START\].*?\[END&gt;"; int myIndex = mg.Groups[4].Index + mmg.Index;
//string lookForXml = string.Format(@"&lt;START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END&gt;", rousg.ROUsageID); int myLength = mg.Groups[4].Length;
string lookForXml = string.Format(@"^&lt;START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END&gt;", tran.TranType, tran.TransitionID); if (mg.Groups[3].Value != " ")
MatchCollection msg = Regex.Matches(MyGrid.Data, findLinkXml); {
foreach (Match mmg in msg) myIndex = mg.Groups[3].Index + mmg.Index;
{ myLength += mg.Groups[3].Length;
Match mg = Regex.Match(mmg.Value, lookForXml);// Regex.Match(MyGrid.Data, lookForXml); }
if (mg != null && mg.Groups.Count > 1) string gg = MyGrid.Data.Substring(myIndex, myLength);
{ if (newvalue.Contains(@"\u8209?"))
int myIndex = mg.Groups[4].Index + mmg.Index; {
int myLength = mg.Groups[4].Length; // B2022-058: Printing of '-' in transition in table prints as '?' instead of '-'. Wasn't using correct string to
if (mg.Groups[3].Value != " ") // look for font character (was using newvalue, not gg)
{ Match m = Regex.Match(gg, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
myIndex = mg.Groups[3].Index + mmg.Index; if (m == null)
myLength += mg.Groups[3].Length; newvalue = newvalue.Replace(@"\u8209?", "-");
} else
string gg = MyGrid.Data.Substring(myIndex, myLength); newvalue = newvalue.Replace(@"\u8209?", $@"{m.Groups[1].Value}\u8209?{m.Groups[3].Value}");
if (newvalue.Contains(@"\u8209?")) }
{ if (newvalue.Contains(@"\u9586?"))
// B2022-058: Printing of '-' in transition in table prints as '?' instead of '-'. Wasn't using correct string to {
// look for font character (was using newvalue, not gg) Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
Match m = Regex.Match(gg, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)"); if (m == null)
if (m == null) newvalue = newvalue.Replace(@"\u9586?", @"\\");
newvalue = newvalue.Replace(@"\u8209?", "-"); else
else newvalue = newvalue.Replace(@"\u9586?", $@"{m.Groups[1].Value}\u9586?{m.Groups[3].Value}");
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value); }
} if (newvalue.Contains(@"\u9586?"))
if (newvalue.Contains(@"\u9586?")) {
{ Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)");
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)"); if (m == null)
if (m == null) newvalue = newvalue.Replace(@"\u9586?", @"\\");
newvalue = newvalue.Replace(@"\u9586?", @"\\"); else
else newvalue = newvalue.Replace(@"\u9586?", $@"{m.Groups[1].Value}\u9586?{m.Groups[3].Value}");
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value); }
} MyGridMessage = string.Format("ContentExt.ContentInfo:Grid:{0}, {1}, {2}", ContentID, tran.TransitionID, gg);
if (newvalue.Contains(@"\u9586?")) if (gg != newvalue)
{ {
Match m = Regex.Match(newvalue, @"(\\f[0-9]+)(\\u[0-9]{1,4}\?)(\\f[0-9]+ ?)"); MyGrid.SetData(MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength));
if (m == null) }
newvalue = newvalue.Replace(@"\u9586?", @"\\"); }
else }
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value); }
}
MyGridMessage = string.Format("ContentExt.ContentInfo:Grid:{0}, {1}, {2}", this.ContentID, tran.TransitionID, gg);
if (gg != newvalue)
{
MyGrid.SetData(MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength));
}
}
}
}
} }
public void FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo, ItemInfo ii) public void FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo, ItemInfo ii)
@@ -1362,10 +1183,6 @@ namespace VEPROMS.CSLA.Library
newvalue = newvalue.Replace($"{(char)916}", @"\u916?"); newvalue = newvalue.Replace($"{(char)916}", @"\u916?");
} }
// Debug - jsj 5-19-2017 - left in for initial check-in
//string xx_gg = gg_org.Replace(@"\'b0", @"\'B0").Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
//string xx_nv = newval_org.Replace(@"\'b0", @"\'B0").Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
//Console.WriteLine(xx_gg.CompareTo(xx_nv));
OnStaticContentInfoChange(ii, new StaticContentInfoEventArgs(gg, newvalue, "RO")); OnStaticContentInfoChange(ii, new StaticContentInfoEventArgs(gg, newvalue, "RO"));
break; // Text has been processed break; // Text has been processed
} }
@@ -1378,7 +1195,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (rotype == (int)E_ROValueType.Table) // if change in rotable data... if (rotype == (int)E_ROValueType.Table) // if change in rotable data...
{ {
List<string> retlist = origROFstInfo.OnROTableUpdate(this.Get(), new ROFstInfoROTableUpdateEventArgs(newvalue, MyGrid.Data)); List<string> retlist = origROFstInfo.OnROTableUpdate(Get(), new ROFstInfoROTableUpdateEventArgs(newvalue, MyGrid.Data));
if (retlist != null && Text != retlist[0]) _Text = retlist[0]; //B2022-075 added null reference check if (retlist != null && Text != retlist[0]) _Text = retlist[0]; //B2022-075 added null reference check
} }
else else
@@ -1412,7 +1229,7 @@ namespace VEPROMS.CSLA.Library
if (m.Groups.Count < 3) if (m.Groups.Count < 3)
newvalue = newvalue.Replace(@"\u8209?", "-"); newvalue = newvalue.Replace(@"\u8209?", "-");
else else
newvalue = newvalue.Replace(@"\u8209?", m.Groups[1].Value + @"\u8209?" + m.Groups[3].Value); newvalue = newvalue.Replace(@"\u8209?", $@"{m.Groups[1].Value}\u8209?{m.Groups[3].Value}");
} }
//B2024-003, B2023-113, B2024-093 - Updating RO Values inside a text Grid, //B2024-003, B2023-113, B2024-093 - Updating RO Values inside a text Grid,
// This will handle if there is a delta and the column/row of the grid is removed // This will handle if there is a delta and the column/row of the grid is removed
@@ -1425,7 +1242,7 @@ namespace VEPROMS.CSLA.Library
else if (m.Groups.Count < 3) else if (m.Groups.Count < 3)
newvalue = newvalue.Replace(@"\u916?", $"{(char)916}"); newvalue = newvalue.Replace(@"\u916?", $"{(char)916}");
else else
newvalue = newvalue.Replace(@"\u916?", m.Groups[1].Value + @"\u916?" + m.Groups[3].Value); newvalue = newvalue.Replace(@"\u916?", $@"{m.Groups[1].Value}\u916?{m.Groups[3].Value}");
} }
if (newvalue.Contains(@"\u8593?")) if (newvalue.Contains(@"\u8593?"))
{ {
@@ -1433,7 +1250,7 @@ namespace VEPROMS.CSLA.Library
if (m.Groups.Count < 3) if (m.Groups.Count < 3)
newvalue = newvalue.Replace(@"\u8593?", "^"); newvalue = newvalue.Replace(@"\u8593?", "^");
else else
newvalue = newvalue.Replace(@"\u8593?", m.Groups[1].Value + @"\u8593?" + m.Groups[3].Value); newvalue = newvalue.Replace(@"\u8593?", $@"{m.Groups[1].Value}\u8593?{m.Groups[3].Value}");
} }
if (newvalue.Contains(@"\u9586?")) if (newvalue.Contains(@"\u9586?"))
@@ -1442,7 +1259,7 @@ namespace VEPROMS.CSLA.Library
if (m.Groups.Count < 3) if (m.Groups.Count < 3)
newvalue = newvalue.Replace(@"\u9586?", @"\\"); newvalue = newvalue.Replace(@"\u9586?", @"\\");
else else
newvalue = newvalue.Replace(@"\u9586?", m.Groups[1].Value + @"\u9586?" + m.Groups[3].Value); newvalue = newvalue.Replace(@"\u9586?", $@"{m.Groups[1].Value}\u9586?{m.Groups[3].Value}");
} }
// B2022-064: Translate '<' to '&lt;', '<' is xml token, so xml grid string was incorrect for print. // B2022-064: Translate '<' to '&lt;', '<' is xml token, so xml grid string was incorrect for print.
// Note that the '>' symbol was also translated. This method does NOT save the string to database, // Note that the '>' symbol was also translated. This method does NOT save the string to database,
@@ -1469,24 +1286,18 @@ namespace VEPROMS.CSLA.Library
_Text = "?"; _Text = "?";
} }
// C2021-018 used to update the content record when displaying Alarm Pont Table information in the step Editor (BNPP alarms) // C2021-018 used to update the content record when displaying Alarm Pont Table information in the step Editor (BNPP alarms)
public void UpdateAlarmTableInfoView(string updateText) public void UpdateAlarmTableInfoView(string updateText) => _Text = updateText;
{
_Text = updateText;
}
public void LoadNonCachedGrid() public void LoadNonCachedGrid()
{ {
_MyGrid = GridInfo.GetNonCached(ContentID); _MyGrid = GridInfo.GetNonCached(ContentID);
//Console.WriteLine("LoadNonCachedGrid {0},{1},{2}",ContentID,_MyGrid==null,_MyContentInfoUnique); //Console.WriteLine("LoadNonCachedGrid {0},{1},{2}",ContentID,_MyGrid==null,_MyContentInfoUnique);
} }
public PartInfoList LocalContentParts public PartInfoList LocalContentParts => _ContentParts;
{
get { return _ContentParts; }
}
public void AddPart(SafeDataReader dr, ItemInfo itemInfo) public void AddPart(SafeDataReader dr, ItemInfo itemInfo)
{ {
if (_ContentParts == null) if (_ContentParts == null)
_ContentParts = new PartInfoList(dr, itemInfo); _ContentParts = new PartInfoList(dr, itemInfo);
@@ -1494,17 +1305,11 @@ namespace VEPROMS.CSLA.Library
_ContentParts.AddPartInfo(dr, itemInfo); _ContentParts.AddPartInfo(dr, itemInfo);
} }
public override string ToString() public override string ToString() => $"{Number} {Text}";
{
return string.Format("{0} {1}", Number, Text);
}
public void ShowChange() public void ShowChange() => OnChange();
{
OnChange();
}
internal ContentInfo(SafeDataReader dr, bool ForItem) internal ContentInfo(SafeDataReader dr, bool ForItem)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.Constructor", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.Constructor", GetHashCode());
@@ -1587,7 +1392,7 @@ namespace VEPROMS.CSLA.Library
private void DataPortal_Fetch(ContentListCriteria criteria) private void DataPortal_Fetch(ContentListCriteria criteria)
{ {
this.RaiseListChangedEvents = false; RaiseListChangedEvents = false;
try try
{ {
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -1604,7 +1409,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -1616,7 +1421,7 @@ namespace VEPROMS.CSLA.Library
Database.LogException("ContentInfoList.DataPortal_Fetch", ex); Database.LogException("ContentInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ContentInfoList.DataPortal_Fetch", ex); throw new DbCslaException("ContentInfoList.DataPortal_Fetch", ex);
} }
this.RaiseListChangedEvents = true; RaiseListChangedEvents = true;
} }
public static ContentInfoList GetChangedList(byte[] lastChanged) public static ContentInfoList GetChangedList(byte[] lastChanged)
@@ -1624,7 +1429,6 @@ namespace VEPROMS.CSLA.Library
try try
{ {
ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ChangeListCriteria(lastChanged)); ContentInfoList tmp = DataPortal.Fetch<ContentInfoList>(new ChangeListCriteria(lastChanged));
// ContentInfo.AddList(tmp);
tmp.AddEvents(); tmp.AddEvents();
return tmp; return tmp;
} }
@@ -1651,7 +1455,7 @@ namespace VEPROMS.CSLA.Library
private void DataPortal_Fetch(ChangeListCriteria criteria) private void DataPortal_Fetch(ChangeListCriteria criteria)
{ {
this.RaiseListChangedEvents = false; RaiseListChangedEvents = false;
try try
{ {
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -1668,7 +1472,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -1680,7 +1484,7 @@ namespace VEPROMS.CSLA.Library
Database.LogException("ContentInfoList.DataPortal_Fetch", ex); Database.LogException("ContentInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("ContentInfoList.DataPortal_Fetch", ex); throw new DbCslaException("ContentInfoList.DataPortal_Fetch", ex);
} }
this.RaiseListChangedEvents = true; RaiseListChangedEvents = true;
} }
#region ClearCBOverride #region ClearCBOverride
@@ -1725,7 +1529,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -1760,29 +1564,15 @@ namespace VEPROMS.CSLA.Library
{ {
public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int? newformatID) public ClearOverrideFormatsByDocVersionCriteria(string dvlist, int? formatID, int? newformatID)
{ {
_FormatID = formatID; FormatID = formatID;
_DVList = dvlist; DVList = dvlist;
_NewFormatID = newformatID; NewFormatID = newformatID;
} }
private int? _FormatID;
public int? FormatID public int? FormatID { get; set; }
{ public int? NewFormatID { get; set; }
get { return _FormatID; } public string DVList { get; set; }
set { _FormatID = value; } }
}
private int? _NewFormatID;
public int? NewFormatID
{
get { return _NewFormatID; }
set { _NewFormatID = value; }
}
private string _DVList;
public string DVList
{
get { return _DVList; }
set { _DVList = value; }
}
}
private void DataPortal_Fetch(ClearOverrideFormatsByDocVersionCriteria criteria) private void DataPortal_Fetch(ClearOverrideFormatsByDocVersionCriteria criteria)
{ {
@@ -1810,7 +1600,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -1841,29 +1631,15 @@ namespace VEPROMS.CSLA.Library
{ {
public ClearOverrideFormatsByItemCriteria(int itemID, int? formatID, int? newformatID) public ClearOverrideFormatsByItemCriteria(int itemID, int? formatID, int? newformatID)
{ {
_FormatID = formatID; FormatID = formatID;
_NewFormatID = newformatID; NewFormatID = newformatID;
_ItemID = itemID; ItemID = itemID;
} }
private int? _FormatID;
public int? FormatID public int? FormatID { get; set; }
{ public int? NewFormatID { get; set; }
get { return _FormatID; } public int ItemID { get; set; }
set { _FormatID = value; } }
}
private int? _NewFormatID;
public int? NewFormatID
{
get { return _NewFormatID; }
set { _NewFormatID = value; }
}
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
private void DataPortal_Fetch(ClearOverrideFormatsByItemCriteria criteria) private void DataPortal_Fetch(ClearOverrideFormatsByItemCriteria criteria)
{ {
@@ -1891,7 +1667,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -1975,7 +1751,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -2005,7 +1781,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -2069,7 +1845,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -2146,7 +1922,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -2222,7 +1998,7 @@ namespace VEPROMS.CSLA.Library
while (dr.Read()) while (dr.Read())
{ {
ContentInfo contentInfo = new ContentInfo(dr); ContentInfo contentInfo = new ContentInfo(dr);
this.Add(contentInfo); Add(contentInfo);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
File diff suppressed because it is too large Load Diff
@@ -18,7 +18,6 @@ using System.IO;
using System.Threading; using System.Threading;
using System.Xml; using System.Xml;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
//using VEPROMS.Properties;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -26,8 +25,6 @@ namespace VEPROMS.CSLA.Library
{ {
public static DocVersion GetFromDB(int versionID) // get data from database (don't look in cache first) public static DocVersion GetFromDB(int versionID) // get data from database (don't look in cache first)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a DocVersion");
try try
{ {
DocVersion tmp = DataPortal.Fetch<DocVersion>(new PKCriteria(versionID)); DocVersion tmp = DataPortal.Fetch<DocVersion>(new PKCriteria(versionID));
@@ -146,18 +143,15 @@ namespace VEPROMS.CSLA.Library
return _DocVersionConfig; return _DocVersionConfig;
} }
} }
private void _DocVersionConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) private void _DocVersionConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) => Config = _DocVersionConfig.ToString();
{ #endregion
Config = _DocVersionConfig.ToString(); #region UserSettings
} /// <summary>
#endregion /// These settings are set on the user interface side.
#region UserSettings /// This is used to control whether the Name and/or Title is displayed
/// <summary> /// next to the tree nodes in the user interface
/// These settings are set on the user interface side. /// </summary>
/// This is used to control whether the Name and/or Title is displayed private bool _DisplayTreeNodeNames = true;
/// next to the tree nodes in the user interface
/// </summary>
private bool _DisplayTreeNodeNames = true;
public bool DisplayTreeNodeNames public bool DisplayTreeNodeNames
{ {
get { return _DisplayTreeNodeNames; } get { return _DisplayTreeNodeNames; }
@@ -182,50 +176,12 @@ namespace VEPROMS.CSLA.Library
rtnstr += Title; rtnstr += Title;
} }
return rtnstr; return rtnstr;
//return string.Format("{0} - {1}", Name, Title);
} }
#region IVEDrillDown #region IVEDrillDown
//public System.Collections.IList GetChildren() public ConfigDynamicTypeDescriptor MyConfig => DocVersionConfig;
//{ #endregion
// return null; public DocVersionInfo MyDocVersionInfo => DocVersionInfo.Get(VersionID);
//} }
//public bool HasChildren
//{
// get { return _ItemID > 0; }
//}
//public IVEDrillDown ActiveParent
//{
// get
// {
// return MyFolder;
// }
//}
//private Format _ActiveFormat = null;
//public Format ActiveFormat
//{
// get
// {
// if (_ActiveFormat == null)
// _ActiveFormat = LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat;
// return _ActiveFormat;
// }
// set
// {
// _ActiveFormat = null;
// }
//}
//public Format LocalFormat
//{
// get { return MyFormat; }
//}
public ConfigDynamicTypeDescriptor MyConfig
{
get { return DocVersionConfig; }
}
#endregion
public DocVersionInfo MyDocVersionInfo
{ get { return DocVersionInfo.Get(VersionID); } }
}
public partial class DocVersionInfo : IVEDrillDownReadOnly public partial class DocVersionInfo : IVEDrillDownReadOnly
{ {
public TimeSpan tsTimeOut = TimeSpan.FromSeconds(6); public TimeSpan tsTimeOut = TimeSpan.FromSeconds(6);
@@ -249,9 +205,10 @@ namespace VEPROMS.CSLA.Library
} }
return exists; return exists;
} }
// The following dictionary is used to store the state of the ro.fst check so that it is // The following dictionary is used to store the state of the ro.fst check so that it is
// not made repeatedly in NewerRoFst. (B2017-050) // not made repeatedly in NewerRoFst. (B2017-050)
private static Dictionary<string, bool> NewerRoFstLookup = new Dictionary<string, bool>(); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static Dictionary<string, bool> NewerRoFstLookup = new Dictionary<string, bool>();
private static bool AddToRoFstLookup(string key, bool result) private static bool AddToRoFstLookup(string key, bool result)
{ {
if (!NewerRoFstLookup.ContainsKey(key)) NewerRoFstLookup.Add(key, result); if (!NewerRoFstLookup.ContainsKey(key)) NewerRoFstLookup.Add(key, result);
@@ -267,7 +224,6 @@ namespace VEPROMS.CSLA.Library
RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID); RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID);
string rofstPath = rdi.FolderPath + @"\ro.fst"; string rofstPath = rdi.FolderPath + @"\ro.fst";
//if (!File.Exists(rofstPath)) return false;
if (!pathExists(rofstPath)) if (!pathExists(rofstPath))
{ {
_MyLog.WarnFormat("RO Path '{0}' could not be found", rofstPath); _MyLog.WarnFormat("RO Path '{0}' could not be found", rofstPath);
@@ -369,10 +325,10 @@ namespace VEPROMS.CSLA.Library
return _SearchDVPath; return _SearchDVPath;
} }
} }
public string SearchPath { get { return ""; } } public string SearchPath => "";
// B2021-076: Proms search results are not presented in order when printed to PDF // B2021-076: Proms search results are not presented in order when printed to PDF
public string SearchDefaultSort { get { return string.Empty; } } public string SearchDefaultSort => string.Empty;
#endregion #endregion
#region UnlinkEnhancedDocVersion #region UnlinkEnhancedDocVersion
@@ -420,22 +376,15 @@ namespace VEPROMS.CSLA.Library
#region DocVersion Config #region DocVersion Config
[NonSerialized] [NonSerialized]
private DocVersionConfig _DocVersionConfig; private DocVersionConfig _DocVersionConfig;
public DocVersionConfig DocVersionConfig public DocVersionConfig DocVersionConfig => _DocVersionConfig ?? (_DocVersionConfig = new DocVersionConfig(this));
{ get { return (_DocVersionConfig != null ? _DocVersionConfig : _DocVersionConfig = new DocVersionConfig(this)); } } private void DocVersionConfigRefresh() => _DocVersionConfig = null;
private void DocVersionConfigRefresh() #endregion
{
_DocVersionConfig = null;
}
#endregion
#region MOVE TO DOCVERSION CONFIG #region MOVE TO DOCVERSION CONFIG
private string GetProfile(string grp, string nam) private string GetProfile(string grp, string nam) => GetProfile(grp, nam, false);
{
return GetProfile(grp, nam, false);
}
private string GetProfile(string grp, string nam, bool flag) private string GetProfile(string grp, string nam, bool flag)
{ {
DocVersionConfig dvcfg = DocVersionConfig; DocVersionConfig dvcfg = DocVersionConfig;
string buff = null; string buff = null;
@@ -454,16 +403,14 @@ namespace VEPROMS.CSLA.Library
} }
// B2021-066: Procedure PC/PC resolve procedure number with Unit Specific info // B2021-066: Procedure PC/PC resolve procedure number with Unit Specific info
public string UnitSpecific(string str, int len, ItemInfo ii) public string UnitSpecific(ItemInfo ii)
{ {
ProcedureInfo pi = ii as ProcedureInfo; if (!(ii is ProcedureInfo pi)) // B2022-004: Don't crash if Proc PC/PC (ii is from a list, so wasn't an ItemInfo)
{
pi = ProcedureInfo.Get(ii.ItemID);
}
if (pi == null) // B2022-004: Don't crash if Proc PC/PC (ii is from a list, so wasn't an ItemInfo) if (pi == null) return "";
{
pi = ProcedureInfo.Get(ii.ItemID);
}
if (pi == null) return "";
// B2023-035 for save the current select child (selectedSlave) and use the child number // B2023-035 for save the current select child (selectedSlave) and use the child number
// that was selected when printed. This is needed for when "Other" applicability // that was selected when printed. This is needed for when "Other" applicability
@@ -478,9 +425,8 @@ namespace VEPROMS.CSLA.Library
} }
string unitdes = "ID"; string unitdes = "ID";
string prefix = null; string prefix = null;
string fromunitdes = null; string str = ItemInfo.ConvertToDisplayText(pi.MyContent.Number);
str = ItemInfo.ConvertToDisplayText(pi.MyContent.Number); bool hastoken = false;
bool hastoken = false;
// Determine if there is a token in the procedure number data, default is ID // Determine if there is a token in the procedure number data, default is ID
if (str.ToUpper().Contains(@"<U")) if (str.ToUpper().Contains(@"<U"))
@@ -503,28 +449,29 @@ namespace VEPROMS.CSLA.Library
} }
} }
if (unitdes == "NUMBER") string fromunitdes;
fromunitdes = DocVersionConfig.Unit_Number; if (unitdes == "NUMBER")
else if (unitdes == "ID") fromunitdes = DocVersionConfig.Unit_Number;
fromunitdes = DocVersionConfig.Unit_ID; else if (unitdes == "ID")
else if (unitdes == "NAME") fromunitdes = DocVersionConfig.Unit_ID;
fromunitdes = DocVersionConfig.Unit_Name; else if (unitdes == "NAME")
else if (unitdes == "TEXT") fromunitdes = DocVersionConfig.Unit_Name;
fromunitdes = DocVersionConfig.Unit_Text; else if (unitdes == "TEXT")
// B2021-145: For applicability, the tree view & pdf file name are not getting resolved when using any of the ‘OTHER’ tokens fromunitdes = DocVersionConfig.Unit_Text;
// B2022-023 also check for other followed by a space // B2021-145: For applicability, the tree view & pdf file name are not getting resolved when using any of the ‘OTHER’ tokens
else if (unitdes == "OTHERTEXT" || unitdes == "OTHER TEXT") // B2022-023 also check for other followed by a space
fromunitdes = DocVersionConfig.Other_Unit_Text; else if (unitdes == "OTHERTEXT" || unitdes == "OTHER TEXT")
else if (unitdes == "OTHERNUMBER" || unitdes == "OTHER NUMBER") fromunitdes = DocVersionConfig.Other_Unit_Text;
fromunitdes = DocVersionConfig.Other_Unit_Number; else if (unitdes == "OTHERNUMBER" || unitdes == "OTHER NUMBER")
else if (unitdes == "OTHERNAME" || unitdes == "OTHER NAME") fromunitdes = DocVersionConfig.Other_Unit_Number;
fromunitdes = DocVersionConfig.Other_Unit_Name; else if (unitdes == "OTHERNAME" || unitdes == "OTHER NAME")
else if (unitdes == "OTHERID" || unitdes == "OTHER ID") fromunitdes = DocVersionConfig.Other_Unit_Name;
fromunitdes = DocVersionConfig.Other_Unit_ID; else if (unitdes == "OTHERID" || unitdes == "OTHER ID")
else fromunitdes = DocVersionConfig.Other_Unit_ID;
fromunitdes = DocVersionConfig.Unit_ID; else
fromunitdes = DocVersionConfig.Unit_ID;
DocVersionConfig.SelectedSlave = docVerSelectedSlave; //B2023-035 reset the selected Slave DocVersionConfig.SelectedSlave = docVerSelectedSlave; //B2023-035 reset the selected Slave
// adjustments to the procedure number for applicability can be defined in 2 places: // adjustments to the procedure number for applicability can be defined in 2 places:
// 1) mstr below: working draft properties/Applicability/Procedure number field for each unit can have text. The '#' in this // 1) mstr below: working draft properties/Applicability/Procedure number field for each unit can have text. The '#' in this
@@ -569,16 +516,16 @@ namespace VEPROMS.CSLA.Library
else else
if (procAppl) prefs.Add(tokRepAndPrefix); if (procAppl) prefs.Add(tokRepAndPrefix);
} }
if (procAppl && tokRepAndPrefix != "") prefix = prefix + (prefix == null ? tokRepAndPrefix : (prefix != null && prefix.Length > 0 && prefix[prefix.Length - 1] != ',' ? "," : "") + tokRepAndPrefix); if (procAppl && tokRepAndPrefix != "") prefix += (prefix == null ? tokRepAndPrefix : (prefix != null && prefix.Length > 0 && prefix[prefix.Length - 1] != ',' ? "," : "") + tokRepAndPrefix);
} }
str = Regex.Replace(str, @"\<[uU]-[a-zA-Z]+\>", ""); str = Regex.Replace(str, @"\<[uU]-[a-zA-Z]+\>", "");
str = Regex.Replace(str, @"\<[uU]\>", ""); str = Regex.Replace(str, @"\<[uU]\>", "");
return (!sometext) ? str: "[" + prefix + "]" + str; return (!sometext) ? str: $"[{prefix}]{str}";
} }
public string UnitSpecific(string str, int len) public string UnitSpecific(string str)
{ {
// This routine retrieves the procedure number format from the // This routine retrieves the procedure number format from the
@@ -587,20 +534,8 @@ namespace VEPROMS.CSLA.Library
string retvalu = ""; string retvalu = "";
string asis = "#"; string asis = "#";
if (str == null || str.Equals(string.Empty)) return retvalu; // return a null (empty) string if (str == null || str.Equals(string.Empty)) return retvalu; // return a null (empty) string
/*
* Bug fix: B2005-017 3/2/2005
* Need to use the largest procedure number length that's in the
* SET.DFF file. "LargestNumber" is the largest length after the
* procedure number is replaced via the SET.INI file "replace" list.
*
if(len==0)len=LargestNumber;
*/
// TODO: Do we need this line?-->>> if(len==0)len=LargestRawSetNumber;
//GetPrivateProfileString("unit", "procedure number", asis, mstr, MAXPATH, "proc.ini");
string pnum = asis; string pnum = asis;
//rhm/jcb stuff 20120511
//string mstr = GetProfile("Unit", "ProcedureNumber", true);
string mstr = DocVersionConfig.Unit_ProcedureNumber; string mstr = DocVersionConfig.Unit_ProcedureNumber;
if (mstr != null && !mstr.Equals(string.Empty)) if (mstr != null && !mstr.Equals(string.Empty))
pnum = mstr; pnum = mstr;
@@ -684,11 +619,11 @@ namespace VEPROMS.CSLA.Library
case 'P': case 'P':
//TODO: THIS IS A GLOBAL IN THE 16 BIT CODE!!!! //TODO: THIS IS A GLOBAL IN THE 16 BIT CODE!!!!
string procnumber = ""; string procnumber = "";
pn = UnitSpecific(procnumber, 0); pn = UnitSpecific(procnumber);
retval = GetProfile(pn, substr, true); retval = GetProfile(pn, substr, true);
break; break;
} }
if (retval == null) // .Equals(string.Empty)) if (retval == null)
swptr++; swptr++;
} }
str += sav; str += sav;
@@ -752,13 +687,9 @@ namespace VEPROMS.CSLA.Library
#endregion #endregion
ItemInfoList _Procedures = null; ItemInfoList _Procedures = null;
public ItemInfoList Procedures public ItemInfoList Procedures => _Procedures ?? (_Procedures = ItemInfoList.GetList(_ItemID, (int)E_FromType.Procedure));
{ get { return (_Procedures != null ? _Procedures : _Procedures = ItemInfoList.GetList(_ItemID, (int)E_FromType.Procedure)); } } public void ResetProcedures() => _Procedures = null;
public void ResetProcedures() public static void ResetProcedures(int versionID)
{
_Procedures = null;
}
public static void ResetProcedures(int versionID)
{ {
string key = versionID.ToString(); string key = versionID.ToString();
if (_CacheByPrimaryKey.ContainsKey(key)) if (_CacheByPrimaryKey.ContainsKey(key))
@@ -778,31 +709,12 @@ namespace VEPROMS.CSLA.Library
foreach (DocVersionInfo dvi in _CacheList) foreach (DocVersionInfo dvi in _CacheList)
dvi.ResetProcedures(); dvi.ResetProcedures();
} }
#region IVEReadOnlyItem #region IVEReadOnlyItem
public System.Collections.IList GetChildren() public System.Collections.IList GetChildren() => Procedures;
{ public bool HasChildren => _ItemID > 0;
return Procedures; public IVEDrillDownReadOnly ActiveParent => MyFolder;
} public FormatInfo ActiveFormat => LocalFormat ?? ActiveParent.ActiveFormat;
//public bool ChildrenAreLoaded public FormatInfo LocalFormat
//{
// get { return _iil == null; }
//}
public bool HasChildren
{
get { return _ItemID > 0; }
}
public IVEDrillDownReadOnly ActiveParent
{
get
{
return MyFolder;
}
}
public FormatInfo ActiveFormat
{
get { return LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat; }
}
public FormatInfo LocalFormat
{ {
get get
{ {
@@ -810,17 +722,14 @@ namespace VEPROMS.CSLA.Library
return MyFormat; return MyFormat;
} }
} }
public ConfigDynamicTypeDescriptor MyConfig public ConfigDynamicTypeDescriptor MyConfig => DocVersionConfig;
#region PasteChild
public ItemInfo PasteChild(int copyStartID) // pastes into an 'empty' docversion
{ {
get { return DocVersionConfig; } #pragma warning disable IDE0059 // Unnecessary assignment of a value - Kept for Side Effect and Debugging
} ItemInfo cpItem = ItemInfo.Get(copyStartID);
//public bool HasStandardSteps() #pragma warning restore IDE0059 // Unnecessary assignment of a value
//{ return false; } try
#region PasteChild
public ItemInfo PasteChild(int copyStartID) // pastes into an 'empty' docversion
{
ItemInfo cpItem = ItemInfo.Get(copyStartID);
try
{ {
DocVersionInfo dvi = DataPortal.Fetch<DocVersionInfo>(new VersionPastingPartCriteria(VersionID, copyStartID, DateTime.Now, Volian.Base.Library.VlnSettings.UserID)); DocVersionInfo dvi = DataPortal.Fetch<DocVersionInfo>(new VersionPastingPartCriteria(VersionID, copyStartID, DateTime.Now, Volian.Base.Library.VlnSettings.UserID));
ItemInfo tmp = dvi.Procedures[0] as ItemInfo; ItemInfo tmp = dvi.Procedures[0] as ItemInfo;
@@ -831,8 +740,8 @@ namespace VEPROMS.CSLA.Library
} }
return tmp; return tmp;
} }
catch (Exception ex) catch (Exception)
{ {
System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.", "Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); System.Windows.Forms.MessageBox.Show("Details were written to the Error Log.", "Paste Failed", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
return null; return null;
} }
@@ -869,23 +778,12 @@ namespace VEPROMS.CSLA.Library
rtnstr += Title; rtnstr += Title;
} }
return rtnstr; return rtnstr;
//return string.Format("{0} - {1}", Name, Title);
} }
//public string ToString(string str,System.IFormatProvider ifp) public ItemInfo LastChild() => MyItem.LastSibling;
//{ public ItemInfo FirstChild() => MyItem;
// return ToString(); #endregion
//} #region DataPortal
public ItemInfo LastChild() private void DataPortal_Fetch(VersionPastingPartCriteria criteria)
{
return MyItem.LastSibling;
}
public ItemInfo FirstChild()
{
return MyItem;
}
#endregion
#region DataPortal
private void DataPortal_Fetch(VersionPastingPartCriteria criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.DataPortal_Fetch", GetHashCode());
try try
@@ -899,10 +797,12 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@VersionID", criteria.VersionID); cm.Parameters.AddWithValue("@VersionID", criteria.VersionID);
cm.Parameters.AddWithValue("@StartItemID", criteria.StartItemID); cm.Parameters.AddWithValue("@StartItemID", criteria.StartItemID);
cm.Parameters.AddWithValue("@DTS", criteria.DTS); //ABC cm.Parameters.AddWithValue("@DTS", criteria.DTS); //ABC
cm.Parameters.AddWithValue("@UserID", criteria.UserID); //ABC cm.Parameters.AddWithValue("@UserID", criteria.UserID); //ABC
SqlParameter param_ContentID = new SqlParameter("@ThisVersionID", SqlDbType.Int); SqlParameter param_ContentID = new SqlParameter("@ThisVersionID", SqlDbType.Int)
param_ContentID.Direction = ParameterDirection.Output; {
cm.Parameters.Add(param_ContentID); Direction = ParameterDirection.Output
};
cm.Parameters.Add(param_ContentID);
cm.CommandText = "PasteDocVersionChild"; cm.CommandText = "PasteDocVersionChild";
cm.CommandTimeout = Database.DefaultTimeout; cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
@@ -934,12 +834,9 @@ namespace VEPROMS.CSLA.Library
#region Extension #region Extension
partial class DocVersionInfoExtension : extensionBase partial class DocVersionInfoExtension : extensionBase
{ {
public override void Refresh(DocVersionInfo tmp) public override void Refresh(DocVersionInfo tmp) => tmp.DocVersionConfigRefresh();
{
tmp.DocVersionConfigRefresh();
}
} }
#endregion #endregion
public ROFstInfo GetROFst(int rodbid) public ROFstInfo GetROFst(int rodbid)
{ {
@@ -967,7 +864,8 @@ namespace VEPROMS.CSLA.Library
rodbid, DocVersionAssociations.Count, VersionID, MyFolder.Name); rodbid, DocVersionAssociations.Count, VersionID, MyFolder.Name);
return null; return null;
} }
private static List<int> _HasBadRODBIDProblem = new List<int>(); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<int> _HasBadRODBIDProblem = new List<int>();
private bool FirstBadRODBIDProblemDetected private bool FirstBadRODBIDProblemDetected
{ {
get get
@@ -977,49 +875,13 @@ namespace VEPROMS.CSLA.Library
return true; return true;
} }
} }
public bool IsFolder public bool IsFolder => false;
{ public bool IsDocVersion => true;
get public bool IsProcedure => false;
{ public bool IsSection => false;
return false; public bool IsStep => false;
} public int MultiUnitCount => DocVersionConfig.Unit_Count;
} private string[] _UnitNames;
public bool IsDocVersion
{
get
{
return true;
}
}
public bool IsProcedure
{
get
{
return false;
}
}
public bool IsSection
{
get
{
return false;
}
}
public bool IsStep
{
get
{
return false;
}
}
public int MultiUnitCount
{
get
{
return DocVersionConfig.Unit_Count;
}
}
private string[] _UnitNames;
public string[] UnitNames public string[] UnitNames
{ {
get get
@@ -1138,7 +1000,8 @@ namespace VEPROMS.CSLA.Library
{ {
public DocVersionNonEnhancedListCriteria() { ;} public DocVersionNonEnhancedListCriteria() { ;}
} }
private void DataPortal_Fetch(DocVersionNonEnhancedListCriteria criteria) [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping until replace CSLA")]
private void DataPortal_Fetch(DocVersionNonEnhancedListCriteria criteria)
{ {
this.RaiseListChangedEvents = false; this.RaiseListChangedEvents = false;
try try
File diff suppressed because it is too large Load Diff
@@ -1,12 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using System.IO;
using Volian.Base.Library;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -16,13 +12,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
private class AddByROFstIDImageIDCriteria private class AddByROFstIDImageIDCriteria
{ {
private int _ROFstID; private readonly int _ROFstID;
public int ROFstID public int ROFstID => _ROFstID;
{ get { return _ROFstID; } } private readonly string _ImagedIDs;
private string _ImagedIDs; public string ImagedIDs => _ImagedIDs;
public string ImagedIDs public AddByROFstIDImageIDCriteria(int rOFstID, string imagedIDs)
{ get { return _ImagedIDs; } }
public AddByROFstIDImageIDCriteria(int rOFstID, string imagedIDs)
{ {
_ROFstID = rOFstID; _ROFstID = rOFstID;
_ImagedIDs = imagedIDs; _ImagedIDs = imagedIDs;
+46 -173
View File
@@ -13,10 +13,7 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using System.Configuration;
using System.IO;
using System.Drawing; using System.Drawing;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Linq; using System.Linq;
@@ -40,73 +37,19 @@ namespace VEPROMS.CSLA.Library
return _FolderConfig; return _FolderConfig;
} }
} }
public void FolderConfigRefresh() public void FolderConfigRefresh() => _FolderConfig = null;
{ private void _FolderConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) => Config = _FolderConfig.ToString();
_FolderConfig = null; #endregion
} public override string ToString() => _Title;
private void _FolderConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) #region IVEReadOnlyItem
{ public ConfigDynamicTypeDescriptor MyConfig => FolderConfig;
Config = _FolderConfig.ToString(); #endregion
} #region MakeFolders for ManualOrder
#endregion public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config, DateTime dts, string usrID) => MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config, dts, usrID);
public override string ToString() public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config) => MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config);
{ #endregion
return _Title; public FolderInfo MyFolderInfo => FolderInfo.Get(FolderID);
} }
#region IVEReadOnlyItem
//public System.Collections.IList GetChildren()
//{
// if (FolderDocVersionCount != 0) return FolderDocVersions;
// if (ChildFolderCount != 0) return ChildFolders;
// return null;
//}
//public bool HasChildren
//{
// get { return _FolderDocVersionCount > 0 || _ChildFolderCount > 0; }
//}
//public IVEDrillDown ActiveParent
//{
// get
// {
// return MyParent;
// }
//}
//private Format _ActiveFormat = null;
//public Format ActiveFormat
//{
// get
// {
// if (_ActiveFormat == null)
// _ActiveFormat = (LocalFormat != null ? LocalFormat : ActiveParent != null ? ActiveParent.ActiveFormat : null);
// return _ActiveFormat;
// }
// set
// {
// _ActiveFormat = null; // Reset
// }
//}
//public Format LocalFormat
//{
// get { return MyFormat; }
//}
public ConfigDynamicTypeDescriptor MyConfig
{
get { return FolderConfig; }
}
#endregion
#region MakeFolders for ManualOrder
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config, DateTime dts, string usrID)
{
return MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config, dts, usrID);
}
public static Folder MakeFolder(Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config)
{
return MakeFolder(myParent, myConnection, name, title, shortName, myFormat, null, config);
}
#endregion
public FolderInfo MyFolderInfo
{ get { return FolderInfo.Get(FolderID); } }
}
public partial class FolderInfo:IVEDrillDownReadOnly public partial class FolderInfo:IVEDrillDownReadOnly
{ {
#region Search Paths #region Search Paths
@@ -125,26 +68,20 @@ namespace VEPROMS.CSLA.Library
return _SearchDVPath; return _SearchDVPath;
} }
} }
public string SearchPath { get { return ""; } } public string SearchPath => "";
// B2021-076: Proms search results are not presented in order when printed to PDF // B2021-076: Proms search results are not presented in order when printed to PDF
public string SearchDefaultSort { get { return string.Empty; } } public string SearchDefaultSort => string.Empty;
#endregion #endregion
#region Folder Config (Read-Only) #region Folder Config (Read-Only)
[NonSerialized] [NonSerialized]
private FolderConfig _FolderConfig; private FolderConfig _FolderConfig;
public FolderConfig FolderConfig public FolderConfig FolderConfig => _FolderConfig ?? (_FolderConfig = new FolderConfig(this));
{ get { private void FolderConfigRefresh() => _FolderConfig = null;
return (_FolderConfig != null ? _FolderConfig : _FolderConfig = new FolderConfig(this)); #endregion
} } #region SortingChildren
private void FolderConfigRefresh() private static bool IsInManualOrderNullFix = false;
{
_FolderConfig = null;
}
#endregion
#region SortingChildren
private static bool IsInManualOrderNullFix = false;
[NonSerialized] [NonSerialized]
public Csla.SortedBindingList<FolderInfo> _SortedChildFolders; public Csla.SortedBindingList<FolderInfo> _SortedChildFolders;
@@ -180,8 +117,6 @@ namespace VEPROMS.CSLA.Library
if (_SortedChildFolders == null) if (_SortedChildFolders == null)
{ {
_SortedChildFolders = new SortedBindingList<FolderInfo>(ChildFolders); _SortedChildFolders = new SortedBindingList<FolderInfo>(ChildFolders);
//_SortedChildFolders.ApplySort("FolderID", ListSortDirection.Ascending);
//_SortedChildFolders.ApplySort("Name", ListSortDirection.Ascending);
} }
else if (_SortedChildFolders.Count != ChildFolders.Count) else if (_SortedChildFolders.Count != ChildFolders.Count)
{ {
@@ -266,43 +201,20 @@ namespace VEPROMS.CSLA.Library
public System.Collections.IList GetChildren() public System.Collections.IList GetChildren()
{ {
if(FolderDocVersionCount != 0)return FolderDocVersions; if(FolderDocVersionCount != 0)return FolderDocVersions;
//if (ChildFolderCount != 0) return ChildFolders;
if (ChildFolderCount != 0) return SortedChildFolders; if (ChildFolderCount != 0) return SortedChildFolders;
return null; return null;
} }
//public bool ChildrenAreLoaded public bool HasChildren => FolderDocVersionCount > 0 || ChildFolderCount > 0;
//{ public IVEDrillDownReadOnly ActiveParent => MyParent;
// get { return _FolderDocVersions != null || _ChildFolders != null; } public FormatInfo ActiveFormat => LocalFormat ?? (ActiveParent?.ActiveFormat);
//} public FormatInfo LocalFormat => MyFormat;
public bool HasChildren public ConfigDynamicTypeDescriptor MyConfig => FolderConfig;
{ /// <summary>
get { return FolderDocVersionCount > 0 || ChildFolderCount > 0; } /// These settings are set on the user interface side.
} /// This is used to control whether the Name and/or Title is displayed
public IVEDrillDownReadOnly ActiveParent /// next to the tree nodes in the user interface
{ /// </summary>
get private bool _DisplayTreeNodeNames = true;
{
return MyParent;
}
}
public FormatInfo ActiveFormat
{
get { return LocalFormat != null ? LocalFormat : ( ActiveParent != null ? ActiveParent.ActiveFormat : null); }
}
public FormatInfo LocalFormat
{
get { return MyFormat; }
}
public ConfigDynamicTypeDescriptor MyConfig
{
get { return FolderConfig; }
}
/// <summary>
/// These settings are set on the user interface side.
/// This is used to control whether the Name and/or Title is displayed
/// next to the tree nodes in the user interface
/// </summary>
private bool _DisplayTreeNodeNames = true;
public bool DisplayTreeNodeNames public bool DisplayTreeNodeNames
{ {
get { return _DisplayTreeNodeNames; } get { return _DisplayTreeNodeNames; }
@@ -326,12 +238,7 @@ namespace VEPROMS.CSLA.Library
rtnstr += Title; rtnstr += Title;
} }
return rtnstr; return rtnstr;
//return string.Format("{0} - {1}", Name, Title);
} }
//public string ToString(string str, System.IFormatProvider ifp)
//{
// return ToString();
//}
#endregion #endregion
public Color BackColor public Color BackColor
{ get { return FolderConfig.Default_BkColor; } } { get { return FolderConfig.Default_BkColor; } }
@@ -351,15 +258,10 @@ namespace VEPROMS.CSLA.Library
#region Extension #region Extension
partial class FolderInfoExtension : extensionBase partial class FolderInfoExtension : extensionBase
{ {
public override void Refresh(FolderInfo tmp) public override void Refresh(FolderInfo tmp) => tmp.FolderConfigRefresh();
{ }
tmp.FolderConfigRefresh();
}
}
public static FolderInfo GetTop() public static FolderInfo GetTop()
{ {
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a Folder");
try try
{ {
FolderInfo tmp = DataPortal.Fetch<FolderInfo>(new TopCriteria()); FolderInfo tmp = DataPortal.Fetch<FolderInfo>(new TopCriteria());
@@ -375,7 +277,8 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on FolderInfo.GetTop", ex); throw new DbCslaException("Error on FolderInfo.GetTop", ex);
} }
} }
private void DataPortal_Fetch(TopCriteria criteria) [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping until replace CSLA")]
private void DataPortal_Fetch(TopCriteria criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.DataPortal_Fetch", GetHashCode());
try try
@@ -416,41 +319,11 @@ namespace VEPROMS.CSLA.Library
{ {
public TopCriteria() { ;} public TopCriteria() { ;}
} }
public bool IsFolder public bool IsFolder => true;
{ public bool IsDocVersion => false;
get public bool IsProcedure => false;
{ public bool IsSection => false;
return true; public bool IsStep => false;
} }
}
public bool IsDocVersion
{
get
{
return false;
}
}
public bool IsProcedure
{
get
{
return false;
}
}
public bool IsSection
{
get
{
return false;
}
}
public bool IsStep
{
get
{
return false;
}
}
}
} }
@@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace VEPROMS.CSLA.Library
{
//public static class FontTab
//{
// private static Dictionary<string, int> FontIndx = null;
// // This dictionary takes a color name and converts it to the rtf string:
// private static Dictionary<string, string> FontRtf = null;
// public enum E_Fonts : int
// {
// None = 0, PrestigeEliteTall = 64, CourierNew = 2, TimesNewRoman = 0, LetterGothic = 66, Arial = 202, VolianDraw = 70, GothicUltra = 63, LetterGothicTall = 67, VolianScript = 71, ArialUnicode = 35
// }
// #region FontIndex
// /// <summary>
// /// GetIndex - Use this to get the number of the font in the font table based on the input
// /// string.
// /// </summary>
// /// <param name="font"></param>
// /// <returns></returns>
// public static int GetIndex(string font)
// {
// // if the dictionary hasn't been set yet,
// if (FontIndx==null)
// {
// FontIndx = new Dictionary<string, int>();
// FontIndx["Prestige Elite Tall"] = 64;
// FontIndx["Courier New"] = 2;
// FontIndx["Times New Roman"] = 0;
// FontIndx["Letter Gothic"] = 66;
// FontIndx["Arial"] = 202;
// FontIndx["Volian Draw"] = 70;
// FontIndx["Gothic Ultra"] = 63;
// FontIndx["Letter Gothic Tall"] = 67;
// FontIndx["VolianScript"] = 71;
// FontIndx["Arial Unicode"] = 35;
// }
// return FontIndx[font];
// }
// #endregion
// #region ColorRtf
// /// <summary>
// /// GetTableString - Use this to get the string to add to font table based on the input
// /// string.
// /// </summary>
// public static string GetTableString(string font)
// {
// if (FontRtf == null)
// {
// FontRtf = new Dictionary<string, string>();
// FontRtf["Prestige Elite Tall"] = "{\\f64\\fmodern\\fcharset2\\fprq1 Prestige Elite Tall;}";
// FontRtf["Courier New"] = "{\\f2\\fmodern\\fcharset0\\fprq1 Courier New;}";
// FontRtf["Times New Roman"] = "{\\f0\\froman\\fcharset0\\fprq2 Times New Roman;}";
// FontRtf["Letter Gothic"] = "{\\f66\\fmodern\\fcharset2\\fprq1 Letter Gothic;}";
// FontRtf["Arial"] = "{\\f1\\fswiss\\fcharset0\\fprq2 Arial;}";
// FontRtf["Volian Draw"] = "{\\f70\\fmodern\\fcharset2\\fprq1 VolianDraw;}";
// FontRtf["Gothic Ultra"] = "{\\f63\\fmodern\\fcharset2\\fprq1 Gothic Ultra;}";
// FontRtf["Letter Gothic Tall"] = "{\\f67\\fmodern\\fcharset2\\fprq1 Letter Gothic Tall;}";
// FontRtf["VolianScript"] = "{\\f71\\fswiss\\fcharset2\\fprq2 VolianScript;}";
// FontRtf["Arial Unicode"] = "{\\f35\\fswiss\\fcharset128\\fprq2 Arial Unicode MS;}";
// }
// return FontRtf[font];
// }
// #endregion
//}
}
+91 -162
View File
@@ -13,10 +13,8 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using System.Configuration;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using System.Drawing;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic; using System.Collections.Generic;
using Volian.Base.Library; using Volian.Base.Library;
@@ -33,17 +31,12 @@ namespace VEPROMS.CSLA.Library
get { return _AllFormats; } get { return _AllFormats; }
set { _AllFormats = value; } set { _AllFormats = value; }
} }
public CriteriaAllFormats(bool allFormats) public CriteriaAllFormats(bool allFormats) => _AllFormats = allFormats;
{ }
_AllFormats = allFormats;
}
}
public partial class Format public partial class Format
{ {
public static Format GetJustFormat(int formatID) public static Format GetJustFormat(int formatID)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Format");
try try
{ {
Format tmp = GetCachedByPrimaryKey(formatID); Format tmp = GetCachedByPrimaryKey(formatID);
@@ -67,14 +60,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class PKCriteriaJustFormat protected class PKCriteriaJustFormat
{ {
private int _FormatID; private readonly int _FormatID;
public int FormatID public int FormatID => _FormatID;
{ get { return _FormatID; } } public PKCriteriaJustFormat(int formatID) => _FormatID = formatID;
public PKCriteriaJustFormat(int formatID) }
{
_FormatID = formatID;
}
}
private void DataPortal_Fetch(PKCriteriaJustFormat criteria) private void DataPortal_Fetch(PKCriteriaJustFormat criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Fetch JustFormat", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Fetch JustFormat", GetHashCode());
@@ -123,92 +112,66 @@ namespace VEPROMS.CSLA.Library
} }
public class FormatEventArgs public class FormatEventArgs
{ {
private string _Status; public string Status { get; set; }
public string Status public FormatEventArgs(string status) => Status = status;
{ }
get { return _Status; }
set { _Status = value; }
}
public FormatEventArgs(string status)
{
_Status = status;
}
}
public delegate void FormatEvent(object sender,FormatEventArgs args); public delegate void FormatEvent(object sender,FormatEventArgs args);
public partial class Format:IFormatOrFormatInfo public partial class Format:IFormatOrFormatInfo
{ {
#region PlantFormat #region PlantFormat
[NonSerialized] [NonSerialized]
private PlantFormat _PlantFormat; private PlantFormat _PlantFormat;
public PlantFormat PlantFormat public PlantFormat PlantFormat => _PlantFormat ?? (_PlantFormat = new PlantFormat(this, Config));
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this, Config)); } } #endregion
#endregion public static event FormatEvent FormatLoaded;
public static event FormatEvent FormatLoaded; private static void OnFormatLoaded(object sender, FormatEventArgs args) => FormatLoaded?.Invoke(sender, args);
private static void OnFormatLoaded(object sender, FormatEventArgs args) public IFormatOrFormatInfo MyIParent => MyParent;
{ public override string ToString() => FullName;
if (FormatLoaded != null) public string FullName
FormatLoaded(sender, args);
}
public IFormatOrFormatInfo MyIParent { get { return MyParent; } }
public override string ToString()
{
//return Name;
//return PlantFormat.FormatData.Name;
return FullName;
}
public string FullName
{ {
get get
{ {
if (ParentID == 1) return Description + " (" + Name + ")"; if (ParentID == 1) return $"{Description} ({Name})";
if (Description.StartsWith("*")) return Description.Substring(1) + " (" + Name + ")"; if (Description.StartsWith("*")) return $"{Description.Substring(1)} ({Name})";
// C2019-029: if UCF, just use description & name, using parent is confusing // C2019-029: if UCF, just use description & name, using parent is confusing
if (Config != null && Config != "") return Description + " (" + Name + ")"; if (Config != null && Config != "") return $"{Description} ({Name})";
return MyParent.Description + " - " + Description + " (" + Name + ")"; return $"{MyParent.Description} - {Description} ({Name})";
} }
} }
public static void UpdateFormats(string fmtPath, string genmacPath) public static void UpdateFormats(string fmtPath, string genmacPath)
{ {
Format basefmt = null; // Load base format.
Format parent = null; Format basefmt = AddFormatToDB(null, "base", false, "Migration", fmtPath, genmacPath);
if (basefmt == null) return;
// Load base format.
basefmt = AddFormatToDB(null, "base", false, DateTime.Now, "Migration", fmtPath, genmacPath);
if (basefmt == null) return;
// now loop through all files... If there is an _ in the name, it's a subformat // now loop through all files... If there is an _ in the name, it's a subformat
// (for example, AEP_00.xml) skip it in main loop, it's handled for each format. // (for example, AEP_00.xml) skip it in main loop, it's handled for each format.
DirectoryInfo di = new DirectoryInfo(fmtPath); //(@"c:\development\fmtall"); DirectoryInfo di = new DirectoryInfo(fmtPath); //(@"c:\development\fmtall");
FileInfo[] fis = di.GetFiles("*.xml"); FileInfo[] fis = di.GetFiles("*.xml");
OnFormatLoaded(null, new FormatEventArgs(fis.Length.ToString() + " Formats to Load")); OnFormatLoaded(null, new FormatEventArgs($"{fis.Length} Formats to Load"));
foreach (FileInfo fi in fis) foreach (FileInfo fi in fis)
{ {
//if (fi.Name.ToUpper() == "WCN2ALL.XML"|| fi.Name.ToUpper() == "OHLPALL.XML") bool issub = (fi.Name.IndexOf("_") > 0);
//{
bool issub = (fi.Name.IndexOf("_") > 0) ? true : false;
if (!issub && fi.Name.ToLower() != "baseall.xml") if (!issub && fi.Name.ToLower() != "baseall.xml")
{ {
string fmtname = fi.Name.Substring(0, fi.Name.Length - 7); string fmtname = fi.Name.Substring(0, fi.Name.Length - 7);
// remove the all.xml part of the filename. // remove the all.xml part of the filename.
try try
{ {
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration", fmtPath, genmacPath); Format parent = AddFormatToDB(basefmt, fmtname, issub, "Migration", fmtPath, genmacPath);
if (parent != null) if (parent != null)
{ {
// now see if there are any subformats associated with this, if so // now see if there are any subformats associated with this, if so
// add them here... // add them here...
DirectoryInfo sdi = new DirectoryInfo(fmtPath); //("c:\\development\\fmtall"); DirectoryInfo sdi = new DirectoryInfo(fmtPath); //("c:\\development\\fmtall");
FileInfo[] sfis = di.GetFiles(fmtname + "_*.xml"); FileInfo[] sfis = di.GetFiles($"{fmtname}_*.xml");
foreach (FileInfo sfi in sfis) foreach (FileInfo sfi in sfis)
{ {
string nm = sfi.Name.Substring(0, sfi.Name.Length - 7); string nm = sfi.Name.Substring(0, sfi.Name.Length - 7);
OnFormatLoaded(null, new FormatEventArgs("Loading SubFormat " + sfi.Name)); OnFormatLoaded(null, new FormatEventArgs($"Loading SubFormat {sfi.Name}"));
//Console.WriteLine("Processing {0}", sfi.Name);
//frmMain.Status = string.Format("Processing Format {0}", sfi.Name);
try try
{ {
AddFormatToDB(parent, nm, true, DateTime.Now, "Migration",fmtPath,genmacPath); AddFormatToDB(parent, nm, true, "Migration",fmtPath,genmacPath);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -242,7 +205,7 @@ namespace VEPROMS.CSLA.Library
string fmtname = Path.GetFileNameWithoutExtension(fi.Name); string fmtname = Path.GetFileNameWithoutExtension(fi.Name);
try try
{ {
AddEPFormatToDB(fmtname, DateTime.Now, VlnSettings.UserID, epPath); AddEPFormatToDB(fmtname, VlnSettings.UserID, epPath);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -283,16 +246,15 @@ namespace VEPROMS.CSLA.Library
_ = LookupFormats; _ = LookupFormats;
} }
private static Format AddFormatToDB(Format parent, string format, bool issub, DateTime Dts, string Userid, string fmtPath, string genmacPath) private static Format AddFormatToDB(Format parent, string format, bool issub, string Userid, string fmtPath, string genmacPath)
{ {
string fmtdata = null; string fmtdata = null;
FileInfo fmtfi = null; FileInfo fmtfi = null;
string genmacdata = null; string genmacdata = null;
XmlDocument xd = null; XmlDocument xd = null;
OnFormatLoaded(null, new FormatEventArgs("Loading Format "+format)); OnFormatLoaded(null, new FormatEventArgs($"Loading Format {format}"));
//string path = "c:\\development\\fmtall\\" + format + "all.xml"; string path = $"{fmtPath}\\{format}all.xml";
string path = fmtPath + "\\" + format + "all.xml";
if (File.Exists(path)) if (File.Exists(path))
{ {
try try
@@ -301,12 +263,11 @@ namespace VEPROMS.CSLA.Library
fmtfi = new FileInfo(path); fmtfi = new FileInfo(path);
xd = new XmlDocument(); xd = new XmlDocument();
xd.Load(srf); xd.Load(srf);
//xd.Load(path);
fmtdata = xd.OuterXml; fmtdata = xd.OuterXml;
} }
catch (Exception ex) catch (Exception)
{ {
OnFormatLoaded(null, new FormatEventArgs("Error Loading Format " + format)); OnFormatLoaded(null, new FormatEventArgs($"Error Loading Format {format}"));
_MyLog.ErrorFormat("AddFormatToDB('{0}','{1}')", (parent == null)?"Base": parent.Name, path); _MyLog.ErrorFormat("AddFormatToDB('{0}','{1}')", (parent == null)?"Base": parent.Name, path);
return null; return null;
} }
@@ -315,8 +276,7 @@ namespace VEPROMS.CSLA.Library
// Do we need genmac - only if non-subformat // Do we need genmac - only if non-subformat
if (!issub) if (!issub)
{ {
//path = "c:\\development\\genmacall\\" + format + ".svg"; path = $"{genmacPath}\\{format}.svg";
path = genmacPath + "\\" + format + ".svg";
if (File.Exists(path)) if (File.Exists(path))
{ {
try try
@@ -327,9 +287,8 @@ namespace VEPROMS.CSLA.Library
//xdg.Load(path); //xdg.Load(path);
genmacdata = xdg.OuterXml; genmacdata = xdg.OuterXml;
} }
catch (Exception ex) catch (Exception)
{ {
//frmMain.AddError(ex, "AddFormatToDB('{0}','{1}')", parent.Name, path);
_MyLog.ErrorFormat("AddFormatToDB('{0}','{1}')", parent.Name, path); _MyLog.ErrorFormat("AddFormatToDB('{0}','{1}')", parent.Name, path);
return null; return null;
} }
@@ -344,12 +303,11 @@ namespace VEPROMS.CSLA.Library
if (parent != null) if (parent != null)
{ {
XmlNode nmnode = xd.SelectSingleNode("//FormatData"); XmlNode nmnode = xd.SelectSingleNode("//FormatData");
if (nmnode is XmlElement) if (nmnode is XmlElement xm)
{ {
XmlElement xm = (XmlElement)nmnode; nmattr = xm.GetAttribute("Name");
nmattr = xm.GetAttribute("Name"); }
} }
}
// use the format name if base or non sub. If it's a sub, remove the "_". // use the format name if base or non sub. If it's a sub, remove the "_".
string fname = issub ? format.Replace("_", "") : format; string fname = issub ? format.Replace("_", "") : format;
Format rec = null; Format rec = null;
@@ -369,40 +327,39 @@ namespace VEPROMS.CSLA.Library
rec = rec.Save(); rec = rec.Save();
} }
} }
catch (Exception ex) catch (Exception)
{ {
//frmMain.AddError(ex, "AddFormatToDB-make format('{0}','{1}')", parent.Name, path); //Do Nothing --- if Debugging: frmMain.AddError(ex, "AddFormatToDB-make format('{0}','{1}')", parent.Name, path);
} }
return rec; return rec;
} }
//C2025-023 - Electronic Procedures - Modifications to PROMS //C2025-023 - Electronic Procedures - Modifications to PROMS
//Procedure to load the EP format fiels into the DB //Procedure to load the EP format fiels into the DB
private static void AddEPFormatToDB(string formatname, DateTime Dts, string Userid, string epPath) private static void AddEPFormatToDB(string formatname, string Userid, string epPath)
{ {
string fmtdata = null; string fmtdata = null;
FileInfo fmtfi = null; OnFormatLoaded(null, new FormatEventArgs($"Loading Format {formatname}"));
XmlDocument xd = null;
OnFormatLoaded(null, new FormatEventArgs("Loading Format " + formatname)); string path = Path.Combine(epPath, $"{formatname}.xml");
string path = Path.Combine(epPath, formatname + ".xml");
if (File.Exists(path)) if (File.Exists(path))
{ {
try try
{ {
using (StreamReader srf = new StreamReader(path)) using (StreamReader srf = new StreamReader(path))
{ {
fmtfi = new FileInfo(path); FileInfo fmtfi = new FileInfo(path);
xd = new XmlDocument(); XmlDocument xd = new XmlDocument
xd.XmlResolver = null; {
xd.Load(srf); XmlResolver = null
};
xd.Load(srf);
fmtdata = xd.OuterXml; fmtdata = xd.OuterXml;
} }
} }
catch (Exception ex) catch (Exception)
{ {
OnFormatLoaded(null, new FormatEventArgs("Error Loading Format " + formatname)); OnFormatLoaded(null, new FormatEventArgs($"Error Loading Format {formatname}"));
_MyLog.ErrorFormat($"AddEPFormatToDB('{path}')"); _MyLog.ErrorFormat($"AddEPFormatToDB('{path}')");
return; return;
} }
@@ -414,7 +371,7 @@ namespace VEPROMS.CSLA.Library
{ {
EPFormatFile.UpdateEPFormat(formatname, fmtdata, Userid); EPFormatFile.UpdateEPFormat(formatname, fmtdata, Userid);
} }
catch (Exception ex) catch (Exception)
{ {
_MyLog.ErrorFormat($"AddFormatToDB-make format('{path}')"); _MyLog.ErrorFormat($"AddFormatToDB-make format('{path}')");
} }
@@ -441,13 +398,10 @@ public partial class FormatInfo : IFormatOrFormatInfo
[Serializable()] [Serializable()]
private class FormatIDCriteria private class FormatIDCriteria
{ {
private int _FormatID; private readonly int _FormatID;
public int FormatID { get { return _FormatID; } } public int FormatID => _FormatID;
public FormatIDCriteria(int formatID) public FormatIDCriteria(int formatID) => _FormatID = formatID;
{ }
_FormatID = formatID;
}
}
private void DataPortal_Fetch(FormatIDCriteria criteria) private void DataPortal_Fetch(FormatIDCriteria criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfoList.DataPortal_Fetch", GetHashCode());
@@ -478,17 +432,10 @@ public partial class FormatInfo : IFormatOrFormatInfo
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex); throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
} }
} }
//end transition report stuff //end transition report stuff
public virtual Format GetJustFormat() public virtual Format GetJustFormat() => _Editable = Format.GetJustFormat(_FormatID);
{ public static bool HasLatestChanges() => HasSeqTabFmtTabToken();
return _Editable = Format.GetJustFormat(_FormatID); private static bool HasSeqTabFmtTabToken()
}
public static bool HasLatestChanges()
{
if (!HasSeqTabFmtTabToken()) return false;
return true;
}
private static bool HasSeqTabFmtTabToken()
{ {
using (FormatInfo fi = FormatInfo.Get("WCN2")) using (FormatInfo fi = FormatInfo.Get("WCN2"))
{ {
@@ -517,17 +464,13 @@ public partial class FormatInfo : IFormatOrFormatInfo
return _PROMSBaseFormat; return _PROMSBaseFormat;
} }
} }
public static void Reset() public static void Reset() => _PROMSBaseFormat = null;
{
_PROMSBaseFormat = null;
}
public static FormatInfo Get(string name) public static FormatInfo Get(string name)
{ {
try try
{ {
FormatInfo tmp = DataPortal.Fetch<FormatInfo>(new NameCriteria(name)); FormatInfo tmp = DataPortal.Fetch<FormatInfo>(new NameCriteria(name));
//AddToCache(tmp);
if (tmp.ErrorMessage == "No Record Found") if (tmp.ErrorMessage == "No Record Found")
{ {
tmp.Dispose(); // Clean-up FormatInfo tmp.Dispose(); // Clean-up FormatInfo
@@ -563,14 +506,10 @@ public partial class FormatInfo : IFormatOrFormatInfo
} }
protected class NameCriteria protected class NameCriteria
{ {
private string _Name; private readonly string _Name;
public string Name public string Name => _Name;
{ get { return _Name; } } public NameCriteria(string name) => _Name = name;
public NameCriteria(string name) }
{
_Name = name;
}
}
private void DataPortal_Fetch(NameCriteria criteria) private void DataPortal_Fetch(NameCriteria criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode());
@@ -611,17 +550,11 @@ public partial class FormatInfo : IFormatOrFormatInfo
#region PlantFormat #region PlantFormat
[NonSerialized] [NonSerialized]
private PlantFormat _PlantFormat; private PlantFormat _PlantFormat;
public PlantFormat PlantFormat public PlantFormat PlantFormat => _PlantFormat ?? (_PlantFormat = new PlantFormat(this, Config));
{ get { return (_PlantFormat != null ? _PlantFormat : _PlantFormat = new PlantFormat(this, Config)); } } #endregion
#endregion public IFormatOrFormatInfo MyIParent => MyParent;
public IFormatOrFormatInfo MyIParent { get { return MyParent; } } public override string ToString() => FullName;
public override string ToString() public string FullName
{
//return Name;
//return PlantFormat.FormatData.Name;
return FullName;
}
public string FullName
{ {
get get
{ {
@@ -632,15 +565,9 @@ public partial class FormatInfo : IFormatOrFormatInfo
return MyParent.Description + " - " + Description + " (" + Name + ")"; return MyParent.Description + " - " + Description + " (" + Name + ")";
} }
} }
public StepSectionLayoutData MyStepSectionLayoutData public StepSectionLayoutData MyStepSectionLayoutData => PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData;
{ public StepSectionPrintData MyStepSectionPrintData => PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData;
get { return PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData; } }
}
public StepSectionPrintData MyStepSectionPrintData
{
get { return PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData; }
}
}
public partial class FormatInfoList public partial class FormatInfoList
{ {
/// <summary> /// <summary>
@@ -658,7 +585,8 @@ public partial class FormatInfo : IFormatOrFormatInfo
throw new DbCslaException("Error on FormatInfoList.GetAll", ex); throw new DbCslaException("Error on FormatInfoList.GetAll", ex);
} }
} }
private void DataPortal_Fetch(CriteriaAllFormats myCrit) [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping until replace CSLA")]
private void DataPortal_Fetch(CriteriaAllFormats myCrit)
{ {
this.RaiseListChangedEvents = false; this.RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfoList.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfoList.DataPortal_Fetch", GetHashCode());
@@ -716,7 +644,8 @@ public partial class FormatInfo : IFormatOrFormatInfo
protected class FormatInfoListUsedCriteria protected class FormatInfoListUsedCriteria
{ {
} }
private void DataPortal_Fetch(FormatInfoListUsedCriteria criteria) [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping until replace CSLA")]
private void DataPortal_Fetch(FormatInfoListUsedCriteria criteria)
{ {
try try
{ {
@@ -749,13 +678,13 @@ public partial class FormatInfo : IFormatOrFormatInfo
} }
public class FormatVersion public class FormatVersion
{ {
private string _Title; private readonly string _Title;
public string Title { get { return _Title; } } public string Title => _Title;
private int _FormatID; private readonly int _FormatID;
public int FormatID { get { return _FormatID; } } public int FormatID => _FormatID;
private int _VersionID; private readonly int _VersionID;
public int VersionID { get { return _VersionID; } } public int VersionID => _VersionID;
public FormatVersion(string title, int formatID, int versionID) public FormatVersion(string title, int formatID, int versionID)
{ {
_Title = title; _Title = title;
_FormatID = formatID; _FormatID = formatID;
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
@@ -12,69 +11,23 @@ namespace VEPROMS.CSLA.Library
// B2022-047 - refresh the Content/Text field for table. Get all grids in database. // B2022-047 - refresh the Content/Text field for table. Get all grids in database.
public class CriteriaAllGridIds public class CriteriaAllGridIds
{ {
bool _AllGridIds; public bool AllGridIds { get; set; }
public bool AllGridIds public CriteriaAllGridIds(bool allGridIds) => AllGridIds = allGridIds;
{ }
get { return _AllGridIds; }
set { _AllGridIds = value; }
}
public CriteriaAllGridIds(bool allGridIds)
{
_AllGridIds = allGridIds;
}
}
[Serializable()] [Serializable()]
[TypeConverter(typeof(FormatInfoListConverter))] [TypeConverter(typeof(FormatInfoListConverter))]
public partial class GridInfoList : ReadOnlyListBase<GridInfoList, GridInfo> public partial class GridInfoList : ReadOnlyListBase<GridInfoList, GridInfo>
{ {
#region Log4Net #region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
internal new IList<GridInfo> Items private bool _Disposed = false;
{ get { return base.Items; } }
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
~GridInfoList()
{
_CountFinalized++;
}
public void Dispose() public void Dispose()
{ {
if (_Disposed) return; if (_Disposed) return;
_CountDisposed++;
_Disposed = true; _Disposed = true;
} }
public static GridInfoList _GridInfoList = null; public static GridInfoList _GridInfoList = null;
/// <summary>
/// Return a list of all GridInfo. Commented out - GridInfoList was added to fix B2022-047. Have this code here in
/// case it is needed in the future.
/// </summary>
//public static GridInfoList Get()
//{
// try
// {
// if (_GridInfoList != null)
// return _GridInfoList;
// GridInfoList tmp = DataPortal.Fetch<GridInfoList>();
// _GridInfoList = tmp;
// return tmp;
// }
// catch (Exception ex)
// {
// throw new DbCslaException("Error on FormatInfoList.Get", ex);
// }
//}
public static List<int> GetIds() public static List<int> GetIds()
{ {
try try
@@ -108,53 +61,17 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on GridInfoList.Get", ex); throw new DbCslaException("Error on GridInfoList.Get", ex);
} }
} }
// Commented out - GridInfoList was added to fix B2022-047. Have this code here in
// case it is needed in the future. The associated query 'getGrids' does not exist.
//private void DataPortal_Fetch()
//{
// this.RaiseListChangedEvents = false;
// if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GridInfoList.DataPortal_Fetch", GetHashCode());
// try
// {
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
// {
// using (SqlCommand cm = cn.CreateCommand())
// {
// cm.CommandType = CommandType.StoredProcedure;
// cm.CommandText = "getGrids";
// cm.CommandTimeout = Database.DefaultTimeout;
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
// {
// IsReadOnly = false;
// while (dr.Read()) this.Add(new GridInfo(dr));
// IsReadOnly = true;
// }
// }
// }
// }
// catch (Exception ex)
// {
// if (_MyLog.IsErrorEnabled) _MyLog.Error("GridInfoList.DataPortal_Fetch", ex);
// throw new DbCslaException("GridInfoList.DataPortal_Fetch", ex);
// }
// this.RaiseListChangedEvents = true;
//}
} }
public partial class GridInfo public partial class GridInfo
{ {
public void ResetContent(Grid myGrid) public void ResetContent(Grid myGrid) => RefreshFields(myGrid);
{ public void SetData(string myData)
RefreshFields(myGrid);
}
public void SetData(string myData)
{ {
_Data = myData; _Data = myData;
RemoveFromCache(this); RemoveFromCache(this);
} }
public static GridInfo GetNonCached(int contentID) public static GridInfo GetNonCached(int contentID)
{ {
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a Grid");
try try
{ {
GridInfo tmp = DataPortal.Fetch<GridInfo>(new PKCriteria(contentID)); GridInfo tmp = DataPortal.Fetch<GridInfo>(new PKCriteria(contentID));
File diff suppressed because it is too large Load Diff
@@ -1,19 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
public partial class ItemInfo public partial class ItemInfo
{ {
public ItemInfo SearchNext public ItemInfo SearchNext => SearchNextSkip(SkipPartType.This);
{ private ItemInfo SearchNextSkip(SkipPartType skip)
get
{
return SearchNextSkip(SkipPartType.This);
}
}
private ItemInfo SearchNextSkip(SkipPartType skip)
{ {
if (skip < SkipPartType.Caution && Cautions != null && Cautions.Count > 0) return Cautions[0].SearchTop; if (skip < SkipPartType.Caution && Cautions != null && Cautions.Count > 0) return Cautions[0].SearchTop;
if (skip < SkipPartType.Note && Notes != null && Notes.Count > 0) return Notes[0].SearchTop; if (skip < SkipPartType.Note && Notes != null && Notes.Count > 0) return Notes[0].SearchTop;
@@ -28,9 +18,8 @@ namespace VEPROMS.CSLA.Library
bool iseditable = true; bool iseditable = true;
if (IsSection) if (IsSection)
{ {
SectionConfig sc = MyConfig as SectionConfig; if (MyConfig is SectionConfig sc && sc.SubSection_Edit != "Y") iseditable = false;
if (sc != null && sc.SubSection_Edit != "Y") iseditable = false; }
}
if (iseditable && skip < SkipPartType.Steps && Steps != null && Steps.Count > 0) return Steps[0].SearchTop; if (iseditable && skip < SkipPartType.Steps && Steps != null && Steps.Count > 0) return Steps[0].SearchTop;
if (NextItem != null) return NextItem.SearchTop; if (NextItem != null) return NextItem.SearchTop;
@@ -49,9 +38,8 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
ItemInfo parentItem = ActiveParent as ItemInfo; if (!(ActiveParent is ItemInfo parentItem)) return null;
if (parentItem == null) return null; if (IsCautionPart) return parentItem.SearchNextSkip(SkipPartType.Caution);
if (IsCautionPart) return parentItem.SearchNextSkip(SkipPartType.Caution);
if (IsNotePart) return parentItem.SearchNextSkip(SkipPartType.Note); if (IsNotePart) return parentItem.SearchNextSkip(SkipPartType.Note);
if (IsRNOPart) return parentItem.SearchNextSkip(SkipPartType.RNO); if (IsRNOPart) return parentItem.SearchNextSkip(SkipPartType.RNO);
if (IsSupInfoPart) return parentItem.SearchNextSkip(SkipPartType.SupInfo); if (IsSupInfoPart) return parentItem.SearchNextSkip(SkipPartType.SupInfo);
@@ -63,14 +51,8 @@ namespace VEPROMS.CSLA.Library
return parentItem.UpOneNext; return parentItem.UpOneNext;
} }
} }
public ItemInfo SearchPrev public ItemInfo SearchPrev => SearchPrevSkip(SkipPartType.This);
{ private ItemInfo SearchPrevSkip(SkipPartType skip)
get
{
return SearchPrevSkip(SkipPartType.This);
}
}
private ItemInfo SearchPrevSkip(SkipPartType skip)
{ {
if (skip > SkipPartType.Steps && Steps != null) return Steps[0].LastSibling.SearchBottom; if (skip > SkipPartType.Steps && Steps != null) return Steps[0].LastSibling.SearchBottom;
if (skip > SkipPartType.Sections && Sections != null) return Sections[0].LastSibling.SearchBottom; if (skip > SkipPartType.Sections && Sections != null) return Sections[0].LastSibling.SearchBottom;
@@ -101,9 +83,8 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
ItemInfo parentItem = ActiveParent as ItemInfo; if (!(ActiveParent is ItemInfo parentItem)) return null;
if (parentItem == null) return null; if (IsCautionPart) return parentItem.SearchPrevSkip(SkipPartType.Caution);
if (IsCautionPart) return parentItem.SearchPrevSkip(SkipPartType.Caution);
if (IsNotePart) return parentItem.SearchPrevSkip(SkipPartType.Note); if (IsNotePart) return parentItem.SearchPrevSkip(SkipPartType.Note);
if (IsRNOPart) return parentItem.SearchPrevSkip(SkipPartType.RNO); if (IsRNOPart) return parentItem.SearchPrevSkip(SkipPartType.RNO);
if (IsSupInfoPart) return parentItem.SearchPrevSkip(SkipPartType.SupInfo); if (IsSupInfoPart) return parentItem.SearchPrevSkip(SkipPartType.SupInfo);
File diff suppressed because it is too large Load Diff
@@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Text.RegularExpressions;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
@@ -23,13 +21,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
public class CanCheckOutItemCriteria public class CanCheckOutItemCriteria
{ {
private int _ObjectID; private readonly int _ObjectID;
public int ObjectID public int ObjectID => _ObjectID;
{ get { return _ObjectID; } } private readonly CheckOutType _ObjectType;
private CheckOutType _ObjectType; public CheckOutType ObjectType => _ObjectType;
public CheckOutType ObjectType public CanCheckOutItemCriteria(int objectID, CheckOutType objectType)
{ get { return _ObjectType; } }
public CanCheckOutItemCriteria(int objectID, CheckOutType objectType)
{ {
_ObjectID = objectID; _ObjectID = objectID;
_ObjectType = objectType; _ObjectType = objectType;
@@ -37,7 +33,7 @@ namespace VEPROMS.CSLA.Library
} }
private void DataPortal_Fetch(CanCheckOutItemCriteria criteria) private void DataPortal_Fetch(CanCheckOutItemCriteria criteria)
{ {
this.RaiseListChangedEvents = false; RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] SessionInfoList.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] SessionInfoList.DataPortal_Fetch", GetHashCode());
try try
{ {
@@ -53,7 +49,7 @@ namespace VEPROMS.CSLA.Library
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{ {
IsReadOnly = false; IsReadOnly = false;
while (dr.Read()) this.Add(new SessionInfo(dr)); while (dr.Read()) Add(new SessionInfo(dr));
IsReadOnly = true; IsReadOnly = true;
} }
} }
@@ -64,7 +60,7 @@ namespace VEPROMS.CSLA.Library
if (_MyLog.IsErrorEnabled) _MyLog.Error("SessionInfoList.DataPortal_Fetch", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("SessionInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("SessionInfoList.DataPortal_Fetch", ex); throw new DbCslaException("SessionInfoList.DataPortal_Fetch", ex);
} }
this.RaiseListChangedEvents = true; RaiseListChangedEvents = true;
} }
} }
#endregion #endregion
@@ -72,8 +68,8 @@ namespace VEPROMS.CSLA.Library
#region SessionInfo stuff #region SessionInfo stuff
public partial class SessionInfo public partial class SessionInfo
{ {
private Int64 _LastContentChange; private long _LastContentChange;
public Int64 LastContentChange public long LastContentChange
{ {
get { return _LastContentChange; } get { return _LastContentChange; }
set { _LastContentChange = value; } set { _LastContentChange = value; }
@@ -88,15 +84,9 @@ namespace VEPROMS.CSLA.Library
} }
set { _LastChanged = value; } set { _LastChanged = value; }
} }
public string LastChangedString public string LastChangedString => ContentInfo.FormatByteArray(_LastChanged);
{ public long LastChangedInt64 => Convert.ToInt64(LastChangedString, 16);
get { return ContentInfo.FormatByteArray(_LastChanged); } public static SessionInfo BeginSession(string machineName, int processID)
}
public Int64 LastChangedInt64
{
get { return Convert.ToInt64(LastChangedString, 16); }
}
public static SessionInfo BeginSession(string machineName, int processID)
{ {
try try
{ {
@@ -113,14 +103,14 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on SessionInfo.BeginSession", ex); throw new DbCslaException("Error on SessionInfo.BeginSession", ex);
} }
} }
private Dictionary<int, Int64> _ChangedContents; private Dictionary<int, long> _ChangedContents;
public Dictionary<int, Int64> ChangedContents public Dictionary<int, long> ChangedContents
{ {
get { return _ChangedContents; } get { return _ChangedContents; }
set { _ChangedContents = value; } set { _ChangedContents = value; }
} }
private Dictionary<int, Int64> _ChangedItems; private Dictionary<int, long> _ChangedItems;
public Dictionary<int, Int64> ChangedItems public Dictionary<int, long> ChangedItems
{ {
get { return _ChangedItems; } get { return _ChangedItems; }
set { _ChangedItems = value; } set { _ChangedItems = value; }
@@ -131,10 +121,10 @@ namespace VEPROMS.CSLA.Library
try try
{ {
List<int> myList = new List<int>(); List<int> myList = new List<int>();
SessionPing.Execute(this.SessionID); SessionPing.Execute(SessionID);
ChangedContents = SessionChangedContents.Execute(this.LastContentChange); ChangedContents = SessionChangedContents.Execute(LastContentChange);
ChangedItems = SessionChangedItems.Execute(this.LastContentChange); ChangedItems = SessionChangedItems.Execute(LastContentChange);
OwnerInfoList oil = OwnerInfoList.GetBySessionID(this.SessionID); OwnerInfoList oil = OwnerInfoList.GetBySessionID(SessionID);
foreach (OwnerInfo oi in oil) foreach (OwnerInfo oi in oil)
myList.Add(oi.OwnerID); myList.Add(oi.OwnerID);
return myList; return myList;
@@ -144,11 +134,8 @@ namespace VEPROMS.CSLA.Library
return null; return null;
} }
} }
public void EndSession() public void EndSession() => SessionEnd.Execute(SessionID);
{ public bool CanCheckOutItem(int objectID, CheckOutType objectType, ref string message)
SessionEnd.Execute(this.SessionID);
}
public bool CanCheckOutItem(int objectID, CheckOutType objectType, ref string message)
{ {
try try
{ {
@@ -178,7 +165,7 @@ namespace VEPROMS.CSLA.Library
// C2015-022 part of separate windows logic, check the processID instead of the sessionID // C2015-022 part of separate windows logic, check the processID instead of the sessionID
foreach (SessionInfo si in sil) foreach (SessionInfo si in sil)
{ {
if (si.ProcessID != this.ProcessID && objectType == CheckOutType.Procedure) if (si.ProcessID != ProcessID && objectType == CheckOutType.Procedure)
{ {
//B2024-074 If no Number for Procedure, Display Title //B2024-074 If no Number for Procedure, Display Title
ProcedureInfo tmpproc = ItemInfo.Get(objectID).MyProcedure; ProcedureInfo tmpproc = ItemInfo.Get(objectID).MyProcedure;
@@ -189,12 +176,12 @@ namespace VEPROMS.CSLA.Library
message = string.Format("The procedure {0} is already checked out to {1}.\r\nWould You like to open the procedure in View Only Mode?", name, si.UserID); message = string.Format("The procedure {0} is already checked out to {1}.\r\nWould You like to open the procedure in View Only Mode?", name, si.UserID);
rv = rv && false; rv = rv && false;
} }
else if (si.ProcessID != this.ProcessID && objectType == CheckOutType.Document) else if (si.ProcessID != ProcessID && objectType == CheckOutType.Document)
{ {
message = string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(objectID).DocumentEntries[0].MyContent.Text, si.UserID); message = string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(objectID).DocumentEntries[0].MyContent.Text, si.UserID);
rv = rv && false; rv = rv && false;
} }
else if (si.ProcessID != this.ProcessID && objectType == CheckOutType.DocVersion) else if (si.ProcessID != ProcessID && objectType == CheckOutType.DocVersion)
{ {
// gets here if other session has working draft open & click on sam working draft. // gets here if other session has working draft open & click on sam working draft.
OwnerInfo oi = OwnerInfo.GetBySessionIDandVersionID(si.SessionID, objectID); OwnerInfo oi = OwnerInfo.GetBySessionIDandVersionID(si.SessionID, objectID);
@@ -213,10 +200,10 @@ namespace VEPROMS.CSLA.Library
else if (oi.OwnerType == 1) else if (oi.OwnerType == 1)
message = message + string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(oi.OwnerItemID).DocumentEntries[0].MyContent.Text, si.UserID) + Environment.NewLine; message = message + string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(oi.OwnerItemID).DocumentEntries[0].MyContent.Text, si.UserID) + Environment.NewLine;
else if (oi.OwnerType == 2) else if (oi.OwnerType == 2)
message = message + string.Format("The working draft is already checked out to {0}", si.UserID); message += string.Format("The working draft is already checked out to {0}", si.UserID);
rv = rv && false; rv = rv && false;
} }
else if (si.ProcessID != this.ProcessID && objectType == CheckOutType.Folder) else if (si.ProcessID != ProcessID && objectType == CheckOutType.Folder)
{ {
// gets here if other session has working draft open & click on folder above. Gets here // gets here if other session has working draft open & click on folder above. Gets here
// if other session has wd open and click on top folder - query returns empty. // if other session has wd open and click on top folder - query returns empty.
@@ -236,9 +223,9 @@ namespace VEPROMS.CSLA.Library
else if (oi.OwnerType == 1) else if (oi.OwnerType == 1)
message = message + string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(oi.OwnerItemID).DocumentEntries[0].MyContent.Text, si.UserID) + Environment.NewLine; message = message + string.Format("The document {0} is already checked out to {1}", DocumentInfo.Get(oi.OwnerItemID).DocumentEntries[0].MyContent.Text, si.UserID) + Environment.NewLine;
else if (oi.OwnerType == 2) else if (oi.OwnerType == 2)
message = message + string.Format("The working draft is already checked out to {0}", si.UserID); message += string.Format("The working draft is already checked out to {0}", si.UserID);
else if (oi.OwnerType == 3) else if (oi.OwnerType == 3)
message = message + string.Format("The folder is already checked out to {0}", si.UserID); message += string.Format("The folder is already checked out to {0}", si.UserID);
rv = rv && false; rv = rv && false;
} }
} }
@@ -251,16 +238,9 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on SessionInfo.Get", ex); throw new DbCslaException("Error on SessionInfo.Get", ex);
} }
} }
public int CheckOutItem(int itemID, CheckOutType itemType) public int CheckOutItem(int itemID, CheckOutType itemType) => SessionCheckOutItem.Execute(SessionID, itemID, itemType);
{ public void CheckInItem(int ownerID) => SessionCheckInItem.Execute(ownerID);
int ownerID = SessionCheckOutItem.Execute(this.SessionID, itemID, itemType); private void DataPortal_Fetch(BeginSessionCriteria criteria)
return ownerID;
}
public void CheckInItem(int ownerID)
{
SessionCheckInItem.Execute(ownerID);
}
private void DataPortal_Fetch(BeginSessionCriteria criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] SessionInfo.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] SessionInfo.DataPortal_Fetch", GetHashCode());
try try
@@ -298,78 +278,22 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("SessionInfo.DataPortal_Fetch", ex); throw new DbCslaException("SessionInfo.DataPortal_Fetch", ex);
} }
} }
//private void DataPortal_Fetch(CanCheckOutItemCriteria criteria)
//{
// if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] SessionInfo.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 = "vesp_SessionCanCheckOutItem";
// cm.Parameters.AddWithValue("@ObjectID", criteria.ObjectID);
// cm.Parameters.AddWithValue("@ObjectType", criteria.ObjectType);
// using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
// {
// while(dr.Read())
// 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("SessionInfo.DataPortal_Fetch", ex);
// _ErrorMessage = ex.Message;
// throw new DbCslaException("SessionInfo.DataPortal_Fetch", ex);
// }
//}
[Serializable()] [Serializable()]
protected class BeginSessionCriteria protected class BeginSessionCriteria
{ {
private string _UserID; private readonly string _UserID;
public string UserID public string UserID => _UserID;
{ get { return _UserID; } } private readonly string _MachineName;
private string _MachineName; public string MachineName => _MachineName;
public string MachineName private readonly int _ProcessID;
{ get { return _MachineName; } } public int ProcessID => _ProcessID;
private int _ProcessID; public BeginSessionCriteria(string userID, string machineName, int processID)
public int ProcessID
{ get { return _ProcessID; } }
public BeginSessionCriteria(string userID, string machineName, int processID)
{ {
_UserID = userID; _UserID = userID;
_MachineName = machineName; _MachineName = machineName;
_ProcessID = processID; _ProcessID = processID;
} }
} }
//[Serializable()]
//protected class CanCheckOutItemCriteria
//{
// private int _ObjectID;
// public int ObjectID
// { get { return _ObjectID; } }
// private CheckOutType _ObjectType;
// public CheckOutType ObjectType
// { get { return _ObjectType; } }
// public CanCheckOutItemCriteria(int objectID, CheckOutType objectType)
// {
// _ObjectID = objectID;
// _ObjectType = objectType;
// }
//}
} }
public class TurnChangeManagerOff : CommandBase public class TurnChangeManagerOff : CommandBase
{ {
@@ -473,20 +397,18 @@ namespace VEPROMS.CSLA.Library
public class SessionPing : CommandBase public class SessionPing : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private int _SessionID;
public int SessionID public int SessionID { get; set; }
{ #region Factory Methods
get { return _SessionID; } public static void Execute(int sessionID)
set { _SessionID = value; }
}
#region Factory Methods
public static void Execute(int sessionID)
{ {
try try
{ {
SessionPing cmd = new SessionPing(); SessionPing cmd = new SessionPing
cmd.SessionID = sessionID; {
DataPortal.Execute<SessionPing>(cmd); SessionID = sessionID
};
DataPortal.Execute<SessionPing>(cmd);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -521,18 +443,16 @@ namespace VEPROMS.CSLA.Library
public class SessionEnd : CommandBase public class SessionEnd : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private int _SessionID;
public int SessionID public int SessionID { get; set; }
#region Factory Methods
public static void Execute(int sessionID)
{ {
get { return _SessionID; } SessionEnd cmd = new SessionEnd
set { _SessionID = value; } {
} SessionID = sessionID
#region Factory Methods };
public static void Execute(int sessionID) DataPortal.Execute<SessionEnd>(cmd);
{
SessionEnd cmd = new SessionEnd();
cmd.SessionID = sessionID;
DataPortal.Execute<SessionEnd>(cmd);
} }
#endregion #endregion
#region Server-Side code #region Server-Side code
@@ -562,38 +482,21 @@ namespace VEPROMS.CSLA.Library
public class SessionCheckOutItem : CommandBase public class SessionCheckOutItem : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private int _SessionID;
public int SessionID public int SessionID { get; set; }
public int ItemID { get; set; }
public int ItemType { get; set; }
public int OwnerID { get; set; }
#region Factory Methods
public static int Execute(int sessionID, int itemID, CheckOutType itemType)
{ {
get { return _SessionID; } SessionCheckOutItem cmd = new SessionCheckOutItem
set { _SessionID = value; } {
} SessionID = sessionID,
private int _ItemID; ItemID = itemID,
public int ItemID ItemType = (int)itemType
{ };
get { return _ItemID; } cmd = DataPortal.Execute<SessionCheckOutItem>(cmd);
set { _ItemID = value; }
}
private int _ItemType;
public int ItemType
{
get { return _ItemType; }
set { _ItemType = value; }
}
private int _OwnerID;
public int OwnerID
{
get { return _OwnerID; }
set { _OwnerID = value; }
}
#region Factory Methods
public static int Execute(int sessionID, int itemID, CheckOutType itemType)
{
SessionCheckOutItem cmd = new SessionCheckOutItem();
cmd.SessionID = sessionID;
cmd.ItemID = itemID;
cmd.ItemType = (int)itemType;
cmd = DataPortal.Execute<SessionCheckOutItem>(cmd);
return cmd.OwnerID; return cmd.OwnerID;
} }
#endregion #endregion
@@ -629,19 +532,16 @@ namespace VEPROMS.CSLA.Library
public class SessionCheckInItem : CommandBase public class SessionCheckInItem : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private int _OwnerID;
public int OwnerID public int OwnerID { get; set; }
#region Factory Methods
public static void Execute(int ownerID)
{ {
get { return _OwnerID; } SessionCheckInItem cmd = new SessionCheckInItem
set { _OwnerID = value; } {
} OwnerID = ownerID
private int _ItemID; };
#region Factory Methods DataPortal.Execute<SessionCheckInItem>(cmd);
public static void Execute(int ownerID)
{
SessionCheckInItem cmd = new SessionCheckInItem();
cmd.OwnerID = ownerID;
DataPortal.Execute<SessionCheckInItem>(cmd);
} }
#endregion #endregion
#region Server-Side code #region Server-Side code
@@ -671,24 +571,17 @@ namespace VEPROMS.CSLA.Library
public class SessionChangedContents : CommandBase public class SessionChangedContents : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Int64 _LastContentChange;
public Int64 LastContentChange public long LastContentChange { get; set; }
public Dictionary<int, long> ChangedContents { get; set; }
#region Factory Methods
public static Dictionary<int, long> Execute(long lastContentChanged)
{ {
get { return _LastContentChange; } SessionChangedContents cmd = new SessionChangedContents
set { _LastContentChange = value; } {
} LastContentChange = lastContentChanged
private Dictionary<int,Int64> _ChangedContents; };
public Dictionary<int, Int64> ChangedContents cmd = DataPortal.Execute<SessionChangedContents>(cmd);
{
get { return _ChangedContents; }
set { _ChangedContents = value; }
}
#region Factory Methods
public static Dictionary<int, Int64> Execute(Int64 lastContentChanged)
{
SessionChangedContents cmd = new SessionChangedContents();
cmd.LastContentChange = lastContentChanged;
cmd = DataPortal.Execute<SessionChangedContents>(cmd);
return cmd.ChangedContents; return cmd.ChangedContents;
} }
#endregion #endregion
@@ -706,9 +599,9 @@ namespace VEPROMS.CSLA.Library
cmd.Parameters.AddWithValue("@LastChanged", LastContentChange); cmd.Parameters.AddWithValue("@LastChanged", LastContentChange);
cmd.Parameters.AddWithValue("@UserID", Volian.Base.Library.VlnSettings.UserID); cmd.Parameters.AddWithValue("@UserID", Volian.Base.Library.VlnSettings.UserID);
SqlDataReader dr = cmd.ExecuteReader(); SqlDataReader dr = cmd.ExecuteReader();
ChangedContents = new Dictionary<int, Int64>(); ChangedContents = new Dictionary<int, long>();
while (dr.Read()) while (dr.Read())
ChangedContents.Add(dr.GetInt32(0), (Int64)dr.GetSqlInt64(1)); ChangedContents.Add(dr.GetInt32(0), (long)dr.GetSqlInt64(1));
} }
} }
} }
@@ -723,24 +616,17 @@ namespace VEPROMS.CSLA.Library
public class SessionChangedItems : CommandBase public class SessionChangedItems : CommandBase
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Int64 _LastContentChange;
public Int64 LastContentChange public long LastContentChange { get; set; }
public Dictionary<int, long> ChangedItems { get; set; }
#region Factory Methods
public static Dictionary<int, long> Execute(long lastContentChanged)
{ {
get { return _LastContentChange; } SessionChangedItems cmd = new SessionChangedItems
set { _LastContentChange = value; } {
} LastContentChange = lastContentChanged
private Dictionary<int, Int64> _ChangedItems; };
public Dictionary<int, Int64> ChangedItems cmd = DataPortal.Execute<SessionChangedItems>(cmd);
{
get { return _ChangedItems; }
set { _ChangedItems = value; }
}
#region Factory Methods
public static Dictionary<int, Int64> Execute(Int64 lastContentChanged)
{
SessionChangedItems cmd = new SessionChangedItems();
cmd.LastContentChange = lastContentChanged;
cmd = DataPortal.Execute<SessionChangedItems>(cmd);
return cmd.ChangedItems; return cmd.ChangedItems;
} }
#endregion #endregion
@@ -758,9 +644,9 @@ namespace VEPROMS.CSLA.Library
cmd.Parameters.AddWithValue("@LastChanged", LastContentChange); cmd.Parameters.AddWithValue("@LastChanged", LastContentChange);
cmd.Parameters.AddWithValue("@UserID", Volian.Base.Library.VlnSettings.UserID); cmd.Parameters.AddWithValue("@UserID", Volian.Base.Library.VlnSettings.UserID);
SqlDataReader dr = cmd.ExecuteReader(); SqlDataReader dr = cmd.ExecuteReader();
ChangedItems = new Dictionary<int, Int64>(); ChangedItems = new Dictionary<int, long>();
while (dr.Read()) while (dr.Read())
ChangedItems.Add(dr.GetInt32(0), (Int64)dr.GetSqlInt64(1)); ChangedItems.Add(dr.GetInt32(0), (long)dr.GetSqlInt64(1));
} }
} }
} }
@@ -777,24 +663,17 @@ namespace VEPROMS.CSLA.Library
#region OwnerInfo stuff #region OwnerInfo stuff
public partial class OwnerInfoList public partial class OwnerInfoList
{ {
public static OwnerInfoList GetBySessionID(int sessionID) public static OwnerInfoList GetBySessionID(int sessionID) => DataPortal.Fetch<OwnerInfoList>(new GetBySessionIDCriteria(sessionID));
{ [Serializable()]
OwnerInfoList tmp = DataPortal.Fetch<OwnerInfoList>(new GetBySessionIDCriteria(sessionID));
return tmp;
}
[Serializable()]
protected class GetBySessionIDCriteria protected class GetBySessionIDCriteria
{ {
private int _SessionID; private readonly int _SessionID;
public int SessionID { get { return _SessionID; } } public int SessionID => _SessionID;
public GetBySessionIDCriteria(int sessionID) public GetBySessionIDCriteria(int sessionID) => _SessionID = sessionID;
{ }
_SessionID = sessionID;
}
}
private void DataPortal_Fetch(GetBySessionIDCriteria criteria) private void DataPortal_Fetch(GetBySessionIDCriteria criteria)
{ {
this.RaiseListChangedEvents = false; RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfoList.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfoList.DataPortal_Fetch", GetHashCode());
try try
{ {
@@ -809,7 +688,7 @@ namespace VEPROMS.CSLA.Library
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{ {
IsReadOnly = false; IsReadOnly = false;
while (dr.Read()) this.Add(new OwnerInfo(dr)); while (dr.Read()) Add(new OwnerInfo(dr));
IsReadOnly = true; IsReadOnly = true;
} }
} }
@@ -820,7 +699,7 @@ namespace VEPROMS.CSLA.Library
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfoList.DataPortal_Fetch", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("OwnerInfoList.DataPortal_Fetch", ex); throw new DbCslaException("OwnerInfoList.DataPortal_Fetch", ex);
} }
this.RaiseListChangedEvents = true; RaiseListChangedEvents = true;
} }
public static OwnerInfoList GetByVersionID(int versionID) public static OwnerInfoList GetByVersionID(int versionID)
{ {
@@ -839,16 +718,13 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class GetByVersionIDCriteria protected class GetByVersionIDCriteria
{ {
private int _VersionID; private readonly int _VersionID;
public int VersionID { get { return _VersionID; } } public int VersionID => _VersionID;
public GetByVersionIDCriteria(int versionID) public GetByVersionIDCriteria(int versionID) => _VersionID = versionID;
{
_VersionID = versionID;
}
} }
private void DataPortal_Fetch(GetByVersionIDCriteria criteria) private void DataPortal_Fetch(GetByVersionIDCriteria criteria)
{ {
this.RaiseListChangedEvents = false; RaiseListChangedEvents = false;
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfoList.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] OwnerInfoList.DataPortal_Fetch", GetHashCode());
try try
{ {
@@ -863,7 +739,7 @@ namespace VEPROMS.CSLA.Library
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{ {
IsReadOnly = false; IsReadOnly = false;
while (dr.Read()) this.Add(new OwnerInfo(dr)); while (dr.Read()) Add(new OwnerInfo(dr));
IsReadOnly = true; IsReadOnly = true;
} }
} }
@@ -874,7 +750,7 @@ namespace VEPROMS.CSLA.Library
if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfoList.DataPortal_Fetch", ex); if (_MyLog.IsErrorEnabled) _MyLog.Error("OwnerInfoList.DataPortal_Fetch", ex);
throw new DbCslaException("OwnerInfoList.DataPortal_Fetch", ex); throw new DbCslaException("OwnerInfoList.DataPortal_Fetch", ex);
} }
this.RaiseListChangedEvents = true; RaiseListChangedEvents = true;
} }
} }
public partial class OwnerInfo public partial class OwnerInfo
@@ -899,13 +775,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class GetBySessionIDandFolderIDCriteria protected class GetBySessionIDandFolderIDCriteria
{ {
private int _SessionID; private readonly int _SessionID;
public int SessionID public int SessionID => _SessionID;
{ get { return _SessionID; } } private readonly int _FolderID;
private int _FolderID; public int FolderID => _FolderID;
public int FolderID public GetBySessionIDandFolderIDCriteria(int sessionID, int folderID)
{ get { return _FolderID; } }
public GetBySessionIDandFolderIDCriteria(int sessionID, int folderID)
{ {
_SessionID = sessionID; _SessionID = sessionID;
_FolderID = folderID; _FolderID = folderID;
@@ -968,13 +842,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class GetBySessionIDandVersionIDCriteria protected class GetBySessionIDandVersionIDCriteria
{ {
private int _SessionID; private readonly int _SessionID;
public int SessionID public int SessionID => _SessionID;
{ get { return _SessionID; } } private readonly int _VersionID;
private int _VersionID; public int VersionID => _VersionID;
public int VersionID public GetBySessionIDandVersionIDCriteria(int sessionID, int versionID)
{ get { return _VersionID; } }
public GetBySessionIDandVersionIDCriteria(int sessionID, int versionID)
{ {
_SessionID = sessionID; _SessionID = sessionID;
_VersionID = versionID; _VersionID = versionID;
@@ -1037,13 +909,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class GetByItemIDCriteria protected class GetByItemIDCriteria
{ {
private int _ItemID; private readonly int _ItemID;
public int ItemID public int ItemID => _ItemID;
{ get { return _ItemID; } } private readonly CheckOutType _ItemType;
private CheckOutType _ItemType; public CheckOutType ItemType => _ItemType;
public CheckOutType ItemType public GetByItemIDCriteria(int itemID, CheckOutType itemType)
{ get { return _ItemType; } }
public GetByItemIDCriteria(int itemID, CheckOutType itemType)
{ {
_ItemID = itemID; _ItemID = itemID;
_ItemType = itemType; _ItemType = itemType;
@@ -1090,7 +960,7 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
SessionInfo si = SessionInfo.Get(this.SessionID); SessionInfo si = SessionInfo.Get(SessionID);
return si.UserID; return si.UserID;
} }
} }
@@ -1101,32 +971,20 @@ namespace VEPROMS.CSLA.Library
public partial class UserInfo public partial class UserInfo
{ {
public static bool CanEdit(UserInfo myUserInfo, DocVersionInfo myDVI) public static bool CanEdit(UserInfo myUserInfo, DocVersionInfo myDVI) => myUserInfo != null && myDVI != null && (myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsWriter(myDVI));
{
return myUserInfo!=null && myDVI!=null && (myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsWriter(myDVI));
}
public static bool CanEditROs(UserInfo myUserInfo, DocVersionInfo myDVI) public static bool CanEditROs(UserInfo myUserInfo, DocVersionInfo myDVI) => myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsROEditor(myDVI);
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsROEditor(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, DocVersionInfo myDVI) public static bool CanCreateFolders(UserInfo myUserInfo, DocVersionInfo myDVI) => myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI);
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, FolderInfo fi) public static bool CanCreateFolders(UserInfo myUserInfo, FolderInfo fi) => myUserInfo != null && fi != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(fi.MyParent); //B2020-111 allow if set amin controls parent
{
return myUserInfo != null && fi != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(fi.MyParent); //B2020-111 allow if set amin controls parent
}
public bool IsAdministrator() public bool IsAdministrator()
{ {
if (this.UserMembershipCount == 0) if (UserMembershipCount == 0)
return false; return false;
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in UserMemberships)
{ {
if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
@@ -1145,10 +1003,10 @@ namespace VEPROMS.CSLA.Library
// would then be skipped (from where is called) // would then be skipped (from where is called)
public bool IsSetAdministrator(FolderInfo fldinf) public bool IsSetAdministrator(FolderInfo fldinf)
{ {
if (this.UserMembershipCount == 0 || fldinf == null) if (UserMembershipCount == 0 || fldinf == null)
return false; return false;
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in UserMemberships)
{ {
if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
@@ -1173,10 +1031,10 @@ namespace VEPROMS.CSLA.Library
public bool IsSetAdministrator(DocVersionInfo dv) public bool IsSetAdministrator(DocVersionInfo dv)
{ {
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo if (UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false; return false;
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in UserMemberships)
{ {
if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
@@ -1200,10 +1058,10 @@ namespace VEPROMS.CSLA.Library
public bool IsWriter(DocVersionInfo dv) public bool IsWriter(DocVersionInfo dv)
{ {
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo if (UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false; return false;
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in UserMemberships)
{ {
if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
@@ -1227,10 +1085,10 @@ namespace VEPROMS.CSLA.Library
public bool IsReviewer(DocVersionInfo dv) public bool IsReviewer(DocVersionInfo dv)
{ {
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo if (UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false; return false;
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in UserMemberships)
{ {
if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
@@ -1254,10 +1112,10 @@ namespace VEPROMS.CSLA.Library
public bool IsROEditor(DocVersionInfo dv) public bool IsROEditor(DocVersionInfo dv)
{ {
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo if (UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false; return false;
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in UserMemberships)
{ {
if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
@@ -1279,12 +1137,9 @@ namespace VEPROMS.CSLA.Library
return false; return false;
} }
// B2018-112 added for easy check if user's PROMS Security allows making edits - used in StepTabRibbon - SetButtonAndMenuEnabling() // B2018-112 added for easy check if user's PROMS Security allows making edits - used in StepTabRibbon - SetButtonAndMenuEnabling()
public bool IsAllowedToEdit(DocVersionInfo dvi) public bool IsAllowedToEdit(DocVersionInfo dvi) => IsAdministrator() || IsSetAdministrator(dvi) || IsWriter(dvi);
{ public static UserInfo GetByUserID(string userID)
return IsAdministrator() || IsSetAdministrator(dvi) || IsWriter(dvi);
}
public static UserInfo GetByUserID(string userID)
{ {
try try
{ {
@@ -1305,14 +1160,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class GetByUserIDCriteria protected class GetByUserIDCriteria
{ {
private string _UserID; private readonly string _UserID;
public string UserID public string UserID => _UserID;
{ get { return _UserID; } } public GetByUserIDCriteria(string userID) => _UserID = userID;
public GetByUserIDCriteria(string userID) }
{
_UserID = userID;
}
}
private void DataPortal_Fetch(GetByUserIDCriteria criteria) private void DataPortal_Fetch(GetByUserIDCriteria criteria)
{ {
@@ -12,19 +12,10 @@ namespace VEPROMS.CSLA.Library
Rtf = rtf; Rtf = rtf;
WithBorder = withBorder; WithBorder = withBorder;
} }
private string _Rtf;
public string Rtf public string Rtf { get; set; }
{ public bool WithBorder { get; set; }
get { return _Rtf; } private RtfLines _Lines;
set { _Rtf = value; }
}
private bool _WithBorder;
public bool WithBorder
{
get { return _WithBorder; }
set { _WithBorder = value; }
}
private RtfLines _Lines;
public RtfLines Lines public RtfLines Lines
{ {
get get
@@ -43,11 +34,8 @@ namespace VEPROMS.CSLA.Library
Lines.Add(new RtfLine(maxWidth, WithBorder ? @"\u9492?" : " ", WithBorder ? @"\u9472?" : " ", WithBorder ? @"\u9496?" : " ")); // Insert bottom line Lines.Add(new RtfLine(maxWidth, WithBorder ? @"\u9492?" : " ", WithBorder ? @"\u9472?" : " ", WithBorder ? @"\u9496?" : " ")); // Insert bottom line
Lines.ReplaceLines(WithBorder); Lines.ReplaceLines(WithBorder);
} }
public override string ToString() public override string ToString() => Lines.ToString();
{ }
return Lines.ToString();
}
}
public class RtfLines : List<RtfLine> public class RtfLines : List<RtfLine>
{ {
public static Regex _RegReplaceLine = new Regex(@"\\line((\\[^ \[\]\\\(\)]*) )"); public static Regex _RegReplaceLine = new Regex(@"\\line((\\[^ \[\]\\\(\)]*) )");
@@ -58,7 +46,6 @@ namespace VEPROMS.CSLA.Library
// split text into lines // split text into lines
string[] breaks = { "\r\n" }; string[] breaks = { "\r\n" };
string[] lines = txt.Split(breaks, StringSplitOptions.None); string[] lines = txt.Split(breaks, StringSplitOptions.None);
//string lastLine = lines[lines.Length - 1];
foreach (string line in lines) foreach (string line in lines)
Add(new RtfLine(line.Replace("\\bullet","*"))); Add(new RtfLine(line.Replace("\\bullet","*")));
} }
@@ -89,19 +76,19 @@ namespace VEPROMS.CSLA.Library
} }
return sb.ToString(); return sb.ToString();
} }
private static Regex _RegRightCheck = new Regex(@"-|\\u9472?|\\u8209\?"); private static readonly Regex _RegRightCheck = new Regex(@"-|\\u9472?|\\u8209\?");
private static Regex _RegAboveCheck = new Regex(@"\||\\u9474\?|\\u9492\?|\\u9516\?|\\u9532\?|\\u9500\?|\\u9484\?|\\u9524\?|\\u9488\?|\\u9508\?"); private static readonly Regex _RegAboveCheck = new Regex(@"\||\\u9474\?|\\u9492\?|\\u9516\?|\\u9532\?|\\u9500\?|\\u9484\?|\\u9524\?|\\u9488\?|\\u9508\?");
private static Regex _RegLeftCheck = new Regex(@"-|\\u9472\?|\\u9508\?|\\u9516\?|\\u9500\?|\\u9532\?|\\u9484\?|\\u9488\?|\\u9492\?|\\u8209\?"); private static readonly Regex _RegLeftCheck = new Regex(@"-|\\u9472\?|\\u9508\?|\\u9516\?|\\u9500\?|\\u9532\?|\\u9484\?|\\u9488\?|\\u9492\?|\\u8209\?");
private static Regex _RegBelowCheck = new Regex(@"\||\\u9474\?"); private static readonly Regex _RegBelowCheck = new Regex(@"\||\\u9474\?");
private static Regex _RegRightCheck1 = new Regex(@"\\u9474\?"); private static readonly Regex _RegRightCheck1 = new Regex(@"\\u9474\?");
private static Regex _RegAboveCheck1 = new Regex(@"\\u9472\?|\\u8209\?"); private static readonly Regex _RegAboveCheck1 = new Regex(@"\\u9472\?|\\u8209\?");
private static Regex _RegLeftCheck1 = new Regex(@"\\u9474\?"); private static readonly Regex _RegLeftCheck1 = new Regex(@"\\u9474\?");
private static Regex _RegBelowCheck1 = new Regex(@"\\u9472\?|\\u8209\?"); private static readonly Regex _RegBelowCheck1 = new Regex(@"\\u9472\?|\\u8209\?");
private static Regex _RegHorizontalCheck = new Regex(@"-|\\u9472\?|\\u8209\?"); private static readonly Regex _RegHorizontalCheck = new Regex(@"-|\\u9472\?|\\u8209\?");
private static Regex _RegVerticalCheck = new Regex(@"\||\\u9474\?"); private static readonly Regex _RegVerticalCheck = new Regex(@"\||\\u9474\?");
static private string[] TableCharsU = { private static readonly string[] TableCharsU = {
"\x0", // HEX"\x0", // No character "\x0", // HEX"\x0", // No character
@"\u9472?", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4' @"\u9472?", // HEX@"\u2500",// - Horizontal line - 16-bit char: '\xC4'
@"\u9474?", // HEX@"\u2502",// | Vertical line - 16-bit char: '\xB3' @"\u9474?", // HEX@"\u2502",// | Vertical line - 16-bit char: '\xB3'
@@ -159,24 +146,10 @@ namespace VEPROMS.CSLA.Library
} }
} }
} }
private void ListItems(string loc, string str)
{
StringBuilder sb = new StringBuilder(string.Format("{0} = @\"", loc));
string sep = "";
foreach (char c in str)
{
if (c < 127)
sb.Append(sep + c.ToString());
else
sb.Append(sep + string.Format("\\u{0}?", (int)c));
sep = "|";
}
Console.WriteLine(sb.ToString());
}
} }
public class RtfLine : List<RtfPiece> public class RtfLine : List<RtfPiece>
{ {
private static Regex _RegRtfText = new Regex(@"((\\[^'u ]*|\\up[0-9]|\\ul|\\ulnone)+( |$|(?=\\['u])))?(<START\]|#Link.*?\[END>|\\'[0-9a-fA-F]{2}|\\u[0-9]*\?|[^\\]{1}|$|)"); private static readonly Regex _RegRtfText = new Regex(@"((\\[^'u ]*|\\up[0-9]|\\ul|\\ulnone)+( |$|(?=\\['u])))?(<START\]|#Link.*?\[END>|\\'[0-9a-fA-F]{2}|\\u[0-9]*\?|[^\\]{1}|$|)");
public RtfLine(string text) public RtfLine(string text)
{ {
MatchCollection matches = _RegRtfText.Matches(text); MatchCollection matches = _RegRtfText.Matches(text);
@@ -192,15 +165,13 @@ namespace VEPROMS.CSLA.Library
nextIndex = match.Index + match.Length; nextIndex = match.Index + match.Length;
string rtfPart = match.Groups[1].ToString(); string rtfPart = match.Groups[1].ToString();
if (match.Groups[1].ToString().TrimEnd(" ".ToCharArray()).Length + match.Groups[4].ToString().Length > 0) if (match.Groups[1].ToString().TrimEnd(" ".ToCharArray()).Length + match.Groups[4].ToString().Length > 0)
this.Add(new RtfPiece(match.Groups[1].ToString().TrimEnd(" ".ToCharArray()), match.Groups[4].ToString())); Add(new RtfPiece(match.Groups[1].ToString().TrimEnd(" ".ToCharArray()), match.Groups[4].ToString()));
//if (match.Groups[1].ToString().Length + match.Groups[4].ToString().Length > 0)
// this.Add(new RtfPiece(match.Groups[1].ToString(), match.Groups[4].ToString()));
} }
} }
public RtfLine(int width, string left, string fill, string right) public RtfLine(int width, string left, string fill, string right)
{ {
Add(new RtfPiece("", left)); Add(new RtfPiece("", left));
for (int i = 0; i < width; i++) this.Add(new RtfPiece("", fill)); // Pad for (int i = 0; i < width; i++) Add(new RtfPiece("", fill)); // Pad
Add(new RtfPiece("", right)); Add(new RtfPiece("", right));
} }
public int MaximumWidth public int MaximumWidth
@@ -223,9 +194,9 @@ namespace VEPROMS.CSLA.Library
internal void Pad(int maxWidth, string edge) internal void Pad(int maxWidth, string edge)
{ {
int pad = maxWidth - MaximumWidth; int pad = maxWidth - MaximumWidth;
this.Insert(0, new RtfPiece("", edge)); // Left Edge Insert(0, new RtfPiece("", edge)); // Left Edge
for (int i = 0; i < pad; i++) this.Add(new RtfPiece("", " ")); // Pad for (int i = 0; i < pad; i++) Add(new RtfPiece("", " ")); // Pad
this.Add(new RtfPiece("", edge)); // Right Edge Add(new RtfPiece("", edge)); // Right Edge
} }
public new RtfPiece this[int index] public new RtfPiece this[int index]
{ {
@@ -246,61 +217,23 @@ namespace VEPROMS.CSLA.Library
} }
public class RtfPiece public class RtfPiece
{ {
private string _Rtf; public string Rtf { get; set; }
public string Rtf public string Text { get; set; } = "";
{ public int TextLength => Text.Length;
get { return _Rtf; } public int MaximumWidth => Text == "" ? 0 : 1;
set { _Rtf = value; } private static readonly Regex _RegStartLink = new Regex(@"<START\]");
} private static readonly Regex _RegEndLink = new Regex(@"#Link.*?\[END>");
private string _Text = "";
public string Text
{
get { return _Text; }
set { _Text = value; }
}
public int TextLength
{
get { return Text.Length; }
}
public int MaximumWidth
{
get { return Text == "" ? 0 : 1; }
}
private static Regex _RegStartLink = new Regex(@"<START\]");
private static Regex _RegEndLink = new Regex(@"#Link.*?\[END>");
public RtfPiece(string rtf, string text) public RtfPiece(string rtf, string text)
{ {
_Rtf = rtf; Rtf = rtf;
if (_RegStartLink.IsMatch(text) || _RegEndLink.IsMatch(text)) if (_RegStartLink.IsMatch(text) || _RegEndLink.IsMatch(text))
_Rtf += (rtf == "" ? "" : " ") + text; Rtf += (rtf == "" ? "" : " ") + text;
else else
{ {
_Rtf += rtf == "" ? "" : " "; Rtf += rtf == "" ? "" : " ";
_Text = text; Text = text;
} }
} }
public override string ToString() public override string ToString() => Rtf + Text;
{ }
return _Rtf + _Text;
//string retval = _RegUnicode.Replace(_Text, new MatchEvaluator(RtfUnicodeCharacter));
//retval = _RegHex.Replace(retval, new MatchEvaluator(RtfHexCharacter));
//return retval;
}
//private static Regex _RegUnicode = new Regex(@"\\u([0-9ABCDEF]*)\?");
//internal static string RtfUnicodeCharacter(Match myMatch)
//{
// string hexStr = myMatch.Groups[1].ToString();
// int i = int.Parse(hexStr);
// Char schar = Convert.ToChar(i);
// return schar.ToString();
//}
//private static Regex _RegHex = new Regex(@"\\'([0-9A-Fa-f]{2})");
//internal static string RtfHexCharacter(Match myMatch)
//{
// string hexStr = myMatch.Groups[1].ToString();
// int i = int.Parse(hexStr, System.Globalization.NumberStyles.HexNumber);
// Char schar = Convert.ToChar(i);
// return schar.ToString();
//}
}
} }
+28 -103
View File
@@ -1,42 +1,27 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using Csla;
using Csla.Data; using Csla.Data;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
public partial class ContentPart public partial class ContentPart
{ {
public override string ToString() public override string ToString() => string.Format("{0} {1}", MyItem.MyContent.Number, MyItem.MyContent.Text);
{ }
return string.Format("{0} {1}", MyItem.MyContent.Number, MyItem.MyContent.Text);
}
}
public partial class ItemPart public partial class ItemPart
{ {
public override string ToString() public override string ToString() => string.Format("{0} {1}", _MyContent.Number, MyContent.Text);
{ }
return string.Format("{0} {1}", _MyContent.Number, MyContent.Text);
}
}
public partial class Part public partial class Part
{ {
public override string ToString() public override string ToString() => string.Format("{0} {1}", MyItem.MyContent.Number, MyItem.MyContent.Text);
{ }
return string.Format("{0} {1}", MyItem.MyContent.Number, MyItem.MyContent.Text);
}
}
public partial class PartInfoList public partial class PartInfoList
{ {
internal PartInfoList(SafeDataReader dr, ItemInfo itemInfo) internal PartInfoList(SafeDataReader dr, ItemInfo itemInfo) => AddPartInfo(dr, itemInfo);
{ internal void AddPartInfo(SafeDataReader dr, ItemInfo itemInfo)
AddPartInfo(dr,itemInfo);
}
internal void AddPartInfo(SafeDataReader dr, ItemInfo itemInfo)
{ {
IsReadOnly = false; IsReadOnly = false;
this.Add(new PartInfo(dr, itemInfo)); Add(new PartInfo(dr, itemInfo));
IsReadOnly = true; IsReadOnly = true;
} }
public PartInfo Find(E_FromType fromType) public PartInfo Find(E_FromType fromType)
@@ -124,9 +109,8 @@ namespace VEPROMS.CSLA.Library
{ {
if (_SearchDefaultSort == null) if (_SearchDefaultSort == null)
{ {
string partText = String.Empty; string partText;
switch ((E_FromType)FromType)
switch ((E_FromType)FromType)
{ {
case E_FromType.Caution: case E_FromType.Caution:
partText = ".Caution"; partText = ".Caution";
@@ -189,11 +173,9 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("PartInfo.ReadData", ex); throw new DbCslaException("PartInfo.ReadData", ex);
} }
} }
public E_FromType PartType public E_FromType PartType => (E_FromType)_FromType;
{ get { return (E_FromType)_FromType; } } public E_FromTypes PartTypes => (E_FromTypes)_FromType;
public E_FromTypes PartTypes public override string ToString()
{ get { return (E_FromTypes)_FromType; } }
public override string ToString()
{ {
// if the parttype is table or figure, add the correct label: // if the parttype is table or figure, add the correct label:
if (PartTypes == E_FromTypes.Tables) if (PartTypes == E_FromTypes.Tables)
@@ -204,28 +186,12 @@ namespace VEPROMS.CSLA.Library
} }
return string.Format("{0}", PartTypes); return string.Format("{0}", PartTypes);
} }
//public string ToString(string str, System.IFormatProvider ifp)
//{
// return ToString();
//}
#region IVEDrillDownReadOnly #region IVEDrillDownReadOnly
public ItemInfoList _MyItems; public ItemInfoList _MyItems;
public ItemInfoList MyItems public ItemInfoList MyItems => _MyItems ?? (_MyItems = ItemInfoList.GetList(_ItemID, _FromType));
{ get { return (_MyItems != null ? _MyItems : _MyItems = ItemInfoList.GetList(_ItemID, _FromType)); } } public System.Collections.IList GetChildren() => MyItems;
public System.Collections.IList GetChildren() public bool HasChildren => MyContent.ContentPartCount > 0;
{ public IVEDrillDownReadOnly ActiveParent
//return (_MyItems != null ? _MyItems : _MyItems = ItemInfoList.GetList(_ItemID, _FromType));
return MyItems;
}
//public bool ChildrenAreLoaded
//{
// get { return _MyItems == null; }
//}
public bool HasChildren
{
get { return this.MyContent.ContentPartCount > 0; }
}
public IVEDrillDownReadOnly ActiveParent
{ {
get get
{ {
@@ -234,57 +200,16 @@ namespace VEPROMS.CSLA.Library
return parentContent.ContentItems[0]; return parentContent.ContentItems[0];
} }
} }
public FormatInfo ActiveFormat public FormatInfo ActiveFormat => ActiveParent.ActiveFormat;
{ public FormatInfo LocalFormat => null;
get { return ActiveParent.ActiveFormat; } public ConfigDynamicTypeDescriptor MyConfig => null;
} public bool IsFolder => false;
public FormatInfo LocalFormat public bool IsDocVersion => false;
{ public bool IsProcedure => false;
get { return null; } public bool IsSection => false;
} public bool IsStep => false;
public ConfigDynamicTypeDescriptor MyConfig #endregion
{ }
get { return null; }
}
public bool IsFolder
{
get
{
return false;
}
}
public bool IsDocVersion
{
get
{
return false;
}
}
public bool IsProcedure
{
get
{
return false;
}
}
public bool IsSection
{
get
{
return false;
}
}
public bool IsStep
{
get
{
return false;
}
}
//public bool HasStandardSteps()
//{ return false; }
#endregion
}
// B2017-146 added the "Part" and "Parts" types of zero so that we have a valid node name when creating an export of a procedure with this FromType value // B2017-146 added the "Part" and "Parts" types of zero so that we have a valid node name when creating an export of a procedure with this FromType value
public enum E_FromType : int public enum E_FromType : int
+19 -35
View File
@@ -1,12 +1,7 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
using Csla.Data;
using Csla.Validation;
using System.Diagnostics;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
@@ -14,8 +9,6 @@ namespace VEPROMS.CSLA.Library
{ {
public static void DeleteAll(int docID) public static void DeleteAll(int docID)
{ {
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Pdf");
try try
{ {
DataPortal.Delete(new DocIDCriteria(docID)); DataPortal.Delete(new DocIDCriteria(docID));
@@ -28,14 +21,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class DocIDCriteria protected class DocIDCriteria
{ {
private int _DocID; private readonly int _DocID;
public int DocID public int DocID => _DocID;
{ get { return _DocID; } } public DocIDCriteria(int docID) => _DocID = docID;
public DocIDCriteria(int docID) }
{
_DocID = docID;
}
}
[Transactional(TransactionalTypes.TransactionScope)] [Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(DocIDCriteria criteria) private void DataPortal_Delete(DocIDCriteria criteria)
{ {
@@ -66,8 +55,6 @@ namespace VEPROMS.CSLA.Library
// used to remove word section PDFs to force ROs to be updated when printed or saved // used to remove word section PDFs to force ROs to be updated when printed or saved
public static void DeleteDocVersionPDFsWithNewROs(int versionID, int origfstid, int newfstid) public static void DeleteDocVersionPDFsWithNewROs(int versionID, int origfstid, int newfstid)
{ {
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Pdf");
try try
{ {
DeleteWithNewROs(versionID, origfstid, newfstid); DeleteWithNewROs(versionID, origfstid, newfstid);
@@ -111,11 +98,10 @@ namespace VEPROMS.CSLA.Library
{ {
if (sect.MyContent.MyEntry == null) return; // B2023-030 not a word section so just jump out if (sect.MyContent.MyEntry == null) return; // B2023-030 not a word section so just jump out
DocStyle myDocStyle = sect.ActiveSection.MyDocStyle; DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig;
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave; int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
if (sc != null && sc.Section_WordMargin == "Y") if (sect.ActiveSection.MyConfig is SectionConfig sc && sc.Section_WordMargin == "Y")
{ {
RemoveFromCachedByPrimaryKey(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0); RemoveFromCachedByPrimaryKey(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0);
} }
@@ -132,23 +118,21 @@ namespace VEPROMS.CSLA.Library
while (count < 2) while (count < 2)
{ {
DocStyle myDocStyle = sect.ActiveSection.MyDocStyle; DocStyle myDocStyle = sect.ActiveSection.MyDocStyle;
SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig; int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave;
PdfInfo myPdf = null;
int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave; PdfInfo myPdf;
if (sect.ActiveSection.MyConfig is SectionConfig sc && sc.Section_WordMargin == "Y")
{
myPdf = Get(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0);
}
else
{
myPdf = Get(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth);
}
if (sc != null && sc.Section_WordMargin == "Y") // override forces the printing of the word section, which creates a word file with resolved ROs, which is saved for an approved export
{ if (!ovrride || (ovrride && count == 1))
myPdf = Get(sect.MyContent.MyEntry.DocID, ss*10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0);
}
else
{
myPdf = Get(sect.MyContent.MyEntry.DocID, ss*10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth);
}
// override forces the printing of the word section, which creates a word file with resolved ROs, which is saved for an approved export
if (!ovrride || (ovrride && count == 1))
{ {
if (myPdf != null) return myPdf; if (myPdf != null) return myPdf;
if (count > 0) return null; // Could not find or create a pdf if (count > 0) return null; // Could not find or create a pdf
@@ -8,13 +8,6 @@
// $History: $ // $History: $
// ======================================================================== // ========================================================================
using System;
using System.Data;
using System.Data.SqlClient;
using Csla;
using Csla.Data;
using System.Configuration;
using System.IO;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections; using System.Collections;
@@ -23,22 +16,16 @@ namespace VEPROMS.CSLA.Library
{ {
public partial class ChildFoldersPropertyDescriptor public partial class ChildFoldersPropertyDescriptor
{ {
public override string DisplayName public override string DisplayName => Item.Name;
{ get { return Item.Name; } } public override string Description => Item.Title;
public override string Description public override string Name => Item.Name;
{ get { return Item.Title; } } }
public override string Name
{ get { return Item.Name; } }
}
public partial class FolderDocVersionsPropertyDescriptor public partial class FolderDocVersionsPropertyDescriptor
{ {
public override string DisplayName public override string DisplayName => Item.Name;
{ get { return Item.Name; } } public override string Description => Item.Name;
public override string Description public override string Name => Item.Name;
{ get { return Item.Name; } } }
public override string Name
{ get { return Item.Name; } }
}
public class FormatList : System.ComponentModel.StringConverter public class FormatList : System.ComponentModel.StringConverter
{ {
private static SortedList<string, FormatInfo> _MyFormatInfoList; private static SortedList<string, FormatInfo> _MyFormatInfoList;
@@ -64,19 +51,10 @@ namespace VEPROMS.CSLA.Library
_MyFormatInfoList.Add("", null); _MyFormatInfoList.Add("", null);
} }
} }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) => new StandardValuesCollection((ICollection)MyFormatInfoList.Values);
{ public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
return new StandardValuesCollection((ICollection)MyFormatInfoList.Values); public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => true;
} public static int? ToInt(string formatName)
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
public static int? ToInt(string formatName)
{ {
if (formatName == null || formatName == string.Empty) return null; if (formatName == null || formatName == string.Empty) return null;
foreach (FormatInfo formatInfo in MyFormatInfoList.Values) foreach (FormatInfo formatInfo in MyFormatInfoList.Values)
@@ -136,31 +114,12 @@ namespace VEPROMS.CSLA.Library
if (!ds.Inactive)_MyDocStyleList.Add(ds.Name,10000 + (int) ds.Index); if (!ds.Inactive)_MyDocStyleList.Add(ds.Name,10000 + (int) ds.Index);
} }
} }
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) => new StandardValuesCollection((ICollection)MyDocStyleList.Keys);
{ public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
return new StandardValuesCollection((ICollection)MyDocStyleList.Keys); public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => true;
} public static int? ToInt(string docStyleName) => MyDocStyleList[docStyleName];
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) public static string ToString(int? sectionType) => sectionType == null ? null : MyDocStyleList.Keys[MyDocStyleList.IndexOfValue((int)sectionType)];
{ public static int ToSectionType(string docStyleName) => MyDocStyleList[docStyleName];
return true; }
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
public static int? ToInt(string docStyleName)
{
return MyDocStyleList[docStyleName];
}
public static string ToString(int? sectionType)
{
if (sectionType == null) return null;
return MyDocStyleList.Keys[MyDocStyleList.IndexOfValue((int)sectionType)];
}
public static int ToSectionType(string docStyleName)
{
return MyDocStyleList[docStyleName];
}
}
} }
+12 -52
View File
@@ -9,13 +9,6 @@
// ======================================================================== // ========================================================================
using System; using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.IO;
using System.Xml.Serialization;
using System.Xml;
using System.Xml.XPath;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
@@ -28,17 +21,10 @@ namespace VEPROMS.CSLA.Library
#region RODb Config #region RODb Config
[NonSerialized] [NonSerialized]
private RODbConfig _RODbConfig; private RODbConfig _RODbConfig;
public RODbConfig RODbConfig public RODbConfig RODbConfig => _RODbConfig ?? (_RODbConfig = new RODbConfig(this));
{ get { return (_RODbConfig != null ? _RODbConfig : _RODbConfig = new RODbConfig(this)); } }
private void RODbConfigRefresh()
{
_RODbConfig = null;
}
#endregion #endregion
public static RODbInfo GetJustRODB(int rODbID) public static RODbInfo GetJustRODB(int rODbID)
{ {
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a RODb");
try try
{ {
RODbInfo tmp = GetCachedByPrimaryKey(rODbID); RODbInfo tmp = GetCachedByPrimaryKey(rODbID);
@@ -62,14 +48,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class PKCriteriaJustRODB protected class PKCriteriaJustRODB
{ {
private int _RODbID; private readonly int _RODbID;
public int RODbID public int RODbID => _RODbID;
{ get { return _RODbID; } } public PKCriteriaJustRODB(int rODbID) => _RODbID = rODbID;
public PKCriteriaJustRODB(int rODbID) }
{
_RODbID = rODbID;
}
}
private void DataPortal_Fetch(PKCriteriaJustRODB criteria) private void DataPortal_Fetch(PKCriteriaJustRODB criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbInfo.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbInfo.DataPortal_Fetch", GetHashCode());
@@ -112,8 +94,6 @@ namespace VEPROMS.CSLA.Library
{ {
public static RODb GetJustRoDb(int rODbID) public static RODb GetJustRoDb(int rODbID)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a RODb");
try try
{ {
RODb tmp = DataPortal.Fetch<RODb>(new PKCriteriaJustRoDb(rODbID)); RODb tmp = DataPortal.Fetch<RODb>(new PKCriteriaJustRoDb(rODbID));
@@ -151,15 +131,6 @@ namespace VEPROMS.CSLA.Library
return; return;
} }
ReadData(dr); ReadData(dr);
// Don't load child objects
//dr.NextResult();
//_RODbROFsts = RODbROFsts.Get(dr);
// load child objects
//dr.NextResult();
//_RODbROImages = RODbROImages.Get(dr);
// load child objects
//dr.NextResult();
//_RODbRoUsages = RODbRoUsages.Get(dr);
} }
} }
// removing of item only needed for local data portal // removing of item only needed for local data portal
@@ -177,18 +148,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class PKCriteriaJustRoDb protected class PKCriteriaJustRoDb
{ {
private int _RODbID; private readonly int _RODbID;
public int RODbID public int RODbID => _RODbID;
{ get { return _RODbID; } } public PKCriteriaJustRoDb(int rODbID) => _RODbID = rODbID;
public PKCriteriaJustRoDb(int rODbID) }
{
_RODbID = rODbID;
}
}
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
#region RODb Config #region RODb Config
[NonSerialized] [NonSerialized]
@@ -205,10 +168,7 @@ namespace VEPROMS.CSLA.Library
return _RODbConfig; return _RODbConfig;
} }
} }
private void _RODbConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) private void _RODbConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) => Config = _RODbConfig.ToString();
{ #endregion
Config = _RODbConfig.ToString(); }
}
#endregion
}
} }
+111 -208
View File
@@ -10,12 +10,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Xml.Serialization;
using System.Xml;
using System.Xml.XPath;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
@@ -30,9 +26,6 @@ namespace VEPROMS.CSLA.Library
{ {
public static ROFst GetJustROFst(int rOFstID) public static ROFst GetJustROFst(int rOFstID)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a ROFst");
try try
{ {
ROFst tmp = GetCachedByPrimaryKey(rOFstID); ROFst tmp = GetCachedByPrimaryKey(rOFstID);
@@ -59,14 +52,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class PKCriteriaJustROFst protected class PKCriteriaJustROFst
{ {
private int _ROFstID; private readonly int _ROFstID;
public int ROFstID public int ROFstID => _ROFstID;
{ get { return _ROFstID; } } public PKCriteriaJustROFst(int rOFstID) => _ROFstID = rOFstID;
public PKCriteriaJustROFst(int rOFstID) }
{
_ROFstID = rOFstID;
}
}
private void DataPortal_Fetch(PKCriteriaJustROFst criteria) private void DataPortal_Fetch(PKCriteriaJustROFst criteria)
{ {
@@ -111,30 +100,22 @@ namespace VEPROMS.CSLA.Library
public partial class ROFstInfo public partial class ROFstInfo
{ {
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
[Serializable()] [Serializable()]
protected class PKCriteriaJustROFst protected class PKCriteriaJustROFst
{ {
private int _ROFstID; private readonly int _ROFstID;
public int ROFstID public int ROFstID => _ROFstID;
{ get { return _ROFstID; } } public PKCriteriaJustROFst(int rOFstID) => _ROFstID = rOFstID;
public PKCriteriaJustROFst(int rOFstID) }
{
_ROFstID = rOFstID;
}
}
#region Fields #region Fields
// this is used by the frmBatchRefresh which is the Adim Tools so that one message is display for a group of procedure sets processed // this is used by the frmBatchRefresh which is the Adim Tools so that one message is display for a group of procedure sets processed
public static StringBuilder MessageList = null; public static StringBuilder MessageList = null;
private static List<int> DocVersionsNeedingROUpdate = new List<int>(); [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<int> DocVersionsNeedingROUpdate = new List<int>();
#endregion #endregion
@@ -142,23 +123,19 @@ namespace VEPROMS.CSLA.Library
public event ROFstInfoROTableUpdateEvent ROTableUpdate; public event ROFstInfoROTableUpdateEvent ROTableUpdate;
#endregion #endregion
#region Public Methods #region Public Methods
// B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database
public ROFSTLookup GetROFSTLookup(DocVersionInfo dvi, string ovrrideChild = null, bool showLoadingStatus = true) => new ROFSTLookup(this.ROFstID, dvi, ovrrideChild, showLoadingStatus);
public ROFSTLookup GetROFSTLookup(DocVersionInfo dvi, string ovrrideChild = null, bool showLoadingStatus = true) /// <summary>
{ /// Adds an ro.fst into a sql database.
// B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database /// </summary>
return new ROFSTLookup(this.ROFstID, dvi, ovrrideChild, showLoadingStatus); /// <param name="rdi" - the Rodb to use as the path for updating the ro.fst, i.e. import from there.
} /// <param name="docver" - hook into this doc version></param>
/// <returns>ROFst: Returns the created rofst object</returns>
/// <summary> public static ROFst AddRoFst(RODbInfo rdi, DocVersion docver, ROFstInfoProgressBarRefresh myProgressBarRefresh)
/// Adds an ro.fst into a sql database.
/// </summary>
/// <param name="rdi" - the Rodb to use as the path for updating the ro.fst, i.e. import from there.
/// <param name="docver" - hook into this doc version></param>
/// <returns>ROFst: Returns the created rofst object</returns>
public static ROFst AddRoFst(RODbInfo rdi, DocVersion docver, ROFstInfoProgressBarRefresh myProgressBarRefresh)
{ {
string rofstfilepath = rdi.FolderPath + @"\ro.fst"; string rofstfilepath = rdi.FolderPath + @"\ro.fst";
DirectoryInfo di = new DirectoryInfo(rdi.FolderPath); DirectoryInfo di = new DirectoryInfo(rdi.FolderPath);
@@ -218,9 +195,11 @@ namespace VEPROMS.CSLA.Library
} }
if (myUnChangedROImages.Count > 0) if (myUnChangedROImages.Count > 0)
using (FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID, buildImageIDString(myUnChangedROImages))) ; #pragma warning disable CS0642 // Possible mistaken empty statement - valid - keeps scope of add
using (FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID, buildImageIDString(myUnChangedROImages))) ;
#pragma warning restore CS0642 // Possible mistaken empty statement
return rofst; return rofst;
} }
} }
} }
@@ -252,8 +231,7 @@ namespace VEPROMS.CSLA.Library
TimeSpan ts = DateTime.Now - start; TimeSpan ts = DateTime.Now - start;
if (tbStatus != null) tbStatus?.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects{0}, Fixed {3} Referenced Objects{0}, Elapsed Seconds:{4}{0}{0}", Environment.NewLine, itm.MyProcedure.DisplayNumber, ItemInfo.ROCheckCount, ItemInfo.ROFixCount, ts.TotalSeconds));
tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects{0}, Fixed {3} Referenced Objects{0}, Elapsed Seconds:{4}{0}{0}", Environment.NewLine, itm.MyProcedure.DisplayNumber, ItemInfo.ROCheckCount, ItemInfo.ROFixCount, ts.TotalSeconds));
} }
//Update the DocVersion Associations to link to the new RO FST id and current date/time //Update the DocVersion Associations to link to the new RO FST id and current date/time
@@ -288,8 +266,7 @@ namespace VEPROMS.CSLA.Library
DocVersionInfo dvi = DocVersionInfo.Get(proc.MyDocVersion.VersionID); DocVersionInfo dvi = DocVersionInfo.Get(proc.MyDocVersion.VersionID);
if (dvi.DocVersionConfig.SelectedSlave <= 0) if (dvi.DocVersionConfig.SelectedSlave <= 0)
{ {
int i = 0; DateTime start = DateTime.Now;
DateTime start = DateTime.Now;
ProcedureInfo.ResetCheckROLinkCounters(); ProcedureInfo.ResetCheckROLinkCounters();
ProcedureInfo.CheckReferenceObjectsLinks(proc); ProcedureInfo.CheckReferenceObjectsLinks(proc);
@@ -297,8 +274,7 @@ namespace VEPROMS.CSLA.Library
TimeSpan ts = DateTime.Now - start; TimeSpan ts = DateTime.Now - start;
if (tbStatus != null) tbStatus?.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
/*** keep for now - incase we decide to fix RO links later on, this will show the number of RO Links that we fixed /*** keep for now - incase we decide to fix RO links later on, this will show the number of RO Links that we fixed
//tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0}, Fixed {4} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds)); //tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0}, Fixed {4} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
***/ ***/
@@ -330,9 +306,9 @@ namespace VEPROMS.CSLA.Library
{ {
ROWorkingDraftAsk.ClearWorkingDrafts(); ROWorkingDraftAsk.ClearWorkingDrafts();
if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update"); myProgressBarRefresh?.Invoke(0, 100, "Starting Update");
int origFSTid = origROFst.ROFstID; int origFSTid = origROFst.ROFstID;
DirectoryInfo di = new DirectoryInfo(rdi.FolderPath); DirectoryInfo di = new DirectoryInfo(rdi.FolderPath);
string rofstfilepath = rdi.FolderPath + @"\ro.fst"; string rofstfilepath = rdi.FolderPath + @"\ro.fst";
@@ -346,16 +322,15 @@ namespace VEPROMS.CSLA.Library
if (rofst != null) if (rofst != null)
{ {
// Get a list of figures which have changed content (DTS) // Get a list of figures which have changed content (DTS)
List<string> MyChangedFigureROIDs = null;
if (docver.ROfstLoadingFigures) // B2017-125 see if loading figures was completed if (docver.ROfstLoadingFigures) // B2017-125 see if loading figures was completed
{ {
ROFSTLookup myLookup = new ROFSTLookup(rofst.ROFstID, DocVersionInfo.Get(docver.VersionID)); ROFSTLookup myLookup = new ROFSTLookup(rofst.ROFstID, DocVersionInfo.Get(docver.VersionID));
MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, RODb.GetJustRoDb(rdi.RODbID), myLookup, docver); _ = UpdateROFigures(rdi, myProgressBarRefresh, rofst, RODb.GetJustRoDb(rdi.RODbID), myLookup, docver);
} }
else else
{ {
MyChangedFigureROIDs = GetChangedFigureROIDs(origROFst, ROFstInfo.GetJustROFst(rofst.ROFstID), DocVersionInfo.Get(docver.VersionID), myProgressBarRefresh); _ = GetChangedFigureROIDs(origROFst, ROFstInfo.GetJustROFst(rofst.ROFstID), DocVersionInfo.Get(docver.VersionID), myProgressBarRefresh);
} }
docver.DocVersionAssociations[0].MyROFst = rofst; docver.DocVersionAssociations[0].MyROFst = rofst;
@@ -404,18 +379,11 @@ namespace VEPROMS.CSLA.Library
return false; return false;
} }
public ROFst GetJustROFst() public ROFst GetJustROFst() => ROFst.GetJustROFst(ROFstID);
{
return ROFst.GetJustROFst(ROFstID);
}
public List<string> OnROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) public List<string> OnROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) => ROTableUpdate != null ? ROTableUpdate(sender, args) : null;
{
if (ROTableUpdate != null) return ROTableUpdate(sender, args);
return null;
}
public static ROFstInfo GetJustROFst(int rOFstID) public static ROFstInfo GetJustROFst(int rOFstID)
{ {
try try
{ {
@@ -433,11 +401,6 @@ namespace VEPROMS.CSLA.Library
tmp = null; tmp = null;
} }
if (tmp != null)
{
tmp.ClearROLookupBytes();
}
return tmp; return tmp;
} }
catch (Exception ex) catch (Exception ex)
@@ -481,9 +444,11 @@ namespace VEPROMS.CSLA.Library
{ {
string cfg = docver.DocVersionAssociations[0].Config; string cfg = docver.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg); AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg)
ac.ROUpdate_LastCompleted = value; {
docver.DocVersionAssociations[0].Config = ac.ToString(); ROUpdate_LastCompleted = value
};
docver.DocVersionAssociations[0].Config = ac.ToString();
docver.Save(); docver.Save();
} }
@@ -494,9 +459,11 @@ namespace VEPROMS.CSLA.Library
if (docver.DocVersionAssociations[0]?.MyROFst != null && value != -1) if (docver.DocVersionAssociations[0]?.MyROFst != null && value != -1)
{ {
string cfg = docver.DocVersionAssociations[0].Config; string cfg = docver.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg); AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg)
ac.ROUpdate_PrevROFSTID = value.ToString(); {
docver.DocVersionAssociations[0].Config = ac.ToString(); ROUpdate_PrevROFSTID = value.ToString()
};
docver.DocVersionAssociations[0].Config = ac.ToString();
docver.Save(); docver.Save();
} }
} }
@@ -506,9 +473,11 @@ namespace VEPROMS.CSLA.Library
{ {
string cfg = docver.DocVersionAssociations[0].Config; string cfg = docver.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg); AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg)
ac.ROUpdate_LoadingFigures = value; {
docver.DocVersionAssociations[0].Config = ac.ToString(); ROUpdate_LoadingFigures = value
};
docver.DocVersionAssociations[0].Config = ac.ToString();
docver.Save(); docver.Save();
} }
@@ -539,8 +508,10 @@ namespace VEPROMS.CSLA.Library
// Add references for existing RO Images to the Figure table (Figure table relates ro.fst with its images) // Add references for existing RO Images to the Figure table (Figure table relates ro.fst with its images)
if (myUnChangedROImages.Count > 0) if (myUnChangedROImages.Count > 0)
using (FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID, buildImageIDString(myUnChangedROImages))) ; #pragma warning disable CS0642 // Possible mistaken empty statement - valid keeps scope of add
} using (FigureInfoList fil = FigureInfoList.AddByROFstIDImageIDs(rofst.ROFstID, buildImageIDString(myUnChangedROImages))) ;
#pragma warning restore CS0642 // Possible mistaken empty statement
}
SetAssociationROFiguresLoading(docVer, string.Empty); // B2017-125 loading RO Figures is completed SetAssociationROFiguresLoading(docVer, string.Empty); // B2017-125 loading RO Figures is completed
@@ -662,12 +633,9 @@ namespace VEPROMS.CSLA.Library
return myRoImagesList; return myRoImagesList;
} }
private static string ROImageKey(string fileName, DateTime dts) private static string ROImageKey(string fileName, DateTime dts) => string.Format("{0}:{1}", fileName, dts);
{
return string.Format("{0}:{1}", fileName, dts);
}
private static string buildImageIDString(List<int> myROImageIDs) private static string buildImageIDString(List<int> myROImageIDs)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -687,61 +655,6 @@ namespace VEPROMS.CSLA.Library
return sb.ToString(); return sb.ToString();
} }
private static DateTime ShowDuration(DateTime dtLast, string message)
{
DateTime dtNext = DateTime.Now;
Console.WriteLine("{0,10:#####0.00},'{1}'", TimeSpan.FromTicks(dtNext.Ticks - dtLast.Ticks).TotalSeconds, message);
return dtNext;
}
private static List<string> BuildActiveROIDsForRoUsages12(string RoidList, string versions)
{
List<string> activeRoids = new List<string>();
using (RoUsageInfoList activeList = RoUsageInfoList.GetROUSagesByROIDsAndVersions(RoidList, versions))
{
foreach (RoUsageInfo roui in activeList)
{
string roid = roui.ROID.ToUpper().Substring(0, 12);
if (!activeRoids.Contains(roid))
activeRoids.Add(roid);
}
}
return activeRoids;
}
private static List<string> BuildActiveROIDsForDRoUsages12(string RoidList, string versions)
{
List<string> activeRoids = new List<string>();
using (DROUsageInfoList activeList = DROUsageInfoList.GetDROUsagesByROIDsAndVersions(RoidList, versions))
{
foreach (DROUsageInfo roui in activeList)
{
string roid = roui.ROID.Substring(0, 12);
if (!activeRoids.Contains(roid))
activeRoids.Add(roid);
}
}
return activeRoids;
}
private static string GetRoidList(int dbid, List<string> chgList)
{
StringBuilder sb = new StringBuilder(string.Format("{0}", dbid));
string sep = ":";
foreach (string roid in chgList)
{
sb.Append(sep + roid);
sep = ",";
}
return sb.ToString();
}
// B2022-026 RO Memory Reduction code - all rochild types passed in are of type image (graphics) // B2022-026 RO Memory Reduction code - all rochild types passed in are of type image (graphics)
private void MigrateRoFstGraphics(RODbInfo rdi, ROFSTLookup.rochild[] rochild, RODb rodb, ROFst rofst, Dictionary<string, int> myExistingROImages, List<int> myUnChangedROImages, List<string> myAddedROImages, List<string> MyChangedFigureROIDs, ROFstInfoProgressBarRefresh myProgressBarRefresh, int cnt, ref int curCnt) private void MigrateRoFstGraphics(RODbInfo rdi, ROFSTLookup.rochild[] rochild, RODb rodb, ROFst rofst, Dictionary<string, int> myExistingROImages, List<int> myUnChangedROImages, List<string> myAddedROImages, List<string> MyChangedFigureROIDs, ROFstInfoProgressBarRefresh myProgressBarRefresh, int cnt, ref int curCnt)
{ {
@@ -771,64 +684,65 @@ namespace VEPROMS.CSLA.Library
} }
string imgfile = rdi.FolderPath + @"\" + fname; string imgfile = rdi.FolderPath + @"\" + fname;
if (File.Exists(imgfile))
{
FileInfo fi = new FileInfo(imgfile);
ROImage roImg = null; // if the roimage record exists, don't create a new one...
string key = ROImageKey(imgname, fi.LastWriteTimeUtc);
if (File.Exists(imgfile)) if (myExistingROImages.ContainsKey(key))
{ {
FileInfo fi = new FileInfo(imgfile); int imageID = myExistingROImages[key];
if (!myUnChangedROImages.Contains(imageID))
myUnChangedROImages.Add(imageID);
}
else
{
if (!myAddedROImages.Contains(key))
{
myProgressBarRefresh(curCnt, cnt, "Loading " + imgname); // show progress of loading images
// if the roimage record exists, don't create a new one... FileStream fsIn = new FileStream(imgfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
string key = ROImageKey(imgname, fi.LastWriteTimeUtc); BinaryReader r = new BinaryReader(fsIn);
byte[] ab = r.ReadBytes((int)fsIn.Length);
r.Close();
fsIn.Close();
if (myExistingROImages.ContainsKey(key)) byte[] cmp = ROImageInfo.Compress(ab);
{ int existingImageID = FindExisting(myExistingROImages, imgname, imgfile, cmp, ab);
int imageID = myExistingROImages[key];
if (!myUnChangedROImages.Contains(imageID))
myUnChangedROImages.Add(imageID);
}
else
{
if (!myAddedROImages.Contains(key))
{
myProgressBarRefresh(curCnt, cnt, "Loading " + imgname); // show progress of loading images
FileStream fsIn = new FileStream(imgfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); if (existingImageID != 0)
BinaryReader r = new BinaryReader(fsIn); {
byte[] ab = r.ReadBytes((int)fsIn.Length); if (!myUnChangedROImages.Contains(existingImageID))
r.Close(); {
fsIn.Close(); myUnChangedROImages.Add(existingImageID);
}
byte[] cmp = ROImageInfo.Compress(ab); return;
int existingImageID = FindExisting(myExistingROImages, imgname, imgfile, cmp, ab); }
if (existingImageID != 0) ROImageConfig rc = new ROImageConfig
{ {
if (!myUnChangedROImages.Contains(existingImageID)) Image_Size = ab.Length.ToString()
{ };
myUnChangedROImages.Add(existingImageID);
}
return;
}
ROImageConfig rc = new ROImageConfig(); ROImage roImg;
rc.Image_Size = ab.Length.ToString(); using (roImg = ROImage.MakeROImage(rodb, imgname, ROImageInfo.Compress(ab), rc.ToString(), fi.LastWriteTimeUtc, "Migration"))
{
using (roImg = ROImage.MakeROImage(rodb, imgname, ROImageInfo.Compress(ab), rc.ToString(), fi.LastWriteTimeUtc, "Migration")) using (Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID))
{ {
using (Figure figure = Figure.GetByROFstID_ImageID(this.ROFstID, roImg.ImageID)) if (figure != null) return;
{ Figure.MakeFigure(rofst, roImg, null).Dispose();
if (figure != null) return; myAddedROImages.Add(key);
Figure.MakeFigure(rofst, roImg, null).Dispose(); MyChangedFigureROIDs.Add(myRO.roid); // Save the roid so that the related documents will be refeshed. (PDF will be deleted)
myAddedROImages.Add(key); }
MyChangedFigureROIDs.Add(myRO.roid); // Save the roid so that the related documents will be refeshed. (PDF will be deleted) }
} }
} }
} }
} }
}
}
private int FindExisting(Dictionary<string, int> myExistingROImages, string imgname, string imgfile, byte[] cmpFileContents, byte[] fileContents) private int FindExisting(Dictionary<string, int> myExistingROImages, string imgname, string imgfile, byte[] cmpFileContents, byte[] fileContents)
{ {
@@ -940,22 +854,12 @@ namespace VEPROMS.CSLA.Library
public class ROFstInfoROTableUpdateEventArgs public class ROFstInfoROTableUpdateEventArgs
{ {
private string _ROText; public string ROText { get; set; }
public string ROText public string OldGridXml { get; set; }
public ROFstInfoROTableUpdateEventArgs(string rotext, string oldgridxml)
{ {
get { return _ROText; } ROText = rotext;
set { _ROText = value; } OldGridXml = oldgridxml;
}
private string _OldGridXml;
public string OldGridXml
{
get { return _OldGridXml; }
set { _OldGridXml = value; }
}
public ROFstInfoROTableUpdateEventArgs(string rotext, string oldgridxml)
{
_ROText = rotext;
_OldGridXml = oldgridxml;
} }
} }
@@ -1045,7 +949,6 @@ namespace VEPROMS.CSLA.Library
} }
} }
//GC.Collect();
return isDifferent; return isDifferent;
} }
catch (Exception ex) catch (Exception ex)
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
@@ -14,63 +13,30 @@ namespace VEPROMS.CSLA.Library
public delegate void ROImageInfoCompressionEvent(object sender, ROImageInfoCompressionEventArgs args); public delegate void ROImageInfoCompressionEvent(object sender, ROImageInfoCompressionEventArgs args);
public class ROImageInfoCompressionEventArgs public class ROImageInfoCompressionEventArgs
{ {
private int _Total; public int Total { get; set; }
public int Total public int Current { get; set; }
public string FileName { get; set; }
public ROImageCompressionEventType Type { get; set; }
public ROImageInfoCompressionEventArgs(ROImageCompressionEventType type) => Type = type;
public ROImageInfoCompressionEventArgs(int current, string fileName)
{ {
get { return _Total; } Current = current;
set { _Total = value; } FileName = fileName;
} Type = ROImageCompressionEventType.Update;
private int _Current;
public int Current
{
get { return _Current; }
set { _Current = value; }
}
private string _FileName;
public string FileName
{
get { return _FileName; }
set { _FileName = value; }
}
private ROImageCompressionEventType _Type;
public ROImageCompressionEventType Type
{
get { return _Type; }
set { _Type = value; }
}
public ROImageInfoCompressionEventArgs(ROImageCompressionEventType type)
{
_Type = type;
}
public ROImageInfoCompressionEventArgs(int current, string fileName)
{
_Current = current;
_FileName = fileName;
_Type = ROImageCompressionEventType.Update;
} }
public ROImageInfoCompressionEventArgs(int total) public ROImageInfoCompressionEventArgs(int total)
{ {
_Type = ROImageCompressionEventType.Initialize; Type = ROImageCompressionEventType.Initialize;
_Total = total; Total = total;
} }
} }
public enum ROImageCompressionEventType:int {Initialize, Update, Complete}; public enum ROImageCompressionEventType:int {Initialize, Update, Complete};
public partial class ROImageInfo public partial class ROImageInfo
{ {
public static event ROImageInfoCompressionEvent CompressAllExistingImages; public static event ROImageInfoCompressionEvent CompressAllExistingImages;
public static void OnCompressAllExistingImages(object sender, ROImageInfoCompressionEventArgs args) public static void OnCompressAllExistingImages(object sender, ROImageInfoCompressionEventArgs args) => CompressAllExistingImages?.Invoke(sender, args);
public static ROImageInfo GetByROFstID_FileName(int rOFstID, string fileName)
{ {
if (CompressAllExistingImages != null) CompressAllExistingImages(sender, args);
}
// put in for debug
//public static int CacheCountPrimaryKey
//{ get { return _CacheByPrimaryKey.Count; } }
//public static int CacheCountList
//{ get { return _CacheList.Count; } }
public static ROImageInfo GetByROFstID_FileName(int rOFstID, string fileName)
{
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a ROImage");
try try
{ {
if (fileName.EndsWith("PCX")) fileName = fileName.Replace(".PCX", ".TIF"); if (fileName.EndsWith("PCX")) fileName = fileName.Replace(".PCX", ".TIF");
@@ -95,7 +61,6 @@ namespace VEPROMS.CSLA.Library
} }
public static byte[] Compress(byte[] blob) public static byte[] Compress(byte[] blob)
{ {
int size = blob.Length;
using (MemoryStream Source = new MemoryStream(blob)) using (MemoryStream Source = new MemoryStream(blob))
{ {
using (MemoryStream Destination = new MemoryStream()) using (MemoryStream Destination = new MemoryStream())
@@ -171,9 +136,11 @@ namespace VEPROMS.CSLA.Library
{ {
string nm = ro.FileName; string nm = ro.FileName;
OnCompressAllExistingImages(null, new ROImageInfoCompressionEventArgs(pcount++, nm)); OnCompressAllExistingImages(null, new ROImageInfoCompressionEventArgs(pcount++, nm));
ROImageConfig rc = new ROImageConfig(); ROImageConfig rc = new ROImageConfig
rc.Image_Size = ro.Content.Length.ToString(); {
ro.Content = ROImageInfo.Compress(ro.Content); Image_Size = ro.Content.Length.ToString()
};
ro.Content = ROImageInfo.Compress(ro.Content);
ro.Config = rc.ToString(); ro.Config = rc.ToString();
ro.Save(); ro.Save();
} }
@@ -226,14 +193,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
private class ROFstID_FileNameCriteria private class ROFstID_FileNameCriteria
{ {
private int _ROFstID; private readonly int _ROFstID;
public int ROFstID => _ROFstID;
public int ROFstID private readonly string _FileName;
{ get { return _ROFstID; } } public string FileName => _FileName;
private string _FileName; public ROFstID_FileNameCriteria(int rOFstID, string fileName)
public string FileName
{ get { return _FileName; } }
public ROFstID_FileNameCriteria(int rOFstID, string fileName)
{ {
_ROFstID = rOFstID; _ROFstID = rOFstID;
_FileName = fileName; _FileName = fileName;
@@ -245,7 +209,6 @@ namespace VEPROMS.CSLA.Library
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#region Fields #region Fields
private bool _IsDisposed; private bool _IsDisposed;
//private static string _TemporaryFolder = null;
#endregion #endregion
#region Properties #region Properties
private ROImageInfo _MyROImage = null; private ROImageInfo _MyROImage = null;
@@ -260,19 +223,12 @@ namespace VEPROMS.CSLA.Library
} }
} }
private FileInfo _MyFile = null; private FileInfo _MyFile = null;
public FileInfo MyFile public FileInfo MyFile => _MyFile;
{
get { return _MyFile; } public string Extension { get; set; } = "TIF";
} #endregion
private string _Extension = "TIF"; #region Private Methods
public string Extension private void TryDelete()
{
get { return _Extension; }
set { _Extension = value; }
}
#endregion
#region Private Methods
private void TryDelete()
{ {
if (_MyROImage == null) return; if (_MyROImage == null) return;
if (_MyFile == null) return; if (_MyFile == null) return;
@@ -356,15 +312,12 @@ namespace VEPROMS.CSLA.Library
roImage.DTS = _MyFile.LastWriteTimeUtc; roImage.DTS = _MyFile.LastWriteTimeUtc;
roImage.Save(); roImage.Save();
} }
#endregion #endregion
#region Constructors #region Constructors
public ROImageFile(ROImageInfo myROImage) public ROImageFile(ROImageInfo myROImage) => MyROImage = myROImage;
{ #endregion
MyROImage = myROImage; #region Destructor
} ~ROImageFile()
#endregion
#region Destructor
~ROImageFile()
{ {
Dispose(false); Dispose(false);
} }
@@ -374,7 +327,8 @@ namespace VEPROMS.CSLA.Library
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
protected void Dispose(bool disposing) [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping disposing to match different signature")]
protected void Dispose(bool disposing)
{ {
if (!_IsDisposed) if (!_IsDisposed)
{ {
@@ -402,17 +356,10 @@ namespace VEPROMS.CSLA.Library
} }
private class RODbIDNoDataCriteria private class RODbIDNoDataCriteria
{ {
public RODbIDNoDataCriteria(int rODbID) public RODbIDNoDataCriteria(int rODbID) => RODbID = rODbID;
{
_RODbID = rODbID; public int RODbID { get; set; }
} }
private int _RODbID;
public int RODbID
{
get { return _RODbID; }
set { _RODbID = value; }
}
}
private void DataPortal_Fetch(RODbIDNoDataCriteria criteria) private void DataPortal_Fetch(RODbIDNoDataCriteria criteria)
{ {
this.RaiseListChangedEvents = false; this.RaiseListChangedEvents = false;
@@ -448,7 +395,6 @@ namespace VEPROMS.CSLA.Library
try try
{ {
ROImageInfoList tmp = DataPortal.Fetch<ROImageInfoList>(new RODbIDFilenameCriteria(rODbID,filename)); ROImageInfoList tmp = DataPortal.Fetch<ROImageInfoList>(new RODbIDFilenameCriteria(rODbID,filename));
//ROImageInfo.AddList(tmp);
tmp.AddEvents(); tmp.AddEvents();
return tmp; return tmp;
} }
@@ -461,22 +407,13 @@ namespace VEPROMS.CSLA.Library
{ {
public RODbIDFilenameCriteria(int rODbID,string filename) public RODbIDFilenameCriteria(int rODbID,string filename)
{ {
_RODbID = rODbID; RODbID = rODbID;
_Filename = filename; Filename = filename;
} }
private int _RODbID;
public int RODbID public int RODbID { get; set; }
{ public string Filename { get; set; }
get { return _RODbID; } }
set { _RODbID = value; }
}
private string _Filename;
public string Filename
{
get { return _Filename; }
set { _Filename = value; }
}
}
private void DataPortal_Fetch(RODbIDFilenameCriteria criteria) private void DataPortal_Fetch(RODbIDFilenameCriteria criteria)
{ {
this.RaiseListChangedEvents = false; this.RaiseListChangedEvents = false;
@@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using Csla; using Csla;
@@ -118,11 +116,8 @@ namespace VEPROMS.CSLA.Library
[Serializable] [Serializable]
private class GetROUsagesByROIDsCriteria private class GetROUsagesByROIDsCriteria
{ {
public GetROUsagesByROIDsCriteria(string roids) public GetROUsagesByROIDsCriteria(string roids) => _ROIDS = roids;
{ private string _ROIDS;
_ROIDS = roids;
}
private string _ROIDS;
public string ROIDS public string ROIDS
{ {
get { return _ROIDS; } get { return _ROIDS; }
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using Csla.Validation;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Data; using System.Data;
using Volian.Base.Library; using Volian.Base.Library;
@@ -143,35 +142,20 @@ namespace VEPROMS.CSLA.Library
public delegate void ItemInfoListCCEvent(object sender, ItemInfoListCCEventArgs args); public delegate void ItemInfoListCCEvent(object sender, ItemInfoListCCEventArgs args);
public class ItemInfoListCCEventArgs : EventArgs public class ItemInfoListCCEventArgs : EventArgs
{ {
private ProcedureInfo _MyProcedure; public ProcedureInfo MyProcedure { get; set; }
public ProcedureInfo MyProcedure public int MyCount { get; set; }
public ItemInfoListCCEventArgs(ProcedureInfo myProcedure, int myCount)
{ {
get { return _MyProcedure; } MyProcedure = myProcedure;
set { _MyProcedure = value; } MyCount = myCount;
}
private int _MyCount;
public int MyCount
{
get { return _MyCount; }
set { _MyCount = value; }
}
public ItemInfoListCCEventArgs(ProcedureInfo myProcedure, int myCount)
{
_MyProcedure = myProcedure;
_MyCount = myCount;
} }
} }
public partial class ItemInfoList public partial class ItemInfoList
{ {
public static event ItemInfoListCCEvent ConsistencyCheckUpdated; public static event ItemInfoListCCEvent ConsistencyCheckUpdated;
private static void OnConsistencyCheckUpdated(object sender, ItemInfoListCCEventArgs args) private static void OnConsistencyCheckUpdated(object sender, ItemInfoListCCEventArgs args) => ConsistencyCheckUpdated?.Invoke(sender, args);
{ public static ItemInfoList GetMoreProcedures(List<ProcedureInfo> procs)
if (ConsistencyCheckUpdated != null)
ConsistencyCheckUpdated(sender, args);
}
public static ItemInfoList GetMoreProcedures(List<ProcedureInfo> procs)
{ {
StringBuilder sb = new StringBuilder("<Items>"); StringBuilder sb = new StringBuilder("<Items>");
int count = 1; int count = 1;
@@ -290,11 +274,8 @@ namespace VEPROMS.CSLA.Library
get { return _DocVersionID; } get { return _DocVersionID; }
set { _DocVersionID = value; } set { _DocVersionID = value; }
} }
public ItemListAllInConsistenciesCriteria(int docVersionID) public ItemListAllInConsistenciesCriteria(int docVersionID) => _DocVersionID = docVersionID;
{ }
_DocVersionID = docVersionID;
}
}
private void DataPortal_Fetch(ItemListAllInConsistenciesCriteria criteria) private void DataPortal_Fetch(ItemListAllInConsistenciesCriteria criteria)
{ {
this.RaiseListChangedEvents = false; this.RaiseListChangedEvents = false;
@@ -359,16 +340,9 @@ namespace VEPROMS.CSLA.Library
} }
public static Revision GetByItemIDAndRevisionNumber(int itemID, string revisionNumber) public static Revision GetByItemIDAndRevisionNumber(int itemID, string revisionNumber)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Revision");
try try
{ {
//Revision tmp = GetCachedByPrimaryKey(revisionID); Revision tmp = DataPortal.Fetch<Revision>(new ItemRevisionNumberCriteria(itemID, revisionNumber));
//if (tmp == null)
//{
Revision tmp = DataPortal.Fetch<Revision>(new ItemRevisionNumberCriteria(itemID, revisionNumber));
// AddToCache(tmp);
//}
if (tmp.ErrorMessage == "No Record Found") if (tmp.ErrorMessage == "No Record Found")
{ {
tmp.Dispose(); // Clean-up Revision tmp.Dispose(); // Clean-up Revision
@@ -384,13 +358,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class ItemRevisionNumberCriteria protected class ItemRevisionNumberCriteria
{ {
private int _ItemID; private readonly int _ItemID;
public int ItemID public int ItemID => _ItemID;
{ get { return _ItemID; } } private readonly string _RevisionNumber;
private string _RevisionNumber; public string RevisionNumber => _RevisionNumber;
public string RevisionNumber public ItemRevisionNumberCriteria(int itemID, string revisionNumber)
{ get { return _RevisionNumber; } }
public ItemRevisionNumberCriteria(int itemID, string revisionNumber)
{ {
_ItemID = itemID; _ItemID = itemID;
_RevisionNumber = revisionNumber; _RevisionNumber = revisionNumber;
@@ -442,16 +414,9 @@ namespace VEPROMS.CSLA.Library
//jcb 20120625 //jcb 20120625
public static Revision GetByItemIDAndRevisionNumberAndUnitID(int itemID, string revisionNumber, int unitID) public static Revision GetByItemIDAndRevisionNumberAndUnitID(int itemID, string revisionNumber, int unitID)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Revision");
try try
{ {
//Revision tmp = GetCachedByPrimaryKey(revisionID);
//if (tmp == null)
//{
Revision tmp = DataPortal.Fetch<Revision>(new UnitItemRevisionNumberCriteria(itemID, revisionNumber, unitID)); Revision tmp = DataPortal.Fetch<Revision>(new UnitItemRevisionNumberCriteria(itemID, revisionNumber, unitID));
// AddToCache(tmp);
//}
if (tmp.ErrorMessage == "No Record Found") if (tmp.ErrorMessage == "No Record Found")
{ {
tmp.Dispose(); // Clean-up Revision tmp.Dispose(); // Clean-up Revision
@@ -467,16 +432,13 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class UnitItemRevisionNumberCriteria protected class UnitItemRevisionNumberCriteria
{ {
private int _ItemID; private readonly int _ItemID;
public int ItemID public int ItemID => _ItemID;
{ get { return _ItemID; } } private readonly string _RevisionNumber;
private string _RevisionNumber; public string RevisionNumber => _RevisionNumber;
public string RevisionNumber private readonly int _UnitID;
{ get { return _RevisionNumber; } } public int UnitID => _UnitID;
private int _UnitID; public UnitItemRevisionNumberCriteria(int itemID, string revisionNumber, int unitID)
public int UnitID
{ get { return _UnitID; } }
public UnitItemRevisionNumberCriteria(int itemID, string revisionNumber, int unitID)
{ {
_ItemID = itemID; _ItemID = itemID;
_RevisionNumber = revisionNumber; _RevisionNumber = revisionNumber;
@@ -535,12 +497,9 @@ namespace VEPROMS.CSLA.Library
{ {
try try
{ {
//if (_RevisionInfoList != null)
// return _RevisionInfoList;
RevisionInfoList tmp = DataPortal.Fetch<RevisionInfoList>(new ItemCriteria(itemID)); RevisionInfoList tmp = DataPortal.Fetch<RevisionInfoList>(new ItemCriteria(itemID));
RevisionInfo.AddList(tmp); RevisionInfo.AddList(tmp);
tmp.AddEvents(); tmp.AddEvents();
//_RevisionInfoList = tmp;
return tmp; return tmp;
} }
catch (Exception ex) catch (Exception ex)
@@ -551,14 +510,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class ItemCriteria protected class ItemCriteria
{ {
private int _ItemID; private readonly int _ItemID;
public int ItemID public int ItemID => _ItemID;
{ get { return _ItemID; } } public ItemCriteria(int itemID) => _ItemID = itemID;
public ItemCriteria(int itemID) }
{
_ItemID = itemID;
}
}
private void DataPortal_Fetch(ItemCriteria criteria) private void DataPortal_Fetch(ItemCriteria criteria)
{ {
this.RaiseListChangedEvents = false; this.RaiseListChangedEvents = false;
@@ -594,12 +549,9 @@ namespace VEPROMS.CSLA.Library
{ {
try try
{ {
//if (_RevisionInfoList != null)
// return _RevisionInfoList;
RevisionInfoList tmp = DataPortal.Fetch<RevisionInfoList>(new ItemUnitCriteria(itemID, unitID)); RevisionInfoList tmp = DataPortal.Fetch<RevisionInfoList>(new ItemUnitCriteria(itemID, unitID));
RevisionInfo.AddList(tmp); RevisionInfo.AddList(tmp);
tmp.AddEvents(); tmp.AddEvents();
//_RevisionInfoList = tmp;
return tmp; return tmp;
} }
catch (Exception ex) catch (Exception ex)
@@ -610,13 +562,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class ItemUnitCriteria protected class ItemUnitCriteria
{ {
private int _ItemID; private readonly int _ItemID;
public int ItemID public int ItemID => _ItemID;
{ get { return _ItemID; } } private readonly int _UnitID;
private int _UnitID; public int UnitID => _UnitID;
public int UnitID public ItemUnitCriteria(int itemID, int unitID)
{ get { return _UnitID; } }
public ItemUnitCriteria(int itemID, int unitID)
{ {
_ItemID = itemID; _ItemID = itemID;
_UnitID = unitID; _UnitID = unitID;
@@ -671,14 +621,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class ItemCriteria protected class ItemCriteria
{ {
private int _ItemID; private readonly int _ItemID;
public int ItemID public int ItemID => _ItemID;
{ get { return _ItemID; } } public ItemCriteria(int itemID) => _ItemID = itemID;
public ItemCriteria(int itemID) private int _UnitID = 0;
{
_ItemID = itemID;
}
private int _UnitID = 0;
public int UnitID public int UnitID
{ {
get{return _UnitID;} get{return _UnitID;}
@@ -696,12 +642,9 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class CurrentItemUnitCriteria : ItemCriteria protected class CurrentItemUnitCriteria : ItemCriteria
{ {
public CurrentItemUnitCriteria(int itemID, int unitID) public CurrentItemUnitCriteria(int itemID, int unitID)
: base(itemID) : base(itemID) => UnitID = unitID;
{ }
UnitID = unitID;
}
}
[Serializable()] [Serializable()]
protected class PreviousItemCriteria : ItemCriteria protected class PreviousItemCriteria : ItemCriteria
{ {
@@ -714,12 +657,6 @@ namespace VEPROMS.CSLA.Library
{ {
try try
{ {
//RevisionInfo tmp = GetCachedByPrimaryKey(revisionID);
//if (tmp == null)
//{
// tmp = DataPortal.Fetch<RevisionInfo>(new PKCriteria(revisionID));
// AddToCache(tmp);
//}
RevisionInfo tmp = DataPortal.Fetch<RevisionInfo>(new CurrentItemCriteria(itemID)); RevisionInfo tmp = DataPortal.Fetch<RevisionInfo>(new CurrentItemCriteria(itemID));
if (tmp.ErrorMessage == "No Record Found") if (tmp.ErrorMessage == "No Record Found")
{ {
@@ -754,12 +691,6 @@ namespace VEPROMS.CSLA.Library
{ {
try try
{ {
//RevisionInfo tmp = GetCachedByPrimaryKey(revisionID);
//if (tmp == null)
//{
// tmp = DataPortal.Fetch<RevisionInfo>(new PKCriteria(revisionID));
// AddToCache(tmp);
//}
RevisionInfo tmp = DataPortal.Fetch<RevisionInfo>(new PreviousItemCriteria(itemID)); RevisionInfo tmp = DataPortal.Fetch<RevisionInfo>(new PreviousItemCriteria(itemID));
if (tmp.ErrorMessage == "No Record Found") if (tmp.ErrorMessage == "No Record Found")
{ {
@@ -906,9 +837,11 @@ namespace VEPROMS.CSLA.Library
} }
public static string BuildRevisionChecks(ProcedureInfo proc) public static string BuildRevisionChecks(ProcedureInfo proc)
{ {
ConsistencyChecks cc = new ConsistencyChecks(); ConsistencyChecks cc = new ConsistencyChecks
cc.ItemID = proc.ItemID; {
BuildROChecks(cc, proc); ItemID = proc.ItemID
};
BuildROChecks(cc, proc);
BuildTransitionFromChecks(cc, proc); BuildTransitionFromChecks(cc, proc);
BuildTransitionToChecks(cc, proc); BuildTransitionToChecks(cc, proc);
BuildLibDocChecks(cc, proc); BuildLibDocChecks(cc, proc);
@@ -933,13 +866,11 @@ namespace VEPROMS.CSLA.Library
//create checkro record for each roid //create checkro record for each roid
//_MyTimer.ActiveProcess = "Get DocVersionInfo"; //_MyTimer.ActiveProcess = "Get DocVersionInfo";
// DocVersionInfo dbi = proc.ActiveParent as DocVersionInfo;
DocVersionInfo dvi = proc.MyDocVersion; DocVersionInfo dvi = proc.MyDocVersion;
//_MyTimer.ActiveProcess = "Get MyROFst"; //_MyTimer.ActiveProcess = "Get MyROFst";
if (dvi.DocVersionAssociations == null || dvi.DocVersionAssociations.Count == 0) return; // B2020-124: don't crash if docversion doesn't have rofst if (dvi.DocVersionAssociations == null || dvi.DocVersionAssociations.Count == 0) return; // B2020-124: don't crash if docversion doesn't have rofst
ROFstInfo rofst = ROFstInfo.GetJustROFst(dvi.DocVersionAssociations[0].ROFstID); ROFstInfo rofst = ROFstInfo.GetJustROFst(dvi.DocVersionAssociations[0].ROFstID);
//_MyTimer.ActiveProcess = "Get ROFst Lookup"; //_MyTimer.ActiveProcess = "Get ROFst Lookup";
//rofst.docVer = dvi;
ROFSTLookup lookup = rofst.GetROFSTLookup(dvi); ROFSTLookup lookup = rofst.GetROFSTLookup(dvi);
//_MyTimer.ActiveProcess = "Populating RevisionChecksXML table"; //_MyTimer.ActiveProcess = "Populating RevisionChecksXML table";
cc.ROConsistency.ROFstDate = rofst.DTS; cc.ROConsistency.ROFstDate = rofst.DTS;
@@ -957,27 +888,21 @@ namespace VEPROMS.CSLA.Library
using (TransitionInfoList myList = TransitionInfoList.GetAllForProcedure(proc, true)) using (TransitionInfoList myList = TransitionInfoList.GetAllForProcedure(proc, true))
foreach (TransitionInfo myTI in myList) foreach (TransitionInfo myTI in myList)
{ {
//\v <START]\v0 EMG\u160?ES\u8209?02, REACTOR TRIP RESPONSE, Step 14\v #Link:Transition:0 1 102[END>\v0 string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
//string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
Match m = Regex.Match(myTI.ContentText, lookFor); Match m = Regex.Match(myTI.ContentText, lookFor);
if (m != null && m.Groups.Count > 1) if (m != null && m.Groups.Count > 1)
{ {
int myIndex = m.Groups[4].Index; int myIndex = m.Groups[4].Index;
int myLength = m.Groups[4].Length; int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ") if (m.Groups[3].Value != " ")
{ {
myIndex = m.Groups[3].Index; myIndex = m.Groups[3].Index;
myLength += m.Groups[3].Length; myLength += m.Groups[3].Length;
} }
string gg = myTI.ContentText.Substring(myIndex, myLength); string gg = myTI.ContentText.Substring(myIndex, myLength);
cc.AddTransitionFromCheck(myTI.TransitionID, gg); cc.AddTransitionFromCheck(myTI.TransitionID, gg);
// System.Text.RegularExpressions.Group g = m.Groups[3];
// cc.AddTransitionFromCheck(myTI.TransitionID, g.ToString());
} }
//_MyTimer.ActiveProcess = "get from path"; //_MyTimer.ActiveProcess = "get from path";
//string myPath = myTI.MyItemToID.ShortPath;
} }
} }
private static void BuildTransitionToChecks(ConsistencyChecks cc, ProcedureInfo proc) private static void BuildTransitionToChecks(ConsistencyChecks cc, ProcedureInfo proc)
@@ -985,24 +910,20 @@ namespace VEPROMS.CSLA.Library
using (TransitionInfoList myList = TransitionInfoList.GetAllForProcedure(proc, false)) using (TransitionInfoList myList = TransitionInfoList.GetAllForProcedure(proc, false))
foreach (TransitionInfo myTI in myList) foreach (TransitionInfo myTI in myList)
{ {
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID); string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
//string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", myTI.TranType, myTI.TransitionID);
//string lookFor = string.Format(@"<START\]\\v0 ([^#]*?)\\v #Link:Transition[^:]*?:{0} {1} [0-9]*\[END>", tran.TranType, tran.TransitionID);
Match m = Regex.Match(myTI.ContentText, lookFor); Match m = Regex.Match(myTI.ContentText, lookFor);
if (m != null && m.Groups.Count > 1) if (m != null && m.Groups.Count > 1)
{ {
int myIndex = m.Groups[4].Index; int myIndex = m.Groups[4].Index;
int myLength = m.Groups[4].Length; int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ") if (m.Groups[3].Value != " ")
{ {
myIndex = m.Groups[3].Index; myIndex = m.Groups[3].Index;
myLength += m.Groups[3].Length; myLength += m.Groups[3].Length;
} }
string gg = myTI.ContentText.Substring(myIndex, myLength); string gg = myTI.ContentText.Substring(myIndex, myLength);
gg = gg.Replace("{", @"\{").Replace("}", @"\}"); gg = gg.Replace("{", @"\{").Replace("}", @"\}");
cc.AddTransitionToCheck(myTI.TransitionID, gg); cc.AddTransitionToCheck(myTI.TransitionID, gg);
// System.Text.RegularExpressions.Group g = m.Groups[3];
// cc.AddTransitionToCheck(myTI.TransitionID, g.ToString());
} }
} }
} }
@@ -1013,25 +934,16 @@ namespace VEPROMS.CSLA.Library
cc.AddLibDocCheck(myDI.DocID, myDI.DTS); cc.AddLibDocCheck(myDI.DocID, myDI.DTS);
} }
private static Volian.Base.Library.VlnTimer _MyTimer; private static Volian.Base.Library.VlnTimer _MyTimer;
public static void SetupTimer() public static void SetupTimer() => _MyTimer = new Volian.Base.Library.VlnTimer();
{ public static void ShowTimer() => _MyTimer.ShowElapsedTimes("BuildROChecks");
_MyTimer = new Volian.Base.Library.VlnTimer(); }
}
public static void ShowTimer()
{
_MyTimer.ShowElapsedTimes("BuildROChecks");
}
}
public partial class RoUsageInfoList public partial class RoUsageInfoList
{ {
[Serializable()] [Serializable()]
private class AllForProcedureCriteria private class AllForProcedureCriteria
{ {
public AllForProcedureCriteria(int itemID) public AllForProcedureCriteria(int itemID) => _ItemID = itemID;
{ private int _ItemID;
_ItemID = itemID;
}
private int _ItemID;
public int ItemID public int ItemID
{ {
get { return _ItemID; } get { return _ItemID; }
@@ -1090,11 +1002,8 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
private class AllForProcedureCriteria private class AllForProcedureCriteria
{ {
public AllForProcedureCriteria(int itemID) public AllForProcedureCriteria(int itemID) => _ItemID = itemID;
{ private int _ItemID;
_ItemID = itemID;
}
private int _ItemID;
public int ItemID public int ItemID
{ {
get { return _ItemID; } get { return _ItemID; }
@@ -1217,9 +1126,11 @@ namespace VEPROMS.CSLA.Library
IsReadOnly = false; IsReadOnly = false;
while (dr.Read()) while (dr.Read())
{ {
TransitionInfo ti = new TransitionInfo(dr); TransitionInfo ti = new TransitionInfo(dr)
ti.ContentText = dr.GetString("ContentText"); {
this.Add(ti); ContentText = dr.GetString("ContentText")
};
this.Add(ti);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -1239,11 +1150,8 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
private class AllForProcedureCriteria private class AllForProcedureCriteria
{ {
public AllForProcedureCriteria(int itemID) public AllForProcedureCriteria(int itemID) => _ItemID = itemID;
{ private int _ItemID;
_ItemID = itemID;
}
private int _ItemID;
public int ItemID public int ItemID
{ {
get { return _ItemID; } get { return _ItemID; }
@@ -1301,15 +1209,9 @@ namespace VEPROMS.CSLA.Library
[XmlRoot("ConsistencyChecks")] [XmlRoot("ConsistencyChecks")]
public class ConsistencyChecks public class ConsistencyChecks
{ {
public static ConsistencyChecks Get(string xml) public static ConsistencyChecks Get(string xml) => GenericSerializer<ConsistencyChecks>.StringDeserialize(xml);
{ public override string ToString() => GenericSerializer<ConsistencyChecks>.StringSerialize(this);
return GenericSerializer<ConsistencyChecks>.StringDeserialize(xml); private int _ItemID;
}
public override string ToString()
{
return GenericSerializer<ConsistencyChecks>.StringSerialize(this);
}
private int _ItemID;
[XmlAttribute("ItemID")] [XmlAttribute("ItemID")]
public int ItemID public int ItemID
{ {
@@ -1326,12 +1228,9 @@ namespace VEPROMS.CSLA.Library
get { return _ROConsistency; } get { return _ROConsistency; }
set { _ROConsistency = value; } set { _ROConsistency = value; }
} }
public void AddROCheck(string roid, string roValue) public void AddROCheck(string roid, string roValue) => ROConsistency.AddROCheck(roid, roValue);
{
ROConsistency.AddROCheck(roid, roValue);
}
private TransitionConsistency _TransitionFromConsistency = new TransitionConsistency(); private TransitionConsistency _TransitionFromConsistency = new TransitionConsistency();
[XmlElement("TransitionFromChecks")] [XmlElement("TransitionFromChecks")]
[Category("Transitions")] [Category("Transitions")]
[Description("Transition From Consistency Data")] [Description("Transition From Consistency Data")]
@@ -1341,11 +1240,8 @@ namespace VEPROMS.CSLA.Library
get { return _TransitionFromConsistency; } get { return _TransitionFromConsistency; }
set { _TransitionFromConsistency = value; } set { _TransitionFromConsistency = value; }
} }
public void AddTransitionFromCheck(int transitionid, string transitionValue) public void AddTransitionFromCheck(int transitionid, string transitionValue) => TransitionFromConsistency.AddTransitionCheck(transitionid, transitionValue);
{ private TransitionConsistency _TransitionToConsistency = new TransitionConsistency();
TransitionFromConsistency.AddTransitionCheck(transitionid, transitionValue);
}
private TransitionConsistency _TransitionToConsistency = new TransitionConsistency();
[XmlElement("TransitionToChecks")] [XmlElement("TransitionToChecks")]
[Category("Transitions")] [Category("Transitions")]
[Description("Transition To Consistency Data")] [Description("Transition To Consistency Data")]
@@ -1355,11 +1251,8 @@ namespace VEPROMS.CSLA.Library
get { return _TransitionToConsistency; } get { return _TransitionToConsistency; }
set { _TransitionToConsistency = value; } set { _TransitionToConsistency = value; }
} }
public void AddTransitionToCheck(int transitionid, string transitionValue) public void AddTransitionToCheck(int transitionid, string transitionValue) => TransitionToConsistency.AddTransitionCheck(transitionid, transitionValue);
{ private TransitionConsistency _TransitionConsistency = new TransitionConsistency();
TransitionToConsistency.AddTransitionCheck(transitionid, transitionValue);
}
private TransitionConsistency _TransitionConsistency = new TransitionConsistency();
[XmlElement("TransitionChecks")] [XmlElement("TransitionChecks")]
[Category("Transitions")] [Category("Transitions")]
[Description("Transition Consistency Data")] [Description("Transition Consistency Data")]
@@ -1380,11 +1273,8 @@ namespace VEPROMS.CSLA.Library
get { return _LibDocConsistency; } get { return _LibDocConsistency; }
set { _LibDocConsistency = value; } set { _LibDocConsistency = value; }
} }
public void AddLibDocCheck(int docid, DateTime docdate) public void AddLibDocCheck(int docid, DateTime docdate) => LibDocConsistency.AddLibDocCheck(docid, docdate);
{ }
LibDocConsistency.AddLibDocCheck(docid, docdate);
}
}
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class ROConsistency public class ROConsistency
@@ -1422,11 +1312,8 @@ namespace VEPROMS.CSLA.Library
if (!_ROCheckList.ContainsKey(roid)) if (!_ROCheckList.ContainsKey(roid))
_ROCheckList.Add(roid, new ROCheck(roid, roValue)); _ROCheckList.Add(roid, new ROCheck(roid, roValue));
} }
public override string ToString() public override string ToString() => string.Format("{0} ROs", _ROCheckList.Count);
{ }
return string.Format("{0} ROs", _ROCheckList.Count);
}
}
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class ROCheck public class ROCheck
@@ -1463,11 +1350,8 @@ namespace VEPROMS.CSLA.Library
public ROCheck() public ROCheck()
{ {
} }
public override string ToString() public override string ToString() => string.Format("{0} - '{1}'", ROID, ROValue);
{ }
return string.Format("{0} - '{1}'", ROID, ROValue);
}
}
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
@@ -1497,11 +1381,8 @@ namespace VEPROMS.CSLA.Library
if (!_TransitionCheckList.ContainsKey(transitionid)) if (!_TransitionCheckList.ContainsKey(transitionid))
_TransitionCheckList.Add(transitionid, new TransitionCheck(transitionid, transitionValue)); _TransitionCheckList.Add(transitionid, new TransitionCheck(transitionid, transitionValue));
} }
public override string ToString() public override string ToString() => string.Format("{0} Transitions", _TransitionCheckList.Count);
{ }
return string.Format("{0} Transitions", _TransitionCheckList.Count);
}
}
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class TransitionCheck public class TransitionCheck
@@ -1538,11 +1419,8 @@ namespace VEPROMS.CSLA.Library
public TransitionCheck() public TransitionCheck()
{ {
} }
public override string ToString() public override string ToString() => string.Format("{0} - '{1}'", TransitionID, TransitionValue);
{ }
return string.Format("{0} - '{1}'", TransitionID, TransitionValue);
}
}
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
@@ -1572,11 +1450,8 @@ namespace VEPROMS.CSLA.Library
if (!_LibDocCheckList.ContainsKey(docid)) if (!_LibDocCheckList.ContainsKey(docid))
_LibDocCheckList.Add(docid, new LibDocCheck(docid, docDate)); _LibDocCheckList.Add(docid, new LibDocCheck(docid, docDate));
} }
public override string ToString() public override string ToString() => string.Format("{0} LibDocs", _LibDocCheckList.Count);
{ }
return string.Format("{0} LibDocs", _LibDocCheckList.Count);
}
}
[Serializable] [Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public class LibDocCheck public class LibDocCheck
@@ -1604,16 +1479,10 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
//if (_OldDocDate == DateTime.MinValue)
// return null;
return _OldDocDate; return _OldDocDate;
} }
set set
{ {
//if (value == null)
// _OldDocDate = DateTime.MinValue;
//else
// _OldDocDate = value.Value;
_OldDocDate = value; _OldDocDate = value;
} }
} }
@@ -1625,11 +1494,8 @@ namespace VEPROMS.CSLA.Library
public LibDocCheck() public LibDocCheck()
{ {
} }
public override string ToString() public override string ToString() => string.Format("{0} - '{1}'", DocID, DocDate);
{ }
return string.Format("{0} - '{1}'", DocID, DocDate);
}
}
public enum Rev_Types : int public enum Rev_Types : int
{ {
Revision = 1, TempMod = 2 Revision = 1, TempMod = 2
@@ -9,13 +9,6 @@
// ======================================================================== // ========================================================================
using System; using System;
//using System.Collections.Generic;
//using System.Collections.Specialized;
//using System.Text;
//using System.IO;
//using System.Xml.Serialization;
//using System.Xml;
//using System.Xml.XPath;
using Csla; using Csla;
using Csla.Data; using Csla.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
@@ -50,14 +43,10 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class PKCriteriaJustStage protected class PKCriteriaJustStage
{ {
private int _StageID; private readonly int _StageID;
public int StageID public int StageID => _StageID;
{ get { return _StageID; } } public PKCriteriaJustStage(int stageID) => _StageID = stageID;
public PKCriteriaJustStage(int stageID) }
{
_StageID = stageID;
}
}
private void DataPortal_Fetch(PKCriteriaJustStage criteria) private void DataPortal_Fetch(PKCriteriaJustStage criteria)
{ {
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] StageInfo.DataPortal_Fetch", GetHashCode()); if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] StageInfo.DataPortal_Fetch", GetHashCode());
@@ -99,8 +88,6 @@ namespace VEPROMS.CSLA.Library
{ {
public static Stage GetJustStage(int stageID) public static Stage GetJustStage(int stageID)
{ {
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Stage");
try try
{ {
Stage tmp = DataPortal.Fetch<Stage>(new PKCriteriaJustStage(stageID)); Stage tmp = DataPortal.Fetch<Stage>(new PKCriteriaJustStage(stageID));
@@ -138,12 +125,6 @@ namespace VEPROMS.CSLA.Library
return; return;
} }
ReadData(dr); ReadData(dr);
// Don't load child objects
//dr.NextResult();
//_StageChecks = StageChecks.Get(dr);
// load child objects
//dr.NextResult();
//_StageVersions = StageVersions.Get(dr);
} }
} }
// removing of item only needed for local data portal // removing of item only needed for local data portal
@@ -161,17 +142,9 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class PKCriteriaJustStage protected class PKCriteriaJustStage
{ {
private int _StageID; private readonly int _StageID;
public int StageID public int StageID => _StageID;
{ get { return _StageID; } } public PKCriteriaJustStage(int stageID) => _StageID = stageID;
public PKCriteriaJustStage(int stageID) }
{
_StageID = stageID;
}
}
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
} }
} }
@@ -25,25 +25,10 @@ namespace VEPROMS.CSLA.Library
get { return _NewTransToUnNumberedItem; } get { return _NewTransToUnNumberedItem; }
set { _NewTransToUnNumberedItem = value; } set { _NewTransToUnNumberedItem = value; }
} }
public string PathTo public string PathTo => MyItemToID.Path;
{ public string PathFrom => MyContent.ContentItems[0].Path;
get public override string ToString() => $"ID: {TransitionID} From: {FromID} To: {ToID}";
{ [NonSerialized]
return MyItemToID.Path;
}
}
public string PathFrom
{
get
{
return MyContent.ContentItems[0].Path;
}
}
public override string ToString()
{
return string.Format("ID: {0} From: {1} To: {2}", TransitionID, FromID, ToID);
}
[NonSerialized]
private TransitionConfig _TransitionConfig; private TransitionConfig _TransitionConfig;
public TransitionConfig TransitionConfig public TransitionConfig TransitionConfig
{ {
@@ -56,27 +41,7 @@ namespace VEPROMS.CSLA.Library
return _TransitionConfig; return _TransitionConfig;
} }
} }
public bool HasPageNum public bool HasPageNum => TransitionConfig.Transition_Formatted.ToUpper() == "TRUE";
{
get
{
return TransitionConfig.Transition_Formatted.ToUpper() == "TRUE";
}
}
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem, bool hasPageNum)
{
try
{
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem, HasPageNum);
}
catch (Exception ex)
{
if (tranType == 2 && ex.Message == "Cannot find Next Item")
return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, toitem, HasPageNum);
_MyLog.Error("Error Processing Transition Text", ex);
return "(Resolved Transition Text)";
}
}
public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem) public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem)
{ {
try try
@@ -108,13 +73,6 @@ namespace VEPROMS.CSLA.Library
ItemInfo item = MyContent.ContentItems[0]; ItemInfo item = MyContent.ContentItems[0];
ItemInfo myItemToID = MyItemToID; ItemInfo myItemToID = MyItemToID;
if (tranLookup.ContainsKey(item.ItemID)) item = tranLookup[item.ItemID]; if (tranLookup.ContainsKey(item.ItemID)) item = tranLookup[item.ItemID];
bool hasPageNum = false;
if (item.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
item.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
{
TransitionConfig tc = new TransitionConfig(Config);
if (tc != null && tc.Transition_Formatted.ToUpper() == "TRUE") hasPageNum = true;
}
if (tranLookup.ContainsKey(ToID)) if (tranLookup.ContainsKey(ToID))
{ {
myItemToID = tranLookup[ToID]; myItemToID = tranLookup[ToID];
@@ -150,7 +108,7 @@ namespace VEPROMS.CSLA.Library
//Console.WriteLine("MyItemToID = {0}", MyItemToID); //Console.WriteLine("MyItemToID = {0}", MyItemToID);
//Console.WriteLine("MyItemRangeID = {0}", MyItemRangeID); //Console.WriteLine("MyItemRangeID = {0}", MyItemRangeID);
} }
return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID, hasPageNum); return ResolvePathTo(item.ActiveFormat, item, TranType, myItemToID, myItemRangeID);
} }
} }
#region AffectedTransitons #region AffectedTransitons
@@ -172,17 +130,11 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
protected class TransitionReportDataCriteria protected class TransitionReportDataCriteria
{ {
private int _VersionID; private readonly int _VersionID;
public int VersionID public int VersionID => _VersionID;
{ private readonly int _ProcedureID;
get { return _VersionID; } public int ProcedureID => _ProcedureID;
} public TransitionReportDataCriteria(int versionID, int procedureID)
private int _ProcedureID;
public int ProcedureID
{
get { return _ProcedureID; }
}
public TransitionReportDataCriteria(int versionID, int procedureID)
{ {
_VersionID = versionID; _VersionID = versionID;
_ProcedureID = procedureID; _ProcedureID = procedureID;
@@ -208,9 +160,11 @@ namespace VEPROMS.CSLA.Library
IsReadOnly = false; IsReadOnly = false;
while (dr.Read()) while (dr.Read())
{ {
TransitionInfo ti = new TransitionInfo(dr); TransitionInfo ti = new TransitionInfo(dr)
ti.Level = dr.GetInt32("level"); {
this.Add(ti); Level = dr.GetInt32("level")
};
this.Add(ti);
} }
IsReadOnly = true; IsReadOnly = true;
} }
@@ -228,11 +182,8 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
private class AffectedTransitonsCriteria private class AffectedTransitonsCriteria
{ {
public AffectedTransitonsCriteria(int itemID) public AffectedTransitonsCriteria(int itemID) => _ItemID = itemID;
{ private int _ItemID;
_ItemID = itemID;
}
private int _ItemID;
public int ItemID public int ItemID
{ {
get { return _ItemID; } get { return _ItemID; }
@@ -287,24 +238,17 @@ namespace VEPROMS.CSLA.Library
{ {
StringBuilder sb = new StringBuilder(""); StringBuilder sb = new StringBuilder("");
foreach (TransitionInfo trans in this) foreach (TransitionInfo trans in this)
sb.Append("\r\n" + trans.PathFrom); sb.Append($"\r\n{trans.PathFrom}");
return sb.ToString(); return sb.ToString();
} }
#endregion #endregion
#region ExternalTransitionsToChildren #region ExternalTransitionsToChildren
private class ExternalTransitionsToChildrenCriteria private class ExternalTransitionsToChildrenCriteria
{ {
public ExternalTransitionsToChildrenCriteria(int itemID) public ExternalTransitionsToChildrenCriteria(int itemID) => ItemID = itemID;
{
_ItemID = itemID; public int ItemID { get; set; }
} }
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
public static TransitionInfoList GetExternalTransitionsToChildren(int itemID) public static TransitionInfoList GetExternalTransitionsToChildren(int itemID)
{ {
try try
@@ -354,17 +298,10 @@ namespace VEPROMS.CSLA.Library
#region ExternalTransitions #region ExternalTransitions
private class ExternalTransitionsCriteria private class ExternalTransitionsCriteria
{ {
public ExternalTransitionsCriteria(int itemID) public ExternalTransitionsCriteria(int itemID) => ItemID = itemID;
{
_ItemID = itemID; public int ItemID { get; set; }
} }
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
public static TransitionInfoList GetExternalTransitions(int itemID) public static TransitionInfoList GetExternalTransitions(int itemID)
{ {
try try
@@ -413,17 +350,10 @@ namespace VEPROMS.CSLA.Library
#region PastedAffectedTransitions #region PastedAffectedTransitions
private class PastedAffectedTransitonsCriteria private class PastedAffectedTransitonsCriteria
{ {
public PastedAffectedTransitonsCriteria(int itemID) public PastedAffectedTransitonsCriteria(int itemID) => ItemID = itemID;
{
_ItemID = itemID; public int ItemID { get; set; }
} }
private int _ItemID;
public int ItemID
{
get { return _ItemID; }
set { _ItemID = value; }
}
}
internal static TransitionInfoList GetPastedAffected(int itemID) internal static TransitionInfoList GetPastedAffected(int itemID)
{ {
try try
@@ -472,17 +402,10 @@ namespace VEPROMS.CSLA.Library
#region TransitionsToDisconnected #region TransitionsToDisconnected
private class TransitionsToDisconnectedCriteria private class TransitionsToDisconnectedCriteria
{ {
public TransitionsToDisconnectedCriteria(string docVersionList) public TransitionsToDisconnectedCriteria(string docVersionList) => DocVersionList = docVersionList;
{
_DocVersionList = docVersionList; public string DocVersionList { get; set; }
} }
private string _DocVersionList;
public string DocVersionList
{
get { return _DocVersionList; }
set { _DocVersionList = value; }
}
}
public static TransitionInfoList GetTransitionsToDisconnected(string docVersionList) public static TransitionInfoList GetTransitionsToDisconnected(string docVersionList)
{ {
try try
@@ -531,17 +454,10 @@ namespace VEPROMS.CSLA.Library
#region TransitionsToNonEditable #region TransitionsToNonEditable
private class TransitionsToNonEditableCriteria private class TransitionsToNonEditableCriteria
{ {
public TransitionsToNonEditableCriteria(string docVersionList) public TransitionsToNonEditableCriteria(string docVersionList) => DocVersionList = docVersionList;
{
_DocVersionList = docVersionList; public string DocVersionList { get; set; }
} }
private string _DocVersionList;
public string DocVersionList
{
get { return _DocVersionList; }
set { _DocVersionList = value; }
}
}
public static TransitionInfoList GetTransitionsToNonEditable(string docVersionList) public static TransitionInfoList GetTransitionsToNonEditable(string docVersionList)
{ {
try try
@@ -590,7 +506,7 @@ namespace VEPROMS.CSLA.Library
} }
public class TransitionBuilder public class TransitionBuilder
{ {
private StringBuilder _Results = new StringBuilder(); private readonly StringBuilder _Results = new StringBuilder();
public FormatData _FormatData; public FormatData _FormatData;
public string _TransFormat; public string _TransFormat;
public E_TransUI _TransUI; public E_TransUI _TransUI;
@@ -599,53 +515,25 @@ namespace VEPROMS.CSLA.Library
public ItemInfo _ToItem; public ItemInfo _ToItem;
public ItemInfo _RangeItem; public ItemInfo _RangeItem;
public bool _UsedRangeAncestor; public bool _UsedRangeAncestor;
private string _Token; public string _UnitProcSetString;
public string _UnitProcSetString;
public bool SectNumWithStepNum; public bool SectNumWithStepNum;
private int _SectionNumberLength = 0;
public int SectionNumberLength public int SectionNumberLength { get; set; } = 0;
{ public string StepPrefix { get; set; } = "";
get { return _SectionNumberLength; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
set { _SectionNumberLength = value; } private List<int> _SectionsUsed = new List<int>();
} public List<int> SectionsUsed => _SectionsUsed;
private string _StepPrefix = ""; public string Token { get; set; }
public string StepPrefix private string _Prefix;
{
get { return _StepPrefix; }
set { _StepPrefix = value; }
}
private List<int> _SectionsUsed = new List<int>();
public List<int> SectionsUsed
{
get { return _SectionsUsed; }
}
public string Token
{
get { return _Token; }
set { _Token = value; }
}
private string _Prefix;
public string Prefix public string Prefix
{ {
get { return _Prefix; } get { return _Prefix; }
set { if(_Prefix==null)_Prefix = value; } set { if(_Prefix==null)_Prefix = value; }
} }
public void ResetPrefix(string str) public void ResetPrefix(string str) => _Prefix = str;
{ public bool HasText => _Results.Length > 0;
_Prefix = str; public StringBuilder Append(string str) => _Results.Append(str);
} public StringBuilder ReplaceToken(string str)
public bool HasText
{
get
{
return _Results.Length > 0;
}
}
public StringBuilder Append(string str)
{
return _Results.Append(str);
}
public StringBuilder ReplaceToken(string str)
{ {
if (str == null || str == "") return _Results; if (str == null || str == "") return _Results;
if (_FormatData.TransData.XchngTranSpForHard && str[0]!=',' && str[0] != ' ') if (_FormatData.TransData.XchngTranSpForHard && str[0]!=',' && str[0] != ' ')
@@ -662,19 +550,10 @@ namespace VEPROMS.CSLA.Library
else else
return _Results.Append(str.TrimEnd(" :".ToCharArray())); return _Results.Append(str.TrimEnd(" :".ToCharArray()));
} }
public override string ToString() public override string ToString() => _Results.ToString();
{ public StringBuilder Remove(int startIndex, int length) => _Results.Remove(startIndex, length);
return _Results.ToString(); public int Length => _Results.Length;
} public void AppendPrefix()
public StringBuilder Remove(int startIndex, int length)
{
return _Results.Remove(startIndex, length);
}
public int Length
{
get { return _Results.Length; }
}
public void AppendPrefix()
{ {
if (Prefix == null) return; // no Prefix text to add if (Prefix == null) return; // no Prefix text to add
if (HasText) if (HasText)
@@ -741,47 +620,43 @@ namespace VEPROMS.CSLA.Library
private static Dictionary<string, TransitionAppendFunction> _AppendMethods; private static Dictionary<string, TransitionAppendFunction> _AppendMethods;
private static void SetupMethods() private static void SetupMethods()
{ {
_AppendMethods = new Dictionary<string, TransitionAppendFunction>(); _AppendMethods = new Dictionary<string, TransitionAppendFunction>
_AppendMethods.Add("{Proc Num}", AddTransitionProcNum); {
_AppendMethods.Add("{?.Proc Num}", AddOptionalTransitionProcNum); { "{Proc Num}", AddTransitionProcNum },
_AppendMethods.Add("{Proc Title}", AddTransitionProcTitle); { "{?.Proc Num}", AddOptionalTransitionProcNum },
_AppendMethods.Add("{?.Proc Title}", AddOptionalTransitionProcTitle); { "{Proc Title}", AddTransitionProcTitle },
_AppendMethods.Add("{First Step}", AddStepNumber); { "{?.Proc Title}", AddOptionalTransitionProcTitle },
_AppendMethods.Add("{Step Number}", AddStepNumber); // WCN2, tran type 6 { "{First Step}", AddStepNumber },
_AppendMethods.Add("{Last Step}", AddRangeStepNumber); { "{Step Number}", AddStepNumber }, // WCN2, tran type 6
_AppendMethods.Add("{.}", AddIncludedStepNumber); { "{Last Step}", AddRangeStepNumber },
_AppendMethods.Add("{Sect Hdr}", AddTranGetSectionHdr); { "{.}", AddIncludedStepNumber },
_AppendMethods.Add("{?.Sect Hdr}", AddOptionalTranGetSectionHdr); { "{Sect Hdr}", AddTranGetSectionHdr },
_AppendMethods.Add("{Sect Title}", AddTranGetSectionTitle); { "{?.Sect Hdr}", AddOptionalTranGetSectionHdr },
_AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionTitle); { "{Sect Title}", AddTranGetSectionTitle },
_AppendMethods.Add("{?.Sect Num}", AddOptionalTranGetSectionNum); { "{?.Sect Title}", AddOptionalTranGetSectionTitle },
_AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber); { "{?.Sect Num}", AddOptionalTranGetSectionNum },
_AppendMethods.Add("{Sect Num All}", AddTranGetAllSectionNumber); { "{Sect Num}", AddTranGetSectionNumber },
_AppendMethods.Add("{Sect Number}", AddTranGetSectionNumber); // WCN2, tran type 6 { "{Sect Num All}", AddTranGetAllSectionNumber },
_AppendMethods.Add("{Page Num}", AddPageNumber); { "{Sect Number}", AddTranGetSectionNumber }, // WCN2, tran type 6
_AppendMethods.Add("{Step Text}", AddStepText); { "{Page Num}", AddPageNumber },
{ "{Step Text}", AddStepText }
};
} }
public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool hasPageNum) public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool hasPageNum) => GetResolvedText(fromInfo.ActiveFormat, fromInfo, tranType, toItem, rangeItem, hasPageNum);
{ private static readonly Regex RegFixVCS = new Regex(@"Section ([0-9.]+)(.0)? Step \1"); // Find Section xxx followed by Step xxx
return GetResolvedText(fromInfo.ActiveFormat, fromInfo, tranType, toItem, rangeItem, hasPageNum);
}
private static Regex RegFixVCS = new Regex(@"Section ([0-9.]+)(.0)? Step \1"); // Find Section xxx followed by Step xxx
public static string GetResolvedText(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool pagenum) public static string GetResolvedText(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem, bool pagenum)
{ {
if (!pagenum) if (!pagenum)
{ {
TransitionInfo ct = fromInfo.MyContent.ContentTransitionCount > 0 ? fromInfo.MyContent.ContentTransitions[0] : null; TransitionInfo ct = fromInfo.MyContent.ContentTransitionCount > 0 ? fromInfo.MyContent.ContentTransitions[0] : null;
int trIU = -1; if (ct != null)
string cfg = string.Empty;
if (ct != null)
{ {
trIU = fromInfo.MyContent.ContentTransitions[0].MyTransitionInfoUnique; _ = fromInfo.MyContent.ContentTransitions[0].MyTransitionInfoUnique;
cfg = fromInfo.MyContent.ContentTransitions[0].Config; _ = fromInfo.MyContent.ContentTransitions[0].Config;
} }
else else
{ {
string pattern = string.Format(@"<START\]\\v0([^#]*)\\v #Link:Transition(|Range):[0-9]* <CTID=-[0-9]+>( [0-9]*){{1,2}}\[END>"); string pattern = string.Format(@"<START\]\\v0([^#]*)\\v #Link:Transition(|Range):[0-9]* <CTID=-[0-9]+>( [0-9]*){{1,2}}\[END>");
//string pattern = string.Format(@".*\\v <START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:[0-9]+ <CTID=-[0-9]+>( [0-9]*){{1,2}}\[END>");
Match m = Regex.Match(fromInfo.MyContent.Text, pattern); Match m = Regex.Match(fromInfo.MyContent.Text, pattern);
if (m.Groups.Count > 1 && m.Groups[1].Value.ToUpper().Contains("(PAGE ~)")) // B2020-089, check for upper case Page ~ in case step was upper cased if (m.Groups.Count > 1 && m.Groups[1].Value.ToUpper().Contains("(PAGE ~)")) // B2020-089, check for upper case Page ~ in case step was upper cased
pagenum = true; pagenum = true;
@@ -805,7 +680,7 @@ namespace VEPROMS.CSLA.Library
tb._TransFormat = tb._TransFormat.Insert(tb._TransFormat.IndexOf("{First Step}")+12, " {Page Num}"); tb._TransFormat = tb._TransFormat.Insert(tb._TransFormat.IndexOf("{First Step}")+12, " {Page Num}");
} }
else else
tb._TransFormat = tb._TransFormat + " {Page Num}"; tb._TransFormat += " {Page Num}";
} }
} }
if(_AppendMethods==null) if(_AppendMethods==null)
@@ -820,18 +695,7 @@ namespace VEPROMS.CSLA.Library
retval = toItem.Ordinal.ToString(); retval = toItem.Ordinal.ToString();
fromInfo.NewTransToUnNumberedItem = true; fromInfo.NewTransToUnNumberedItem = true;
//Volian.Base.Library.vlnStackTrace.ShowStackLocal("Setting Flag", 3, 10); //Volian.Base.Library.vlnStackTrace.ShowStackLocal("Setting Flag", 3, 10);
//using (Item itm = fromInfo.Get())
//{
// ItemAnnotation ia = itm.ItemAnnotations.Add(AnnotationType.GetByName("Verifcation Required"));
// ia.SearchText = "Transition to Un-Numbered Step";
//itm.Save();
//}
} }
//if (Regex.IsMatch(retval, @".*\[[BP][0-9]{4,4}\].*")
// && tb._ToItem.ActiveFormat != null
// && tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert )
// retval = Regex.Replace(retval, @" *(\[[BP][0-9]{4,4}\])+","");
//return retval;
if (Regex.IsMatch(retval, @".* *\[([A-Z0-9 ]|\\u160\?)+\] *.*") if (Regex.IsMatch(retval, @".* *\[([A-Z0-9 ]|\\u160\?)+\] *.*")
&& tb._ToItem.ActiveFormat != null && tb._ToItem.ActiveFormat != null
&& tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) && tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert)
@@ -844,11 +708,13 @@ namespace VEPROMS.CSLA.Library
} }
private static TransitionBuilder SetupTransitionBuilder(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) private static TransitionBuilder SetupTransitionBuilder(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem)
{ {
TransitionBuilder tb = new TransitionBuilder(); TransitionBuilder tb = new TransitionBuilder
tb._FormatData = formatInfo.PlantFormat.FormatData; {
// get the format of the transition string based on this transition's index into the TransData part of _FormatData = formatInfo.PlantFormat.FormatData
// format.... };
if (tranType >= tb._FormatData.TransData.TransTypeList.MaxIndex) // found during fixing of B2016-176 B2016-197 fixes invalid index error during import of procedure // get the format of the transition string based on this transition's index into the TransData part of
// format....
if (tranType >= tb._FormatData.TransData.TransTypeList.MaxIndex) // found during fixing of B2016-176 B2016-197 fixes invalid index error during import of procedure
tranType = 0; tranType = 0;
// Replace 3 tokens ", {.}, {.}, {.}" with a single token "{.}" // Replace 3 tokens ", {.}, {.}, {.}" with a single token "{.}"
tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat.Replace(", {.}, {.}, {.}", "{.}"); tb._TransFormat = tb._FormatData.TransData.TransTypeList[tranType].TransFormat.Replace(", {.}, {.}, {.}", "{.}");
@@ -873,9 +739,7 @@ namespace VEPROMS.CSLA.Library
tb._TranType = 4; tb._TranType = 4;
} }
int startIndex = 0; int startIndex = 0;
int index = -1; string prefix = null;
int rexIndex = -1;
string prefix = null;
string prevToken = null; string prevToken = null;
bool lastAdded = false; bool lastAdded = false;
MatchCollection mc = Regex.Matches(tb._TransFormat, @"{(Proc Num|\?\.Proc Num|Proc Title|\?\.Proc Title|" + MatchCollection mc = Regex.Matches(tb._TransFormat, @"{(Proc Num|\?\.Proc Num|Proc Title|\?\.Proc Title|" +
@@ -885,8 +749,8 @@ namespace VEPROMS.CSLA.Library
{ {
string tmppref = prefix; string tmppref = prefix;
prefix = null; prefix = null;
rexIndex = m.Index; int rexIndex = m.Index;
int rexEndToken = m.Index + m.Length - 1; int rexEndToken = m.Index + m.Length - 1;
if (rexIndex > startIndex) prefix = tb._TransFormat.Substring(startIndex, rexIndex - startIndex); if (rexIndex > startIndex) prefix = tb._TransFormat.Substring(startIndex, rexIndex - startIndex);
if (prefix == null) prevToken = null; if (prefix == null) prevToken = null;
// if the last token did not add anything to the buffer, still want to put the text prefix in: // if the last token did not add anything to the buffer, still want to put the text prefix in:
@@ -1007,9 +871,8 @@ namespace VEPROMS.CSLA.Library
// as used by AEP is: UnitProcSetString ="{PSI:UNITCOM}-{SI:SETNAME}-{PSI:SETID}-" // as used by AEP is: UnitProcSetString ="{PSI:UNITCOM}-{SI:SETNAME}-{PSI:SETID}-"
string findMatch = "{.*?}"; string findMatch = "{.*?}";
MatchCollection ms = Regex.Matches(tb._UnitProcSetString,findMatch); MatchCollection ms = Regex.Matches(tb._UnitProcSetString,findMatch);
string txt = tb._UnitProcSetString; _ = tb._ToItem.MyDocVersion.MyFolder.FolderConfig as FolderConfig;
FolderConfig fc = tb._ToItem.MyDocVersion.MyFolder.FolderConfig as FolderConfig; ProcedureConfig pc = new ProcedureConfig(tb._ToItem.MyProcedure.MyContent.Config);
ProcedureConfig pc = new ProcedureConfig(tb._ToItem.MyProcedure.MyContent.Config);
// Use a dictionary to get all of the tokens from the format string, then // Use a dictionary to get all of the tokens from the format string, then
// go through all dictionary entries to make the replacements. // go through all dictionary entries to make the replacements.
Dictionary<string, string> repStr = new Dictionary<string, string>(); Dictionary<string, string> repStr = new Dictionary<string, string>();
@@ -1094,7 +957,7 @@ namespace VEPROMS.CSLA.Library
{ {
lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle); lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle);
lretstr.Append(tb._FormatData.TransData.CapsTransitions ? parenstr.ToUpper().Replace(@"\U", @"\u") : lretstr.Append(tb._FormatData.TransData.CapsTransitions ? parenstr.ToUpper().Replace(@"\U", @"\u") :
tb._FormatData.TransData.Cap1stCharTrans ? CapFirstLetterOnly(parenstr, 0) : tb._FormatData.TransData.Cap1stCharTrans ? CapFirstLetterOnly(parenstr) :
parenstr); parenstr);
lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle); lretstr.Append(tb._FormatData.TransData.DelimiterForTransitionTitle);
} }
@@ -1170,7 +1033,7 @@ namespace VEPROMS.CSLA.Library
if (thisTab != null && thisTab != "") if (thisTab != null && thisTab != "")
{ {
thisTab = thisTab.Trim(" ".ToCharArray()); thisTab = thisTab.Trim(" ".ToCharArray());
if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + "."; if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab += ".";
if (hasDotZero && thisTab.EndsWith(".0.")) thisTab = thisTab.Substring(0, thisTab.Length - 2); if (hasDotZero && thisTab.EndsWith(".0.")) thisTab = thisTab.Substring(0, thisTab.Length - 2);
} }
// RHM 20130326 2039 - I added the logic to limit the addition of the section tab to // RHM 20130326 2039 - I added the logic to limit the addition of the section tab to
@@ -1197,7 +1060,7 @@ namespace VEPROMS.CSLA.Library
if (!hasDelim) if (!hasDelim)
foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, ""); foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, "");
hlsTab = hlsTab.Trim(" ".ToCharArray()); hlsTab = hlsTab.Trim(" ".ToCharArray());
if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + "."; if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab += ".";
if (hasDotZero) if (hasDotZero)
{ {
if (item.IsHigh) if (item.IsHigh)
@@ -1218,9 +1081,6 @@ namespace VEPROMS.CSLA.Library
} }
private static bool AddPageNumber(TransitionBuilder tb) private static bool AddPageNumber(TransitionBuilder tb)
{ {
//At some point, add a property off a section 'IsFoldout' and use the next two lines:
//if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && mySection.MyContent.Number.ToUpper() == "FOLDOUT")
//|| (myProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.AlternateFloatingFoldout && mySection.MyContent.Text.ToUpper().Contains("FOLDOUT")))
if (tb._ToItem.PageNumber != -1 && (tb._FromItem.PageNumber != -1 || (tb._FromItem.ActiveSection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box if (tb._ToItem.PageNumber != -1 && (tb._FromItem.PageNumber != -1 || (tb._FromItem.ActiveSection.MyConfig as SectionConfig).Section_IsFoldout == "Y")) //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box
{ {
int pgoffset = tb._ToItem.PageNumber - tb._FromItem.PageNumber; int pgoffset = tb._ToItem.PageNumber - tb._FromItem.PageNumber;
@@ -1255,9 +1115,11 @@ namespace VEPROMS.CSLA.Library
} }
private static bool AddStepNumber(TransitionBuilder tb) private static bool AddStepNumber(TransitionBuilder tb)
{ {
// If we're on a step put out the step number. // If we're on a step put out the step number.
ItemInfo secitm = TranGetSectionItem(tb._ToItem); #pragma warning disable IDE0059 // Unnecessary assignment of a value - Kept for Debugging
if ((!((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || tb._ToItem.MyContent.Type > 20000) ItemInfo secitm = TranGetSectionItem(tb._ToItem);
#pragma warning restore IDE0059 // Unnecessary assignment of a value
if ((!((tb._TransUI & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) || tb._ToItem.MyContent.Type > 20000)
{ {
if (tb._FormatData.PrintData.SpecialCaseCalvertAlarm && tb._ToItem.IsHigh && tb._ToItem.FormatStepData.StepEditData.TypeMenu.MenuItem.ToUpper().Contains("WINDOW")) if (tb._FormatData.PrintData.SpecialCaseCalvertAlarm && tb._ToItem.IsHigh && tb._ToItem.FormatStepData.StepEditData.TypeMenu.MenuItem.ToUpper().Contains("WINDOW"))
{ {
@@ -1281,7 +1143,6 @@ namespace VEPROMS.CSLA.Library
tb.Remove(tb.Length - 7, 7); // 7 is length of ", Step " tb.Remove(tb.Length - 7, 7); // 7 is length of ", Step "
tb.AppendPrefix(); tb.AppendPrefix();
} }
//else if (tb._TranType == 4 && tb._ToItem.MoreThanOneStepSection())
else if (tb._TranType == 4 && tb._ToItem.MoreThanOneStepSection() || tb._TranType == 5) else if (tb._TranType == 4 && tb._ToItem.MoreThanOneStepSection() || tb._TranType == 5)
{ {
tb.AppendPrefix(); tb.AppendPrefix();
@@ -1333,14 +1194,14 @@ namespace VEPROMS.CSLA.Library
bool usedRangeAncestor = false; bool usedRangeAncestor = false;
// Refresh Next Items // Refresh Next Items
tb._ToItem.RefreshNextItems(); tb._ToItem.RefreshNextItems();
ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors, ref usedRangeAncestor); ItemInfo next = GetNextItem(tb._ToItem, rangeAncestors);
string lastTab = Tab(tb._RangeItem, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag); string lastTab = Tab(tb._RangeItem, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag);
while (next.ItemID != tb._RangeItem.ItemID) while (next.ItemID != tb._RangeItem.ItemID)
{ {
string thisTab = Tab(next, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag); string thisTab = Tab(next, tb._RangeItem.ActiveFormat.PlantFormat.FormatData.TransData.TStepNoFlag);
if (lastTab == thisTab) break; if (lastTab == thisTab) break;
tb.ReplaceToken(", " + thisTab); tb.ReplaceToken(", " + thisTab);
next = GetNextItem(next, rangeAncestors, ref usedRangeAncestor); next = GetNextItem(next, rangeAncestors);
} }
tb._UsedRangeAncestor = usedRangeAncestor; tb._UsedRangeAncestor = usedRangeAncestor;
return true; return true;
@@ -1363,7 +1224,7 @@ namespace VEPROMS.CSLA.Library
} }
return retval; return retval;
} }
private static ItemInfo GetNextItem(ItemInfo next, Dictionary<int, ItemInfo> rangeAncestors, ref bool usedRangeAncestor) private static ItemInfo GetNextItem(ItemInfo next, Dictionary<int, ItemInfo> rangeAncestors)
{ {
if (rangeAncestors.ContainsKey(next.ItemID)) if (rangeAncestors.ContainsKey(next.ItemID))
return rangeAncestors[next.ItemID]; return rangeAncestors[next.ItemID];
@@ -1473,15 +1334,9 @@ namespace VEPROMS.CSLA.Library
} }
return false; return false;
} }
private static bool AddTranGetSectionNumber(TransitionBuilder tb) private static bool AddTranGetSectionNumber(TransitionBuilder tb) => AddTranGetSectionNumber(tb, false);
{ private static bool AddTranGetAllSectionNumber(TransitionBuilder tb) => AddTranGetSectionNumber(tb, true);
return AddTranGetSectionNumber(tb, false); private static bool AddTranGetSectionNumber(TransitionBuilder tb, bool allLevels)
}
private static bool AddTranGetAllSectionNumber(TransitionBuilder tb)
{
return AddTranGetSectionNumber(tb, true);
}
private static bool AddTranGetSectionNumber(TransitionBuilder tb, bool allLevels)
{ {
if (tb._TranType == 1 && tb._ToItem.ActiveSection.ItemID == tb._FromItem.ActiveSection.ItemID) return false; if (tb._TranType == 1 && tb._ToItem.ActiveSection.ItemID == tb._FromItem.ActiveSection.ItemID) return false;
if (tb.SectNumWithStepNum) return false; if (tb.SectNumWithStepNum) return false;
@@ -1514,13 +1369,9 @@ namespace VEPROMS.CSLA.Library
tb.ReplaceToken(retstr); tb.ReplaceToken(retstr);
return (retstr != null && retstr != ""); return (retstr != null && retstr != "");
} }
//B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text //B2016-003 Transitions to sections whose number has a leading space was causing errors in transition text
private static string TrimSectNumber(string str) private static string TrimSectNumber(string str) => str == null ? str : str.TrimStart();
{ private static string FixTitleCase(Match m)
if (str == null) return str;
return str.TrimStart();
}
private static string FixTitleCase(Match m)
{ {
if (Regex.IsMatch(m.Value, @"^[A-Za-z]+\.?$")) if (Regex.IsMatch(m.Value, @"^[A-Za-z]+\.?$"))
{ {
@@ -1533,12 +1384,11 @@ namespace VEPROMS.CSLA.Library
} }
return m.Value; return m.Value;
} }
private static string CapFirstLetterOnly(string retstr, int p) private static string CapFirstLetterOnly(string retstr)
{ {
// LATER: write code to capitalize first letter (active plants) // LATER: write code to capitalize first letter (active plants)
// F2021-037: Support title case include '/' as separator (added '/' to regex replace) // F2021-037: Support title case include '/' as separator (added '/' to regex replace)
string lretstr = Regex.Replace(retstr, @"([^ ,/]+)", new MatchEvaluator(FixTitleCase)); return Regex.Replace(retstr, @"([^ ,/]+)", new MatchEvaluator(FixTitleCase));
return lretstr;
} }
// TODO: Section methods are not complete.... // TODO: Section methods are not complete....
private static ItemInfo TranGetSectionItem(ItemInfo itminfo) private static ItemInfo TranGetSectionItem(ItemInfo itminfo)
@@ -1564,7 +1414,7 @@ namespace VEPROMS.CSLA.Library
string str1 = TranGetSectionNumber(tb._ToItem); string str1 = TranGetSectionNumber(tb._ToItem);
// F2024-008 added flag to title case the section number in transitions // F2024-008 added flag to title case the section number in transitions
if (tb._FormatData.TransData.Cap1stCharTransSectionNumber) if (tb._FormatData.TransData.Cap1stCharTransSectionNumber)
str1 = CapFirstLetterOnly(str1, 0); str1 = CapFirstLetterOnly(str1);
if(!tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) return str1; if(!tb._ToItem.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) return str1;
List<ItemInfo> FromSections = GetSections(tb._FromItem.ActiveSection); List<ItemInfo> FromSections = GetSections(tb._FromItem.ActiveSection);
List<ItemInfo> ToSections = GetSections(tb._ToItem.ActiveSection); List<ItemInfo> ToSections = GetSections(tb._ToItem.ActiveSection);
@@ -1578,11 +1428,9 @@ namespace VEPROMS.CSLA.Library
break; break;
} }
} }
//string str = tmpitm.MyContent.Number;
string str = BuildSectionPath(ToSections); string str = BuildSectionPath(ToSections);
// B2024-025 - process all of the applicability token (<U-xxx>, <U>, <ID>) // B2024-025 - process all of the applicability token (<U-xxx>, <U>, <ID>)
str = VEPROMS.CSLA.Library.DisplayText.ResolveUnitSpecific(tb._ToItem.MyDocVersion, str); str = VEPROMS.CSLA.Library.DisplayText.ResolveUnitSpecific(tb._ToItem.MyDocVersion, str);
//if (!str.EndsWith(".") && tb._ToItem.ItemID != tb._ToItem.ActiveSection.ItemID)
tb.StepPrefix = "."; tb.StepPrefix = ".";
tb.SectionNumberLength = str.Length; tb.SectionNumberLength = str.Length;
return (str); return (str);
@@ -1611,11 +1459,8 @@ namespace VEPROMS.CSLA.Library
sb.Append(sep + lastPart.TrimEnd(" ".ToCharArray())); sb.Append(sep + lastPart.TrimEnd(" ".ToCharArray()));
return sb.ToString(); return sb.ToString();
} }
private static bool IsRoman(string number) private static bool IsRoman(string number) => Regex.IsMatch(number, @"[IVXLCDM]+\.?");
{ private static List<ItemInfo> GetSections(ItemInfo myItemInfo)
return Regex.IsMatch(number,@"[IVXLCDM]+\.?");
}
private static List<ItemInfo> GetSections(ItemInfo myItemInfo)
{ {
List<ItemInfo> retval = new List<ItemInfo>(); List<ItemInfo> retval = new List<ItemInfo>();
while (myItemInfo != null && myItemInfo.IsSection) while (myItemInfo != null && myItemInfo.IsSection)
@@ -1633,7 +1478,7 @@ namespace VEPROMS.CSLA.Library
ItemInfo tmpitm = TranGetSectionItem(itminfo); ItemInfo tmpitm = TranGetSectionItem(itminfo);
string sectionTitle = tmpitm.MyContent.Text; string sectionTitle = tmpitm.MyContent.Text;
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") : sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) : tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle) :
sectionTitle); sectionTitle);
// F2024-008 Added flag to surround the section title with parenthesis in transitions // F2024-008 Added flag to surround the section title with parenthesis in transitions
if (tb._FormatData.TransData.ParensAroundSectionTitle) if (tb._FormatData.TransData.ParensAroundSectionTitle)
@@ -1658,7 +1503,7 @@ namespace VEPROMS.CSLA.Library
ItemInfo tmpitm = TranGetSectionItem(itminfo); ItemInfo tmpitm = TranGetSectionItem(itminfo);
string sectionTitle = tmpitm.MyContent.Text; string sectionTitle = tmpitm.MyContent.Text;
sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") : sectionTitle = (tb._FormatData.TransData.CapsTransitionsSection ? sectionTitle.ToUpper().Replace(@"\U", @"\u") :
tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle, 0) : tb._FormatData.TransData.Cap1stCharTransSection ? CapFirstLetterOnly(sectionTitle) :
sectionTitle); sectionTitle);
// B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title. // B2017-236 Replace embedded returns with spaces and trim the spaces from the end of the section title.
return TrimSectionTitle(sectionTitle); return TrimSectionTitle(sectionTitle);