fixes to change manager

This commit is contained in:
Rich 2012-01-23 13:55:50 +00:00
parent 0e94b48af2
commit 58454f44aa

View File

@ -37,6 +37,11 @@ namespace Volian.Controls.Library
{
if (ItemRestored != null) ItemRestored(restoredItemInfo);
}
public event AnnotationRestoredHandler AnnotationRestored;
private void OnAnnotationRestored(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem)
{
if (AnnotationRestored != null) AnnotationRestored(restoredAnnotationInfo, currentItem);
}
#endregion
private ContentAuditInfoList _ChronologyAuditList;
private ContentAuditInfoList _SummaryAuditList;
@ -66,9 +71,12 @@ namespace Volian.Controls.Library
if (_MyItemInfo != null)
{
MyProcedureInfo = _MyItemInfo.MyProcedure;
this.Visible = true;
if (this.Visible)
UpdateHistory();
}
else
this.Visible = false;
}
}
private EditItem _MyEditItem;
@ -127,6 +135,7 @@ namespace Volian.Controls.Library
#region setup
btnRestore.Enabled = false;
myRTB.Clear();
//myRTB.LastRtf = string.Empty;
myVFG.Clear();
tvAudits.Nodes.Clear();
if (MyItemInfo == null)
@ -191,7 +200,7 @@ namespace Volian.Controls.Library
//content changes
TreeNode contentHistory = null;
if (MyItemInfo == null) return;
ContentAuditInfoList cail = ContentAuditInfoList.Get(MyItemInfo.ContentID);
ContentAuditInfoList cail = ContentAuditInfoList.Get(MyItemInfo.ContentID, MyItemInfo.MyProcedure.DTS);
// ContentAuditInfoList cail = ContentAuditInfoList.GetChronology(MyItemInfo.MyProcedure.ItemID, MyItemInfo.ItemID, false);
ContentInfo ci = ContentInfo.Get(MyItemInfo.ContentID);
foreach (ContentAuditInfo cai in cail)
@ -407,10 +416,13 @@ namespace Volian.Controls.Library
//Console.WriteLine("WalkProcedure aail2: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
_AnnotationList = aail2;
foreach (ContentAuditInfo cai in cail2)
{
if (cai.DTS > MyProcedureInfo.DTS)
{
string itemTitle = FixPath(cai.Path);
lbChanges.Items.Add(string.Format("{4} item {0} by {1} on {2} @ {3}", cai.ActionWhat, cai.UserID, cai.ActionWhen == DateTime.MinValue ? cai.DTS.ToShortDateString() : cai.ActionWhen.ToShortDateString(), cai.ActionWhen == DateTime.MinValue ? cai.DTS.ToShortTimeString() : cai.ActionWhen.ToShortTimeString(), itemTitle));
}
}
foreach (AnnotationAuditInfo aai in aail2)
{
string stepnum = string.Empty;
@ -428,6 +440,7 @@ namespace Volian.Controls.Library
if(iii != null)
stepnum = FixPath(iii.SearchPath);
}
if(aai.DTS > MyProcedureInfo.DTS)
lbChanges.Items.Add(string.Format("{0} Annotation {1}", stepnum, aai.ToString()));
}
//Console.WriteLine("WalkProcedure fini: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
@ -574,6 +587,7 @@ namespace Volian.Controls.Library
}
private void btnViewChronologyReport_Click(object sender, EventArgs e)
{
RefreshList();
//if (lbChanges.Items.Count > 0)
//{
OnChronologyPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyChronology.pdf", MyItemInfo.MyProcedure, _ChronologyAuditList, _AnnotationList));
@ -581,6 +595,7 @@ namespace Volian.Controls.Library
}
private void btnViewSummaryReport_Click(object sender, EventArgs e)
{
RefreshList();
//if (lbChanges.Items.Count > 0)
//{
OnSummaryPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MySummary.pdf", MyItemInfo.MyProcedure, _SummaryAuditList, _AnnotationList));
@ -602,6 +617,7 @@ namespace Volian.Controls.Library
UpdateHistory();
myRTB.Clear();
myVFG.Clear();
MyEditItem.SetAllTabs();
}
}
if (tn.Tag is ItemAuditInfo)
@ -702,6 +718,7 @@ namespace Volian.Controls.Library
default:
break;
}
ii.UpdateTransitionText();
}
if(MyEditItem.MyPreviousEditItem != null)
MyEditItem.MyPreviousEditItem.SetAllTabs();
@ -718,6 +735,7 @@ namespace Volian.Controls.Library
if (MessageBox.Show(this, "Do you want to restore this annotation?", "Confirm Annotation Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
AnnotationInfo ai = AnnotationInfo.RestoreAnnotation(aai);
OnAnnotationRestored(ai, ai.MyItem);
UpdateHistory();
myRTB.Clear();
myVFG.Clear();
@ -789,6 +807,8 @@ namespace Volian.Controls.Library
myVFG.Visible = false;
// myRTB.Font = new Font("Arial", 12, FontStyle.Regular);
// myRTB.Text = cai.Text;
//myRTB.SetupRichText("bozo", MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font);
//myRTB.LastRtf = string.Empty;
myRTB.SetupRichText(cai.Text, MyItemInfo.FormatStepData == null ? MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font : MyItemInfo.FormatStepData.Font);
}
}
@ -850,6 +870,7 @@ namespace Volian.Controls.Library
}
public delegate void ItemRestoredHandler(ItemInfo restoredItemInfo);
public delegate void AnnotationRestoredHandler(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem);
public delegate void DisplayHistoryReportEvent(object sender, DisplayHistoryReportEventArgs args);
public delegate void DisplayHistoryEvent(object sender, DisplayHistoryEventArgs args);
public class DisplayHistoryReportEventArgs