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; /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.panel1 = new System.Windows.Forms.Panel(); this.btnDelete = new DevComponents.DotNetBar.ButtonX(); this.btnSave = new DevComponents.DotNetBar.ButtonX(); this.SuspendLayout(); // // panel1 // this.panel1.Location = new System.Drawing.Point(15, 12); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(227, 304); this.panel1.TabIndex = 0; // // btnDelete // this.btnDelete.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnDelete.Location = new System.Drawing.Point(37, 323); this.btnDelete.Name = "btnDelete"; this.btnDelete.Size = new System.Drawing.Size(86, 30); this.btnDelete.TabIndex = 4; this.btnDelete.Text = "删除"; this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); // // btnSave // this.btnSave.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnSave.Location = new System.Drawing.Point(129, 323); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(86, 30); this.btnSave.TabIndex = 3; this.btnSave.Text = "取消"; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // DeletePhysios // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(254, 359); this.Controls.Add(this.btnDelete); this.Controls.Add(this.btnSave); this.Controls.Add(this.panel1); this.Name = "DeletePhysios"; this.ShowIcon = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "选择删除"; this.Load += new System.EventHandler(this.frmDeletePhysio_Load); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Panel panel1; private DevComponents.DotNetBar.ButtonX btnDelete; private DevComponents.DotNetBar.ButtonX btnSave; 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(); } } }