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); if (ItemRestored != null) ItemRestored(restoredItemInfo);
} }
public event AnnotationRestoredHandler AnnotationRestored;
private void OnAnnotationRestored(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem)
{
if (AnnotationRestored != null) AnnotationRestored(restoredAnnotationInfo, currentItem);
}
#endregion #endregion
private ContentAuditInfoList _ChronologyAuditList; private ContentAuditInfoList _ChronologyAuditList;
private ContentAuditInfoList _SummaryAuditList; private ContentAuditInfoList _SummaryAuditList;
@ -66,9 +71,12 @@ namespace Volian.Controls.Library
if (_MyItemInfo != null) if (_MyItemInfo != null)
{ {
MyProcedureInfo = _MyItemInfo.MyProcedure; MyProcedureInfo = _MyItemInfo.MyProcedure;
if(this.Visible) this.Visible = true;
if (this.Visible)
UpdateHistory(); UpdateHistory();
} }
else
this.Visible = false;
} }
} }
private EditItem _MyEditItem; private EditItem _MyEditItem;
@ -127,6 +135,7 @@ namespace Volian.Controls.Library
#region setup #region setup
btnRestore.Enabled = false; btnRestore.Enabled = false;
myRTB.Clear(); myRTB.Clear();
//myRTB.LastRtf = string.Empty;
myVFG.Clear(); myVFG.Clear();
tvAudits.Nodes.Clear(); tvAudits.Nodes.Clear();
if (MyItemInfo == null) if (MyItemInfo == null)
@ -191,7 +200,7 @@ namespace Volian.Controls.Library
//content changes //content changes
TreeNode contentHistory = null; TreeNode contentHistory = null;
if (MyItemInfo == null) return; 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); // ContentAuditInfoList cail = ContentAuditInfoList.GetChronology(MyItemInfo.MyProcedure.ItemID, MyItemInfo.ItemID, false);
ContentInfo ci = ContentInfo.Get(MyItemInfo.ContentID); ContentInfo ci = ContentInfo.Get(MyItemInfo.ContentID);
foreach (ContentAuditInfo cai in cail) foreach (ContentAuditInfo cai in cail)
@ -408,8 +417,11 @@ namespace Volian.Controls.Library
_AnnotationList = aail2; _AnnotationList = aail2;
foreach (ContentAuditInfo cai in cail2) foreach (ContentAuditInfo cai in cail2)
{ {
string itemTitle = FixPath(cai.Path); if (cai.DTS > MyProcedureInfo.DTS)
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)); {
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) foreach (AnnotationAuditInfo aai in aail2)
{ {
@ -428,7 +440,8 @@ namespace Volian.Controls.Library
if(iii != null) if(iii != null)
stepnum = FixPath(iii.SearchPath); stepnum = FixPath(iii.SearchPath);
} }
lbChanges.Items.Add(string.Format("{0} Annotation {1}", stepnum, aai.ToString())); 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); //Console.WriteLine("WalkProcedure fini: {0} seconds", TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks).TotalSeconds);
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
@ -574,6 +587,7 @@ namespace Volian.Controls.Library
} }
private void btnViewChronologyReport_Click(object sender, EventArgs e) private void btnViewChronologyReport_Click(object sender, EventArgs e)
{ {
RefreshList();
//if (lbChanges.Items.Count > 0) //if (lbChanges.Items.Count > 0)
//{ //{
OnChronologyPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyChronology.pdf", MyItemInfo.MyProcedure, _ChronologyAuditList, _AnnotationList)); 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) private void btnViewSummaryReport_Click(object sender, EventArgs e)
{ {
RefreshList();
//if (lbChanges.Items.Count > 0) //if (lbChanges.Items.Count > 0)
//{ //{
OnSummaryPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MySummary.pdf", MyItemInfo.MyProcedure, _SummaryAuditList, _AnnotationList)); OnSummaryPrintRequest(new DisplayHistoryReportEventArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MySummary.pdf", MyItemInfo.MyProcedure, _SummaryAuditList, _AnnotationList));
@ -602,6 +617,7 @@ namespace Volian.Controls.Library
UpdateHistory(); UpdateHistory();
myRTB.Clear(); myRTB.Clear();
myVFG.Clear(); myVFG.Clear();
MyEditItem.SetAllTabs();
} }
} }
if (tn.Tag is ItemAuditInfo) if (tn.Tag is ItemAuditInfo)
@ -702,6 +718,7 @@ namespace Volian.Controls.Library
default: default:
break; break;
} }
ii.UpdateTransitionText();
} }
if(MyEditItem.MyPreviousEditItem != null) if(MyEditItem.MyPreviousEditItem != null)
MyEditItem.MyPreviousEditItem.SetAllTabs(); 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) 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); AnnotationInfo ai = AnnotationInfo.RestoreAnnotation(aai);
OnAnnotationRestored(ai, ai.MyItem);
UpdateHistory(); UpdateHistory();
myRTB.Clear(); myRTB.Clear();
myVFG.Clear(); myVFG.Clear();
@ -789,6 +807,8 @@ namespace Volian.Controls.Library
myVFG.Visible = false; myVFG.Visible = false;
// myRTB.Font = new Font("Arial", 12, FontStyle.Regular); // myRTB.Font = new Font("Arial", 12, FontStyle.Regular);
// myRTB.Text = cai.Text; // 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); 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 ItemRestoredHandler(ItemInfo restoredItemInfo);
public delegate void AnnotationRestoredHandler(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem);
public delegate void DisplayHistoryReportEvent(object sender, DisplayHistoryReportEventArgs args); public delegate void DisplayHistoryReportEvent(object sender, DisplayHistoryReportEventArgs args);
public delegate void DisplayHistoryEvent(object sender, DisplayHistoryEventArgs args); public delegate void DisplayHistoryEvent(object sender, DisplayHistoryEventArgs args);
public class DisplayHistoryReportEventArgs public class DisplayHistoryReportEventArgs