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:
John Jenko 2016-02-24 17:34:21 +00:00
parent 1bc587a36f
commit 2d753b1db6
4 changed files with 389 additions and 4 deletions

View File

@ -0,0 +1,179 @@
namespace VEPROMS
{
partial class dlgSetChangeBarStartDate
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOK = new DevComponents.DotNetBar.ButtonX();
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
this.label1 = new System.Windows.Forms.Label();
this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip();
this.dateTimeInput1 = new DevComponents.Editors.DateTimeAdv.DateTimeInput();
this.btnNow = new DevComponents.DotNetBar.ButtonX();
((System.ComponentModel.ISupportInitialize)(this.dateTimeInput1)).BeginInit();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnOK.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(18, 111);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(64, 23);
this.btnOK.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnOK.TabIndex = 1;
this.btnOK.Text = "OK";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(165, 111);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(64, 23);
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(3, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(229, 15);
this.label1.TabIndex = 3;
this.label1.Text = "Show Change Bars on Changes Starting:";
//
// superTooltip1
//
this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray);
this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
//
// dateTimeInput1
//
//
//
//
this.dateTimeInput1.BackgroundStyle.Class = "DateTimeInputBackground";
this.dateTimeInput1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.dateTimeInput1.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown;
this.dateTimeInput1.ButtonDropDown.Visible = true;
this.dateTimeInput1.CustomFormat = "MM/dd/yyyy";
this.dateTimeInput1.DateTimeSelectorVisibility = DevComponents.Editors.DateTimeAdv.eDateTimeSelectorVisibility.DateSelector;
this.dateTimeInput1.Format = DevComponents.Editors.eDateTimePickerFormat.Custom;
this.dateTimeInput1.IsPopupCalendarOpen = false;
this.dateTimeInput1.Location = new System.Drawing.Point(30, 51);
//
//
//
//
//
//
this.dateTimeInput1.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.dateTimeInput1.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1);
this.dateTimeInput1.MonthCalendar.ClearButtonVisible = true;
//
//
//
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.dateTimeInput1.MonthCalendar.DisplayMonth = new System.DateTime(2016, 2, 1, 0, 0, 0, 0);
//
//
//
this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90;
this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.dateTimeInput1.MonthCalendar.TodayButtonVisible = true;
this.dateTimeInput1.Name = "dateTimeInput1";
this.dateTimeInput1.Size = new System.Drawing.Size(113, 20);
this.dateTimeInput1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.superTooltip1.SetSuperTooltip(this.dateTimeInput1, new DevComponents.DotNetBar.SuperTooltipInfo("Change Bar Start Date", "", "Only the changes made after this date will have change bars.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(138, 67)));
this.dateTimeInput1.TabIndex = 4;
this.dateTimeInput1.TimeSelectorTimeFormat = DevComponents.Editors.DateTimeAdv.eTimeSelectorFormat.Time24H;
this.dateTimeInput1.TimeSelectorType = DevComponents.Editors.DateTimeAdv.eTimeSelectorType.TouchStyle;
//
// btnNow
//
this.btnNow.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNow.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnNow.Location = new System.Drawing.Point(149, 51);
this.btnNow.Name = "btnNow";
this.btnNow.Size = new System.Drawing.Size(49, 23);
this.btnNow.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.superTooltip1.SetSuperTooltip(this.btnNow, new DevComponents.DotNetBar.SuperTooltipInfo("Now", "", "This will set the Change Bar Start date to today.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.btnNow.TabIndex = 5;
this.btnNow.Text = "Today";
this.btnNow.Click += new System.EventHandler(this.btnNow_Click);
//
// dlgSetChangeBarStartDate
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(241, 144);
this.Controls.Add(this.btnNow);
this.Controls.Add(this.dateTimeInput1);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "dlgSetChangeBarStartDate";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Change Bar Start Date";
this.Load += new System.EventHandler(this.dlgSetChangeBarStartDate_Load);
((System.ComponentModel.ISupportInitialize)(this.dateTimeInput1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private DevComponents.DotNetBar.ButtonX btnOK;
private DevComponents.DotNetBar.ButtonX btnCancel;
private System.Windows.Forms.Label label1;
private DevComponents.DotNetBar.SuperTooltip superTooltip1;
private DevComponents.Editors.DateTimeAdv.DateTimeInput dateTimeInput1;
private DevComponents.DotNetBar.ButtonX btnNow;
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Controls;
using VEPROMS.CSLA.Library;
namespace VEPROMS
{
public partial class dlgSetChangeBarStartDate : DevComponents.DotNetBar.Office2007Form
{
private ProcedureConfig _MyProcConfig = null;
public ProcedureConfig MyProcConfig
{
get { return _MyProcConfig; }
set { _MyProcConfig = value; }
}
public dlgSetChangeBarStartDate(ProcedureConfig pc)
{
InitializeComponent();
_MyProcConfig = pc;
}
private void dlgSetChangeBarStartDate_Load(object sender, EventArgs e)
{
string cbdt = MyProcConfig.Print_ChangeBarDate;
string[] tmp = cbdt.Split(' ');
cbdt = tmp[0] + " 00:00:00";
dateTimeInput1.Value = (cbdt == null || cbdt == "") ? DateTime.Now : DateTime.Parse(cbdt);
}
private void btnOK_Click(object sender, EventArgs e)
{
MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy 00:00:00");// ("MM/dd/yyyy HH:mm:ss");
}
private void btnNow_Click(object sender, EventArgs e)
{
dateTimeInput1.Value = DateTime.Now;
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="superTooltip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

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;
}
}