C2024-005-Annotations-Cleanup

This commit is contained in:
Paul Larsen 2024-07-17 13:19:58 -04:00
parent b496f8b9ed
commit 331ea86e6e
10 changed files with 32 additions and 56 deletions

View File

@ -22642,8 +22642,7 @@ Go
Begin: C2024-005: PRL - SPs to support Admin tool to clean Annotations Begin: C2024-005: PRL - SPs to support Admin tool to clean Annotations
========================================================================================================== ==========================================================================================================
*/ */
-- Change COMPATIBILITY_LEVEL to 130. This change is needed for C2024-005
ALTER DATABASE [VEPROMS_BeaverValley] SET COMPATIBILITY_LEVEL = 130
/****** Object: StoredProcedure [dbo].[deleteAnnotationsDocvByType] Script Date: 7/11/2024 2:39:59 PM ******/ /****** Object: StoredProcedure [dbo].[deleteAnnotationsDocvByType] Script Date: 7/11/2024 2:39:59 PM ******/
IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'deleteAnnotationsDocvByType') IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'deleteAnnotationsDocvByType')
@ -22688,7 +22687,7 @@ AS
AllItemIDs int AllItemIDs int
) )
INSERT INTO @docvs (DocvVersionID) (select value from STRING_SPLIT(@docvList, ',')) INSERT INTO @docvs (DocvVersionID) (select id from vefn_SplitInt(@docvList, ','))
DECLARE @cnt int = 0 DECLARE @cnt int = 0
DECLARE @cnt2 int DECLARE @cnt2 int
@ -22713,7 +22712,7 @@ AS
-- Delete Annotations -- Delete Annotations
DELETE FROM Ann DELETE FROM Ann
FROM tblAnnotations Ann INNER JOIN @Annotationitems AI ON Ann.itemid = AI.AllItemIDs WHERE TypeID = @typeid FROM tblAnnotations Ann INNER JOIN @Annotationitems AI ON Ann.itemid = AI.AllItemIDs WHERE TypeID = @typeidI beleive the
GO GO
@ -22763,7 +22762,7 @@ AS
DECLARE @cnt2 int DECLARE @cnt2 int
DECLARE @itemid int DECLARE @itemid int
INSERT INTO @procs (ProcItemIDs) (select value from STRING_SPLIT(@procList, ',')) INSERT INTO @procs (ProcItemIDs) (select id from vefn_SplitInt(@procList, ','))
DECLARE @i INT DECLARE @i INT
SET @i = (SELECT MIN(RowID) FROM @procs); SET @i = (SELECT MIN(RowID) FROM @procs);

View File

@ -128,3 +128,4 @@ namespace VEPROMS
private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Button btnClose;
} }
} }

View File

@ -25,38 +25,36 @@ namespace VEPROMS
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;
// frmAnnotationsCleanup constructor passes users procedure and docversion selections from frmBatchRefresh
public frmAnnotationsCleanup(Form callingForm, List<ProcedureInfo> pil, List<DocVersionInfo> dvil) public frmAnnotationsCleanup(Form callingForm, List<ProcedureInfo> pil, List<DocVersionInfo> dvil)
{
{ // Set up link back to parent form.
mainForm = callingForm as frmBatchRefresh; mainForm = callingForm as frmBatchRefresh;
InitializeComponent(); InitializeComponent();
pil2 = pil; pil2 = pil;
dvil2 = dvil; dvil2 = dvil;
// Get list of annotation types for plant.
myAnnotationTypeInfoList = AnnotationTypeInfoList.Get(); myAnnotationTypeInfoList = AnnotationTypeInfoList.Get();
lbAnnotationTypes.DataSource = myLocalAnnotationTypeInfoList = new LocalAnnotationTypeInfoList(myAnnotationTypeInfoList); lbAnnotationTypes.DataSource = myLocalAnnotationTypeInfoList = new LocalAnnotationTypeInfoList(myAnnotationTypeInfoList);
Dictionary<string, string> AnnotationsList = new Dictionary<string, string>(); Dictionary<string, string> AnnotationsList = new Dictionary<string, string>();
// Add name and type ID to form.
foreach (LocalAnnotationTypeInfo lati in myLocalAnnotationTypeInfoList) foreach (LocalAnnotationTypeInfo lati in myLocalAnnotationTypeInfoList)
{ {
AnnotationsList.Add(lati.TypeID.ToString(), lati.Name); AnnotationsList.Add(lati.TypeID.ToString(), lati.Name);
//cbAnnotationTypes.Items.Add(new { Name = lati.Name, Value = lati.TypeID }); //cbAnnotationTypes.Items.Add(new { Name = lati.Name, Value = lati.TypeID });
} }
//cbAnnotationTypes.DroppedDown = true; //DroppedDown
lbAnnotationTypes.DataSource = new BindingSource(AnnotationsList, null); lbAnnotationTypes.DataSource = new BindingSource(AnnotationsList, null);
lbAnnotationTypes.DisplayMember = "Value"; lbAnnotationTypes.DisplayMember = "Value";
lbAnnotationTypes.ValueMember = "Key"; lbAnnotationTypes.ValueMember = "Key";
lbAnnotationTypes.SelectedIndexChanged += lbAnnotationTypes_SelectedIndexChanged; lbAnnotationTypes.SelectedIndexChanged += lbAnnotationTypes_SelectedIndexChanged;
//List<ProcedureInfo> SelectedProds = new List<ProcedureInfo>();
//SelectedProds = frmBatchRefresh.RetrieveChkAnnotations();
} }
// create comma delimited string of procedures selected by user.
private string getAnnotationProcItems(List<ProcedureInfo> pil2) private string getAnnotationProcItems(List<ProcedureInfo> pil2)
{ {
procList = ""; procList = "";
@ -75,9 +73,9 @@ namespace VEPROMS
} }
} }
return procList; return procList;
//for( int i = 0; pil2.Count ; i++ )
} }
// create comma delimited string of doc versions selected by user.
private string getAnnotationDocvItems(List<DocVersionInfo> dvil2) private string getAnnotationDocvItems(List<DocVersionInfo> dvil2)
{ {
docvList = ""; docvList = "";
@ -96,11 +94,12 @@ namespace VEPROMS
} }
} }
return docvList; return docvList;
//for( int i = 0; pil2.Count ; i++ )
} }
private AnnotationTypeInfoList myAnnotationTypeInfoList = null; private AnnotationTypeInfoList myAnnotationTypeInfoList = null;
private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null; private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null;
// 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) foreach (var p in pil2)
@ -127,12 +126,7 @@ namespace VEPROMS
} }
} }
} }
// Retrieve number of annotations that will be deleted.
//private void cbAnnotationTypes_SelectedIndexChanged(object sender, EventArgs e)
//{
// mylab.Text = mylab.Text + ((KeyValuePair<string, string>)cbAnnotationTypes.SelectedItem).Key;
//}
private void lbAnnotationTypes_SelectedIndexChanged(object sender, EventArgs e) private void lbAnnotationTypes_SelectedIndexChanged(object sender, EventArgs e)
{ {
lblCountNumber.Text = ""; lblCountNumber.Text = "";
@ -152,23 +146,11 @@ namespace VEPROMS
lblCountNumber.Text = (deletecountProc + deletecountDocv).ToString(); lblCountNumber.Text = (deletecountProc + deletecountDocv).ToString();
} }
// Close form.
private void btnClose_Click(object sender, EventArgs e) private void btnClose_Click(object sender, EventArgs e)
{ {
this.Close(); this.Close();
} }
//private void cbAnnotationTypes_(object sender, EventArgs e)
//{
// //mylab.Text = mylab.Text + cbAnnotationTypes.SelectedValue;
// //mylab.Text = mylab.Text + cbAnnotationTypes.SelectedItem.ToString();
// //mylab.Text = mylab.Text + ((KeyValuePair<string, string>)cbAnnotationTypes.SelectedItem).Value;
//}
} }
} }

View File

@ -121,3 +121,4 @@
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
</root> </root>

View File

@ -1461,3 +1461,5 @@
private DevComponents.DotNetBar.Controls.SideNavItem sideNavItmDelete; private DevComponents.DotNetBar.Controls.SideNavItem sideNavItmDelete;
} }
} }

View File

@ -53,7 +53,7 @@ namespace VEPROMS
swStandardHypenChars.Enabled = false; swStandardHypenChars.Enabled = false;
} }
} }
// txtProcess text box available to frmAnnotationsClean form. // Make txtProcess text box available to frmAnnotationsClean form.
internal TextBox GettxtProcess() internal TextBox GettxtProcess()
{ {
return txtProcess; return txtProcess;
@ -1718,28 +1718,21 @@ namespace VEPROMS
} }
else else
{ {
//TODO process deletions of annotations // 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>(); List<ProcedureInfo> pil = new List<ProcedureInfo>();
foreach (TreeNode tn in myProcedures.Keys) foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked) if (tn.Checked)
pil.Add(myProcedures[tn]); pil.Add(myProcedures[tn]);
// Create a list of doc versions the user selected
List<DocVersionInfo> dvil = new List<DocVersionInfo>(); List<DocVersionInfo> dvil = new List<DocVersionInfo>();
foreach (TreeNode tn in myDocVersions.Keys) foreach (TreeNode tn in myDocVersions.Keys)
if (tn.Checked) if (tn.Checked)
dvil.Add(myDocVersions[tn]); dvil.Add(myDocVersions[tn]);
//List<DocVersionInfo> dvil = new List<DocVersionInfo>();
//foreach (TreeNode tn in myTVdel.Nodes)
// if (tn.Checked)
// {
// tn.Tag = dvil;
// myDocVersions.Add(tn, dvil);
// }
frmAnnotationsCleanup frmAnnoDel = new frmAnnotationsCleanup(this, pil, dvil); frmAnnotationsCleanup frmAnnoDel = new frmAnnotationsCleanup(this, pil, dvil);
frmAnnoDel.ShowDialog(); frmAnnoDel.ShowDialog();
@ -1794,3 +1787,5 @@ namespace VEPROMS
} }
} }
} }

View File

@ -1763,3 +1763,4 @@ namespace VEPROMS
} }
} }

View File

@ -563,11 +563,6 @@ namespace VEPROMS.CSLA.Library
} }
} }
} }
//public partial class AnnotationTypeAnnotations
//{
// public static int GetAnnotationID()
// {
// return AnnotationTypeAnnotat
// }
//}
} }