Modified code to support structure changes to treeview nodes
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user