AIMS/AIMSControls/PublicUI/frmAnaesthesiaMethod.cs
2023-08-16 22:32:16 +08:00

79 lines
2.8 KiB
C#

using AIMSBLL;
using DataDictionary;
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 AIMS.PublicUI.UI
{
public partial class frmAnaesthesiaMethod : Form
{
public List<int> SelectAnaesthesiaMethodData = new List<int>();
public frmAnaesthesiaMethod()
{
InitializeComponent();
}
private void frmAnaesthesiaMethod_Load(object sender, EventArgs e)
{
ControlExtension.SetDgvAttribute(dgvAnaesthesiaMethod);
this.txtHelpCode.Text = "简拼/汉字/ICD码";
dgvAnaesthesiaMethod.DataSource = BAnaesthesiaMethod.GetDataTable("IsValid =1");
dgvAnaesthesiaMethod.Select();
if (SelectAnaesthesiaMethodData.Count > 0)
{
for (int i = 0; i < dgvAnaesthesiaMethod.Rows.Count; i++)
{
if (SelectAnaesthesiaMethodData.Contains(int.Parse(dgvAnaesthesiaMethod.Rows[i].Cells["IdColumn"].Value.ToString())))
{
dgvAnaesthesiaMethod.Rows[i].Cells["CheckBoxColumn"].Value = true;
for (int J = 0; J < dgvAnaesthesiaMethod.Rows[i].Cells.Count; J++)
{
dgvAnaesthesiaMethod.Rows[i].Cells[J].Style.ForeColor = Color.Red;
}
}
}
}
txtHelpCode.Focus();
}
private void btnOk_Click(object sender, EventArgs e)
{
Close();
}
private void dgvOperationPosition_Click(object sender, EventArgs e)
{
if (Convert.ToBoolean(dgvAnaesthesiaMethod.CurrentRow.Cells["CheckBoxColumn"].EditedFormattedValue) == false)
{
SelectAnaesthesiaMethodData.Add(int.Parse(dgvAnaesthesiaMethod.CurrentRow.Cells["IdColumn"].Value.ToString()));
dgvAnaesthesiaMethod.CurrentRow.Cells["CheckBoxColumn"].Value = true;
}
else
{
SelectAnaesthesiaMethodData.Remove(int.Parse(dgvAnaesthesiaMethod.CurrentRow.Cells["IdColumn"].Value.ToString()));
dgvAnaesthesiaMethod.CurrentRow.Cells["CheckBoxColumn"].Value = false;
}
}
private void txtHelpCode_Click(object sender, EventArgs e)
{
this.txtHelpCode.Text = "";
this.txtHelpCode.ForeColor = Color.Black;
}
private void txtHelpCode_TextChanged(object sender, EventArgs e)
{
dgvAnaesthesiaMethod.DataSource =
BAnaesthesiaMethod.GetDataTable("IsValid =1 AND (Name LIKE '%" + txtHelpCode.Text.Trim() + "%' or helpCode LIKE '%" + txtHelpCode.Text.Trim() + "%')");
}
}
}