Modified code to support structure changes to treeview nodes
This commit is contained in:
@@ -12,6 +12,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
public partial class Content
|
||||
{
|
||||
public string LastChangedString
|
||||
{
|
||||
get { return ContentInfo.FormatByteArray(_LastChanged); }
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} {1}", Number, Text);
|
||||
@@ -554,6 +558,24 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public partial class ContentInfo
|
||||
{
|
||||
public static string FormatByteArray(byte[] myArray)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < myArray.Length; i++)
|
||||
{
|
||||
sb.Append(string.Format("{0:x2}", myArray[i]));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
public string LastChangedString
|
||||
{
|
||||
get { return ContentInfo.FormatByteArray(_LastChanged); }
|
||||
}
|
||||
//Convert.ToInt64( ByteArrayToHexString(_ts), 16 ) )
|
||||
public Int64 LastChangedInt64
|
||||
{
|
||||
get { return Convert.ToInt64(LastChangedString, 16); }
|
||||
}
|
||||
public static bool IsInCache(int contentID)
|
||||
{
|
||||
return _CacheByPrimaryKey.ContainsKey(contentID.ToString());
|
||||
|
@@ -352,6 +352,10 @@ namespace VEPROMS.CSLA.Library
|
||||
if (id == ItemID) return true;
|
||||
return false;
|
||||
}
|
||||
public static bool IsInCache(int itemID)
|
||||
{
|
||||
return _CacheByPrimaryKey.ContainsKey(itemID.ToString());
|
||||
}
|
||||
public void SetHeader(VE_Font myFont, string myText)
|
||||
{
|
||||
_MyHeader = new MetaTag(myFont);
|
||||
@@ -2588,6 +2592,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Lookups and More Related
|
||||
private ItemInfoList Lookup(int fromType, ref ItemInfoList itemInfoList)
|
||||
{
|
||||
Console.WriteLine(itemInfoList);
|
||||
if (itemInfoList == null)
|
||||
itemInfoList = Lookup(fromType);
|
||||
return itemInfoList;
|
||||
@@ -3863,9 +3868,9 @@ namespace VEPROMS.CSLA.Library
|
||||
(MyPrevious != null && MyPrevious.MyContent.Type == MyContent.Type) ||
|
||||
(NextItem != null && nextItem.MyContent.Type == MyContent.Type))
|
||||
{
|
||||
tbformat = tbformat + ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
TabToIdentBAdjustFont();
|
||||
}
|
||||
tbformat = tbformat + ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
TabToIdentBAdjustFont();
|
||||
}
|
||||
}
|
||||
else if (FormatStepData.TabData.IsTransition)
|
||||
return tbformat;
|
||||
|
@@ -68,8 +68,14 @@ namespace VEPROMS.CSLA.Library
|
||||
#region SessionInfo stuff
|
||||
public partial class SessionInfo
|
||||
{
|
||||
private string _LastChanged = string.Empty;
|
||||
public string LastChanged
|
||||
private Int64 _LastContentChange;
|
||||
public Int64 LastContentChange
|
||||
{
|
||||
get { return _LastContentChange; }
|
||||
set { _LastContentChange = value; }
|
||||
}
|
||||
private byte[] _LastChanged = new byte[8];
|
||||
public byte[] LastChanged
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
@@ -79,6 +85,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
set { _LastChanged = value; }
|
||||
}
|
||||
public string LastChangedString
|
||||
{
|
||||
get { return ContentInfo.FormatByteArray(_LastChanged); }
|
||||
}
|
||||
public Int64 LastChangedInt64
|
||||
{
|
||||
get { return Convert.ToInt64(LastChangedString, 16); }
|
||||
}
|
||||
public static SessionInfo BeginSession(string machineName, int processID)
|
||||
{
|
||||
try
|
||||
@@ -96,26 +110,24 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on SessionInfo.BeginSession", ex);
|
||||
}
|
||||
}
|
||||
private Dictionary<int, string> _ChangedContents;
|
||||
public Dictionary<int, string> ChangedContents
|
||||
private Dictionary<int, Int64> _ChangedContents;
|
||||
public Dictionary<int, Int64> ChangedContents
|
||||
{
|
||||
get { return _ChangedContents; }
|
||||
set { _ChangedContents = value; }
|
||||
}
|
||||
private Dictionary<int, Int64> _ChangedItems;
|
||||
public Dictionary<int, Int64> ChangedItems
|
||||
{
|
||||
get { return _ChangedItems; }
|
||||
set { _ChangedItems = value; }
|
||||
}
|
||||
public List<int> PingSession()
|
||||
{
|
||||
List<int> myList = new List<int>();
|
||||
SessionPing.Execute(this.SessionID);
|
||||
ChangedContents = SessionChangedContents.Execute(this.LastChanged);
|
||||
//ContentInfoList cil = ContentInfoList.GetChangedList(Convert.FromBase64String(this.LastChanged));
|
||||
//foreach (ContentInfo ci in cil)
|
||||
// if (!ChangedContentIDs.ContainsKey(ci.ContentID))
|
||||
// ChangedContentIDs.Add(ci.ContentID, false);
|
||||
//foreach(ContentInfo ci in cil)
|
||||
// if(ContentInfo.IsInCache(ci.ContentID))
|
||||
// using (Content cc = ci.Get())
|
||||
// ContentInfo.Refresh(cc);
|
||||
|
||||
ChangedContents = SessionChangedContents.Execute(this.LastContentChange);
|
||||
ChangedItems = SessionChangedItems.Execute(this.LastContentChange);
|
||||
OwnerInfoList oil = OwnerInfoList.GetBySessionID(this.SessionID);
|
||||
foreach (OwnerInfo oi in oil)
|
||||
myList.Add(oi.OwnerID);
|
||||
@@ -234,7 +246,6 @@ namespace VEPROMS.CSLA.Library
|
||||
return;
|
||||
}
|
||||
ReadData(dr);
|
||||
_LastChanged = Convert.ToBase64String(dr["LastChanged"] as byte[]);
|
||||
}
|
||||
}
|
||||
// removing of item only needed for local data portal
|
||||
@@ -622,23 +633,23 @@ namespace VEPROMS.CSLA.Library
|
||||
public class SessionChangedContents : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private string _LastChanged;
|
||||
public string LastChanged
|
||||
private Int64 _LastContentChange;
|
||||
public Int64 LastContentChange
|
||||
{
|
||||
get { return _LastChanged; }
|
||||
set { _LastChanged = value; }
|
||||
get { return _LastContentChange; }
|
||||
set { _LastContentChange = value; }
|
||||
}
|
||||
private Dictionary<int, string> _ChangedContents;
|
||||
public Dictionary<int, string> ChangedContents
|
||||
private Dictionary<int,Int64> _ChangedContents;
|
||||
public Dictionary<int, Int64> ChangedContents
|
||||
{
|
||||
get { return _ChangedContents; }
|
||||
set { _ChangedContents = value; }
|
||||
}
|
||||
#region Factory Methods
|
||||
public static Dictionary<int, string> Execute(string lastChanged)
|
||||
public static Dictionary<int, Int64> Execute(Int64 lastContentChanged)
|
||||
{
|
||||
SessionChangedContents cmd = new SessionChangedContents();
|
||||
cmd.LastChanged = lastChanged;
|
||||
cmd.LastContentChange = lastContentChanged;
|
||||
cmd = DataPortal.Execute<SessionChangedContents>(cmd);
|
||||
return cmd.ChangedContents;
|
||||
}
|
||||
@@ -654,12 +665,12 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 0;
|
||||
cmd.Parameters.AddWithValue("@LastChanged", Convert.FromBase64String(LastChanged));
|
||||
cmd.Parameters.AddWithValue("@LastChanged", LastContentChange);
|
||||
cmd.Parameters.AddWithValue("@UserID", Volian.Base.Library.VlnSettings.UserID);
|
||||
SqlDataReader dr = cmd.ExecuteReader();
|
||||
ChangedContents = new Dictionary<int, string>();
|
||||
ChangedContents = new Dictionary<int, Int64>();
|
||||
while (dr.Read())
|
||||
ChangedContents.Add(dr.GetInt32(0), Convert.ToBase64String(dr["LastChanged"] as byte[]));
|
||||
ChangedContents.Add(dr.GetInt32(0), (Int64)dr.GetSqlInt64(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -671,6 +682,58 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public class SessionChangedItems : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Int64 _LastContentChange;
|
||||
public Int64 LastContentChange
|
||||
{
|
||||
get { return _LastContentChange; }
|
||||
set { _LastContentChange = value; }
|
||||
}
|
||||
private Dictionary<int, Int64> _ChangedItems;
|
||||
public Dictionary<int, Int64> ChangedItems
|
||||
{
|
||||
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;
|
||||
}
|
||||
#endregion
|
||||
#region Server-Side Code
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand("vesp_ListItemsAfterLastChanged", cn))
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 0;
|
||||
cmd.Parameters.AddWithValue("@LastChanged", LastContentChange);
|
||||
cmd.Parameters.AddWithValue("@UserID", Volian.Base.Library.VlnSettings.UserID);
|
||||
SqlDataReader dr = cmd.ExecuteReader();
|
||||
ChangedItems = new Dictionary<int, Int64>();
|
||||
while (dr.Read())
|
||||
ChangedItems.Add(dr.GetInt32(0), (Int64)dr.GetSqlInt64(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("SessionChangedItems Error", ex);
|
||||
throw new ApplicationException("Failure on SessionChangedItems", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region OwnerInfo stuff
|
||||
public partial class OwnerInfoList
|
||||
|
@@ -345,6 +345,16 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public byte[] LastChanged
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("LastChanged", true);
|
||||
return _LastChanged;
|
||||
}
|
||||
set { _LastChanged = value; }
|
||||
}
|
||||
private int _ContentDetailCount = 0;
|
||||
/// <summary>
|
||||
/// Count of ContentDetails for this Content
|
||||
|
@@ -117,6 +117,18 @@ namespace VEPROMS.CSLA.Library
|
||||
return _ContentID;
|
||||
}
|
||||
}
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public byte[] LastChanged
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("LastChanged", true);
|
||||
return _LastChanged;
|
||||
}
|
||||
set { _LastChanged = value; }
|
||||
}
|
||||
|
||||
private string _Number = string.Empty;
|
||||
/// <summary>
|
||||
/// Increased from 30 to 256 to support RTF symbols
|
||||
@@ -631,6 +643,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_LastChanged = tmp.LastChanged;
|
||||
_ContentInfoExtension.Refresh(this);
|
||||
_ContentEntryCount = -1;// Reset Count
|
||||
_ContentGridCount = -1;// Reset Count
|
||||
@@ -724,6 +737,7 @@ namespace VEPROMS.CSLA.Library
|
||||
_Config = dr.GetString("Config");
|
||||
_DTS = dr.GetDateTime("DTS");
|
||||
_UserID = dr.GetString("UserID");
|
||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||
_ContentDetailCount = dr.GetInt32("DetailCount");
|
||||
_ContentEntryCount = dr.GetInt32("EntryCount");
|
||||
_ContentGridCount = dr.GetInt32("GridCount");
|
||||
|
@@ -304,6 +304,8 @@ namespace VEPROMS.CSLA.Library
|
||||
_DTSActivity = dr.GetDateTime("DTSActivity");
|
||||
_MachineName = dr.GetString("MachineName");
|
||||
_ProcessID = dr.GetInt32("ProcessID");
|
||||
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
|
||||
_LastContentChange = dr.GetInt64("LastContentChange");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user