C2024-005-Annotations-Cleanup
This commit is contained in:
@@ -7,29 +7,158 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using Volian.Base.Library;
|
||||
//using Volian.Pipe.Library;
|
||||
using System.Xml;
|
||||
using System.Diagnostics;
|
||||
using JR.Utils.GUI.Forms;
|
||||
|
||||
namespace VEPROMS
|
||||
{
|
||||
public partial class frmAnnotationsCleanup : Form
|
||||
{
|
||||
public frmAnnotationsCleanup()
|
||||
Label mylab = new Label();
|
||||
string procList = "";
|
||||
string docvList = "";
|
||||
int AnnotationTyp;
|
||||
List<ProcedureInfo> pil2 = new List<ProcedureInfo>();
|
||||
List<DocVersionInfo> dvil2 = new List<DocVersionInfo>();
|
||||
private frmBatchRefresh mainForm = null;
|
||||
public frmAnnotationsCleanup(Form callingForm, List<ProcedureInfo> pil, List<DocVersionInfo> dvil)
|
||||
{
|
||||
mainForm = callingForm as frmBatchRefresh;
|
||||
InitializeComponent();
|
||||
|
||||
pil2 = pil;
|
||||
dvil2 = dvil;
|
||||
|
||||
myAnnotationTypeInfoList = AnnotationTypeInfoList.Get();
|
||||
lbAnnotationTypes.DataSource = myLocalAnnotationTypeInfoList = new LocalAnnotationTypeInfoList(myAnnotationTypeInfoList);
|
||||
|
||||
Dictionary<string, string> AnnotationsList = new Dictionary<string, string>();
|
||||
|
||||
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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void label1_Click(object sender, EventArgs e)
|
||||
private string getAnnotationProcItems(List<ProcedureInfo> pil2)
|
||||
{
|
||||
|
||||
foreach (var p in pil2)
|
||||
{
|
||||
if (p.IsProcedure)
|
||||
{
|
||||
if (procList == "")
|
||||
{
|
||||
procList = procList + p.ItemID.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
procList = procList + "," + p.ItemID.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return procList;
|
||||
//for( int i = 0; pil2.Count ; i++ )
|
||||
}
|
||||
|
||||
private string getAnnotationDocvItems(List<DocVersionInfo> dvil2)
|
||||
{
|
||||
|
||||
foreach (var d in dvil2)
|
||||
{
|
||||
if (d.IsDocVersion)
|
||||
{
|
||||
if (docvList == "")
|
||||
{
|
||||
docvList = docvList + d.VersionID.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
docvList = docvList + "," + d.VersionID.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
return docvList;
|
||||
//for( int i = 0; pil2.Count ; i++ )
|
||||
}
|
||||
|
||||
private AnnotationTypeInfoList myAnnotationTypeInfoList = null;
|
||||
private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null;
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lbAnnotations.SelectedItem != null)
|
||||
foreach (var p in pil2)
|
||||
{
|
||||
if (p.IsProcedure)
|
||||
{
|
||||
TextBox frm2 = mainForm.GettxtProcess();
|
||||
frm2.AppendText(p.DisplayNumber + ' ' + p.DisplayText);
|
||||
Annotation.DeleteAnnotationProcByGroup(lbAnnotationTypes.SelectedIndex, p.ItemID);
|
||||
}
|
||||
|
||||
}
|
||||
foreach (var d in dvil2)
|
||||
{
|
||||
if (d.IsDocVersion)
|
||||
{
|
||||
TextBox frm2 = mainForm.GettxtProcess();
|
||||
//frm2.AppendText(p);
|
||||
Annotation.DeleteAnnotationByGroup(lbAnnotationTypes.SelectedIndex, d.VersionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair<string, string>)lbAnnotationTypes.SelectedItem).Key);
|
||||
deletecountDocv = Annotation.getAnnotationCountDocv(AnnotationTyp, getAnnotationDocvItems(dvil2));
|
||||
}
|
||||
lblCountNumber.Text = (deletecountProc + deletecountDocv).ToString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//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;
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user