Compare commits

..

49 Commits

Author SHA1 Message Date
7713f0cd63 Merge pull request 'B2024-059: Paste source section has bad links.' (#391) from B2024-059 into Development
Reviewed-on: #391
Reviewed-by: Paul Larsen <plarsen@volian.com>
2024-08-15 10:10:13 -04:00
2711520666 B2024-059: Paste source section has bad links. 2024-08-15 06:51:02 -04:00
4a6c0ba447 Merge pull request 'B2024-058-RevisionDate-field-Print-dialog' (#390) from B2024-058-RevisionDate-field-Print-dialog into Development
Reviewed-on: #390
Reviewed-by: Kathy Ruffing <kruffing@volian.com>
2024-08-14 12:04:36 -04:00
3f3281e2f4 B2024-058-RevisionDate-field-Print-dialog 2024-08-14 09:37:26 -04:00
0eadd3fe33 B2024-058-RevisionDate-field-Print-dialog 2024-08-13 14:01:38 -04:00
4bf42be80a B2024-058-RevisionDate-field-Print-dialog 2024-08-13 10:05:05 -04:00
d7f829737a B2024-058-RevisionDate-field-Print-dialog 2024-08-08 15:21:11 -04:00
25cc62c7c6 Merge pull request 'F2024-069-Procedure-Set-Specific-Information-dialog-ajustments' (#388) from F2024-069-Procedure-Set-Specific-Information-dialog-ajustments into Development
changes good. ready for testing
2024-08-08 14:13:28 -04:00
47596c7bca Merge pull request 'F2024-067 - Updates to VCSummer for time sensitive stes (clock)' (#387) from F2024-067 into Development
format change ready for testing
2024-08-08 14:12:05 -04:00
7129853902 F2024-069-Procedure-Set-Specific-Information-dialog-ajustments 2024-08-08 13:33:16 -04:00
f08466f702 Merge pull request 'B2024-038: tree view menuing for paste/replace of sections' (#386) from B2024-038 into Development
Reviewed-on: #386
Reviewed-by: Kevin Laskey <klaskey@volian.com>
2024-08-08 10:18:27 -04:00
4248d40917 B2024-058-RevisionDate-field-Print-dialog 2024-08-08 09:27:27 -04:00
7cf28366f4 B2024-038: tree view menuing for paste/replace of sections 2024-08-08 09:01:31 -04:00
037c82e22e Merge pull request 'F2024-068-VCS-Deviation-Format' (#385) from F2024-068-VCS-Deviation-Format into Development
ok for testing phase
2024-08-08 08:29:10 -04:00
6de13b12f9 F2024-068-VCS-Deviation-Format 2024-08-07 21:59:59 -04:00
cf69aa93e6 Merge pull request 'B2024-057 - Updated sizes of tooltips in delete area of admin' (#384) from B2024-057 into Development
OK for testing
2024-08-07 15:22:41 -04:00
4b915b78b6 B2024-057 - Updated sizes of tooltips in delete area of admin 2024-08-07 14:37:31 -04:00
a891a62ffa F2024-067 - Updates to VCSummer for time sensitive stes (clock) 2024-08-07 14:15:57 -04:00
7a768484a1 Merge pull request 'B2024-057' (#382) from B2024-057 into Development
approved, ready for testing
2024-08-06 11:18:30 -04:00
5f7af3309d B2024-054 - Update Annotation tooltip 2024-08-06 11:17:17 -04:00
1f3a1dabbc B2024-055 - Update tooltips for the labels on delete annotations and delete folders 2024-08-06 10:58:04 -04:00
4b61495960 B2024-057 - updated curors 2024-08-06 10:48:05 -04:00
d091a37171 B2024-055 - Update tooltips on admin delete functions 2024-08-06 10:29:06 -04:00
189b78d7d3 B2024-057 - Added check to see if anything is checked out for annotations and folder delete from admin area. 2024-08-06 09:14:36 -04:00
8ee7a31b97 Merge pull request 'C2024-018 - Update to use results pane' (#381) from C2024-018 into Development
approved and ready for testing phase
2024-08-05 15:29:46 -04:00
055be66421 C2024-018 - Update to use results pane 2024-08-05 15:24:43 -04:00
86a3e56a27 Merge pull request 'C2024-018 - Updated fixes per Michelle testing. Added some confirmation messages' (#380) from C2024-018 into Development
changes approved. - ready for testing phase
2024-08-05 12:12:05 -04:00
0db98e4182 C2024-018 - Updated fixes per Michelle testing. Added some confirmation messages 2024-08-05 11:12:21 -04:00
3102596a3d Merge pull request 'C2021-059_deleteFolders' (#379) from C2021-059_deleteFolders into Development
code changes look good.  - on to testing phase
2024-08-02 14:05:24 -04:00
41aa195785 C2021-059 - Added extra code to ensure delect sets parent tree items deslected 2024-08-02 13:08:19 -04:00
954186265e C2021-059 - Patch in auto checkbox filling for delete tree. 2024-08-02 12:56:12 -04:00
33cced07c6 C2021-059 Added veProms connection to remove the node in the main tree 2024-08-02 10:31:50 -04:00
afbf6f360d C2021-059 - Updates to get build moving after custom merging 2024-08-02 10:13:05 -04:00
df2be585a1 C2021-059 - Moved updates to branch 2024-08-01 15:54:28 -04:00
c81f527cb8 C2021-059 - Update Proms Fixes 2024-08-01 15:05:42 -04:00
0f67382c27 Merge pull request 'B2024-054_Update_Tool_tip_text_for_delete_annotations' (#375) from B2024-054_Update_Tool_tip_text_for_delete_annotations into Development
changes look good - onto testing phase
2024-08-01 11:07:59 -04:00
b42b8ddfa3 B2024-054_Update_Tool_tip_text_for_delete_annotations 2024-08-01 10:42:53 -04:00
f3efd409c6 Merge pull request 'B2024-053_Submitted_for_Admin_Tools-Delete' (#372) from B2024-053_Submitted_for_Admin_Tools-Delete into Development
passed code review - on to testing phase.
2024-07-31 14:41:13 -04:00
9011b134d6 B2024-053_Submitted_for_Admin_Tools-Delete 2024-07-31 14:34:49 -04:00
7c33bad362 Merge pull request 'B2024-052-In-Annotations-pop-up-no-Annotation-type-should-be-selected-by-default' (#371) from B2024-052-In-Annotations-pop-up-no-Annotation-type-should-be-selected-by-default into Development
changes look good - onto testing phase
2024-07-31 09:49:30 -04:00
e49a4d674f Merge pull request 'B2024-045, B2024-049, B2024-050 crash on paste/replace' (#370) from B2024-045 into Development
Reviewed-on: #370
Reviewed-by: Kevin Laskey <klaskey@volian.com>
2024-07-31 09:48:50 -04:00
7872f192ed B2024-052-In-Annotations-pop-up-no-Annotation-type-should-be-selected-by-default 2024-07-31 09:23:34 -04:00
870bba0aa6 B2024-045, B2024-049, B2024-050 crash on paste/replace 2024-07-31 07:21:30 -04:00
35c7b2b0cf Merge pull request 'B2024-051 Added null checks in the MultiUser.cs file to handle when a user as access to a procedure set that no longer exists.' (#369) from B2024-051 into Development
Reviewed-on: #369
2024-07-30 15:46:21 -04:00
9e6c8acca4 B2024-051 Added null checks in the MultiUser.cs file to handle when a user as access to a procedure set that no longer exists. 2024-07-30 14:48:34 -04:00
099bbdd328 Merge pull request 'B2024-043-Fix-User-Tab2' (#368) from B2024-043-Fix-User-Tab2 into Development
changes look good. onto the testing phase
2024-07-30 10:38:31 -04:00
720c5db2d0 B2024-043-Fix-User-Tab2 2024-07-30 10:09:40 -04:00
659833c5bf Merge pull request 'C2024-016-Annotations-Delete-Info-to-results-panel' (#366) from C2024-016-Annotations-Delete-Info-to-results-panel into Development
changes OK. ready to create test exe.
2024-07-29 14:12:10 -04:00
5ea9bcdd8b C2024-016-Annotations-Delete-Info-to-results-panel 2024-07-29 12:52:29 -04:00
19 changed files with 987 additions and 411 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -97,12 +97,12 @@ namespace VEPROMS
this.expandableSplitter1 = new DevComponents.DotNetBar.ExpandableSplitter(); this.expandableSplitter1 = new DevComponents.DotNetBar.ExpandableSplitter();
this.panelEx2 = new DevComponents.DotNetBar.PanelEx(); this.panelEx2 = new DevComponents.DotNetBar.PanelEx();
this.groupPag = new DevComponents.DotNetBar.Controls.GroupPanel(); this.groupPag = new DevComponents.DotNetBar.Controls.GroupPanel();
this.cbxGenerateTimeCritActSum = new System.Windows.Forms.CheckBox();
this.expPrnSetting = new DevComponents.DotNetBar.ExpandablePanel(); this.expPrnSetting = new DevComponents.DotNetBar.ExpandablePanel();
this.ppGpDuplex = new DevComponents.DotNetBar.Controls.GroupPanel(); this.ppGpDuplex = new DevComponents.DotNetBar.Controls.GroupPanel();
this.tbBlankPage = new DevComponents.DotNetBar.Controls.TextBoxX(); this.tbBlankPage = new DevComponents.DotNetBar.Controls.TextBoxX();
this.lblBlPg = new DevComponents.DotNetBar.LabelX(); this.lblBlPg = new DevComponents.DotNetBar.LabelX();
this.swtbtnPDFdtPrefixSuffix = new DevComponents.DotNetBar.Controls.SwitchButton(); this.swtbtnPDFdtPrefixSuffix = new DevComponents.DotNetBar.Controls.SwitchButton();
this.cbxGenerateTimeCritActSum = new System.Windows.Forms.CheckBox();
this.gpnlDebug.SuspendLayout(); this.gpnlDebug.SuspendLayout();
this.grpDateSelector.SuspendLayout(); this.grpDateSelector.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.docVersionConfigBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.docVersionConfigBindingSource)).BeginInit();
@ -1285,6 +1285,23 @@ namespace VEPROMS
this.groupPag.TabIndex = 111; this.groupPag.TabIndex = 111;
this.groupPag.Text = "Print using standard PROMS pagination rules by:"; this.groupPag.Text = "Print using standard PROMS pagination rules by:";
// //
// cbxGenerateTimeCritActSum
//
this.cbxGenerateTimeCritActSum.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbxGenerateTimeCritActSum.AutoSize = true;
this.cbxGenerateTimeCritActSum.BackColor = System.Drawing.Color.Transparent;
this.cbxGenerateTimeCritActSum.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbxGenerateTimeCritActSum.ForeColor = System.Drawing.SystemColors.ControlText;
this.cbxGenerateTimeCritActSum.Location = new System.Drawing.Point(240, 273);
this.cbxGenerateTimeCritActSum.Margin = new System.Windows.Forms.Padding(2);
this.cbxGenerateTimeCritActSum.Name = "cbxGenerateTimeCritActSum";
this.cbxGenerateTimeCritActSum.Size = new System.Drawing.Size(294, 17);
this.cbxGenerateTimeCritActSum.TabIndex = 102;
this.cbxGenerateTimeCritActSum.Text = "Generate Time Critical Action Summary (hidden but used)";
this.cbxGenerateTimeCritActSum.UseVisualStyleBackColor = false;
this.cbxGenerateTimeCritActSum.Visible = false;
//
// expPrnSetting // expPrnSetting
// //
this.expPrnSetting.CanvasColor = System.Drawing.SystemColors.Control; this.expPrnSetting.CanvasColor = System.Drawing.SystemColors.Control;
@ -1421,23 +1438,6 @@ namespace VEPROMS
this.swtbtnPDFdtPrefixSuffix.TabIndex = 111; this.swtbtnPDFdtPrefixSuffix.TabIndex = 111;
this.swtbtnPDFdtPrefixSuffix.ValueChanged += new System.EventHandler(this.swtbtnPDFdtPrefixSuffix_ValueChanged); this.swtbtnPDFdtPrefixSuffix.ValueChanged += new System.EventHandler(this.swtbtnPDFdtPrefixSuffix_ValueChanged);
// //
// cbxGenerateTimeCritActSum
//
this.cbxGenerateTimeCritActSum.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbxGenerateTimeCritActSum.AutoSize = true;
this.cbxGenerateTimeCritActSum.BackColor = System.Drawing.Color.Transparent;
this.cbxGenerateTimeCritActSum.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbxGenerateTimeCritActSum.ForeColor = System.Drawing.SystemColors.ControlText;
this.cbxGenerateTimeCritActSum.Location = new System.Drawing.Point(240, 273);
this.cbxGenerateTimeCritActSum.Margin = new System.Windows.Forms.Padding(2);
this.cbxGenerateTimeCritActSum.Name = "cbxGenerateTimeCritActSum";
this.cbxGenerateTimeCritActSum.Size = new System.Drawing.Size(294, 17);
this.cbxGenerateTimeCritActSum.TabIndex = 102;
this.cbxGenerateTimeCritActSum.Text = "Generate Time Critical Action Summary (hidden but used)";
this.cbxGenerateTimeCritActSum.UseVisualStyleBackColor = false;
this.cbxGenerateTimeCritActSum.Visible = false;
//
// DlgPrintProcedure // DlgPrintProcedure
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -1096,6 +1096,15 @@ namespace VEPROMS
} }
private void btnCreatePDF_Click(object sender, EventArgs e) private void btnCreatePDF_Click(object sender, EventArgs e)
{ {
// B2024-058 Add validation for Revision Date field of the Print dialog
if (txbRevDate.Visible)
{
if (!validateDate(txbRevDate))
{
//txbRevDate.Focus();
return;
}
}
DoCreatePDF(); DoCreatePDF();
} }
@ -1193,16 +1202,42 @@ namespace VEPROMS
if (_Initializing) return; if (_Initializing) return;
ppGpbxUserSpecTxt.Enabled = ppCmbxChgBarTxtType.SelectedIndex == (int)PrintChangeBarText.UserDef; ppGpbxUserSpecTxt.Enabled = ppCmbxChgBarTxtType.SelectedIndex == (int)PrintChangeBarText.UserDef;
} }
// B2024-058 Add validation for Revision Date field of the Print dialog
private bool validateDate(TextBox txtDate)
{
DateTime dDate;
if (DateTime.TryParse(txtDate.Text, out dDate))
{
return true;
}
else
{
string txtDate2 = txtDate.Text;
string message = String.Format("Date {0} in wrong format" + System.Environment.NewLine + "Correct the revision date.", txtDate2);
string txtTitle = "Invalid Format";
MessageBox.Show(message, txtTitle);
return false;
}
}
private void txbRevDate_Enter(object sender, EventArgs e) private void txbRevDate_Enter(object sender, EventArgs e)
{ {
txbDate = txbRevDate; txbDate = txbRevDate;
grpDateSelector.Text = "Select Revision Date"; grpDateSelector.Text = "Select Revision Date";
grpDateSelector.Visible = calDateSelector.Visible = true; grpDateSelector.Visible = calDateSelector.Visible = true;
//C2021-007 position the calendar to the current RevDate or if no RevDate, position to today's date //C2021-007 position the calendar to the current RevDate or if no RevDate, position to today's date
DateTime initSelDate =(txbDate.Text != null && txbDate.Text.Length != 0)? Convert.ToDateTime(txbDate.Text) : DateTime.Today; DateTime dDate;
calDateSelector.DisplayMonth = calDateSelector.SelectedDate = initSelDate; // B2024-058 Add validation for Revision Date field of the Print dialog
if (!validateDate(txbDate))
{
txbRevDate.Focus();
}
else
{
DateTime initSelDate = (txbDate.Text != null && txbDate.Text.Length != 0) ? Convert.ToDateTime(txbDate.Text) : DateTime.Today;
calDateSelector.DisplayMonth = calDateSelector.SelectedDate = initSelDate;
}
} }
private void txbRevDate_Leave(object sender, EventArgs e) private void txbRevDate_Leave(object sender, EventArgs e)
{ {
if (_Initializing) return; if (_Initializing) return;
@ -1375,6 +1410,7 @@ namespace VEPROMS
_NewRevForAllProcs = null; _NewRevForAllProcs = null;
} }
//private void cbxDebug_CheckedChanged(object sender, EventArgs e) //private void cbxDebug_CheckedChanged(object sender, EventArgs e)
//{ //{
// cbxCmpPRMSpfd.Visible = cbxDebug.Checked; // cbxCmpPRMSpfd.Visible = cbxDebug.Checked;

View File

@ -23519,6 +23519,90 @@ GO
========================================================================================================== ==========================================================================================================
*/ */
/*
==========================================================================================================
Start: C2021-059: SQL to delete folders using admin tool
==========================================================================================================
*/
IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'deleteFolderAdmin')
DROP PROCEDURE [dbo].[deleteFolderAdmin]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[deleteFolderAdmin]
(
@FolderID int
)
WITH EXECUTE AS OWNER
AS
BEGIN TRY -- Try Block
BEGIN TRANSACTION
DELETE From Assignments WHERE [FolderID]=@FolderID
DELETE From Associations where VersionID in (select versionid from DocVersions where folderid = @FolderID)
DELETE From DocVersions where VersionID in (select versionid from DocVersions where folderid= @FolderID)
DELETE From DocVersions where [FolderID]=@FolderID
-- Delete from items where ItemID matches
DELETE FROM tblitems
WHERE ItemID IN (
SELECT DISTINCT ItemID
FROM docversions
WHERE folderID = @folderID
);
-- Delete from items where ItemID matches
DELETE FROM tblitems
WHERE ItemID IN (
SELECT DISTINCT ItemID
FROM docversions
WHERE folderID = @folderID
);
-- Delete from tblContents where ContentID matches
DELETE FROM tblContents
WHERE ContentID IN (
SELECT DISTINCT c.ContentID
FROM tblContents c
JOIN items i ON c.ContentID = i.ItemID
WHERE i.ItemID IN (
SELECT DISTINCT ItemID
FROM docversions
WHERE folderID = @folderID
)
);
DELETE From Folders WHERE [ParentID] = @FolderID
DELETE From Folders WHERE [FolderID] = @FolderID
IF( @@TRANCOUNT > 0 ) COMMIT
END TRY
BEGIN CATCH -- Catch Block
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
EXEC vlnErrorHandler
END CATCH
GO
/*
==========================================================================================================
End: C2021-059: SQL to delete folders using admin tool
==========================================================================================================
*/
/* /*
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
| ADD New Code Before this Block | | ADD New Code Before this Block |
@ -23552,8 +23636,8 @@ BEGIN TRY -- Try Block
DECLARE @RevDate varchar(255) DECLARE @RevDate varchar(255)
DECLARE @RevDescription varchar(255) DECLARE @RevDescription varchar(255)
set @RevDate = '07/18/2024 11:24' set @RevDate = '07/29/2024 11:24'
set @RevDescription = 'C2024-005 Add an Admin tool that can delete a group of annotations.' set @RevDescription = 'C2021-059 Add SQL for Admin tool delete folders.'
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

@ -22,6 +22,8 @@ namespace VEPROMS
string procList = ""; string procList = "";
string docvList = ""; string docvList = "";
int AnnotationTyp; int AnnotationTyp;
string AnnotationName = "";
string totalDeleteCnt = "";
List<ProcedureInfo> pil2 = new List<ProcedureInfo>(); List<ProcedureInfo> pil2 = new List<ProcedureInfo>();
List<DocVersionInfo> dvil2 = new List<DocVersionInfo>(); List<DocVersionInfo> dvil2 = new List<DocVersionInfo>();
private frmBatchRefresh mainForm = null; private frmBatchRefresh mainForm = null;
@ -52,6 +54,7 @@ namespace VEPROMS
lbAnnotationTypes.DisplayMember = "Value"; lbAnnotationTypes.DisplayMember = "Value";
lbAnnotationTypes.ValueMember = "Key"; lbAnnotationTypes.ValueMember = "Key";
lbAnnotationTypes.SelectedIndexChanged += lbAnnotationTypes_SelectedIndexChanged; lbAnnotationTypes.SelectedIndexChanged += lbAnnotationTypes_SelectedIndexChanged;
lbAnnotationTypes.ClearSelected();
} }
// create comma delimited string of procedures selected by user. // create comma delimited string of procedures selected by user.
@ -99,53 +102,80 @@ namespace VEPROMS
private AnnotationTypeInfoList myAnnotationTypeInfoList = null; private AnnotationTypeInfoList myAnnotationTypeInfoList = null;
private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null; private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null;
// Process used to cleanup annotations "(Proceed?" button) // Process used to cleanup annotations "(Proceed?" button)
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
foreach (var p in pil2) if (lbAnnotationTypes.SelectedIndex > -1)
{ {
if (p.IsProcedure)
{
TextBox frm2 = mainForm.GettxtProcess();
frm2.AppendText(p.DisplayNumber + ' ' + p.DisplayText);
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
Annotation.DeleteAnnotationProcByType(AnnotationTyp, p.ItemID.ToString());
lblCountNumber.Text = "0";
}
} TextBox frm2 = mainForm.GettxtProcess();
foreach (var d in dvil2) TextBox frm3 = mainForm.GettxtResults();
{ AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
if (d.IsDocVersion) AnnotationName = System.Convert.ToString(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Value);
frm3.AppendText("Deleting Annotations: Annotation Type: " + '"' + AnnotationName + '"');
frm3.AppendText(Environment.NewLine + "P = Procedure, F = Folder" + Environment.NewLine);
int deletecountProc = 0;
int deletecountDocv = 0;
foreach (var p in pil2)
{ {
TextBox frm2 = mainForm.GettxtProcess(); if (p.IsProcedure)
frm2.AppendText(d.ActiveParent.ToString()); {
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key); //AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
Annotation.DeleteAnnotationDocvByType(AnnotationTyp, d.VersionID.ToString()); //AnnotationName = System.Convert.ToString(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Value);
lblCountNumber.Text = "0"; //deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, getAnnotationProcItems(p));
deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, p.ItemID.ToString());
frm2.AppendText(Environment.NewLine + p.DisplayNumber + ' ' + p.DisplayText);
//frm3.AppendText(Environment.NewLine + "P: " + p.DisplayNumber + '"' + p.DisplayText + '"' + " Type: " + '"' + AnnotationName + '"' + " count: " + deletecountProc);
frm3.AppendText(Environment.NewLine + "P: " + p.DisplayNumber + '"' + p.DisplayText + '"' + " Delete count: " + deletecountProc);
Annotation.DeleteAnnotationProcByType(AnnotationTyp, p.ItemID.ToString());
lblCountNumber.Text = "0";
}
} }
foreach (var d in dvil2)
{
if (d.IsDocVersion)
{
//AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
//AnnotationName = System.Convert.ToString(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Value);
deletecountDocv = Annotation.getAnnotationCountDocv(AnnotationTyp, d.VersionID.ToString());
frm2.AppendText(Environment.NewLine + d.ActiveParent.ToString());
frm3.AppendText(Environment.NewLine + "F: " + '"' + d.ActiveParent.ToString() + '"' + " Delete count: " + deletecountDocv);
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
Annotation.DeleteAnnotationDocvByType(AnnotationTyp, d.VersionID.ToString());
lblCountNumber.Text = "0";
}
}
frm3.AppendText(Environment.NewLine + Environment.NewLine + "Total Annotations Deleted: " + totalDeleteCnt + Environment.NewLine + Environment.NewLine);
} }
} }
// Retrieve number of annotations that will be deleted.
// Retrieve number of annotations that will be deleted.
private void lbAnnotationTypes_SelectedIndexChanged(object sender, EventArgs e) private void lbAnnotationTypes_SelectedIndexChanged(object sender, EventArgs e)
{ {
btnClean.Enabled = false; if (lbAnnotationTypes.SelectedIndex > -1)
lblCountNumber.Text = "";
int deletecountProc = 0;
int deletecountDocv = 0;
if (pil2.Count > 0)
{ {
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key); btnClean.Enabled = false;
deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, getAnnotationProcItems(pil2)); lblCountNumber.Text = "";
} int deletecountProc = 0;
int deletecountDocv = 0;
if (pil2.Count > 0)
{
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, getAnnotationProcItems(pil2));
}
if (dvil2.Count > 0) if (dvil2.Count > 0)
{ {
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key); AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
deletecountDocv = Annotation.getAnnotationCountDocv(AnnotationTyp, getAnnotationDocvItems(dvil2)); deletecountDocv = Annotation.getAnnotationCountDocv(AnnotationTyp, getAnnotationDocvItems(dvil2));
}
lblCountNumber.Text = (deletecountProc + deletecountDocv).ToString();
totalDeleteCnt = (deletecountProc + deletecountDocv).ToString();
btnClean.Enabled = true;
} }
lblCountNumber.Text = (deletecountProc + deletecountDocv).ToString();
btnClean.Enabled = true;
} }
// Close form. // Close form.
@ -156,3 +186,5 @@ namespace VEPROMS
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ using System.IO;
using Volian.Controls.Library; using Volian.Controls.Library;
using DevComponents.DotNetBar; using DevComponents.DotNetBar;
using JR.Utils.GUI.Forms; using JR.Utils.GUI.Forms;
using Volian.Controls.Library;
namespace VEPROMS namespace VEPROMS
{ {
@ -24,11 +25,17 @@ namespace VEPROMS
private bool IsAdministratorUser = false; //C2020-035 used to control what Set Amins can do private bool IsAdministratorUser = false; //C2020-035 used to control what Set Amins can do
// C2017-030 - new Admin Tools user interface // C2017-030 - new Admin Tools user interface
// pass in session info to constructor // pass in session info to constructor
public frmBatchRefresh(SessionInfo sessionInfo)
private frmVEPROMS _veProms;
public frmBatchRefresh(SessionInfo sessionInfo, frmVEPROMS veProms)
{ {
InitializeComponent(); InitializeComponent();
_MySessionInfo = sessionInfo; _MySessionInfo = sessionInfo;
_veProms = veProms;
// When opening Admin tools Check tab will be default. // When opening Admin tools Check tab will be default.
this.sideNavItmCheck.Checked = true; this.sideNavItmCheck.Checked = true;
@ -36,7 +43,10 @@ namespace VEPROMS
{ {
AdminToolType = (E_AdminToolType)4; AdminToolType = (E_AdminToolType)4;
if (swDeleteFolder.Value) if (swDeleteFolder.Value)
{
ResetDelTV(true); ResetDelTV(true);
setupProgessSteps1();
}
else else
ResetDelTV(false); ResetDelTV(false);
} }
@ -61,6 +71,13 @@ namespace VEPROMS
{ {
return txtProcess; return txtProcess;
} }
// Make txtResults text box available to frmAnnotationsClean form.
internal TextBox GettxtResults()
{
return txtResults;
}
// NOTE: removed the Refresh ROs and Refresh Transitions and ROs options (now only Transitions can be refreshed) // NOTE: removed the Refresh ROs and Refresh Transitions and ROs options (now only Transitions can be refreshed)
// the Update ROs and Refresh ROs logic was merged together. The Update ROs will functionally do both // the Update ROs and Refresh ROs logic was merged together. The Update ROs will functionally do both
// also annotations will be placed on step elements that have RO changes // also annotations will be placed on step elements that have RO changes
@ -94,6 +111,8 @@ namespace VEPROMS
private Dictionary<TreeNode, ProcedureInfo> myProcedures = new Dictionary<TreeNode, ProcedureInfo>(); private Dictionary<TreeNode, ProcedureInfo> myProcedures = new Dictionary<TreeNode, ProcedureInfo>();
private Dictionary<TreeNode, DocVersionInfo> myDocVersions = new Dictionary<TreeNode, DocVersionInfo>(); private Dictionary<TreeNode, DocVersionInfo> myDocVersions = new Dictionary<TreeNode, DocVersionInfo>();
private Dictionary<TreeNode, FolderInfo> myFolders = new Dictionary<TreeNode, FolderInfo>();
private void frmBatchRefresh_Load(object sender, EventArgs e) private void frmBatchRefresh_Load(object sender, EventArgs e)
{ {
IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process. IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
@ -136,6 +155,7 @@ namespace VEPROMS
//myTreeNodePath = new List<string>(); //myTreeNodePath = new List<string>();
myTV.Nodes.Clear(); myTV.Nodes.Clear();
myDocVersions.Clear(); myDocVersions.Clear();
myFolders.Clear();
FolderInfo fi = FolderInfo.GetTop(); FolderInfo fi = FolderInfo.GetTop();
TreeNode tn = myTV.Nodes.Add(fi.Name); TreeNode tn = myTV.Nodes.Add(fi.Name);
tn.Tag = fi; tn.Tag = fi;
@ -159,44 +179,21 @@ namespace VEPROMS
if (fi.ChildFolderCount > 0) if (fi.ChildFolderCount > 0)
{ {
if (noProcs) TreeNode tn = new TreeNode(fi.Name);
{ tn.Tag = fi;
LoadBottomLevelFolders(fi, myTVdel); tn.StateImageIndex = -1; // Hide the checkbox for the root node
} LoadChildFolders(fi, tn, noProcs);
else myTVdel.Nodes.Add(tn);
{
TreeNode tn = new TreeNode(fi.Name);
tn.Tag = fi;
tn.StateImageIndex = -1; // Hide the checkbox for the root node
LoadChildFolders(fi, tn, noProcs);
myTVdel.Nodes.Add(tn);
}
} }
if (myTVdel.SelectedNode != null) if (myTVdel.SelectedNode != null)
myTVdel.SelectedNode.Expand(); myTVdel.SelectedNode.Expand();
this.Cursor = Cursors.Default;
//btnFixLinks.Enabled = false; //Expand if folders
//this.Cursor = Cursors.WaitCursor; if (noProcs)
////myTreeNodePath = new List<string>(); myTVdel.ExpandAll();
//myTVdel.Nodes.Clear();
//myDocVersions.Clear(); this.Cursor = Cursors.Default;
//FolderInfo fi = FolderInfo.GetTop();
//TreeNode tn = myTVdel.Nodes.Add(fi.Name );
//tn.Tag = fi;
//if (fi.ChildFolderCount > 0)
//{
// if (noProcs)
// {
// LoadBottomLevelFolders(fi, myTVdel);
// }
// else
// LoadChildFolders(fi, tn, noProcs);
//}
//if (myTVdel.SelectedNode != null)
// myTVdel.SelectedNode.Expand();
//this.Cursor = Cursors.Default;
} }
// B2021-060 Higher level folders where being removed from the tree even if there was a child folder that containe a working draft set // B2021-060 Higher level folders where being removed from the tree even if there was a child folder that containe a working draft set
@ -208,10 +205,13 @@ namespace VEPROMS
{ {
TreeNode tnc = tn.Nodes.Add(fic.Name); TreeNode tnc = tn.Nodes.Add(fic.Name);
tnc.Tag = fic; tnc.Tag = fic;
if (fic.ChildFolderCount > 0) if (fic.ChildFolderCount > 0)
{
if (LoadChildFolders(fic, tnc, noProcs)) if (LoadChildFolders(fic, tnc, noProcs))
loadedChildWorkingDraft = true; loadedChildWorkingDraft = true;
// B2020-114 and C2020-035 only show folders the Set Admin can access }
if (fic.FolderDocVersionCount > 0) if (fic.FolderDocVersionCount > 0)
{ {
if (!LoadDocVersions(fic, tnc, noProcs)) if (!LoadDocVersions(fic, tnc, noProcs))
@ -219,40 +219,27 @@ namespace VEPROMS
else else
loadedWorkingDraft = true; loadedWorkingDraft = true;
} }
}
if (loadedChildWorkingDraft) loadedWorkingDraft = true; // B2021-060 if child folder working draft loaded set loadedWorkingDraft
if (tn.Parent != null && !loadedWorkingDraft)
tn.Remove();
return loadedWorkingDraft;
}
/// <summary>
/// Load only bottom layer of folders into treenode.
/// </summary>
/// <param name="fi"></param>
/// <param name="tn"></param>
private void LoadBottomLevelFolders(FolderInfo fi, TreeView treeView)
{
foreach (FolderInfo fic in fi.SortedChildFolders)
{
if (fic.ChildFolderCount > 0)
{
// Recursively call for child folders
LoadBottomLevelFolders(fic, treeView);
}
else else
{ {
if (fic.Name != "PROMS") // Add the folder to the dictionary
{ if (!myFolders.ContainsKey(tnc))
myFolders.Add(tnc, fic);
// If the folder is a bottom-level folder (no child folders), add it directly to the TreeView
TreeNode tnc = treeView.Nodes.Add(fic.Name);
tnc.Tag = fic;
}
} }
} }
if (loadedChildWorkingDraft)
{
loadedWorkingDraft = true;
}
if (tn.Parent != null && !loadedWorkingDraft)
{
tn.Remove();
}
return loadedWorkingDraft;
} }
private bool LoadDocVersions(FolderInfo fic, TreeNode tnc, bool noProcs) private bool LoadDocVersions(FolderInfo fic, TreeNode tnc, bool noProcs)
{ {
bool rtnval = false; bool rtnval = false;
@ -1269,6 +1256,76 @@ namespace VEPROMS
} }
} }
} }
//After check model to select and deselect nodes on the delete and annotation tree.
private void myTV_AfterCheck_DelAnn(object sender, TreeViewEventArgs e)
{
if (e.Action != TreeViewAction.Unknown)
{
if (e.Node.Nodes.Count > 0)
{
CheckChildNodes_DelAnn(e.Node, e.Node.Checked);
}
}
if (e.Node.Checked)
{
// Ensure child nodes follow the parent node's state
CheckChildNodes_DelAnn(e.Node, e.Node.Checked);
}
else
{
// Automatically deselect parent nodes if current node is unchecked
if (swDeleteFolder.Value)
DiselectParentNodes_DelAnn(e.Node);
}
btnFixLinks.Enabled = AtLeastOneNodeChecked_DelAnn(); // Ensure button is enabled based on custom logic
}
private void DiselectParentNodes_DelAnn(TreeNode node)
{
TreeNode parent = node.Parent;
while (parent != null)
{
parent.Checked = false;
parent = parent.Parent;
}
}
private void DiselectChildNodes_DelAnn(TreeNodeCollection children)
{
foreach (TreeNode child in children)
{
child.Checked = false;
DiselectChildNodes_DelAnn(child.Nodes);
}
}
private void CheckChildNodes_DelAnn(TreeNode treeNode, bool isChecked)
{
foreach (TreeNode tn in treeNode.Nodes)
{
tn.Checked = isChecked;
if (tn.Nodes.Count > 0)
CheckChildNodes_DelAnn(tn, isChecked);
}
}
private bool AtLeastOneNodeChecked_DelAnn()
{
foreach (TreeNode node in myTV.Nodes)
{
if (node.Checked || AnyChildNodeChecked_DelAnn(node))
return true;
}
return false;
}
private bool AnyChildNodeChecked_DelAnn(TreeNode node)
{
foreach (TreeNode childNode in node.Nodes)
{
if (childNode.Checked || AnyChildNodeChecked_DelAnn(childNode))
return true;
}
return false;
}
private ProgressBarItem _ProgressBar = null; private ProgressBarItem _ProgressBar = null;
@ -1459,8 +1516,20 @@ namespace VEPROMS
break; break;
case E_AdminToolType.Delete: case E_AdminToolType.Delete:
splitContainer3.Panel2Collapsed = true; if (swDeleteFolder.Value)
progressSteps1.Visible = false; {
splitContainer3.Panel2Collapsed = false;
progressSteps1.Items.Add(siOrphDatRecs);
lblAdmToolProgressType.Text = "Deleting: ";
progressSteps1.Visible = true;
progressSteps1.Refresh();
}
else
{
lblAdmToolProgressType.Text = "";
splitContainer3.Panel2Collapsed = true;
progressSteps1.Visible = false;
}
break; break;
} }
} }
@ -1662,6 +1731,7 @@ namespace VEPROMS
//C2024-005 Delete Annotations, Delete Folders //C2024-005 Delete Annotations, Delete Folders
private void swDeleteAnnotations_ValueChanged(object sender, EventArgs e) private void swDeleteAnnotations_ValueChanged(object sender, EventArgs e)
{ {
setupProgessSteps1();
swDeleteFolder.Value = !swDeleteAnnotations.Value; swDeleteFolder.Value = !swDeleteAnnotations.Value;
if (swDeleteFolder.Value) if (swDeleteFolder.Value)
ResetDelTV(true); ResetDelTV(true);
@ -1671,6 +1741,7 @@ namespace VEPROMS
private void swDeleteFolder_ValueChanged(object sender, EventArgs e) private void swDeleteFolder_ValueChanged(object sender, EventArgs e)
{ {
setupProgessSteps1();
swDeleteAnnotations.Value = !swDeleteFolder.Value; swDeleteAnnotations.Value = !swDeleteFolder.Value;
if (swDeleteFolder.Value) if (swDeleteFolder.Value)
ResetDelTV(true); ResetDelTV(true);
@ -1684,68 +1755,105 @@ namespace VEPROMS
txtResults.Clear(); txtResults.Clear();
txtProcess.Clear(); txtProcess.Clear();
this.Cursor = Cursors.WaitCursor;
//Create checked proce and doc info lists.
List<ProcedureInfo> pil = new List<ProcedureInfo>();
List<DocVersionInfo> dvil = new List<DocVersionInfo>();
// Create a list of procedures the user selected
foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked)
pil.Add(myProcedures[tn]);
// Create a list of doc versions the user selected
foreach (TreeNode tn in myDocVersions.Keys)
if (tn.Checked)
dvil.Add(myDocVersions[tn]);
bool cancelledOut = false; // Flag to indicate if the process should be cancelled
StringBuilder sbDocVersions = new StringBuilder();
foreach (DocVersionInfo dq in dvil)
{
string msg = string.Empty;
if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg))
{
string msgp = string.Empty;
foreach (ProcedureInfo pi in dq.Procedures)
{
if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref msgp))
{
FolderInfo fi = (FolderInfo)dq.ActiveParent;
int itemID = (int)fi.FolderID;
string folderName = fi.Name;
if (swDeleteFolder.Value)
sbDocVersions.AppendLine($"{folderName} - {msgp}");
else
sbDocVersions.AppendLine(msgp);
cancelledOut = true;
}
}
}
}
if (cancelledOut)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The batch update process was not successful for all working drafts selected.");
sb.AppendLine("The following procedures are currently checked out...");
sb.AppendLine();
sb.AppendLine(sbDocVersions.ToString());
sb.AppendLine();
if (swDeleteFolder.Value)
sb.AppendLine("If you want to delete these folders, please contact the respective users and have them close any procedures in the working draft.");
else
sb.AppendLine("If you want to delete annotations from these working drafts, please contact the respective users and have them close any procedures in the working draft.");
sb.AppendLine();
txtProcess.AppendText(sb.ToString());
this.Cursor = Cursors.Default;
return;
}
if (swDeleteFolder.Value) if (swDeleteFolder.Value)
{ {
//TODO process deletions of folders if (FlexibleMessageBox.Show(this, "Are you sure you want to remove the selected folders and their contents?", "Confirm Folder Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
txtProcess.AppendText("Deleting Folders..."); {
txtProcess.AppendText("Deleting Folders...");
//List<ProcedureInfo> pil = new List<ProcedureInfo>(); //Load Selected Folders
//foreach (TreeNode tn in myProcedures.Keys) List<FolderInfo> ef = new List<FolderInfo>();
// if (tn.Checked) foreach (TreeNode tn in myFolders.Keys)
// pil.Add(myProcedures[tn]);
////Load Selected Folders if (tn.Checked)
Dictionary<int, string> folderData = new Dictionary<int, string>(); ef.Add(myFolders[tn]);
//List<FolderInfo> Flist = new List<FolderInfo>(); ProcessDelete(dvil, ef);
//foreach (TreeNode tn in myDocVersions.Keys) }
// if (tn.Checked)
// Flist.Add();
//List<DocVersionInfo> dvil = new List<DocVersionInfo>();
//foreach (TreeNode tn in myDocVersions.Keys)
// if (tn.Checked)
// dvil.Add(myDocVersions[tn]);
//foreach (TreeNode tn in myTVdel.Nodes)
//{
// if (tn.Checked)
// {
// var itemInfo = myProcedures[tn];
// folderData.Add(itemInfo.ItemID, itemInfo.DisplayText);
// }
//}
//ProcessDelete(dvil);
} }
else else
{ {
// Write progress status // Write progress status
txtProcess.AppendText("Deleting Annotations..."); txtProcess.AppendText("Deleting Annotations...");
// Create a list of procedures the user selected
List<ProcedureInfo> pil = new List<ProcedureInfo>();
foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked)
pil.Add(myProcedures[tn]);
// Create a list of doc versions the user selected
List<DocVersionInfo> dvil = new List<DocVersionInfo>();
foreach (TreeNode tn in myDocVersions.Keys)
if (tn.Checked)
dvil.Add(myDocVersions[tn]);
frmAnnotationsCleanup frmAnnoDel = new frmAnnotationsCleanup(this, pil, dvil); frmAnnotationsCleanup frmAnnoDel = new frmAnnotationsCleanup(this, pil, dvil);
frmAnnoDel.ShowDialog(); frmAnnoDel.ShowDialog();
} }
this.Cursor = Cursors.Default;
} }
private void ProcessDelete(List<DocVersionInfo> foldersToDelete) private void ProcessDelete(List<DocVersionInfo> foldersToDelete, List<FolderInfo> emptyFoldersToDelete)
{ {
int foldersDeleted = 0;
DateTime pStart = DateTime.Now; DateTime pStart = DateTime.Now;
txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm")); txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
@ -1753,17 +1861,19 @@ namespace VEPROMS
foreach (var kvp in foldersToDelete) foreach (var kvp in foldersToDelete)
{ {
int itemID = (int)kvp.ItemID; //Gather folder information
string folderName = kvp.Name; FolderInfo fi = (FolderInfo)kvp.ActiveParent;
int itemID = (int)fi.FolderID;
string folderName = fi.Name;
// Perform the deletion operation // Perform the deletion operation
// Assume DeleteFolderByID is a method that deletes the folder by its ItemID
bool deletionSuccessful = DeleteFolderByID(itemID); bool deletionSuccessful = DeleteFolderByID(itemID);
// Update txtProcess with the progress // Update txtProcess with the progress
if (deletionSuccessful) if (deletionSuccessful)
{ {
txtProcess.AppendText($"Successfully deleted folder: {folderName} (ID: {itemID})"); txtProcess.AppendText($"Successfully deleted folder: {folderName} (ID: {itemID})");
foldersDeleted += 1;
} }
else else
{ {
@ -1771,13 +1881,69 @@ namespace VEPROMS
} }
txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(Environment.NewLine);
} }
//Delete non working info folders.
foreach (var kvp in emptyFoldersToDelete)
{
//Gather folder information
FolderInfo fi = (FolderInfo)kvp;
int itemID = (int)fi.FolderID;
string folderName = fi.Name;
// Perform the deletion operation
bool deletionSuccessful = DeleteFolderByID(itemID);
// Update txtProcess with the progress
if (deletionSuccessful)
{
txtProcess.AppendText($"Successfully deleted folder: {folderName} (ID: {itemID})");
foldersDeleted += 1;
}
else
{
txtProcess.AppendText($"Failed to delete folder: {folderName} (ID: {itemID})");
}
txtProcess.AppendText(Environment.NewLine);
}
//Run Repair
int prgStpIdx = -1;
StepProgress(++prgStpIdx, 50);
PurgeDisconnectedItems(); // Orphan Items
StepProgress(prgStpIdx, 100);
//rebuild
ResetDelTV(true);
MessageBox.Show($"Folder deletion completed, {foldersDeleted} folders have been deleted.", "Delete Folders");
ClearStepProgress();
txtResults.AppendText($"Folder deletion process completed, {foldersDeleted} folders have been deleted.");
txtResults.AppendText(Environment.NewLine);
} }
// Example deletion method
private bool DeleteFolderByID(int itemID) private bool DeleteFolderByID(int folderID)
{ {
// Implement your folder deletion logic here try
// Return true if deletion was successful, false otherwise {
return true; // Placeholder //Delete
Folder.DeleteFolderAdmin(folderID);
//update treeview UI via veProms
_veProms.tv_FolderDelete(folderID);
return true;
}
catch (Exception ex)
{
string err = ex.ToString();
return false;
}
} }
public List<ProcedureInfo> RetrieveChkAnnotations() public List<ProcedureInfo> RetrieveChkAnnotations()
@ -1792,3 +1958,5 @@ namespace VEPROMS
} }

View File

@ -121,9 +121,7 @@
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<data name="swDeleteFolder.SuperTooltip" xml:space="preserve"> <data name="swDeleteFolder.SuperTooltip" xml:space="preserve">
<value>This allows the user to check referenced objects links in procedure step data for multiple working drafts in a batch mode. <value>This allows the user to remove folders and sub folders as well as their contents.
Bad referenced bject links will be identified with an Bad RO Link annotation. Use the PROMS Search tool to list all of the steps that have this annotation.
Be sure a current backup of the database exists prior performing this function. Be sure a current backup of the database exists prior performing this function.
@ -132,28 +130,34 @@ It is recommended that this be done during off hours.
</value> </value>
</data> </data>
<data name="labelX13.SuperTooltip" xml:space="preserve"> <data name="labelX13.SuperTooltip" xml:space="preserve">
<value>This allows the user to check referenced objects links in procedure step data for multiple working drafts in a batch mode. <value>This allows the user to remove folders and sub folders as well as their contents.
Bad referenced bject links will be identified with an Bad RO Link annotation. Use the PROMS Search tool to list all of the steps that have this annotation.
Be sure a current backup of the database exists prior performing this function. Be sure a current backup of the database exists prior performing this function.
It is recommended that this be done during off hours. It is recommended that this be done during off hours.
</value> </value>
</data> </data>
<data name="swDeleteAnnotations.SuperTooltip" xml:space="preserve"> <data name="swDeleteAnnotations.SuperTooltip" xml:space="preserve">
<value>This function will refresh transitions in all procedures selected below, whether they were selected individually or as a group via a procedure set. <value>This function will allow the user to remove annotations from the selected working drafts.
Be sure a current backup of the database exists prior to running this function. Be sure a current backup of the database exists prior to running this function.
If more than one procedure is selected, it is recommended that this be performed during off hours.</value> If more than one working draft is selected, it is recommended that this be performed during off hours.</value>
</data> </data>
<data name="labelX14.SuperTooltip" xml:space="preserve"> <data name="labelX14.SuperTooltip" xml:space="preserve">
<value>This function will refresh transitions in all procedures selected below, whether they were selected individually or as a group via a procedure set. <value>This function will allow the user to remove annotations from the selected working drafts.
Be sure a current backup of the database exists prior to running this function. Be sure a current backup of the database exists prior to running this function.
If more than one procedure is selected, it is recommended that this be performed during off hours.</value> If more than one working draft is selected, it is recommended that this be performed during off hours.</value>
</data>
<data name="btnDeleteItems.SuperTooltip" xml:space="preserve">
<value>This will allow for the deletion of groups of annotations and allow for deleting entire folders within PROMS. Use the tree nodes to select which items to delete.
Click on the on/off switches to turn on/off each tool.
Note that only one of these tools can be run at a time.</value>
</data> </data>
<data name="swCheckROLinks.SuperTooltip" xml:space="preserve"> <data name="swCheckROLinks.SuperTooltip" xml:space="preserve">
<value>This allows the user to check referenced objects links in procedure step data for multiple working drafts in a batch mode. <value>This allows the user to check referenced objects links in procedure step data for multiple working drafts in a batch mode.

View File

@ -254,6 +254,21 @@ namespace VEPROMS
tc.RefreshItem(myItemInfo); tc.RefreshItem(myItemInfo);
} }
public void tv_FolderDelete(int folderId)
{
// Create an instance of the event args if needed
var args = new vlnTreeFolderDeleteEventArgs(folderId);
// Trigger the deletion using the event arguments
tv.RemoveFolder(args.FolderId);
}
private bool Tv_DeleteFolder(object sender, vlnTreeFolderDeleteEventArgs args)
{
tv.RemoveFolder(args.FolderId);
return true;
}
private E_UCFImportOptions _UCFImportOptionsFromSettings; private E_UCFImportOptions _UCFImportOptionsFromSettings;
public frmVEPROMS() public frmVEPROMS()
@ -474,6 +489,7 @@ namespace VEPROMS
tv.NodeNew += new vlnTreeViewEvent(tv_NodeNew); tv.NodeNew += new vlnTreeViewEvent(tv_NodeNew);
tv.OpenItem += new vlnTreeViewItemInfoEvent(tv_OpenItem); tv.OpenItem += new vlnTreeViewItemInfoEvent(tv_OpenItem);
tv.TabDisplay += new StepPanelTabDisplayEvent(tc_PanelTabDisplay); tv.TabDisplay += new StepPanelTabDisplayEvent(tc_PanelTabDisplay);
tv.DeleteFolder += new vlnTreeViewItemInfoDeleteFolderEvent(Tv_DeleteFolder);
tv.DeleteItemInfo += new vlnTreeViewItemInfoDeleteEvent(tv_DeleteItemInfo); tv.DeleteItemInfo += new vlnTreeViewItemInfoDeleteEvent(tv_DeleteItemInfo);
tv.InsertItemInfo += new vlnTreeViewItemInfoInsertEvent(tv_InsertItemInfo); tv.InsertItemInfo += new vlnTreeViewItemInfoInsertEvent(tv_InsertItemInfo);
tv.NodeInsert += new vlnTreeViewEvent(tv_NodeInsert); tv.NodeInsert += new vlnTreeViewEvent(tv_NodeInsert);
@ -2741,7 +2757,7 @@ namespace VEPROMS
void btnAdministrativeTools_Click(object sender, EventArgs e) void btnAdministrativeTools_Click(object sender, EventArgs e)
{ {
frmBatchRefresh frm = new frmBatchRefresh(MySessionInfo); frmBatchRefresh frm = new frmBatchRefresh(MySessionInfo, this);
frm.ProgressBar = bottomProgBar; frm.ProgressBar = bottomProgBar;
frm.ShowDialog(this); frm.ShowDialog(this);
} }

View File

@ -951,7 +951,10 @@ namespace VEPROMS.CSLA.Library
// it is pasted into a section without enhanced data, then clear it. // it is pasted into a section without enhanced data, then clear it.
// config data can only be on hls/notes/cautions for pasted steps. // config data can only be on hls/notes/cautions for pasted steps.
if (!pasteItem.IsHigh && !pasteItem.IsCaution && !pasteItem.IsNote) return; // B2024-059: clear links on a source section. When a paste occurs, the section is copied with the links but not
// new section is created in the enhanced document, so the links point to the original section (copied). These
// need to be removed.
if (!pasteItem.IsHigh && !pasteItem.IsCaution && !pasteItem.IsNote && !pasteItem.IsSection) return;
// See if the pasted step's section is enhanced with enhanced steps, and if not, clear it // See if the pasted step's section is enhanced with enhanced steps, and if not, clear it
// Also, if pasting into a source section, don't clear (B2017-225), the 'isSourceSection' portion of the code. // Also, if pasting into a source section, don't clear (B2017-225), the 'isSourceSection' portion of the code.
@ -974,6 +977,12 @@ namespace VEPROMS.CSLA.Library
// of the pasted step. // of the pasted step.
if (pasteItem.HasEnhancedLinkedStep) pasteItem.RemoveEnhancedFromConfig(); if (pasteItem.HasEnhancedLinkedStep) pasteItem.RemoveEnhancedFromConfig();
} }
// B2024-059: clear links on a source section
if (isSourceSection)
{
EnhancedDocuments seleds = pasteItem.GetMyEnhancedDocuments();
foreach (EnhancedDocument ed in seleds) pasteItem.DoUnlinkEnhanced(pasteItem, ed.Type, true);
}
} }
#endregion #endregion
#region Insert Child #region Insert Child
@ -1309,8 +1318,7 @@ namespace VEPROMS.CSLA.Library
else if (addType == EAddpingPart.Replace) // what about user interface for enhanced pasted steps? else if (addType == EAddpingPart.Replace) // what about user interface for enhanced pasted steps?
{ {
ItemInfo enhReplaceItem = ItemInfo.Get(edSource.ItemID); ItemInfo enhReplaceItem = ItemInfo.Get(edSource.ItemID);
TreeNode trn = null; newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid);
newEnhancedItemInfo = Item.PasteReplace(enhReplaceItem, tmpCopyEnhancedID, chgid, trn);
} }
// update the config data for the new enhanced item (procedure, section or step) to point back to the correct source // update the config data for the new enhanced item (procedure, section or step) to point back to the correct source
@ -2498,16 +2506,15 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
#region PasteReplace #region PasteReplace
// B2024-045, 049 and 050: remove the treenode that was passed in - adjust tree from user interface code, not in item extension
// code (the 2 PasteReplace methods here had a treenode passed in)
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid)
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace)
{ {
bool tmp = false; bool tmp = false;
return PasteReplace(itemInfo, copyStartID, chgid, treeNodeReplace, ref tmp); return PasteReplace(itemInfo, copyStartID, chgid, ref tmp);
} }
// B2017-179 return a bool (firstTrans) if we could not replace the step but the user wants to position to the first transition that needs resolved // B2017-179 return a bool (firstTrans) if we could not replace the step but the user wants to position to the first transition that needs resolved
public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, TreeNode treeNodeReplace, ref bool firstTrans) public static ItemInfo PasteReplace(ItemInfo itemInfo, int copyStartID, string chgid, ref bool firstTrans)
{ {
firstTrans = false; firstTrans = false;
if (!CanDeleteObject()) if (!CanDeleteObject())
@ -2565,10 +2572,11 @@ namespace VEPROMS.CSLA.Library
} }
else else
{ {
//Create tree node for copied procedure when no other procedures exist in the working draft (treeNodeReplace) // B2024-045, 049 and 050: if not a single procedure replace, update user interface by using the 'OnNewChild'. Single
VETreeNode tn = null; // procedure's MyParent is null because its parent is a working draft (docversion) since MyParent's type is iteminfo.
tn = new VETreeNode(newItemInfo); // For the single procedure case, the user interface code in vlntreeview will update the tree.
treeNodeReplace.Nodes.Add(tn); if (newItemInfo.MyParent != null)
newItemInfo.MyParent.OnNewChild(new ItemInfoInsertEventArgs(newItemInfo, ItemInfo.EAddpingPart.Child));
} }
return newItemInfo; return newItemInfo;
} }

View File

@ -1107,7 +1107,7 @@ namespace VEPROMS.CSLA.Library
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in this.UserMemberships)
{ {
if (mi.EndDate == string.Empty) if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
foreach (AssignmentInfo ai in mi.MyGroup.GroupAssignments) foreach (AssignmentInfo ai in mi.MyGroup.GroupAssignments)
{ {
@ -1129,7 +1129,7 @@ namespace VEPROMS.CSLA.Library
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in this.UserMemberships)
{ {
if (mi.EndDate == string.Empty) if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
Dictionary<int, int> folders = new Dictionary<int, int>(); Dictionary<int, int> folders = new Dictionary<int, int>();
//FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID); //FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID);
@ -1157,7 +1157,7 @@ namespace VEPROMS.CSLA.Library
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in this.UserMemberships)
{ {
if (mi.EndDate == string.Empty) if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
Dictionary<int, int> folders = new Dictionary<int, int>(); Dictionary<int, int> folders = new Dictionary<int, int>();
FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID); FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID);
@ -1184,7 +1184,7 @@ namespace VEPROMS.CSLA.Library
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in this.UserMemberships)
{ {
if (mi.EndDate == string.Empty) if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
Dictionary<int, int> folders = new Dictionary<int, int>(); Dictionary<int, int> folders = new Dictionary<int, int>();
FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID); FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID);
@ -1211,7 +1211,7 @@ namespace VEPROMS.CSLA.Library
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in this.UserMemberships)
{ {
if (mi.EndDate == string.Empty) if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
Dictionary<int, int> folders = new Dictionary<int, int>(); Dictionary<int, int> folders = new Dictionary<int, int>();
FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID); FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID);
@ -1238,7 +1238,7 @@ namespace VEPROMS.CSLA.Library
foreach (MembershipInfo mi in this.UserMemberships) foreach (MembershipInfo mi in this.UserMemberships)
{ {
if (mi.EndDate == string.Empty) if (mi.EndDate == string.Empty && mi.MyGroup.GroupAssignments != null) //B2024-051 added null check - user assigned to non-existing procedure set
{ {
Dictionary<int, int> folders = new Dictionary<int, int>(); Dictionary<int, int> folders = new Dictionary<int, int>();
FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID); FolderInfo fi = FolderInfo.Get(dv.MyFolder.FolderID);

View File

@ -1433,6 +1433,31 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Folder.Remove", ex); throw new DbCslaException("Folder.Remove", ex);
} }
} }
[Transactional(TransactionalTypes.TransactionScope)]
public static void DeleteFolderAdmin(int folderID)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.Remove", 0);
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandTimeout = Database.SQLTimeout;
cm.CommandText = "deleteFolderAdmin";
cm.Parameters.AddWithValue("@FolderID", folderID);
cm.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.Remove", ex);
throw new DbCslaException("Folder.Remove", ex);
}
}
#endregion #endregion
#region Exists #region Exists
public static bool Exists(int folderID) public static bool Exists(int folderID)

View File

@ -672,8 +672,10 @@ namespace Volian.Controls.Library
if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace
{ {
DisplayTabItem pg = _MyDisplayTabItems[key]; DisplayTabItem pg = _MyDisplayTabItems[key];
// B2024-038: if section, refresh the editor even if the section is not expanded.
bool isSec = myItemInfo.IsSection;
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID) && if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID) &&
pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID].Expanded) (pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID].Expanded || isSec))
{ {
EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID]; EditItem edtitm = pg.MyStepTabPanel.MyStepPanel._LookupEditItems[myItemInfo.ItemID];
switch (pasteType) switch (pasteType)
@ -710,7 +712,8 @@ namespace Volian.Controls.Library
} }
else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace) else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace)
{ {
CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab. // B2024-038: changed tab key to procedure (was item, which caused crash if section)
CloseTabItem(_MyDisplayTabItems["Item - " + proc.ItemID.ToString()]); //Grab itemID and set to close open tab.
return false; //B2017-179 PasteReplace will return null if was aborted return false; //B2017-179 PasteReplace will return null if was aborted
} }
return false; return false;

View File

@ -1844,8 +1844,8 @@ namespace Volian.Controls.Library
bool gotoFirstTrans = false; bool gotoFirstTrans = false;
try try
{ {
TreeNode treeNodeReplace = null; // B2024-045, 049 and 050: do not pass in a tree node to Item.PasteReplace
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), treeNodeReplace, ref gotoFirstTrans); newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), ref gotoFirstTrans);
if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved
{ {
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo); MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo);

View File

@ -1,36 +1,36 @@
namespace Volian.Controls.Library namespace Volian.Controls.Library
{ {
partial class vlnTreeView partial class vlnTreeView
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected void Dispose(bool disposing) protected void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Component Designer generated code #region Component Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
} }
#endregion #endregion
} }
} }

View File

@ -26,7 +26,9 @@ namespace Volian.Controls.Library
public delegate void vlnTreeViewItemInfoEvent(object sender, vlnTreeItemInfoEventArgs args); public delegate void vlnTreeViewItemInfoEvent(object sender, vlnTreeItemInfoEventArgs args);
public delegate bool vlnTreeViewBoolEvent(object sender, vlnTreeEventArgs args); public delegate bool vlnTreeViewBoolEvent(object sender, vlnTreeEventArgs args);
public delegate bool vlnTreeViewItemInfoDeleteEvent(object sender, vlnTreeItemInfoEventArgs args); public delegate bool vlnTreeViewItemInfoDeleteEvent(object sender, vlnTreeItemInfoEventArgs args);
public delegate bool vlnTreeViewItemInfoInsertEvent(object sender, vlnTreeItemInfoInsertEventArgs args); public delegate bool vlnTreeViewItemInfoInsertEvent(object sender, vlnTreeItemInfoInsertEventArgs args);
public delegate bool vlnTreeViewItemInfoDeleteFolderEvent(object sender, vlnTreeFolderDeleteEventArgs args);
public delegate bool vlnTreeViewItemInfoPasteEvent(object sender, vlnTreeItemInfoPasteEventArgs args); public delegate bool vlnTreeViewItemInfoPasteEvent(object sender, vlnTreeItemInfoPasteEventArgs args);
public delegate TreeNode vlnTreeViewTreeNodeEvent(object sender, vlnTreeEventArgs args); public delegate TreeNode vlnTreeViewTreeNodeEvent(object sender, vlnTreeEventArgs args);
public delegate DialogResult vlnTreeViewPropertyEvent(object sender, vlnTreePropertyEventArgs args); public delegate DialogResult vlnTreeViewPropertyEvent(object sender, vlnTreePropertyEventArgs args);
@ -220,6 +222,15 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
} }
public class vlnTreeFolderDeleteEventArgs : EventArgs
{
public int FolderId { get; }
public vlnTreeFolderDeleteEventArgs(int folderId)
{
FolderId = folderId;
}
}
public enum E_InsertType {Before, After, Child}; public enum E_InsertType {Before, After, Child};
public partial class vlnTreeItemInfoInsertEventArgs public partial class vlnTreeItemInfoInsertEventArgs
{ {
@ -427,6 +438,12 @@ namespace Volian.Controls.Library
if (DeleteItemInfo != null) return DeleteItemInfo(sender, args); if (DeleteItemInfo != null) return DeleteItemInfo(sender, args);
return false; return false;
} }
public event vlnTreeViewItemInfoDeleteFolderEvent DeleteFolder;
private bool OnDeleteFolder(object sender, vlnTreeFolderDeleteEventArgs args)
{
if (DeleteItemInfo != null) return DeleteFolder(sender, args);
return false;
}
public event vlnTreeViewItemInfoInsertEvent InsertItemInfo; public event vlnTreeViewItemInfoInsertEvent InsertItemInfo;
private bool OnInsertItemInfo(object sender, vlnTreeItemInfoInsertEventArgs args) private bool OnInsertItemInfo(object sender, vlnTreeItemInfoInsertEventArgs args)
{ {
@ -551,6 +568,11 @@ namespace Volian.Controls.Library
{ {
if (ProcedureCheckedOutTo != null) ProcedureCheckedOutTo(sender, args); if (ProcedureCheckedOutTo != null) ProcedureCheckedOutTo(sender, args);
} }
public event vlnTreeViewEvent ExportImportProcedureSets; public event vlnTreeViewEvent ExportImportProcedureSets;
private void OnExportImportProcedureSets(object sender, vlnTreeEventArgs args) private void OnExportImportProcedureSets(object sender, vlnTreeEventArgs args)
{ {
@ -1059,6 +1081,11 @@ namespace Volian.Controls.Library
#region Menu_Delete #region Menu_Delete
if (ok) if (ok)
{ {
// Add delete to the menu unless at the very 'top' node, on a grouping (partinfo) // Add delete to the menu unless at the very 'top' node, on a grouping (partinfo)
// node (RNOs, Steps, Cautions, Notes) or Folder/DocVersion that contains any items. // node (RNOs, Steps, Cautions, Notes) or Folder/DocVersion that contains any items.
@ -1082,6 +1109,7 @@ namespace Volian.Controls.Library
} }
} }
} }
#endregion #endregion
//_MyLog.WarnFormat("Context Menu 6 - {0}", GC.GetTotalMemory(true)); //_MyLog.WarnFormat("Context Menu 6 - {0}", GC.GetTotalMemory(true));
#region Menu_ExternalTransitions #region Menu_ExternalTransitions
@ -1712,10 +1740,13 @@ namespace Volian.Controls.Library
// 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced) // 1) 'to' & 'from' both 'non', i.e. Neither can have enhanced config data (be source or enhanced)
// can do Before/After/Replace // can do Before/After/Replace
// 2) 'to' section is 'source' and 'from' section is 'non' (has no MyEnhancedDocuments) // 2) 'to' section is 'source' and 'from' section is 'non' (has no MyEnhancedDocuments)
// can do Before/After - no links exist in pasted section. // can do Before/After - no links exist in pasted section so cannot do Replace
// cannot do Replace
// 3) 'to' section is 'source' and 'from' section is same docversion 'source' // 3) 'to' section is 'source' and 'from' section is same docversion 'source'
// can do Before/After/Replace // can do Before/After (B2024-038 removes replace)
// 4) 'to' section is not 'source' and 'from' section is source
// can do Before/After but not replace - would have to manage
// links for 'from' section (B2024-038 added this case)
SectionConfig secToCfg = iiPasteHere.MyConfig as SectionConfig; SectionConfig secToCfg = iiPasteHere.MyConfig as SectionConfig;
SectionConfig secFromCfg = iiClipboard.MyConfig as SectionConfig; SectionConfig secFromCfg = iiClipboard.MyConfig as SectionConfig;
@ -1724,13 +1755,22 @@ namespace Volian.Controls.Library
bool secFromIsEnhanced = iiClipboard.IsEnhancedSection; bool secFromIsEnhanced = iiClipboard.IsEnhancedSection;
bool secFromIsSource = secFromCfg.MyEnhancedDocuments != null && secFromCfg.MyEnhancedDocuments.Count > 0 && secFromCfg.MyEnhancedDocuments[0].Type != 0; bool secFromIsSource = secFromCfg.MyEnhancedDocuments != null && secFromCfg.MyEnhancedDocuments.Count > 0 && secFromCfg.MyEnhancedDocuments[0].Type != 0;
bool secCanPaste = false; bool secCanPaste = false;
if (!secToIsEnhanced && !secToIsSource && !secFromIsEnhanced && !secFromIsSource) secCanPaste = true; // 1) if (!secToIsEnhanced && !secToIsSource && !secFromIsEnhanced && !secFromIsSource) secCanPaste = true; // 1)
else if (secToIsSource && !secFromIsEnhanced && !secFromIsSource) // 2) else if (secToIsSource && !secFromIsEnhanced && !secFromIsSource) // 2)
{ {
secCanPaste = true; secCanPaste = true;
okToReplace = false; okToReplace = false;
} }
else if (secToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID) secCanPaste = true; // 3) else if (secToIsSource && iiPasteHere.MyDocVersion.VersionID == iiClipboard.MyDocVersion.VersionID)
{
secCanPaste = true; // 3)
okToReplace = false;
}
else if (!secToIsSource && secFromIsSource)
{
secCanPaste = true; // 4
okToReplace = false;
}
if (iiClipboard.IsRtfRaw) secCanPaste = okToReplace = false; // never paste an equation. if (iiClipboard.IsRtfRaw) secCanPaste = okToReplace = false; // never paste an equation.
if (secCanPaste) cm.MenuItems.Add("Paste Section Before", new EventHandler(mi_Click)); if (secCanPaste) cm.MenuItems.Add("Paste Section Before", new EventHandler(mi_Click));
if (okToReplace && secCanPaste) cm.MenuItems.Add("Replace Existing Section", new EventHandler(mi_Click)); if (okToReplace && secCanPaste) cm.MenuItems.Add("Replace Existing Section", new EventHandler(mi_Click));
@ -1940,6 +1980,16 @@ namespace Volian.Controls.Library
OnPrintTransitionReport(this, new vlnTreeEventArgs(SelectedNode as VETreeNode)); OnPrintTransitionReport(this, new vlnTreeEventArgs(SelectedNode as VETreeNode));
return; return;
} }
if (mi.Text == "Export Procedure Set" || mi.Text == "Export Procedure") if (mi.Text == "Export Procedure Set" || mi.Text == "Export Procedure")
{ {
OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0)); OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0));
@ -2408,7 +2458,7 @@ namespace Volian.Controls.Library
} }
} }
VETreeNode tn = SelectedNode as VETreeNode; VETreeNode tn = SelectedNode as VETreeNode;
TreeNode treeNodeReplace = SelectedNode.Parent; //Get Tree Node of Parent we are proc we are placing into.
DocVersionInfo dvi = tn.VEObject as DocVersionInfo; DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
// Check for paste into a docversion - queries/code is different than paste related to an item (into a proc or section) // Check for paste into a docversion - queries/code is different than paste related to an item (into a proc or section)
if (dvi != null) if (dvi != null)
@ -2445,11 +2495,27 @@ namespace Volian.Controls.Library
PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID); PasteBeforeOrAfter(MenuSelections.StepAfter, tn, iiClipboard.ItemID);
else if (p.IndexOf("Replace") > -1) else if (p.IndexOf("Replace") > -1)
{ {
PasteReplace(tn, iiClipboard.ItemID, treeNodeReplace); bool OnlyProc = iiPaste.IsProcedure && iiPaste.MyPrevious == null && (iiPaste.NextItems == null || iiPaste.NextItems.Count == 0);
VETreeNode tmp = null;
if (OnlyProc)
{
VETreeNode tnp = SelectedNode as VETreeNode;
tmp = tnp == null ? null : tnp.Parent as VETreeNode;
}
ItemInfo repitem = PasteReplace(tn, iiClipboard.ItemID);
// B2024-045, 049 and 050: The treenode was passed into the business object's replace but sometimes it was null. And this
// wasn't working if it was a single procedure in a working Draft. Adjust the tree here if single procedure in working draft.
if (OnlyProc && repitem != null && tmp != null)
{
VETreeNode tn1 = new VETreeNode(repitem);
tmp.Nodes.Add(tn1);
SelectedNode = tn1;
}
} }
else // paste as child else // paste as child
PasteAsChild(tn, iiClipboard.ItemID); PasteAsChild(tn, iiClipboard.ItemID);
//if (p.IndexOf("Replace") <= -1) //if (p.IndexOf("Replace") <= -1)
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
} }
@ -2541,18 +2607,19 @@ namespace Volian.Controls.Library
} }
SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode); SelectedNode = (VETreeNode)((newtype == MenuSelections.StepAfter) ? tn.NextNode : tn.PrevNode);
} }
private void PasteReplace(VETreeNode tn, int copyStartID, TreeNode treeNodeReplace) private ItemInfo PasteReplace(VETreeNode tn, int copyStartID)
{ {
VETreeNode prevtn = (VETreeNode) tn.PrevNode; VETreeNode prevtn = (VETreeNode) tn.PrevNode;
VETreeNode partn = (VETreeNode) tn.Parent; VETreeNode partn = (VETreeNode) tn.Parent;
ItemInfo ii = tn.VEObject as ItemInfo; ItemInfo ii = tn.VEObject as ItemInfo;
// F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format // F2021-009 display a message if pasting step will results in more sub-step levels than are defined in the format
ItemInfo.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, true); ItemInfo.PasteStepIsWithinDefinedSubStepLevels(copyStartID, ii, true);
ItemInfo replItemInfo = null;
if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type))) if (!OnPasteItemInfo(this, new vlnTreeItemInfoPasteEventArgs(ii, copyStartID, ItemInfo.EAddpingPart.Replace, ii.MyContent.Type)))
{ {
// first, check if a changeid is required. // first, check if a changeid is required.
string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii)); string chgId = OnGetChangeId(this, new vlnTreeItemInfoEventArgs(ii));
ItemInfo replItemInfo = Item.PasteReplace(ii, copyStartID, chgId, treeNodeReplace); replItemInfo = Item.PasteReplace(ii, copyStartID, chgId);
StepConfig replItemConfig = ii.MyConfig as StepConfig; StepConfig replItemConfig = ii.MyConfig as StepConfig;
if (replItemInfo != null) if (replItemInfo != null)
@ -2562,8 +2629,8 @@ namespace Volian.Controls.Library
} }
// B2018-047: was crashing on the following line (before change it was casting the result to a VETreeNote when the partn.FirstNode was just a TreeNode) // B2018-047: was crashing on the following line (before change it was casting the result to a VETreeNote when the partn.FirstNode was just a TreeNode)
SelectedNode = prevtn != null ? prevtn.NextNode : partn.FirstNode; SelectedNode = prevtn != null ? prevtn.NextNode : partn.FirstNode;
return replItemInfo;
} }
public void PasteRepalceEmpty(VETreeNode tn, int copyStartID) public void PasteRepalceEmpty(VETreeNode tn, int copyStartID)
{ {
@ -3567,6 +3634,41 @@ namespace Volian.Controls.Library
} }
return false; return false;
} }
public void RemoveFolder(int folderId)
{
TreeNode nodeToRemove = FindNodeById(folderId, this.Nodes);
if (nodeToRemove != null)
{
// Perform the removal logic
nodeToRemove.Remove(); // This removes the node from its parent
}
}
private TreeNode FindNodeById(int folderId, TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
VETreeNode vetNode = node as VETreeNode;
if (vetNode != null)
{
FolderInfo folderInfo = vetNode.VEObject as FolderInfo;
if (folderInfo != null && folderInfo.FolderID == folderId)
{
return node;
}
else
{
TreeNode foundNode = FindNodeById(folderId, node.Nodes);
if (foundNode != null)
{
return foundNode;
}
}
}
}
return null;
}
private bool DeleteItemInfoAndChildren(ItemInfo ii) private bool DeleteItemInfoAndChildren(ItemInfo ii)
{ {
DateTime dtStart = DateTime.Now; DateTime dtStart = DateTime.Now;