AIMS/DrawGraph/AreaManage/DeletePhysios.cs
2023-04-15 18:22:12 +08:00

193 lines
7.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace DrawGraph
{
public partial class DeletePhysios : Form
{
public List<PhysioDataConfig> selparameters;
public List<PhysioDataConfig> delparameters;
public bool isDelete = false;
public int operationId;
public DateTime startTime;
public DateTime endTime;
public double startValue;
public double endValue;
public double startValue2;
public double endValue2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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.AcceptButton = this.btnDelete;
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, double _startValue2, double _endValue2)
{
InitializeComponent();
operationId = _operationId;
startTime = _startTime;
endTime = _endTime;
startValue = _startValue;
endValue = _endValue;
startValue2 = _startValue2;
endValue2 = _endValue2;
}
private void frmDeletePhysio_Load(object sender, EventArgs e)
{
delparameters = new List<PhysioDataConfig>();
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);
// }
//}
if (aerd.YAisx == 0)
PhysioDataService.DelectPhysioDataByID(operationId, startTime, endTime, startValue, endValue, aerd.Id);
else if (aerd.YAisx == 1)
PhysioDataService.DelectPhysioDataByID(operationId, startTime, endTime, startValue2, endValue2, aerd.Id);
}
isDelete = true;
}
this.Close();
}
private void btnSave_Click(object sender, EventArgs e)
{
this.Close();
}
}
}