Added code to support refreshing display based on changes made by another user
This commit is contained in:
@@ -68,6 +68,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#region SessionInfo stuff
|
||||
public partial class SessionInfo
|
||||
{
|
||||
private string _LastChanged = string.Empty;
|
||||
public string LastChanged
|
||||
{
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("LastChanged", true);
|
||||
return _LastChanged;
|
||||
}
|
||||
set { _LastChanged = value; }
|
||||
}
|
||||
public static SessionInfo BeginSession(string machineName, int processID)
|
||||
{
|
||||
try
|
||||
@@ -85,10 +96,26 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on SessionInfo.BeginSession", ex);
|
||||
}
|
||||
}
|
||||
private Dictionary<int, string> _ChangedContents;
|
||||
public Dictionary<int, string> ChangedContents
|
||||
{
|
||||
get { return _ChangedContents; }
|
||||
set { _ChangedContents = 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);
|
||||
|
||||
OwnerInfoList oil = OwnerInfoList.GetBySessionID(this.SessionID);
|
||||
foreach (OwnerInfo oi in oil)
|
||||
myList.Add(oi.OwnerID);
|
||||
@@ -188,6 +215,7 @@ namespace VEPROMS.CSLA.Library
|
||||
return;
|
||||
}
|
||||
ReadData(dr);
|
||||
_LastChanged = Convert.ToBase64String(dr["LastChanged"] as byte[]);
|
||||
}
|
||||
}
|
||||
// removing of item only needed for local data portal
|
||||
@@ -572,6 +600,58 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public class SessionChangedContents : CommandBase
|
||||
{
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private string _LastChanged;
|
||||
public string LastChanged
|
||||
{
|
||||
get { return _LastChanged; }
|
||||
set { _LastChanged = value; }
|
||||
}
|
||||
private Dictionary<int, string> _ChangedContents;
|
||||
public Dictionary<int, string> ChangedContents
|
||||
{
|
||||
get { return _ChangedContents; }
|
||||
set { _ChangedContents = value; }
|
||||
}
|
||||
#region Factory Methods
|
||||
public static Dictionary<int, string> Execute(string lastChanged)
|
||||
{
|
||||
SessionChangedContents cmd = new SessionChangedContents();
|
||||
cmd.LastChanged = lastChanged;
|
||||
cmd = DataPortal.Execute<SessionChangedContents>(cmd);
|
||||
return cmd.ChangedContents;
|
||||
}
|
||||
#endregion
|
||||
#region Server-Side Code
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
{
|
||||
using (SqlCommand cmd = new SqlCommand("vesp_ListContentsAfterLastChanged2", cn))
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandTimeout = 0;
|
||||
cmd.Parameters.AddWithValue("@LastChanged", Convert.FromBase64String(LastChanged));
|
||||
cmd.Parameters.AddWithValue("@UserID", Volian.Base.Library.VlnSettings.UserID);
|
||||
SqlDataReader dr = cmd.ExecuteReader();
|
||||
ChangedContents = new Dictionary<int, string>();
|
||||
while (dr.Read())
|
||||
ChangedContents.Add(dr.GetInt32(0), Convert.ToBase64String(dr["LastChanged"] as byte[]));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("SessionChangedContents Error", ex);
|
||||
throw new ApplicationException("Failure on SessionChangedContents", ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
#region OwnerInfo stuff
|
||||
public partial class OwnerInfoList
|
||||
|
Reference in New Issue
Block a user