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
==========================================================================================================
*/
-- 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 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'deleteAnnotationsDocvByType')
@ -22688,7 +22687,7 @@ AS
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 @cnt2 int
@ -22713,7 +22712,7 @@ AS
-- Delete Annotations
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
@ -22763,7 +22762,7 @@ AS
DECLARE @cnt2 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
SET @i = (SELECT MIN(RowID) FROM @procs);

View File

@ -626,4 +626,4 @@
<PropertyGroup>
<PreBuildEvent>cmd /c "$(ProjectDir)FixRev.bat"</PreBuildEvent>
</PropertyGroup>
</Project>
</Project>

View File

@ -127,4 +127,5 @@ namespace VEPROMS
private System.Windows.Forms.Label lblCount;
private System.Windows.Forms.Button btnClose;
}
}
}

View File

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

@ -120,4 +120,5 @@
<metadata name="itemAnnotationsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
</root>

View File

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

View File

@ -53,7 +53,7 @@ namespace VEPROMS
swStandardHypenChars.Enabled = false;
}
}
// txtProcess text box available to frmAnnotationsClean form.
// Make txtProcess text box available to frmAnnotationsClean form.
internal TextBox GettxtProcess()
{
return txtProcess;
@ -1718,28 +1718,21 @@ namespace VEPROMS
}
else
{
//TODO process deletions of annotations
// Write progress status
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]);
//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);
frmAnnoDel.ShowDialog();
@ -1794,3 +1787,5 @@ namespace VEPROMS
}
}
}

View File

@ -405,4 +405,4 @@ If more than one procedure is selected, it is recommended that this be performed
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>46</value>
</metadata>
</root>
</root>

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
// }
//}
}