From 9011b134d6947f633a252c0facdf152c17c2081a Mon Sep 17 00:00:00 2001 From: Paul Larsen Date: Wed, 31 Jul 2024 14:34:49 -0400 Subject: [PATCH] B2024-053_Submitted_for_Admin_Tools-Delete --- .../frmAnnotationsCleanup.cs | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs b/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs index bb91f05a..ca3f70f8 100644 --- a/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs +++ b/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs @@ -105,47 +105,50 @@ namespace VEPROMS // Process used to cleanup annotations "(Proceed?" button) private void button1_Click(object sender, EventArgs e) { - - TextBox frm2 = mainForm.GettxtProcess(); - TextBox frm3 = mainForm.GettxtResults(); - AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); - AnnotationName = System.Convert.ToString(((KeyValuePair)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) + if (lbAnnotationTypes.SelectedIndex > -1) { - if (p.IsProcedure) - { - //AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); - //AnnotationName = System.Convert.ToString(((KeyValuePair)lbAnnotationTypes.SelectedItem).Value); - //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) + TextBox frm2 = mainForm.GettxtProcess(); + TextBox frm3 = mainForm.GettxtResults(); + AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); + AnnotationName = System.Convert.ToString(((KeyValuePair)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) { - //AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); - //AnnotationName = System.Convert.ToString(((KeyValuePair)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)lbAnnotationTypes.SelectedItem).Key); - Annotation.DeleteAnnotationDocvByType(AnnotationTyp, d.VersionID.ToString()); + if (p.IsProcedure) + { + //AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); + //AnnotationName = System.Convert.ToString(((KeyValuePair)lbAnnotationTypes.SelectedItem).Value); + //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"; + } - lblCountNumber.Text = "0"; } + foreach (var d in dvil2) + { + if (d.IsDocVersion) + { + //AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); + //AnnotationName = System.Convert.ToString(((KeyValuePair)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)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); } - frm3.AppendText(Environment.NewLine + Environment.NewLine + "Total Annotations Deleted: " + totalDeleteCnt + Environment.NewLine + Environment.NewLine); } -- 2.47.2