Modified code to support structure changes to treeview nodes

This commit is contained in:
Jim 2015-05-16 17:02:26 +00:00
parent f66cb15dd3
commit f005316849
9 changed files with 309 additions and 79 deletions

View File

@ -72,7 +72,9 @@ namespace VEPROMS
this.lblItemID = new DevComponents.DotNetBar.LabelItem(); this.lblItemID = new DevComponents.DotNetBar.LabelItem();
this.lblResolution = new DevComponents.DotNetBar.LabelItem(); this.lblResolution = new DevComponents.DotNetBar.LabelItem();
this.lblUser = new DevComponents.DotNetBar.LabelItem(); this.lblUser = new DevComponents.DotNetBar.LabelItem();
this.lblLastChange = new DevComponents.DotNetBar.LabelItem();
//this.txtSearch = new DevComponents.DotNetBar.TextBoxItem(); // RHM20150506 Multiline ItemID TextBox //this.txtSearch = new DevComponents.DotNetBar.TextBoxItem(); // RHM20150506 Multiline ItemID TextBox
this.btnStepRTF = new DevComponents.DotNetBar.ButtonItem();
this.txtSearch = new System.Windows.Forms.TextBox(); this.txtSearch = new System.Windows.Forms.TextBox();
this.btnPrevious = new System.Windows.Forms.Button(); this.btnPrevious = new System.Windows.Forms.Button();
this.btnPrint1 = new System.Windows.Forms.Button(); this.btnPrint1 = new System.Windows.Forms.Button();
@ -507,6 +509,8 @@ namespace VEPROMS
this.lblResolution, this.lblResolution,
this.btnEditItem, this.btnEditItem,
this.lblUser, this.lblUser,
this.lblLastChange,
this.btnStepRTF,
//this.txtSearch, // RHM20150506 Multiline ItemID TextBox //this.txtSearch, // RHM20150506 Multiline ItemID TextBox
this.btnFixMSWord}); this.btnFixMSWord});
this.bottomBar.Location = new System.Drawing.Point(5, 569); this.bottomBar.Location = new System.Drawing.Point(5, 569);
@ -607,6 +611,19 @@ namespace VEPROMS
this.lblUser.Name = "lblUser"; this.lblUser.Name = "lblUser";
this.lblUser.Text = "User"; this.lblUser.Text = "User";
// //
// btnStepRTF
//
this.btnStepRTF.Name = "btnStepRTF";
this.btnStepRTF.Text = "Step RTF";
//this.btnStepRTF.Click += new System.EventHandler(btnStepRTF_Click);
//
// lblLastChange
//
this.lblLastChange.BackColor = System.Drawing.Color.Transparent;
this.lblLastChange.ForeColor = System.Drawing.SystemColors.MenuText;
this.lblLastChange.Name = "lblLastChange";
this.lblLastChange.Text = "LastChange";
//
// txtSearch // txtSearch
// //
this.txtSearch.Name = "txtSearch"; this.txtSearch.Name = "txtSearch";
@ -1664,8 +1681,10 @@ namespace VEPROMS
private System.Windows.Forms.ComboBox cmbFont; private System.Windows.Forms.ComboBox cmbFont;
private DevComponents.DotNetBar.LabelItem lblResolution; private DevComponents.DotNetBar.LabelItem lblResolution;
private DevComponents.DotNetBar.LabelItem lblUser; private DevComponents.DotNetBar.LabelItem lblUser;
private DevComponents.DotNetBar.LabelItem lblLastChange;
//private DevComponents.DotNetBar.TextBoxItem txtSearch; // RHM20150506 Multiline ItemID TextBox //private DevComponents.DotNetBar.TextBoxItem txtSearch; // RHM20150506 Multiline ItemID TextBox
private System.Windows.Forms.TextBox txtSearch; private System.Windows.Forms.TextBox txtSearch;
private DevComponents.DotNetBar.ButtonItem btnStepRTF;
private System.Windows.Forms.Button btnPrevious; private System.Windows.Forms.Button btnPrevious;
private System.Windows.Forms.Button btnPrint1; private System.Windows.Forms.Button btnPrint1;
private System.Windows.Forms.CheckBox cbScrunch; private System.Windows.Forms.CheckBox cbScrunch;

View File

@ -39,7 +39,16 @@ namespace VEPROMS
StepTabPanel _SelectedStepTabPanel = null; StepTabPanel _SelectedStepTabPanel = null;
public FindReplace dlgFindReplace = null; public FindReplace dlgFindReplace = null;
public VlnSpellCheck SpellChecker = null; public VlnSpellCheck SpellChecker = null;
private Int64 _LastContentChange;
public Int64 LastContentChange
{
get { return _LastContentChange; }
set { _LastContentChange = value; }
}
public void RefreshLastChange()
{
lblLastChange.Text = string.Format("Last Change: {0}", MySessionInfo.LastContentChange - this.LastContentChange);
}
public StepTabPanel SelectedStepTabPanel public StepTabPanel SelectedStepTabPanel
{ {
get get
@ -450,7 +459,8 @@ namespace VEPROMS
{ {
log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp; log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("U","") + "_").TrimStart("_".ToCharArray()) + NewFilename; //fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("U","") + "_").TrimStart("_".ToCharArray()) + NewFilename;
fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("prefix", "") + "_").TrimStart("_".ToCharArray()) + NewFilename;
ErrorLogFileName = fApp.File; ErrorLogFileName = fApp.File;
fApp.ActivateOptions(); fApp.ActivateOptions();
return true; // Appender found and name changed to NewFilename return true; // Appender found and name changed to NewFilename
@ -886,16 +896,8 @@ namespace VEPROMS
{ {
get { return _MyCloseTabList; } get { return _MyCloseTabList; }
} }
private int myCounterPingSession = 0;
private int myCounterRefreshChanged = 0;
private void PingSession(Object obj) private void PingSession(Object obj)
{ {
myCounterPingSession++;
if (myCounterPingSession > 10)
{
_MyLog.InfoFormat("Ping Session at: {0} with LastChanged of: {1}", DateTime.Now.ToString("yyyyMMdd HHmmssnnn"), MySessionInfo.LastChanged);
myCounterPingSession = 0;
}
MySemaphore.WaitOne(); MySemaphore.WaitOne();
List<int> myList = MySessionInfo.PingSession(); List<int> myList = MySessionInfo.PingSession();
foreach (DisplayTabItem dti in tc.MyBar.Items) foreach (DisplayTabItem dti in tc.MyBar.Items)
@ -905,31 +907,72 @@ namespace VEPROMS
} }
MySemaphore.Release(); MySemaphore.Release();
} }
WindowsFormsSynchronizationContext mUIContext = new WindowsFormsSynchronizationContext();
public void MyFindNodeAndExpand(object obj)
{
int id = (int)obj;
ItemInfo ii = ItemInfo.Get(id);
ii.ResetParts();
using (Item i = Item.Get(id))
ItemInfo.Refresh(i);
tv.RefreshRelatedNode(ii);
}
private void RefreshChanged(Object obj) private void RefreshChanged(Object obj)
{ {
myCounterRefreshChanged++;
if (myCounterRefreshChanged > 10)
{
_MyLog.InfoFormat("RefreshChanged at: {0} with LastChanged of: {1}", DateTime.Now.ToString("yyyyMMdd HHmmssnnn"), MySessionInfo.LastChanged);
myCounterRefreshChanged = 0;
}
MySemaphore.WaitOne(); MySemaphore.WaitOne();
string lastChanged = string.Empty; try
{
Int64 lastChanged = 0;
if (MySessionInfo.ChangedItems.Count > 0)
{
foreach (int id in MySessionInfo.ChangedItems.Keys)
{
if (ItemInfo.IsInCache(id))
mUIContext.Post(MyFindNodeAndExpand, id);
}
}
if (MySessionInfo.ChangedContents.Count > 0)
foreach (int id in MySessionInfo.ChangedContents.Keys) foreach (int id in MySessionInfo.ChangedContents.Keys)
{
if (ContentInfo.IsInCache(id))
{
ContentInfo ci = ContentInfo.Get(id);
//if (ci.LastChangedInt64 > MySessionInfo.LastChangedInt64)
if (MySessionInfo.LastContentChange >= ci.LastChangedInt64)
{ {
using (Content c = Content.Get(id)) using (Content c = Content.Get(id))
{ {
_MyLog.InfoFormat("Text of contentid: {0} is {1}", id, c.Text);
ContentInfo.Refresh(c); ContentInfo.Refresh(c);
}
}
}
lastChanged = MySessionInfo.ChangedContents[id]; lastChanged = MySessionInfo.ChangedContents[id];
_MyLog.InfoFormat("Refreshing contentid: {0} with LastChanged of {1}", id, lastChanged);
}
} }
MySessionInfo.ChangedItems.Clear();
MySessionInfo.ChangedContents.Clear(); MySessionInfo.ChangedContents.Clear();
if(lastChanged != string.Empty) if (lastChanged > 0)
MySessionInfo.LastChanged = lastChanged; {
MySessionInfo.LastContentChange = lastChanged;
RefreshLastChange();
}
}
catch
{
}
MySemaphore.Release(); MySemaphore.Release();
} }
private bool ByteArrayIsEmpty(byte[] myArray)
{
for (int i = 0; i < myArray.Length; i++)
{
if (myArray[i] != 0)
return false;
}
return true;
}
public ContentInfo ci1;
public ContentInfo ci2;
public ContentInfo ci3;
public Timer tmrCloseTabItems; public Timer tmrCloseTabItems;
public System.Threading.Semaphore MySemaphore = new System.Threading.Semaphore(1, 1); public System.Threading.Semaphore MySemaphore = new System.Threading.Semaphore(1, 1);
private void frmVEPROMS_Load(object sender, EventArgs e) private void frmVEPROMS_Load(object sender, EventArgs e)
@ -979,6 +1022,8 @@ namespace VEPROMS
tmrCloseTabItems.Tick += new EventHandler(tmrCloseTabItems_Tick); tmrCloseTabItems.Tick += new EventHandler(tmrCloseTabItems_Tick);
tmrCloseTabItems.Enabled = true; tmrCloseTabItems.Enabled = true;
MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, System.Diagnostics.Process.GetCurrentProcess().Id); MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, System.Diagnostics.Process.GetCurrentProcess().Id);
this.LastContentChange = MySessionInfo.LastContentChange;
RefreshLastChange();
if (MySessionInfo == null) if (MySessionInfo == null)
{ {
MessageBox.Show("This database is locked by the Administrator. Please try again later", "PROMS is Locked"); MessageBox.Show("This database is locked by the Administrator. Please try again later", "PROMS is Locked");
@ -989,7 +1034,7 @@ namespace VEPROMS
System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false); System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false);
//System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession); //System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession);
//System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess(); //System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess();
if(!System.Diagnostics.Debugger.IsAttached) if (!System.Diagnostics.Debugger.IsAttached)
{ {
System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession); System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession);
MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000); MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000);
@ -1003,7 +1048,7 @@ namespace VEPROMS
// get the saved location and size of the VE-PROMS appication for this user // get the saved location and size of the VE-PROMS appication for this user
this.txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress); this.txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress);
this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multiline ItemID TextBox this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multiline ItemID TextBox
this.txtSearch.TextChanged+=txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox this.txtSearch.TextChanged += txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox
this.btnNext.Click += btnNext_Click; // RHM20150506 Multiline ItemID TextBox this.btnNext.Click += btnNext_Click; // RHM20150506 Multiline ItemID TextBox
this.btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multiline ItemID TextBox this.btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multiline ItemID TextBox
this.cbScrunch.Click += cbScrunch_Click; // RHM20150506 Multiline ItemID TextBox this.cbScrunch.Click += cbScrunch_Click; // RHM20150506 Multiline ItemID TextBox
@ -1042,7 +1087,7 @@ namespace VEPROMS
ctrlAnnotationDetails.SetupAnnotations(displaySearch1); ctrlAnnotationDetails.SetupAnnotations(displaySearch1);
SetupButtons(); SetupButtons();
displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs
office2007StartButton1.MouseDown +=new MouseEventHandler(office2007StartButton1_MouseDown); office2007StartButton1.MouseDown += new MouseEventHandler(office2007StartButton1_MouseDown);
//displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged); //displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
tc.Enter += new EventHandler(tc_Enter); tc.Enter += new EventHandler(tc_Enter);
tc.Leave += new EventHandler(tc_Leave); tc.Leave += new EventHandler(tc_Leave);
@ -1077,7 +1122,7 @@ namespace VEPROMS
// dlgCI.ShowDialog(this); // dlgCI.ShowDialog(this);
//} //}
// RHM20150506 Multiline ItemID TextBox // RHM20150506 Multiline ItemID TextBox
this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetCommand("ItemIDs", "").Replace(",","\r\n"); this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetCommand("ItemIDs", "").Replace(",", "\r\n");
} }
void cbScrunch_Click(object sender, EventArgs e) // RHM20150506 Multiline ItemID TextBox void cbScrunch_Click(object sender, EventArgs e) // RHM20150506 Multiline ItemID TextBox
{ {
@ -1886,7 +1931,7 @@ namespace VEPROMS
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
return DialogResult.None; return DialogResult.None;
} }
int ownerID = MySessionInfo.CheckOutItem(args.ProcedureConfig.MyProcedure.ItemID, 0); int ownerID = MySessionInfo.CheckOutItem(args.ProcedureConfig.MyProcedure.ItemID, CheckOutType.Procedure);
frmProcedureProperties frmproc = new frmProcedureProperties(args.ProcedureConfig); frmProcedureProperties frmproc = new frmProcedureProperties(args.ProcedureConfig);
dr = frmproc.ShowDialog(); dr = frmproc.ShowDialog();
MySessionInfo.CheckInItem(ownerID); MySessionInfo.CheckInItem(ownerID);
@ -1902,12 +1947,25 @@ namespace VEPROMS
//} //}
frmSectionProperties frmsec = new frmSectionProperties(args.SectionConfig); frmSectionProperties frmsec = new frmSectionProperties(args.SectionConfig);
string message = string.Empty;
if (!MySessionInfo.CanCheckOutItem(args.SectionConfig.MySection.MySectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
{
MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.Cursor = Cursors.Default;
return DialogResult.None;
}
int ownerID;
if (args.SectionConfig.MySection.MyContent.MyEntry.MyDocument == null)
ownerID = MySessionInfo.CheckOutItem(args.SectionConfig.MySection.MySectionInfo.MyProcedure.ItemID, CheckOutType.Procedure);
else
ownerID = MySessionInfo.CheckOutItem(args.SectionConfig.MySection.MyContent.MyEntry.MyDocument.DocID, CheckOutType.Document);
dr = frmsec.ShowDialog(); dr = frmsec.ShowDialog();
if (dr == DialogResult.OK && displayLibDocs.LibDocList != null) if (dr == DialogResult.OK && displayLibDocs.LibDocList != null)
{ {
displayLibDocs.LibDocListFillIn(tc); displayLibDocs.LibDocListFillIn(tc);
displayLibDocs.SetSelectedLibDoc(); displayLibDocs.SetSelectedLibDoc();
} }
MySessionInfo.CheckInItem(ownerID);
} }
} }
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;

View File

@ -12,6 +12,10 @@ namespace VEPROMS.CSLA.Library
{ {
public partial class Content public partial class Content
{ {
public string LastChangedString
{
get { return ContentInfo.FormatByteArray(_LastChanged); }
}
public override string ToString() public override string ToString()
{ {
return string.Format("{0} {1}", Number, Text); return string.Format("{0} {1}", Number, Text);
@ -554,6 +558,24 @@ namespace VEPROMS.CSLA.Library
} }
public partial class ContentInfo 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) public static bool IsInCache(int contentID)
{ {
return _CacheByPrimaryKey.ContainsKey(contentID.ToString()); return _CacheByPrimaryKey.ContainsKey(contentID.ToString());

View File

@ -352,6 +352,10 @@ namespace VEPROMS.CSLA.Library
if (id == ItemID) return true; if (id == ItemID) return true;
return false; return false;
} }
public static bool IsInCache(int itemID)
{
return _CacheByPrimaryKey.ContainsKey(itemID.ToString());
}
public void SetHeader(VE_Font myFont, string myText) public void SetHeader(VE_Font myFont, string myText)
{ {
_MyHeader = new MetaTag(myFont); _MyHeader = new MetaTag(myFont);
@ -2588,6 +2592,7 @@ namespace VEPROMS.CSLA.Library
#region Lookups and More Related #region Lookups and More Related
private ItemInfoList Lookup(int fromType, ref ItemInfoList itemInfoList) private ItemInfoList Lookup(int fromType, ref ItemInfoList itemInfoList)
{ {
Console.WriteLine(itemInfoList);
if (itemInfoList == null) if (itemInfoList == null)
itemInfoList = Lookup(fromType); itemInfoList = Lookup(fromType);
return itemInfoList; return itemInfoList;

View File

@ -68,8 +68,14 @@ namespace VEPROMS.CSLA.Library
#region SessionInfo stuff #region SessionInfo stuff
public partial class SessionInfo public partial class SessionInfo
{ {
private string _LastChanged = string.Empty; private Int64 _LastContentChange;
public string LastChanged 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)] [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get get
@ -79,6 +85,14 @@ namespace VEPROMS.CSLA.Library
} }
set { _LastChanged = value; } 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) public static SessionInfo BeginSession(string machineName, int processID)
{ {
try try
@ -96,26 +110,24 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on SessionInfo.BeginSession", ex); throw new DbCslaException("Error on SessionInfo.BeginSession", ex);
} }
} }
private Dictionary<int, string> _ChangedContents; private Dictionary<int, Int64> _ChangedContents;
public Dictionary<int, string> ChangedContents public Dictionary<int, Int64> ChangedContents
{ {
get { return _ChangedContents; } get { return _ChangedContents; }
set { _ChangedContents = value; } set { _ChangedContents = value; }
} }
private Dictionary<int, Int64> _ChangedItems;
public Dictionary<int, Int64> ChangedItems
{
get { return _ChangedItems; }
set { _ChangedItems = value; }
}
public List<int> PingSession() public List<int> PingSession()
{ {
List<int> myList = new List<int>(); List<int> myList = new List<int>();
SessionPing.Execute(this.SessionID); SessionPing.Execute(this.SessionID);
ChangedContents = SessionChangedContents.Execute(this.LastChanged); ChangedContents = SessionChangedContents.Execute(this.LastContentChange);
//ContentInfoList cil = ContentInfoList.GetChangedList(Convert.FromBase64String(this.LastChanged)); ChangedItems = SessionChangedItems.Execute(this.LastContentChange);
//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); OwnerInfoList oil = OwnerInfoList.GetBySessionID(this.SessionID);
foreach (OwnerInfo oi in oil) foreach (OwnerInfo oi in oil)
myList.Add(oi.OwnerID); myList.Add(oi.OwnerID);
@ -234,7 +246,6 @@ namespace VEPROMS.CSLA.Library
return; return;
} }
ReadData(dr); ReadData(dr);
_LastChanged = Convert.ToBase64String(dr["LastChanged"] as byte[]);
} }
} }
// removing of item only needed for local data portal // removing of item only needed for local data portal
@ -622,23 +633,23 @@ 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 string _LastChanged; private Int64 _LastContentChange;
public string LastChanged public Int64 LastContentChange
{ {
get { return _LastChanged; } get { return _LastContentChange; }
set { _LastChanged = value; } set { _LastContentChange = value; }
} }
private Dictionary<int, string> _ChangedContents; private Dictionary<int,Int64> _ChangedContents;
public Dictionary<int, string> ChangedContents public Dictionary<int, Int64> ChangedContents
{ {
get { return _ChangedContents; } get { return _ChangedContents; }
set { _ChangedContents = value; } set { _ChangedContents = value; }
} }
#region Factory Methods #region Factory Methods
public static Dictionary<int, string> Execute(string lastChanged) public static Dictionary<int, Int64> Execute(Int64 lastContentChanged)
{ {
SessionChangedContents cmd = new SessionChangedContents(); SessionChangedContents cmd = new SessionChangedContents();
cmd.LastChanged = lastChanged; cmd.LastContentChange = lastContentChanged;
cmd = DataPortal.Execute<SessionChangedContents>(cmd); cmd = DataPortal.Execute<SessionChangedContents>(cmd);
return cmd.ChangedContents; return cmd.ChangedContents;
} }
@ -654,12 +665,12 @@ namespace VEPROMS.CSLA.Library
{ {
cmd.CommandType = CommandType.StoredProcedure; cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 0; cmd.CommandTimeout = 0;
cmd.Parameters.AddWithValue("@LastChanged", Convert.FromBase64String(LastChanged)); 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, string>(); ChangedContents = new Dictionary<int, Int64>();
while (dr.Read()) 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 #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 #endregion
#region OwnerInfo stuff #region OwnerInfo stuff
public partial class OwnerInfoList public partial class OwnerInfoList

View File

@ -345,6 +345,16 @@ namespace VEPROMS.CSLA.Library
} }
} }
private byte[] _LastChanged = new byte[8];//timestamp 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; private int _ContentDetailCount = 0;
/// <summary> /// <summary>
/// Count of ContentDetails for this Content /// Count of ContentDetails for this Content

View File

@ -117,6 +117,18 @@ namespace VEPROMS.CSLA.Library
return _ContentID; 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; private string _Number = string.Empty;
/// <summary> /// <summary>
/// Increased from 30 to 256 to support RTF symbols /// Increased from 30 to 256 to support RTF symbols
@ -631,6 +643,7 @@ namespace VEPROMS.CSLA.Library
_Config = tmp.Config; _Config = tmp.Config;
_DTS = tmp.DTS; _DTS = tmp.DTS;
_UserID = tmp.UserID; _UserID = tmp.UserID;
_LastChanged = tmp.LastChanged;
_ContentInfoExtension.Refresh(this); _ContentInfoExtension.Refresh(this);
_ContentEntryCount = -1;// Reset Count _ContentEntryCount = -1;// Reset Count
_ContentGridCount = -1;// Reset Count _ContentGridCount = -1;// Reset Count
@ -724,6 +737,7 @@ namespace VEPROMS.CSLA.Library
_Config = dr.GetString("Config"); _Config = dr.GetString("Config");
_DTS = dr.GetDateTime("DTS"); _DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID"); _UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
_ContentDetailCount = dr.GetInt32("DetailCount"); _ContentDetailCount = dr.GetInt32("DetailCount");
_ContentEntryCount = dr.GetInt32("EntryCount"); _ContentEntryCount = dr.GetInt32("EntryCount");
_ContentGridCount = dr.GetInt32("GridCount"); _ContentGridCount = dr.GetInt32("GridCount");

View File

@ -304,6 +304,8 @@ namespace VEPROMS.CSLA.Library
_DTSActivity = dr.GetDateTime("DTSActivity"); _DTSActivity = dr.GetDateTime("DTSActivity");
_MachineName = dr.GetString("MachineName"); _MachineName = dr.GetString("MachineName");
_ProcessID = dr.GetInt32("ProcessID"); _ProcessID = dr.GetInt32("ProcessID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
_LastContentChange = dr.GetInt64("LastContentChange");
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -2909,6 +2909,43 @@ namespace Volian.Controls.Library
if (parent == null) return null; if (parent == null) return null;
if (!parent.IsExpanded) if (!parent.IsExpanded)
parent.Expand(); parent.Expand();
VETreeNode child = GetChildNode(selectedItem, parent);
if (child != null)
return child;
parent.ChildrenLoaded = false;
parent.RefreshNode();
child = GetChildNode(selectedItem, parent);
return child;
}
public VETreeNode FindNode(IVEDrillDownReadOnly selectedItem, TreeNodeCollection tnc)
{
foreach (TreeNode tn in tnc)
if (tn is VETreeNode)
{
if ((tn as VETreeNode).VEObject is ItemInfo && ((tn as VETreeNode).VEObject as ItemInfo).ItemID == (selectedItem as ItemInfo).ItemID)
return tn as VETreeNode;
else
{
VETreeNode cn = FindNode(selectedItem, tn.Nodes);
if (cn != null)
return cn;
}
}
return null;
}
public VETreeNode RefreshRelatedNode(IVEDrillDownReadOnly selectedItem)
{
VETreeNode child = FindNode(selectedItem, this.Nodes);
if (child == null) return null;
if (!child.IsExpanded)
child.Expand();
child.ChildrenLoaded = false;
child.RefreshNode();
return child;
}
private VETreeNode GetChildNode(IVEDrillDownReadOnly selectedItem, VETreeNode parent)
{
foreach (TreeNode childNode in parent.Nodes) foreach (TreeNode childNode in parent.Nodes)
{ {
VETreeNode child = childNode as VETreeNode; VETreeNode child = childNode as VETreeNode;