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 frmContagion : Form { public List SelectContagionData = new List(); public frmContagion() { InitializeComponent(); } private void frmContagion_Load(object sender, EventArgs e) { ControlExtension.SetDgvAttribute(dgvContagion); this.txtHelpCode.Text = "简拼/汉字/ICD码"; dgvContagion.DataSource = BBasicDictionary.GetDataDictionaryDataTableByParentName("术前感染筛查", ""); dgvContagion.Select(); if (SelectContagionData.Count > 0) { for (int i = 0; i < dgvContagion.Rows.Count; i++) { if (SelectContagionData.Contains(int.Parse(dgvContagion.Rows[i].Cells["IdColumn"].Value.ToString()))) { dgvContagion.Rows[i].Cells["CheckBoxColumn"].Value = true; for (int J = 0; J < dgvContagion.Rows[i].Cells.Count; J++) { dgvContagion.Rows[i].Cells[J].Style.ForeColor = Color.Red; } } } } } private void btnOk_Click(object sender, EventArgs e) { Close(); } private void txtHelpCode_Click(object sender, EventArgs e) { this.txtHelpCode.Text = ""; this.txtHelpCode.ForeColor = Color.Black; } private void txtHelpCode_TextChanged(object sender, EventArgs e) { dgvContagion.DataSource = BBasicDictionary.GetDataDictionaryDataTableByParentName("术前感染筛查", txtHelpCode.Text.Trim()); } private void dgvContagion_Click(object sender, EventArgs e) { if (Convert.ToBoolean(dgvContagion.CurrentRow.Cells["CheckBoxColumn"].EditedFormattedValue) == false) { SelectContagionData.Add(int.Parse(dgvContagion.CurrentRow.Cells["IdColumn"].Value.ToString())); dgvContagion.CurrentRow.Cells["CheckBoxColumn"].Value = true; } else { SelectContagionData.Remove(int.Parse(dgvContagion.CurrentRow.Cells["IdColumn"].Value.ToString())); dgvContagion.CurrentRow.Cells["CheckBoxColumn"].Value = false; } } } }