Compare commits

...

4 Commits

9 changed files with 375 additions and 166 deletions

View File

@@ -1643,7 +1643,11 @@ Begin
Select Cast(i.LastChanged as varbinary(8)) as 'ILastChanged', Select Cast(i.LastChanged as varbinary(8)) as 'ILastChanged',
i.ItemID as 'ItemID', i.ItemID as 'ItemID',
zi.VersionID as 'VersionID', zi.VersionID as 'VersionID',
zi.PPath + CASE WHEN c.[Type] % 20000 = 6 THEN REPLACE(zi.PPath,'Note','Caution')
WHEN c.[Type] % 20000 = 7 THEN REPLACE(zi.PPath,'Caution','Note')
ELSE zi.PPath
END
+
Case (c.[Type]/10000) Case (c.[Type]/10000)
When 0 Then @Delim + @UnitPrefix + IsNull(c.Number,'') + @DelimNumber + IsNull(c.Text,'') -- Procedure When 0 Then @Delim + @UnitPrefix + IsNull(c.Number,'') + @DelimNumber + IsNull(c.Text,'') -- Procedure
When 1 Then @Delim + IsNull(c.Number,'') + @DelimNumber + IsNull(c.Text,'') -- Section When 1 Then @Delim + IsNull(c.Number,'') + @DelimNumber + IsNull(c.Text,'') -- Section
@@ -24529,6 +24533,51 @@ GO
PRINT 'Added IX_tblROUsagesRODbIDDeleteStatusROID Index. Speeds up RO queries' PRINT 'Added IX_tblROUsagesRODbIDDeleteStatusROID Index. Speeds up RO queries'
GO GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[GetCurrentApprovedRevisions]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [GetCurrentApprovedRevisions];
GO
/****** Object: StoredProcedure [dbo].[GetCurrentApprovedRevisions] Script Date: 02/05/2026 7:54:42 AM ******/
-- =============================================
-- Author: Matthew Schill
-- Create date: 02/05/2026
-- Description: Gets all current approved revisions
-- =============================================
CREATE PROCEDURE [dbo].[GetCurrentApprovedRevisions]
(
@ItemID AS bigint
)
AS
BEGIN
select max(rr.revisionid) revisionid, UnitId, UnitVal.name UnitName, max(rr.DTS) DTS
from items ii
inner join revisions rr on ii.itemid = rr.itemid
inner join versions vv on rr.revisionid = vv.revisionid
inner join stages ss on vv.stageid = ss.stageid
outer apply
(Select UnitId = r1.value('@Index','int') FROM rr.config.nodes('Config/Applicability') t1(r1)) App
left outer join
(select r1.value('@index','int') indx
,r1.value('@Name','varchar') name
from (select *,cast(config as xml) xconfig from DocVersions
where ItemID in(select itemID from vefn_AllSiblingItems(@ItemID))) SDV
cross apply
xconfig.nodes('Config/Slaves/Slave') t1(r1)) UnitVal ON UnitVal.indx = UnitId
where ss.isapproved = 1
and ii.itemid = @ItemID
group by UnitId, UnitVal.name
RETURN
END
IF (@@Error = 0) PRINT 'Procedure Creation: [GetCurrentApprovedRevisions] Succeeded'
ELSE PRINT 'Procedure Creation: [GetCurrentApprovedRevisions] Error on Creation'
GO
/* /*
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
| ADD New Code Before this Block | | ADD New Code Before this Block |
@@ -24562,8 +24611,8 @@ BEGIN TRY -- Try Block
DECLARE @RevDate varchar(255) DECLARE @RevDate varchar(255)
DECLARE @RevDescription varchar(255) DECLARE @RevDescription varchar(255)
set @RevDate = '01/19/2026 5:00 PM' set @RevDate = '02/09/2026 7:00 AM'
set @RevDescription = 'Sync tree list Sort order between in RO Editor and PROMS' set @RevDescription = 'Added procedure for getting current revisions'
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription

View File

@@ -28,142 +28,158 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.btnOK = new DevComponents.DotNetBar.ButtonX(); this.btnOK = new DevComponents.DotNetBar.ButtonX();
this.btnCancel = new DevComponents.DotNetBar.ButtonX(); this.btnCancel = new DevComponents.DotNetBar.ButtonX();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip();
this.dateTimeInput1 = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.dateTimeInput1 = new DevComponents.Editors.DateTimeAdv.DateTimeInput();
this.btnNow = new DevComponents.DotNetBar.ButtonX(); this.btnNow = new DevComponents.DotNetBar.ButtonX();
((System.ComponentModel.ISupportInitialize)(this.dateTimeInput1)).BeginInit(); this.btnResetToApproved = new DevComponents.DotNetBar.ButtonX();
this.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dateTimeInput1)).BeginInit();
// this.SuspendLayout();
// btnOK //
// // 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.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnOK.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOK.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnOK.Location = new System.Drawing.Point(18, 111); this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Name = "btnOK"; this.btnOK.Location = new System.Drawing.Point(18, 111);
this.btnOK.Size = new System.Drawing.Size(64, 23); this.btnOK.Name = "btnOK";
this.btnOK.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnOK.Size = new System.Drawing.Size(64, 23);
this.btnOK.TabIndex = 1; this.btnOK.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnOK.Text = "OK"; this.btnOK.TabIndex = 1;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click); this.btnOK.Text = "OK";
// this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
// btnCancel //
// // 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.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancel.Location = new System.Drawing.Point(179, 111); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Name = "btnCancel"; this.btnCancel.Location = new System.Drawing.Point(179, 111);
this.btnCancel.Size = new System.Drawing.Size(64, 23); this.btnCancel.Name = "btnCancel";
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnCancel.Size = new System.Drawing.Size(64, 23);
this.btnCancel.TabIndex = 2; this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.Text = "Cancel"; this.btnCancel.TabIndex = 2;
// this.btnCancel.Text = "Cancel";
// label1 //
// // 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.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 19); this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Name = "label1"; this.label1.Location = new System.Drawing.Point(3, 19);
this.label1.Size = new System.Drawing.Size(229, 15); this.label1.Name = "label1";
this.label1.TabIndex = 3; this.label1.Size = new System.Drawing.Size(229, 15);
this.label1.Text = "Show Change Bars on Changes Starting:"; this.label1.TabIndex = 3;
// this.label1.Text = "Show Change Bars on Changes Starting:";
// superTooltip1 //
// // superTooltip1
this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); //
this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray);
// this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
// dateTimeInput1 //
// // dateTimeInput1
// //
// //
// //
this.dateTimeInput1.BackgroundStyle.Class = "DateTimeInputBackground"; //
this.dateTimeInput1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.dateTimeInput1.BackgroundStyle.Class = "DateTimeInputBackground";
this.dateTimeInput1.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; this.dateTimeInput1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.dateTimeInput1.ButtonDropDown.Visible = true; this.dateTimeInput1.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown;
this.dateTimeInput1.CustomFormat = "MM/dd/yyyy HH:mm:ss"; this.dateTimeInput1.ButtonDropDown.Visible = true;
this.dateTimeInput1.DateTimeSelectorVisibility = DevComponents.Editors.DateTimeAdv.eDateTimeSelectorVisibility.DateSelector; this.dateTimeInput1.CustomFormat = "MM/dd/yyyy HH:mm:ss";
this.dateTimeInput1.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; this.dateTimeInput1.DateTimeSelectorVisibility = DevComponents.Editors.DateTimeAdv.eDateTimeSelectorVisibility.DateSelector;
this.dateTimeInput1.IsPopupCalendarOpen = false; this.dateTimeInput1.Format = DevComponents.Editors.eDateTimePickerFormat.Custom;
this.dateTimeInput1.Location = new System.Drawing.Point(30, 51); 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.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.dateTimeInput1.MonthCalendar.ClearButtonVisible = true; 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.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.dateTimeInput1.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1;
this.dateTimeInput1.MonthCalendar.DisplayMonth = new System.DateTime(2016, 2, 1, 0, 0, 0, 0); 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.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90;
this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
this.dateTimeInput1.MonthCalendar.TodayButtonVisible = true; this.dateTimeInput1.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.dateTimeInput1.Name = "dateTimeInput1"; this.dateTimeInput1.MonthCalendar.TodayButtonVisible = true;
this.dateTimeInput1.Size = new System.Drawing.Size(146, 20); this.dateTimeInput1.Name = "dateTimeInput1";
this.dateTimeInput1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.dateTimeInput1.Size = new System.Drawing.Size(146, 20);
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.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.dateTimeInput1.TabIndex = 4; 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.TimeSelectorTimeFormat = DevComponents.Editors.DateTimeAdv.eTimeSelectorFormat.Time24H; this.dateTimeInput1.TabIndex = 4;
this.dateTimeInput1.TimeSelectorType = DevComponents.Editors.DateTimeAdv.eTimeSelectorType.TouchStyle; this.dateTimeInput1.TimeSelectorTimeFormat = DevComponents.Editors.DateTimeAdv.eTimeSelectorFormat.Time24H;
// this.dateTimeInput1.TimeSelectorType = DevComponents.Editors.DateTimeAdv.eTimeSelectorType.TouchStyle;
// btnNow //
// // btnNow
this.btnNow.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; //
this.btnNow.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.btnNow.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnNow.Location = new System.Drawing.Point(182, 51); this.btnNow.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnNow.Name = "btnNow"; this.btnNow.Location = new System.Drawing.Point(182, 51);
this.btnNow.Size = new System.Drawing.Size(49, 23); this.btnNow.Name = "btnNow";
this.btnNow.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnNow.Size = new System.Drawing.Size(49, 23);
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.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnNow.TabIndex = 5; 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.Text = "Today"; this.btnNow.TabIndex = 5;
this.btnNow.Click += new System.EventHandler(this.btnNow_Click); this.btnNow.Text = "Today";
// this.btnNow.Click += new System.EventHandler(this.btnNow_Click);
// dlgSetChangeBarStartDate //
// // btnResetToApproved
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.btnResetToApproved.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.ClientSize = new System.Drawing.Size(268, 144); this.btnResetToApproved.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.Controls.Add(this.btnNow); this.btnResetToApproved.Location = new System.Drawing.Point(30, 77);
this.Controls.Add(this.dateTimeInput1); this.btnResetToApproved.Name = "btnResetToApproved";
this.Controls.Add(this.label1); this.btnResetToApproved.Size = new System.Drawing.Size(201, 23);
this.Controls.Add(this.btnCancel); this.btnResetToApproved.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.Controls.Add(this.btnOK); this.btnResetToApproved.TabIndex = 6;
this.DoubleBuffered = true; this.btnResetToApproved.Text = "Reset Change Bar To Approved Date";
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.btnResetToApproved.Tooltip = "Reset Change Bar to the last approved date. If no approvals, reset to as if no ch" +
this.MaximizeBox = false; "ange bar date. After selecting this, press OK to save.";
this.MinimizeBox = false; this.btnResetToApproved.Click += new System.EventHandler(this.btnResetToApproved_Click);
this.Name = "dlgSetChangeBarStartDate"; //
this.ShowIcon = false; // dlgSetChangeBarStartDate
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; //
this.Text = "Change Bar Start Date"; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Load += new System.EventHandler(this.dlgSetChangeBarStartDate_Load); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
((System.ComponentModel.ISupportInitialize)(this.dateTimeInput1)).EndInit(); this.ClientSize = new System.Drawing.Size(268, 144);
this.ResumeLayout(false); this.Controls.Add(this.btnResetToApproved);
this.PerformLayout(); 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();
} }
@@ -175,5 +191,6 @@
private DevComponents.DotNetBar.SuperTooltip superTooltip1; private DevComponents.DotNetBar.SuperTooltip superTooltip1;
private DevComponents.Editors.DateTimeAdv.DateTimeInput dateTimeInput1; private DevComponents.Editors.DateTimeAdv.DateTimeInput dateTimeInput1;
private DevComponents.DotNetBar.ButtonX btnNow; private DevComponents.DotNetBar.ButtonX btnNow;
} private DevComponents.DotNetBar.ButtonX btnResetToApproved;
}
} }

View File

@@ -1,31 +1,23 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Controls;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
using Volian.Controls.Library;
namespace VEPROMS namespace VEPROMS
{ {
public partial class dlgSetChangeBarStartDate : DevComponents.DotNetBar.Office2007Form public partial class dlgSetChangeBarStartDate : DevComponents.DotNetBar.Office2007Form
{ {
private ProcedureConfig _MyProcConfig = null; public ProcedureConfig MyProcConfig { get; set; } = null;
public ProcedureConfig MyProcConfig public ProcedureInfo MyProcInfo { get; set; } = null;
{
get { return _MyProcConfig; }
set { _MyProcConfig = value; }
}
public dlgSetChangeBarStartDate(ProcedureConfig pc) public dlgSetChangeBarStartDate(ProcedureConfig pc, ProcedureInfo pi)
{ {
InitializeComponent(); InitializeComponent();
_MyProcConfig = pc; MyProcConfig = pc;
MyProcInfo = pi;
} }
private void dlgSetChangeBarStartDate_Load(object sender, EventArgs e) private void dlgSetChangeBarStartDate_Load(object sender, EventArgs e)
@@ -80,5 +72,65 @@ namespace VEPROMS
dateTimeInput1.Value = DateTime.Now; dateTimeInput1.Value = DateTime.Now;
} }
} //C2026-009 Add Option to Reset Change Bar to Last Approved Date/Time
private void btnResetToApproved_Click(object sender, EventArgs e)
{
System.Data.DataTable dt = RevisionData.GetRevisionDataByUnit(MyProcInfo.ItemID);
if (dt.Rows.Count == 0)
{
//no records, remove
if (MessageBox.Show("There are currently no approvals set. Selecting yes will set ChangeBars to show all changes since the creation of the procedure.\r\nAre you sure you wish to reset ChangeBars?", "Reset ChangeBar Date", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
MyProcConfig.Print_ChangeBarDate = "";
DialogResult = DialogResult.OK;
Close();
}
}
else if (RevisionData.HasUnits(dt))
{
//any with units
string maxDTS = RevisionData.MaxDTS(dt).ToString("MM/dd/yyyy HH:mm:ss");
//create wording for ChangeBar changes
StringBuilder sb = new StringBuilder();
sb.Append($" The Procedure Viewer Change Bar Date will be set to ({maxDTS}).");
foreach (DataRow r in dt.Rows)
{
sb.Append($"\r\n The Change Bar Date for Unit ({r["UnitName"]}) will be set to ({Convert.ToDateTime(r["DTS"]):MM/dd/yyyy HH:mm:ss}).");
}
sb.Append("\r\n Any Change Bars for Units not listed above will use the Overall/Procedure Viewer Change Bar Date (as these Units have no approvals).");
if (CustomMessageBox.Show($"This will reset ChangeBars to show for changes newer than the last approval.\r\nThis includes the following changes:\r\n{sb.ToString()}\r\n\r\nAre you sure you wish to reset ChangeBars?", "Reset ChangeBar Date", "Yes", "No") == DialogResult.Yes)
{
//Change the overall ChangeBarDate
MyProcConfig.Print_ChangeBarDate = maxDTS;
//Change the ChangeBarDate for each unit
foreach (DataRow r in dt.Rows)
{
MyProcConfig.SelectedSlave = Convert.ToInt32(r["UnitID"]);
MyProcConfig.Print_ChangeBarDate = Convert.ToDateTime(r["DTS"]).ToString("MM / dd / yyyy HH: mm: ss");
}
MyProcConfig.SelectedSlave = 0;
DialogResult = DialogResult.OK;
Close();
}
}
else
{
//no units
string maxDTS = RevisionData.MaxDTS(dt).ToString("MM/dd/yyyy HH:mm:ss");
if (MessageBox.Show($"This will reset ChangeBars to show for changes newer than the last approval ({maxDTS}).\r\nAre you sure you wish to reset ChangeBars?", "Reset ChangeBar Date", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
MyProcConfig.Print_ChangeBarDate = maxDTS;
DialogResult = DialogResult.OK;
Close();
}
}
}
}
} }

View File

@@ -617,7 +617,7 @@ namespace VEPROMS
ProcedureConfig pc = pi.MyConfig as ProcedureConfig; ProcedureConfig pc = pi.MyConfig as ProcedureConfig;
if (pc == null) return; if (pc == null) return;
dlgSetChangeBarStartDate cbdDlg = new dlgSetChangeBarStartDate(pc); dlgSetChangeBarStartDate cbdDlg = new dlgSetChangeBarStartDate(pc, pi);
if (cbdDlg.ShowDialog() == DialogResult.OK) if (cbdDlg.ShowDialog() == DialogResult.OK)
{ {
using (Item itm = Item.Get(pi.ItemID)) using (Item itm = Item.Get(pi.ItemID))

View File

@@ -0,0 +1,53 @@
using Csla.Data;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
//CSM - C2026-009 - Minimal Class for Getting Revision Data
namespace VEPROMS.CSLA.Library
{
public static class RevisionData
{
#region Check Data
//Check if Data Has Units
public static bool HasUnits(DataTable dt) => dt.AsEnumerable().Any(x => x.Field<int?>("UnitID") > 0);
//Get Maximum Date Time Stamp
public static DateTime MaxDTS(DataTable dt) => dt.AsEnumerable().Max(x => x.Field<DateTime>("DTS"));
#endregion
#region Get Revision Data
//CSM - C2026-009 Get Current Revision Data by Unit
public static DataTable GetRevisionDataByUnit(int itemID)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "GetCurrentApprovedRevisions";
cm.CommandTimeout = Database.DefaultTimeout;
cm.Parameters.AddWithValue("@ItemID", itemID);
using (SqlDataAdapter da = new SqlDataAdapter(cm))
{
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
}
}
}
catch (Exception ex)
{
throw new DbCslaException("Error in GetRevisionDataByUnit: retrieving data failed", ex);
}
}
#endregion
}
}

View File

@@ -391,6 +391,7 @@
<Compile Include="Minimal\AnnotationstypeSections.cs" /> <Compile Include="Minimal\AnnotationstypeSections.cs" />
<Compile Include="Minimal\Maintenance.cs" /> <Compile Include="Minimal\Maintenance.cs" />
<Compile Include="Minimal\GeneralReports.cs" /> <Compile Include="Minimal\GeneralReports.cs" />
<Compile Include="Minimal\RevisionData.cs" />
<Compile Include="Minimal\UserReports.cs" /> <Compile Include="Minimal\UserReports.cs" />
<Compile Include="Minimal\UserSettings.cs" /> <Compile Include="Minimal\UserSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

View File

@@ -31,25 +31,32 @@
this.btn1 = new System.Windows.Forms.Button(); this.btn1 = new System.Windows.Forms.Button();
this.btn2 = new System.Windows.Forms.Button(); this.btn2 = new System.Windows.Forms.Button();
this.lblMessage = new System.Windows.Forms.Label(); this.lblMessage = new System.Windows.Forms.Label();
this.tableLP1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLP1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// btn1 // btn1
// //
this.btn1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btn1.AutoSize = true; this.btn1.AutoSize = true;
this.btn1.Location = new System.Drawing.Point(12, 99); this.btn1.Location = new System.Drawing.Point(18, 102);
this.btn1.Margin = new System.Windows.Forms.Padding(10);
this.btn1.MinimumSize = new System.Drawing.Size(60, 20);
this.btn1.Name = "btn1"; this.btn1.Name = "btn1";
this.btn1.Size = new System.Drawing.Size(75, 23); this.btn1.Size = new System.Drawing.Size(60, 20);
this.btn1.TabIndex = 0; this.btn1.TabIndex = 0;
this.btn1.UseVisualStyleBackColor = true; this.btn1.UseVisualStyleBackColor = true;
this.btn1.Click += new System.EventHandler(this.Btn1_Click); this.btn1.Click += new System.EventHandler(this.Btn1_Click);
// //
// btn2 // btn2
// //
this.btn2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btn2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btn2.AutoSize = true; this.btn2.AutoSize = true;
this.btn2.Location = new System.Drawing.Point(322, 99); this.btn2.Location = new System.Drawing.Point(335, 102);
this.btn2.Margin = new System.Windows.Forms.Padding(10);
this.btn2.MinimumSize = new System.Drawing.Size(60, 20);
this.btn2.Name = "btn2"; this.btn2.Name = "btn2";
this.btn2.Size = new System.Drawing.Size(75, 23); this.btn2.Size = new System.Drawing.Size(60, 20);
this.btn2.TabIndex = 1; this.btn2.TabIndex = 1;
this.btn2.UseVisualStyleBackColor = true; this.btn2.UseVisualStyleBackColor = true;
this.btn2.Click += new System.EventHandler(this.Btn2_Click); this.btn2.Click += new System.EventHandler(this.Btn2_Click);
@@ -57,24 +64,48 @@
// lblMessage // lblMessage
// //
this.lblMessage.AutoSize = true; this.lblMessage.AutoSize = true;
this.lblMessage.Location = new System.Drawing.Point(33, 41); this.tableLP1.SetColumnSpan(this.lblMessage, 2);
this.lblMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblMessage.Location = new System.Drawing.Point(11, 8);
this.lblMessage.MaximumSize = new System.Drawing.Size(413, 0);
this.lblMessage.Name = "lblMessage"; this.lblMessage.Name = "lblMessage";
this.lblMessage.Size = new System.Drawing.Size(0, 13); this.lblMessage.Size = new System.Drawing.Size(391, 84);
this.lblMessage.TabIndex = 2; this.lblMessage.TabIndex = 2;
this.lblMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// tableLP1
//
this.tableLP1.AutoSize = true;
this.tableLP1.ColumnCount = 2;
this.tableLP1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLP1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLP1.Controls.Add(this.lblMessage, 0, 0);
this.tableLP1.Controls.Add(this.btn1);
this.tableLP1.Controls.Add(this.btn2);
this.tableLP1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLP1.Location = new System.Drawing.Point(0, 0);
this.tableLP1.MaximumSize = new System.Drawing.Size(413, 0);
this.tableLP1.MinimumSize = new System.Drawing.Size(413, 130);
this.tableLP1.Name = "tableLP1";
this.tableLP1.Padding = new System.Windows.Forms.Padding(8);
this.tableLP1.RowCount = 2;
this.tableLP1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLP1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLP1.Size = new System.Drawing.Size(413, 130);
this.tableLP1.TabIndex = 0;
//
// CustomMessageBox // CustomMessageBox
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true; this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(419, 130); this.ClientSize = new System.Drawing.Size(419, 130);
this.Controls.Add(this.lblMessage); this.Controls.Add(this.tableLP1);
this.Controls.Add(this.btn2);
this.Controls.Add(this.btn1);
this.Name = "CustomMessageBox"; this.Name = "CustomMessageBox";
this.ShowIcon = false; this.ShowIcon = false;
this.Text = "CustomMessageBox"; this.Text = "CustomMessageBox";
this.tableLP1.ResumeLayout(false);
this.tableLP1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -85,5 +116,6 @@
private System.Windows.Forms.Button btn1; private System.Windows.Forms.Button btn1;
private System.Windows.Forms.Button btn2; private System.Windows.Forms.Button btn2;
private System.Windows.Forms.Label lblMessage; private System.Windows.Forms.Label lblMessage;
private System.Windows.Forms.TableLayoutPanel tableLP1;
} }
} }

View File

@@ -27,6 +27,10 @@ namespace Volian.Controls.Library
{ {
btn2.Text = button2Text; btn2.Text = button2Text;
btn2.Visible = true; btn2.Visible = true;
//make buttons uniform
btn1.Height = btn2.Height = btn1.Height > btn2.Height ? btn1.Height : btn2.Height;
btn1.Width = btn2.Width = btn1.Width > btn2.Width ? btn1.Width : btn2.Width;
} }
else else
{ {

View File

@@ -462,6 +462,7 @@
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="CustomMessageBox.resx"> <EmbeddedResource Include="CustomMessageBox.resx">
<DependentUpon>CustomMessageBox.cs</DependentUpon> <DependentUpon>CustomMessageBox.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="DisplayBookMarks.resx"> <EmbeddedResource Include="DisplayBookMarks.resx">
<DependentUpon>DisplayBookMarks.cs</DependentUpon> <DependentUpon>DisplayBookMarks.cs</DependentUpon>