C2024-005 - Completed some updates for nested folder selection (parent unselect)

This commit is contained in:
Kevin Laskey 2024-08-01 09:23:30 -04:00
parent da1b061eb1
commit a8bbda1281
3 changed files with 216 additions and 87 deletions

View File

@ -350,7 +350,7 @@
this.pnlLater.Controls.Add(this.dtpDate);
this.pnlLater.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlLater.Enabled = false;
this.pnlLater.Location = new System.Drawing.Point(6, 27);
this.pnlLater.Location = new System.Drawing.Point(6, 23);
this.pnlLater.Name = "pnlLater";
this.pnlLater.Padding = new System.Windows.Forms.Padding(6);
this.pnlLater.Size = new System.Drawing.Size(279, 37);
@ -391,7 +391,7 @@
this.chkLater.Dock = System.Windows.Forms.DockStyle.Top;
this.chkLater.Location = new System.Drawing.Point(6, 6);
this.chkLater.Name = "chkLater";
this.chkLater.Size = new System.Drawing.Size(279, 21);
this.chkLater.Size = new System.Drawing.Size(279, 17);
this.chkLater.TabIndex = 4;
this.chkLater.Text = "Process Later";
this.chkLater.UseVisualStyleBackColor = true;
@ -464,8 +464,8 @@
// sideNav1
//
this.sideNav1.BackColor = System.Drawing.SystemColors.Control;
this.sideNav1.Controls.Add(this.sideNavPanel4);
this.sideNav1.Controls.Add(this.sideNavPanel1);
this.sideNav1.Controls.Add(this.sideNavPanel4);
this.sideNav1.Controls.Add(this.sideNavPanel2);
this.sideNav1.Controls.Add(this.sideNavPanel3);
this.sideNav1.Dock = System.Windows.Forms.DockStyle.Fill;
@ -496,10 +496,11 @@
this.sideNavPanel4.Controls.Add(this.myTVdel);
this.sideNavPanel4.Controls.Add(this.btnDeleteItems);
this.sideNavPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.sideNavPanel4.Location = new System.Drawing.Point(102, 39);
this.sideNavPanel4.Location = new System.Drawing.Point(89, 31);
this.sideNavPanel4.Name = "sideNavPanel4";
this.sideNavPanel4.Size = new System.Drawing.Size(278, 486);
this.sideNavPanel4.Size = new System.Drawing.Size(291, 494);
this.sideNavPanel4.TabIndex = 27;
this.sideNavPanel4.Visible = false;
//
// swDeleteFolder
//
@ -571,8 +572,9 @@
this.myTVdel.CheckBoxes = true;
this.myTVdel.Location = new System.Drawing.Point(14, 145);
this.myTVdel.Name = "myTVdel";
this.myTVdel.Size = new System.Drawing.Size(254, 323);
this.myTVdel.Size = new System.Drawing.Size(267, 331);
this.myTVdel.TabIndex = 34;
this.myTVdel.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.myTV_AfterCheck_DelAnn);
//
// btnDeleteItems
//
@ -607,7 +609,6 @@
this.sideNavPanel1.Name = "sideNavPanel1";
this.sideNavPanel1.Size = new System.Drawing.Size(291, 494);
this.sideNavPanel1.TabIndex = 2;
this.sideNavPanel1.Visible = false;
//
// warningBox3
//
@ -615,7 +616,7 @@
this.warningBox3.CloseButtonVisible = false;
this.warningBox3.Image = ((System.Drawing.Image)(resources.GetObject("warningBox3.Image")));
this.warningBox3.Location = new System.Drawing.Point(17, 207);
this.warningBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.warningBox3.Margin = new System.Windows.Forms.Padding(4);
this.warningBox3.Name = "warningBox3";
this.warningBox3.OptionsButtonVisible = false;
this.warningBox3.Size = new System.Drawing.Size(264, 32);
@ -819,7 +820,7 @@
this.warningBox4.CloseButtonVisible = false;
this.warningBox4.Image = ((System.Drawing.Image)(resources.GetObject("warningBox4.Image")));
this.warningBox4.Location = new System.Drawing.Point(12, 264);
this.warningBox4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.warningBox4.Margin = new System.Windows.Forms.Padding(4);
this.warningBox4.Name = "warningBox4";
this.warningBox4.OptionsButtonVisible = false;
this.warningBox4.Size = new System.Drawing.Size(264, 32);
@ -832,7 +833,7 @@
this.warningBox2.CloseButtonVisible = false;
this.warningBox2.Image = ((System.Drawing.Image)(resources.GetObject("warningBox2.Image")));
this.warningBox2.Location = new System.Drawing.Point(12, 302);
this.warningBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.warningBox2.Margin = new System.Windows.Forms.Padding(4);
this.warningBox2.Name = "warningBox2";
this.warningBox2.OptionsButtonVisible = false;
this.warningBox2.Size = new System.Drawing.Size(264, 43);
@ -1063,7 +1064,7 @@
this.warningBox5.CloseButtonVisible = false;
this.warningBox5.Image = ((System.Drawing.Image)(resources.GetObject("warningBox5.Image")));
this.warningBox5.Location = new System.Drawing.Point(17, 145);
this.warningBox5.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.warningBox5.Margin = new System.Windows.Forms.Padding(4);
this.warningBox5.Name = "warningBox5";
this.warningBox5.OptionsButtonVisible = false;
this.warningBox5.Size = new System.Drawing.Size(262, 32);
@ -1147,7 +1148,7 @@
this.warningBox1.CloseButtonVisible = false;
this.warningBox1.Image = ((System.Drawing.Image)(resources.GetObject("warningBox1.Image")));
this.warningBox1.Location = new System.Drawing.Point(17, 181);
this.warningBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.warningBox1.Margin = new System.Windows.Forms.Padding(4);
this.warningBox1.Name = "warningBox1";
this.warningBox1.OptionsButtonVisible = false;
this.warningBox1.Size = new System.Drawing.Size(262, 43);
@ -1190,6 +1191,7 @@
//
// sideNavItmCheck
//
this.sideNavItmCheck.Checked = true;
this.sideNavItmCheck.Name = "sideNavItmCheck";
this.sideNavItmCheck.Panel = this.sideNavPanel1;
this.sideNavItmCheck.Symbol = "";
@ -1228,7 +1230,6 @@
//
// sideNavItmDelete
//
this.sideNavItmDelete.Checked = true;
this.sideNavItmDelete.Name = "sideNavItmDelete";
this.sideNavItmDelete.Panel = this.sideNavPanel4;
this.sideNavItmDelete.Symbol = "";
@ -1280,7 +1281,7 @@
this.stepItem3,
this.stepItem4});
this.progressSteps1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
this.progressSteps1.Location = new System.Drawing.Point(123, 18);
this.progressSteps1.Location = new System.Drawing.Point(123, 13);
this.progressSteps1.Name = "progressSteps1";
this.progressSteps1.Size = new System.Drawing.Size(1032, 26);
this.progressSteps1.TabIndex = 18;

View File

@ -98,6 +98,7 @@ namespace VEPROMS
private Dictionary<TreeNode, ProcedureInfo> myProcedures = new Dictionary<TreeNode, ProcedureInfo>();
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)
{
IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
@ -140,6 +141,8 @@ namespace VEPROMS
//myTreeNodePath = new List<string>();
myTV.Nodes.Clear();
myDocVersions.Clear();
myFolders.Clear();
FolderInfo fi = FolderInfo.GetTop();
TreeNode tn = myTV.Nodes.Add(fi.Name);
tn.Tag = fi;
@ -172,6 +175,11 @@ namespace VEPROMS
if (myTVdel.SelectedNode != null)
myTVdel.SelectedNode.Expand();
//Expand if folders
if (noProcs)
myTVdel.ExpandAll();
this.Cursor = Cursors.Default;
}
@ -179,26 +187,52 @@ namespace VEPROMS
private bool LoadChildFolders(FolderInfo fi, TreeNode tn, bool noProcs)
{
bool loadedWorkingDraft = false;
bool loadedChildWorkingDraft = false; // B2021-060 flag when child folder working draft is loaded
bool loadedChildWorkingDraft = false;
foreach (FolderInfo fic in fi.SortedChildFolders)
{
TreeNode tnc = tn.Nodes.Add(fic.Name);
tnc.Tag = fic;
if (fic.ChildFolderCount > 0)
{
if (LoadChildFolders(fic, tnc, noProcs))
{
loadedChildWorkingDraft = true;
// B2020-114 and C2020-035 only show folders the Set Admin can access
}
}
if (fic.FolderDocVersionCount > 0)
{
if (!LoadDocVersions(fic, tnc, noProcs))
{
tnc.Remove();
}
else
{
loadedWorkingDraft = true;
}
}
else
{
// Add the folder to the dictionary
if (!myFolders.ContainsKey(tnc))
{
myFolders.Add(tnc, fic);
}
}
}
if (loadedChildWorkingDraft) loadedWorkingDraft = true; // B2021-060 if child folder working draft loaded set loadedWorkingDraft
if (loadedChildWorkingDraft)
{
loadedWorkingDraft = true;
}
if (tn.Parent != null && !loadedWorkingDraft)
{
tn.Remove();
}
return loadedWorkingDraft;
}
private bool LoadDocVersions(FolderInfo fic, TreeNode tnc, bool noProcs)
@ -1178,12 +1212,10 @@ namespace VEPROMS
DiselectParentNodes(e.Node.Parent);
DiselectChildNodes(e.Node.Nodes);
}
}
btnFixLinks.Enabled = AtLeastOneNodeChecked(); // C2017-030 support for Refresh Transitions/Update RO Values
}
private void DiselectParentNodes(TreeNode parent)
{
while (parent != null)
@ -1193,7 +1225,6 @@ namespace VEPROMS
parent = parent.Parent;
}
}
private void DiselectChildNodes(TreeNodeCollection childes)
{
foreach (TreeNode oneChild in childes)
@ -1203,8 +1234,6 @@ namespace VEPROMS
DiselectChildNodes(oneChild.Nodes);
}
}
private void CheckChildNodes(TreeNode treeNode, bool ischecked)
{
foreach (TreeNode tn in treeNode.Nodes)
@ -1218,6 +1247,80 @@ 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;
public ProgressBarItem ProgressBar
@ -1329,8 +1432,7 @@ namespace VEPROMS
// new Admin Tools user interface for deletes
private void sideNavItmDelete_Click(object sender, EventArgs e)
{
AdminToolType = E_AdminToolType.Delete;
lblAdmToolProgressType.Text = "";
AdminToolType = E_AdminToolType.Delete;
setupProgessSteps1();
if (swDeleteFolder.Value)
@ -1407,10 +1509,20 @@ namespace VEPROMS
break;
case E_AdminToolType.Delete:
splitContainer3.Panel2Collapsed = false;
progressSteps1.Items.Add(siOrphDatRecs);
progressSteps1.Visible = true;
progressSteps1.Refresh();
if (swDeleteFolder.Value)
{
splitContainer3.Panel2Collapsed = false;
progressSteps1.Items.Add(siOrphDatRecs);
lblAdmToolProgressType.Text = "Repairing: ";
progressSteps1.Visible = true;
progressSteps1.Refresh();
}
else
{
lblAdmToolProgressType.Text = "";
splitContainer3.Panel2Collapsed = true;
progressSteps1.Visible = false;
}
break;
}
}
@ -1612,18 +1724,17 @@ namespace VEPROMS
//C2024-005 Delete Annotations, Delete Folders
private void swDeleteAnnotations_ValueChanged(object sender, EventArgs e)
{
setupProgessSteps1();
swDeleteFolder.Value = !swDeleteAnnotations.Value;
if (swDeleteFolder.Value)
{
ResetDelTV(true);
setupProgessSteps1();
}
ResetDelTV(true);
else
ResetDelTV(false);
}
private void swDeleteFolder_ValueChanged(object sender, EventArgs e)
{
setupProgessSteps1();
swDeleteAnnotations.Value = !swDeleteFolder.Value;
if (swDeleteFolder.Value)
ResetDelTV(true);
@ -1637,29 +1748,25 @@ namespace VEPROMS
txtResults.Clear();
txtProcess.Clear();
if (swDeleteFolder.Value)
{
if (FlexibleMessageBox.Show(this, "You sure you want to remove the selected folders and their contents?", "Confirm Folder Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
//TODO process deletions of folders
txtProcess.AppendText("Deleting Folders...");
//List<ProcedureInfo> pil = new List<ProcedureInfo>();
//foreach (TreeNode tn in myProcedures.Keys)
// if (tn.Checked)
// pil.Add(myProcedures[tn]);
////Load Selected Folders
//Load Selected Folders with docversions
List<DocVersionInfo> dvil = new List<DocVersionInfo>();
foreach (TreeNode tn in myDocVersions.Keys)
if (tn.Checked)
dvil.Add(myDocVersions[tn]);
ProcessDelete(dvil);
//Load Selected Folders with docversions
List<FolderInfo> ef = new List<FolderInfo>();
foreach (TreeNode tn in myFolders.Keys)
if (tn.Checked)
ef.Add(myFolders[tn]);
ProcessDelete(dvil, ef);
}
}
else
@ -1682,12 +1789,10 @@ namespace VEPROMS
frmAnnotationsCleanup frmAnnoDel = new frmAnnotationsCleanup(this, pil, dvil);
frmAnnoDel.ShowDialog();
}
}
private void ProcessDelete(List<DocVersionInfo> foldersToDelete)
private void ProcessDelete(List<DocVersionInfo> foldersToDelete, List<FolderInfo> emptyFoldersToDelete)
{
DateTime pStart = DateTime.Now;
txtProcess.AppendText(Environment.NewLine);
@ -1696,8 +1801,7 @@ namespace VEPROMS
foreach (var kvp in foldersToDelete)
{
//Gather folder information
//Gather folder information
FolderInfo fi = (FolderInfo)kvp.ActiveParent;
int itemID = (int)fi.FolderID;
string folderName = fi.Name;
@ -1717,6 +1821,30 @@ namespace VEPROMS
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})");
}
else
{
txtProcess.AppendText($"Failed to delete folder: {folderName} (ID: {itemID})");
}
txtProcess.AppendText(Environment.NewLine);
}
//Run Repair
int prgStpIdx = -1;
StepProgress(++prgStpIdx, 50);

View File

@ -117,44 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="superTooltip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<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.
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.
It is recommended that this be done during off hours.
</value>
</data>
<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.
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.
It is recommended that this be done during off hours.
</value>
</data>
<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.
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>
</data>
<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.
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>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="warningBox3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -173,6 +135,9 @@ If more than one procedure is selected, it is recommended that this be performed
zJwL4b/EAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="superTooltip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="swCkObsoleteROData.SuperTooltip" xml:space="preserve">
<value>Referenced Objects databases are associated with a procedure set (such as Working Draft).
@ -220,6 +185,41 @@ Should an item become orphaned (disconnected) from the rest of the data, it will
This tool may take an extended period of time to execute.
</value>
</data>
<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.
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.
It is recommended that this be done during off hours.
</value>
</data>
<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.
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.
It is recommended that this be done during off hours.
</value>
</data>
<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.
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>
</data>
<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.
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>
</data>
<data name="swRefreshTblsForSrch.SuperTooltip" xml:space="preserve">
<value>When Word attachments are modified and saved, PROMS will create a PDF of the attachment contents and save it in the database. When this is done, all the of the RO references are resolved as well as pagination of the attachment. This speeds up the overall printing of the procedure in that PROMS simply inserts the attachment contents.