StableVersion4.3/HL_FristAidPlatform_Trauma/Form_Diagnosis.cs

73 lines
2.3 KiB
C#

using DevExpress.XtraEditors;
using HL_FristAidPlatform_Public;
using System;
using System.Data;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Trauma
{
public partial class Form_Diagnosis : XtraForm
{
public string diagnosisValue;
private DataTable dataTable;
public Form_Diagnosis()
{
InitializeComponent();
}
private void Form_Diagnosis_Load(object sender, EventArgs e)
{
dataTable = DBHelpClass.Get("api/base/T_Base_Diagnosis/GetDiagnosisDetailsList");
gridControl1.DataSource = dataTable;
}
private void gridControl1_Click(object sender, EventArgs e)
{
try
{
int[] rownumber = gridView1.GetSelectedRows();//获取选中行号;
foreach (int i in rownumber)
{
//根据行号获取相应行的数据;
diagnosisValue += gridView1.GetRowCellValue(i, "Name").ToString();
}
if (!string.IsNullOrEmpty(diagnosisValue))
{
DialogResult = DialogResult.OK;
}
else
{
XtraMessageBox.Show("请先勾选您要选择的诊断模板!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "确认选择:\r\n" + ex);
}
}
private void textEdit1_Enter(object sender, EventArgs e)
{
textEdit1.Text = "";
}
private void textEdit1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!string.IsNullOrEmpty(textEdit1.Text))
{
string filterExpression = string.Format("Name like '%{0}%'", textEdit1.Text + "");
DataTable table = dataTable.Clone();
foreach (var item in dataTable.Select(filterExpression))
{
table.Rows.Add(item.ItemArray);
}
gridControl1.DataSource = table;
}
else
{
gridControl1.DataSource = dataTable;
}
}
}
}