using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; 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 { Label mylab = new Label(); string procList = ""; string docvList = ""; int AnnotationTyp; List pil2 = new List(); List dvil2 = new List(); private frmBatchRefresh mainForm = null; public frmAnnotationsCleanup(Form callingForm, List pil, List dvil) { mainForm = callingForm as frmBatchRefresh; InitializeComponent(); pil2 = pil; dvil2 = dvil; myAnnotationTypeInfoList = AnnotationTypeInfoList.Get(); lbAnnotationTypes.DataSource = myLocalAnnotationTypeInfoList = new LocalAnnotationTypeInfoList(myAnnotationTypeInfoList); Dictionary AnnotationsList = new Dictionary(); 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 SelectedProds = new List(); //SelectedProds = frmBatchRefresh.RetrieveChkAnnotations(); } private string getAnnotationProcItems(List pil2) { procList = ""; 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 dvil2) { docvList = ""; 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) { foreach (var p in pil2) { if (p.IsProcedure) { TextBox frm2 = mainForm.GettxtProcess(); frm2.AppendText(p.DisplayNumber + ' ' + p.DisplayText); AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); Annotation.DeleteAnnotationProcByType(AnnotationTyp, p.ItemID.ToString()); lblCountNumber.Text = "0"; } } foreach (var d in dvil2) { if (d.IsDocVersion) { TextBox frm2 = mainForm.GettxtProcess(); frm2.AppendText(d.ActiveParent.ToString()); AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); Annotation.DeleteAnnotationDocvByType(AnnotationTyp, d.VersionID.ToString()); lblCountNumber.Text = "0"; } } } //private void cbAnnotationTypes_SelectedIndexChanged(object sender, EventArgs e) //{ // mylab.Text = mylab.Text + ((KeyValuePair)cbAnnotationTypes.SelectedItem).Key; //} private void lbAnnotationTypes_SelectedIndexChanged(object sender, EventArgs e) { lblCountNumber.Text = ""; int deletecountProc = 0; int deletecountDocv = 0; if (pil2.Count > 0) { AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, getAnnotationProcItems(pil2)); } if (dvil2.Count > 0) { AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key); deletecountDocv = Annotation.getAnnotationCountDocv(AnnotationTyp, getAnnotationDocvItems(dvil2)); } lblCountNumber.Text = (deletecountProc + deletecountDocv).ToString(); } 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)cbAnnotationTypes.SelectedItem).Value; //} } }