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 frmOperationCutType : Form { public List SelectOperationCutTypeData = new List(); public frmOperationCutType() { InitializeComponent(); } private void OperationCutType_Load(object sender, EventArgs e) { ControlExtension.SetDgvAttribute(dgvOperationCutType); this.txtHelpCode.Text = "简拼/汉字/ICD码"; dgvOperationCutType.DataSource = BOperationCutType.GetDataTable("IsValid =1"); dgvOperationCutType.Select(); if (SelectOperationCutTypeData.Count > 0) { for (int i = 0; i < dgvOperationCutType.Rows.Count; i++) { if (SelectOperationCutTypeData.Contains(int.Parse(dgvOperationCutType.Rows[i].Cells["IdColumn"].Value.ToString()))) { dgvOperationCutType.Rows[i].Cells["CheckBoxColumn"].Value = true; for (int J = 0; J < dgvOperationCutType.Rows[i].Cells.Count; J++) { dgvOperationCutType.Rows[i].Cells[J].Style.ForeColor = Color.Red; } } } } txtHelpCode.Focus(); } private void btnOk_Click(object sender, EventArgs e) { Close(); } private void dgvOperationCutType_Click(object sender, EventArgs e) { if (Convert.ToBoolean(dgvOperationCutType.CurrentRow.Cells["CheckBoxColumn"].EditedFormattedValue) == false) { SelectOperationCutTypeData.Add(int.Parse(dgvOperationCutType.CurrentRow.Cells["IdColumn"].Value.ToString())); dgvOperationCutType.CurrentRow.Cells["CheckBoxColumn"].Value = true; } else { SelectOperationCutTypeData.Remove(int.Parse(dgvOperationCutType.CurrentRow.Cells["IdColumn"].Value.ToString())); dgvOperationCutType.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) { dgvOperationCutType.DataSource = BOperationCutType.GetDataTable("IsValid =1 AND (Name LIKE '%" + txtHelpCode.Text.Trim() + "%' or helpCode LIKE '%" + txtHelpCode.Text.Trim() + "%')"); } } }