Compare commits
2 Commits
C2022-003-
...
C2026-010
| Author | SHA1 | Date | |
|---|---|---|---|
| f9738451db | |||
| ec73b5cbea |
@@ -24578,6 +24578,161 @@ IF (@@Error = 0) PRINT 'Procedure Creation: [GetCurrentApprovedRevisions] Succee
|
|||||||
ELSE PRINT 'Procedure Creation: [GetCurrentApprovedRevisions] Error on Creation'
|
ELSE PRINT 'Procedure Creation: [GetCurrentApprovedRevisions] Error on Creation'
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
-- Begin: C2026-010 Add Audit Ability for ChangeBars
|
||||||
|
-- Author: Matthew Schill
|
||||||
|
-- Create date: 02/17/2026
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
----------------------------------------------------------------------------------
|
||||||
|
Tables:
|
||||||
|
----------------------------------------------------------------------------------
|
||||||
|
[ChangeBarAudits]
|
||||||
|
|
||||||
|
----------------------------------------------------------------------------------
|
||||||
|
Indexes:
|
||||||
|
----------------------------------------------------------------------------------
|
||||||
|
[IX_ChangeBarAudits_ItemID] on [dbo].[ChangeBarAudits]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
IF Not Exists(SELECT * FROM sys.objects Where name = 'ChangeBarAudits' AND type in (N'U'))
|
||||||
|
Begin
|
||||||
|
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
|
||||||
|
/****** Create Table to hold Audit Information ******/
|
||||||
|
CREATE TABLE [dbo].[ChangeBarAudits](
|
||||||
|
[AuditID] [bigint] IDENTITY(1,1) NOT NULL,
|
||||||
|
[ItemID] [bigint] NOT NULL,
|
||||||
|
[Text] [nvarchar](max) NULL,
|
||||||
|
[DTS] [datetime] NOT NULL,
|
||||||
|
[UserID] [nvarchar](100) NOT NULL,
|
||||||
|
[UnitIndex] [int] NULL,
|
||||||
|
CONSTRAINT [PK_ChangeBarAudits] PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[AuditID] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Table Creation: [ChangeBarAudits] Succeeded'
|
||||||
|
ELSE PRINT 'Table Creation: [ChangeBarAudits] Error on Creation'
|
||||||
|
|
||||||
|
/****** Table was not previously created - so intially populate with info from Approvals ******/
|
||||||
|
INSERT into ChangeBarAudits([ItemID],[Text],[DTS],[UserID],[UnitIndex])
|
||||||
|
select --rr.RevisionID,
|
||||||
|
rr.ItemID,
|
||||||
|
Text = CASE WHEN r1.value('@Index','int') <> 0 AND UnitName IS NOT NULL THEN
|
||||||
|
'(Unit ' + UnitName + ') '
|
||||||
|
ELSE
|
||||||
|
''
|
||||||
|
END +
|
||||||
|
'Approved by (' + rr.UserID + ') on (' +
|
||||||
|
CAST(rr.DTS AS VARCHAR) + ')',
|
||||||
|
rr.DTS,
|
||||||
|
rr.UserID,
|
||||||
|
UnitIndex = r1.value('@Index','int')
|
||||||
|
-- , UnitName
|
||||||
|
from revisions rr
|
||||||
|
inner join versions vv on rr.revisionid = vv.revisionid
|
||||||
|
inner join stages ss on vv.stageid = ss.stageid
|
||||||
|
outer apply rr.config.nodes('Config/Applicability') t1(r1)
|
||||||
|
outer apply
|
||||||
|
( Select r2.value('@Name','varchar') UnitName
|
||||||
|
FROM
|
||||||
|
(select DocVerSions.ItemID, cast(config as xml) xconfig from DocVersions
|
||||||
|
inner join
|
||||||
|
vefn_AllSiblingItems(rr.ItemID) Sib ON DocVerSions.ItemID = Sib.ItemID) SDV
|
||||||
|
cross apply
|
||||||
|
xconfig.nodes('Config/Slaves/Slave') t2(r2)
|
||||||
|
WHERE r2.value('@index','varchar') = r1.value('@Index','int')
|
||||||
|
) UN
|
||||||
|
where ss.isapproved = 1
|
||||||
|
order by rr.ItemID, rr.RevisionID desc
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT '[ChangeBarAudits] Initial Population Succeeded'
|
||||||
|
ELSE PRINT '[ChangeBarAudits] Initial Population Error'
|
||||||
|
|
||||||
|
/****** Create Index to get ChangeBar Audit Information for Item (ItemID = ProcedureID) ******/
|
||||||
|
CREATE NONCLUSTERED INDEX [IX_ChangeBarAudits_ItemID] ON [dbo].[ChangeBarAudits]
|
||||||
|
(
|
||||||
|
[ItemID] ASC
|
||||||
|
)
|
||||||
|
INCLUDE ([AuditID], [Text], [DTS], [UnitIndex])
|
||||||
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Index Creation: [IX_ChangeBarAudits_ItemID] Succeeded'
|
||||||
|
ELSE PRINT 'Index Creation: [IX_ChangeBarAudits_ItemID] Error on Creation'
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
-- =============================================
|
||||||
|
-- Description: Gets ChangeBar Audit History by item
|
||||||
|
-- =============================================
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[GetChangeBarAuditHistoryByItem]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [GetChangeBarAuditHistoryByItem];
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetChangeBarAuditHistoryByItem]
|
||||||
|
(
|
||||||
|
@ItemID AS bigint
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
Select * FROM ChangeBarAudits where ItemID = @ItemID
|
||||||
|
order by DTS desc
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: [GetChangeBarAuditHistoryByItem] Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: [GetChangeBarAuditHistoryByItem] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
-- =============================================
|
||||||
|
-- Description: Adds ChangeBar Audit History
|
||||||
|
-- =============================================
|
||||||
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[AddChangeBarAuditHistory]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
|
DROP PROCEDURE [AddChangeBarAuditHistory];
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[AddChangeBarAuditHistory]
|
||||||
|
(
|
||||||
|
@ItemID AS bigint,
|
||||||
|
@Description As nvarchar(max),
|
||||||
|
@DTS AS Datetime,
|
||||||
|
@UserID As nvarchar(100),
|
||||||
|
@UnitIndex AS bigint = NULL
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
INSERT into ChangeBarAudits([ItemID],[Text],[DTS],[UserID],[UnitIndex])
|
||||||
|
VALUES (@ItemID, @Description, @DTS, @UserID, @UnitIndex)
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Procedure Creation: [AddChangeBarAuditHistory] Succeeded'
|
||||||
|
ELSE PRINT 'Procedure Creation: [AddChangeBarAuditHistory] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
-- End: C2026-010 Add Audit Ability for ChangeBars
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
| ADD New Code Before this Block |
|
| ADD New Code Before this Block |
|
||||||
@@ -24611,8 +24766,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '02/09/2026 7:00 AM'
|
set @RevDate = '02/18/2026 7:00 AM'
|
||||||
set @RevDescription = 'Added procedure for getting current revisions'
|
set @RevDescription = 'Added Audit Ability for ChangeBars'
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -1135,6 +1135,7 @@ namespace VEPROMS
|
|||||||
ViewPDF = ViewPDF && MyProcedures.Count == 1;
|
ViewPDF = ViewPDF && MyProcedures.Count == 1;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
StageInfo nsi = StageInfo.GetJustStage(RevStage);
|
StageInfo nsi = StageInfo.GetJustStage(RevStage);
|
||||||
|
DateTime now = DateTime.Now; //using variable so dates are consistent
|
||||||
foreach (ApprovalProcedure ap in MyProcedures) //spin thru looking for updating current revision
|
foreach (ApprovalProcedure ap in MyProcedures) //spin thru looking for updating current revision
|
||||||
{
|
{
|
||||||
// ric: current revision info record, not new one being created.
|
// ric: current revision info record, not new one being created.
|
||||||
@@ -1207,7 +1208,7 @@ namespace VEPROMS
|
|||||||
cfg.History_StartDate = myDTS; // if there is a slave, date found from above code
|
cfg.History_StartDate = myDTS; // if there is a slave, date found from above code
|
||||||
cfg.Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave;
|
cfg.Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||||
//cfg.Save();
|
//cfg.Save();
|
||||||
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
// revision.MyConfig.History_StartDate = pi.DTS;
|
// revision.MyConfig.History_StartDate = pi.DTS;
|
||||||
// revision.MyConfig.Save();
|
// revision.MyConfig.Save();
|
||||||
// revision = revision.Save();
|
// revision = revision.Save();
|
||||||
@@ -1234,7 +1235,7 @@ namespace VEPROMS
|
|||||||
RevisionConfig cfg = new RevisionConfig();
|
RevisionConfig cfg = new RevisionConfig();
|
||||||
cfg.History_StartDate = pi.DTS; // todo: this should probably be myDTS, found during fix of B2019-051.
|
cfg.History_StartDate = pi.DTS; // todo: this should probably be myDTS, found during fix of B2019-051.
|
||||||
//cfg.Save();
|
//cfg.Save();
|
||||||
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
|
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), now, Volian.Base.Library.VlnSettings.UserID);
|
||||||
// revision.MyConfig.History_StartDate = pi.DTS;
|
// revision.MyConfig.History_StartDate = pi.DTS;
|
||||||
// revision.MyConfig.Save();
|
// revision.MyConfig.Save();
|
||||||
// revision = revision.Save();
|
// revision = revision.Save();
|
||||||
@@ -1253,7 +1254,7 @@ namespace VEPROMS
|
|||||||
byte[] summaryBuf = null;
|
byte[] summaryBuf = null;
|
||||||
//B2017-149 Allow the user to choose if they want the Summary of Changes report created during the approval process
|
//B2017-149 Allow the user to choose if they want the Summary of Changes report created during the approval process
|
||||||
if (doSumChg) summaryBuf = CreateSummary(ref pi, summaryPDF, myDTS);
|
if (doSumChg) summaryBuf = CreateSummary(ref pi, summaryPDF, myDTS);
|
||||||
DateTime currentDTS = DateTime.Now;
|
DateTime currentDTS = now;
|
||||||
Check check = Check.MakeCheck(revision, Stage.GetJustStage(RevStage), RevisionInfo.BuildRevisionChecks(pi), currentDTS, VlnSettings.UserID);
|
Check check = Check.MakeCheck(revision, Stage.GetJustStage(RevStage), RevisionInfo.BuildRevisionChecks(pi), currentDTS, VlnSettings.UserID);
|
||||||
//make pdf with promsprinter and get byte stream
|
//make pdf with promsprinter and get byte stream
|
||||||
// Moved to end so that Item and Content are saved at the same time
|
// Moved to end so that Item and Content are saved at the same time
|
||||||
@@ -1319,7 +1320,10 @@ namespace VEPROMS
|
|||||||
version.ApprovedXML = xd.OuterXml;
|
version.ApprovedXML = xd.OuterXml;
|
||||||
version.Save();
|
version.Save();
|
||||||
dlg.Dispose();
|
dlg.Dispose();
|
||||||
UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, DateTime.Now, selectedSlave);
|
UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, now, selectedSlave);
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
|
||||||
|
ChangeBarAuditHistory.AddAudit(pi.ItemID, $"{(selectedSlave > 0 ? $"(Unit {pi.MyDocVersion.UnitNames[selectedSlave - 1]}) " : "")}Approved by ({VlnSettings.UserID}) on ({now})", now, VlnSettings.UserID, selectedSlave);
|
||||||
|
|
||||||
// Clear the change bar override for this procedure:
|
// Clear the change bar override for this procedure:
|
||||||
pi.ClearChangeBarOverrides();
|
pi.ClearChangeBarOverrides();
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
|
using Volian.Base.Library;
|
||||||
using Volian.Controls.Library;
|
using Volian.Controls.Library;
|
||||||
|
|
||||||
namespace VEPROMS
|
namespace VEPROMS
|
||||||
@@ -64,6 +66,10 @@ namespace VEPROMS
|
|||||||
private void btnOK_Click(object sender, EventArgs e)
|
private void btnOK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");// ("MM/dd/yyyy HH:mm:ss");
|
MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");// ("MM/dd/yyyy HH:mm:ss");
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
|
||||||
|
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({ dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss")}) by ({ VlnSettings.UserID}) on ({DateTime.Now})", DateTime.Now, VlnSettings.UserID, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -84,11 +90,16 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
MyProcConfig.Print_ChangeBarDate = "";
|
MyProcConfig.Print_ChangeBarDate = "";
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
|
||||||
|
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Reset ChangeBars performed by ({VlnSettings.UserID}) on ({DateTime.Now}). ChangeBars reset to show all changes.", DateTime.Now, VlnSettings.UserID, 0);
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (RevisionData.HasUnits(dt))
|
else if (RevisionData.HasUnits(dt))
|
||||||
{
|
{
|
||||||
|
|
||||||
//any with units
|
//any with units
|
||||||
string maxDTS = RevisionData.MaxDTS(dt).ToString("MM/dd/yyyy HH:mm:ss");
|
string maxDTS = RevisionData.MaxDTS(dt).ToString("MM/dd/yyyy HH:mm:ss");
|
||||||
|
|
||||||
@@ -112,10 +123,17 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
MyProcConfig.SelectedSlave = Convert.ToInt32(r["UnitID"]);
|
MyProcConfig.SelectedSlave = Convert.ToInt32(r["UnitID"]);
|
||||||
MyProcConfig.Print_ChangeBarDate = Convert.ToDateTime(r["DTS"]).ToString("MM / dd / yyyy HH: mm: ss");
|
MyProcConfig.Print_ChangeBarDate = Convert.ToDateTime(r["DTS"]).ToString("MM / dd / yyyy HH: mm: ss");
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
|
||||||
|
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Reset ChangeBars performed by ({VlnSettings.UserID}) on ({DateTime.Now}). ChangeBars reset to show since last approval ({Convert.ToDateTime(r["DTS"]):MM/dd/yyyy HH:mm:ss}) for (Unit {r["UnitName"]})", DateTime.Now, VlnSettings.UserID, MyProcConfig.SelectedSlave);
|
||||||
|
|
||||||
}
|
}
|
||||||
MyProcConfig.SelectedSlave = 0;
|
MyProcConfig.SelectedSlave = 0;
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
|
||||||
|
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Reset ChangeBars performed by ({VlnSettings.UserID}) on ({DateTime.Now}). ChangeBars reset to show since last approval ({maxDTS})", DateTime.Now, VlnSettings.UserID, 0);
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,6 +145,9 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
MyProcConfig.Print_ChangeBarDate = maxDTS;
|
MyProcConfig.Print_ChangeBarDate = maxDTS;
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
|
||||||
|
ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Reset ChangeBars performed by ({VlnSettings.UserID}) on ({DateTime.Now}). ChangeBars reset to show since last approval ({maxDTS})", DateTime.Now, VlnSettings.UserID, 0);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -877,7 +877,7 @@ namespace VEPROMS
|
|||||||
this.infoPanel.ExpandOnTitleClick = true;
|
this.infoPanel.ExpandOnTitleClick = true;
|
||||||
this.infoPanel.Location = new System.Drawing.Point(614, 57);
|
this.infoPanel.Location = new System.Drawing.Point(614, 57);
|
||||||
this.infoPanel.Name = "infoPanel";
|
this.infoPanel.Name = "infoPanel";
|
||||||
this.infoPanel.Size = new System.Drawing.Size(230, 490);
|
this.infoPanel.Size = new System.Drawing.Size(300, 490);
|
||||||
this.infoPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
|
this.infoPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||||
this.infoPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
this.infoPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
||||||
this.infoPanel.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
this.infoPanel.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
||||||
|
|||||||
72
PROMS/VEPROMS.CSLA.Library/Minimal/ChangeBarAuditHistory.cs
Normal file
72
PROMS/VEPROMS.CSLA.Library/Minimal/ChangeBarAuditHistory.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using Csla.Data;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Minimal Class for Managing Change Bar Audit History
|
||||||
|
namespace VEPROMS.CSLA.Library
|
||||||
|
{
|
||||||
|
public static class ChangeBarAuditHistory
|
||||||
|
{
|
||||||
|
|
||||||
|
#region Add Audit Record for ChangeBar History
|
||||||
|
public static void AddAudit(int itemID, string description, DateTime dts, string userID, int unitIndex)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "AddChangeBarAuditHistory";
|
||||||
|
cm.Parameters.AddWithValue("@ItemID", itemID);
|
||||||
|
cm.Parameters.AddWithValue("@Description", description);
|
||||||
|
cm.Parameters.AddWithValue("@DTS", dts);
|
||||||
|
cm.Parameters.AddWithValue("@UserID", userID);
|
||||||
|
if (unitIndex != 0) cm.Parameters.AddWithValue("@UnitIndex", unitIndex);
|
||||||
|
|
||||||
|
cm.CommandTimeout = 0;
|
||||||
|
cm.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error in ChangeBarAuditHistory.AddAudit: ", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Get Change Bar Audit History
|
||||||
|
public static DataTable GetChangeBarAuditHistory(int itemID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "GetChangeBarAuditHistoryByItem";
|
||||||
|
cm.Parameters.AddWithValue("@ItemID", itemID);
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
using (SqlDataAdapter da = new SqlDataAdapter(cm))
|
||||||
|
{
|
||||||
|
DataTable dt = new DataTable();
|
||||||
|
da.Fill(dt);
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error in ChangeBarAuditHistory.GetChangeBarAuditHistoryByItem: retrieving data failed", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -389,6 +389,7 @@
|
|||||||
<Compile Include="Generated\ZTransition.cs" />
|
<Compile Include="Generated\ZTransition.cs" />
|
||||||
<Compile Include="Generated\ZTransitionInfo.cs" />
|
<Compile Include="Generated\ZTransitionInfo.cs" />
|
||||||
<Compile Include="Minimal\AnnotationstypeSections.cs" />
|
<Compile Include="Minimal\AnnotationstypeSections.cs" />
|
||||||
|
<Compile Include="Minimal\ChangeBarAuditHistory.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\RevisionData.cs" />
|
||||||
|
|||||||
@@ -56,6 +56,19 @@ namespace Volian.Controls.Library
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface
|
if (DesignMode) return; // B2019-043 need to check if we are just saving changes to the user interface
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Set/Show Change Bar Audit History
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
lbChangeBarHistory.DataSource = ChangeBarAuditHistory.GetChangeBarAuditHistory(value.ItemID);
|
||||||
|
lbChangeBarHistory.ValueMember = "AuditID";
|
||||||
|
lbChangeBarHistory.DisplayMember = "Text";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lbChangeBarHistory.DataSource = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (value is ProcedureInfo && _MyProcedureInfo is ProcedureInfo && value.ItemID == _MyProcedureInfo.ItemID)
|
if (value is ProcedureInfo && _MyProcedureInfo is ProcedureInfo && value.ItemID == _MyProcedureInfo.ItemID)
|
||||||
return;
|
return;
|
||||||
_MyProcedureInfo = value;
|
_MyProcedureInfo = value;
|
||||||
@@ -184,6 +197,15 @@ namespace Volian.Controls.Library
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
myRTB.FormatFont = null;
|
myRTB.FormatFont = null;
|
||||||
RefreshRequired = true;
|
RefreshRequired = true;
|
||||||
|
|
||||||
|
if (MyProcedureInfo != null)
|
||||||
|
{
|
||||||
|
lbChangeBarHistory.DataSource = ChangeBarAuditHistory.GetChangeBarAuditHistory(MyProcedureInfo.ItemID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lbChangeBarHistory.DataSource = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lbChanges_VisibleChanged(object sender, System.EventArgs e)
|
private void lbChanges_VisibleChanged(object sender, System.EventArgs e)
|
||||||
@@ -1075,6 +1097,24 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
tvAudits.Height = ((tcpDetail.Height - btnRestore.Height) / 4) * 3;
|
tvAudits.Height = ((tcpDetail.Height - btnRestore.Height) / 4) * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CSM - C2026-010 - Set/Show Change Bar Audit History
|
||||||
|
//Display a Tooltip for what was in the list
|
||||||
|
private void LbChangeBarHistory_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
// Just use the item's value for the tooltip.
|
||||||
|
int index = lbChangeBarHistory.IndexFromPoint(e.Location);
|
||||||
|
|
||||||
|
if (index != ListBox.NoMatches)
|
||||||
|
{
|
||||||
|
DataRow rw = (lbChangeBarHistory.Items[index] as DataRowView)?.Row;
|
||||||
|
|
||||||
|
// Display the item's value as a tooltip.
|
||||||
|
if (tipCBHistory.GetToolTip(lbChangeBarHistory) != rw["Text"].ToString())
|
||||||
|
tipCBHistory.SetToolTip(lbChangeBarHistory, rw["Text"].ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void RefreshChangeList()
|
public void RefreshChangeList()
|
||||||
{
|
{
|
||||||
myTimer.Enabled = false;
|
myTimer.Enabled = false;
|
||||||
|
|||||||
BIN
PROMS/Volian.Controls.Library/DisplayHistory.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/DisplayHistory.designer.cs
generated
Binary file not shown.
@@ -188,4 +188,7 @@
|
|||||||
<metadata name="myTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="myTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="tipCBHistory.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>119, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user