using DrawGraph; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace DrawGraph { public partial class DeletePhysios : Form { public List selparameters; public List delparameters; public bool isDelete = false; public int operationId; public DateTime startTime; public DateTime endTime; public double startValue; public double endValue; public DeletePhysios() { InitializeComponent(); } public DeletePhysios(int _operationId, DateTime _startTime, DateTime _endTime, double _startValue, double _endValue) { InitializeComponent(); operationId = _operationId; startTime = _startTime; endTime = _endTime; startValue = _startValue; endValue = _endValue; } private void frmDeletePhysio_Load(object sender, EventArgs e) { delparameters = new List(); panel1.Controls.Clear(); int rows = 0; //循环加载CheckBox控件 foreach (PhysioDataConfig ade in selparameters) { CheckBox cb = new CheckBox(); cb.Tag = ade; cb.Text = ade.Name; cb.Font = new System.Drawing.Font("微软雅黑", 10.5f); cb.Width = 100; cb.Tag = ade; cb.Checked = true; cb.CheckedChanged += new EventHandler(cb_CheckedChanged); cb.Location = new Point(10, rows * (cb.Height + 5)); panel1.Controls.Add(cb); delparameters.Add(ade); //如果已加载15行,则另起一列,最多显示3列 rows++; } } void cb_CheckedChanged(object sender, EventArgs e) { //判断CheckBox被选中时 if (((CheckBox)sender).Checked) { delparameters.Add(((CheckBox)sender).Tag as PhysioDataConfig); } else { //CheckBox取消选中时,判断患者不良事件集合是否存在,如果存在则移除 foreach (PhysioDataConfig aerd in delparameters) { if (aerd == ((CheckBox)sender).Tag as PhysioDataConfig) { delparameters.Remove(aerd); break; } } } } private void btnDelete_Click(object sender, EventArgs e) { if (delparameters.Count > 0) { foreach (PhysioDataConfig aerd in delparameters) { //foreach (PhysioData item in pdTemps) //{ // if (item.PhysioDataConfigId == aerd.Id) // { // PhysioDataService.DelPhysioData(item); // } //} PhysioDataService.DelectPhysioDataByID(operationId, startTime, endTime, startValue, endValue, aerd.Id); } isDelete = true; } this.Close(); } private void btnSave_Click(object sender, EventArgs e) { this.Close(); } } }