Allow user to select a date to begin showing change bars

Added context menu item to allow the selection of a date to begin showing change bars.
This commit is contained in:
2016-02-24 17:34:21 +00:00
parent 1bc587a36f
commit 2d753b1db6
4 changed files with 389 additions and 4 deletions

View File

@@ -485,6 +485,11 @@ namespace Volian.Controls.Library
{
if (PrintAllProcedures != null) PrintAllProcedures(sender, args);
}
public event vlnTreeViewEvent SelectDateToStartChangeBars;
private void OnSelectDateToStartChangeBars(object sender, vlnTreeEventArgs args)
{
if (SelectDateToStartChangeBars != null) SelectDateToStartChangeBars(sender, args);
}
public event vlnTreeViewEvent ApproveProcedure;
private void OnApproveProcedure(object sender, vlnTreeEventArgs args)
{
@@ -801,6 +806,7 @@ namespace Volian.Controls.Library
}
cm.MenuItems.Add(micas);
cm.MenuItems.Add(mip);
AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri);
cm.MenuItems.Add(mia);
AddApprovedRevisionsMultiUnit(cm.MenuItems, pri);
}
@@ -808,6 +814,7 @@ namespace Volian.Controls.Library
{
cm.MenuItems.Add("Create Continuous Action Summary", new EventHandler(mi_Click));
cm.MenuItems.Add("Print", new EventHandler(mi_Click));
AddShowChangeBarsAfterMenuItem(cm.MenuItems, pri);
cm.MenuItems.Add("Approve", new EventHandler(mi_Click));
//_MyLog.WarnFormat("Context Menu 1 before - {0}", GC.GetTotalMemory(true));
AddApprovedRevisions(cm.MenuItems, pri);
@@ -1047,7 +1054,7 @@ namespace Volian.Controls.Library
private void AddApprovedRevisionsMultiUnit(Menu.MenuItemCollection menuItemCollection, ProcedureInfo pri)
{
RevisionInfoList ril = RevisionInfoList.GetByItemID(pri.ItemID);
if (ril.Count == 0) return;
if (ril.Count == 0) return; // no versions to list
MenuItem mi = menuItemCollection.Add("Versions");
int k = 0;
int lastApprovedRevisionID = 0;
@@ -1101,7 +1108,7 @@ namespace Volian.Controls.Library
using (RevisionInfoList ril = RevisionInfoList.GetByItemID(pri.ItemID))
{
//_MyLog.WarnFormat("Context Menu 1 After GET - {0}", GC.GetTotalMemory(true));
if (ril.Count == 0) return;
if (ril.Count == 0) return; // no versions to list
MenuItem mi = menuItemCollection.Add("Versions");
int lastApprovedRevisionID = 0;
foreach (RevisionInfo ri in ril)
@@ -1149,6 +1156,25 @@ namespace Volian.Controls.Library
}
}
private void AddShowChangeBarsAfterMenuItem(Menu.MenuItemCollection menuItemCollection, ProcedureInfo pri)
{
using (RevisionInfoList ril = RevisionInfoList.GetByItemID(pri.ItemID))
{
if (ril.Count == 0 || MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(pri.MyDocVersion))
{
ProcedureConfig pc = pri.MyConfig as ProcedureConfig;
string currentChgBarDateTime = "";
if (pc != null)
currentChgBarDateTime = pc.Print_ChangeBarDate; // Current change bar date time before
if (currentChgBarDateTime == "")
currentChgBarDateTime = "(date not set)";
else
currentChgBarDateTime = currentChgBarDateTime.Split(' ')[0]; // only show the date not the time
menuItemCollection.Add(string.Format("Showing Change Bars Starting {0}", currentChgBarDateTime), new EventHandler(mi_Click));
}
}
}
void ImportProcedure_Click(object sender, EventArgs e)
{
RevisionInfo ri = (sender as MenuItem).Tag as RevisionInfo;
@@ -1494,7 +1520,10 @@ namespace Volian.Controls.Library
OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null,0,mi.Text,(int)mi.Tag));
break;
default:
MessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mip.Text));
if (mip.Text.StartsWith("Showing Change Bars Starting"))
OnSelectDateToStartChangeBars(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
else
MessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mip.Text));
break;
}
}
@@ -1668,7 +1697,10 @@ namespace Volian.Controls.Library
// CheckInDocVersion(SelectedNode as VETreeNode);
// break;
default:
MessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mi.Text));
if (mi.Text.StartsWith("Showing Change Bars Starting"))
OnSelectDateToStartChangeBars(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
else
MessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mi.Text));
break;
}
}