using DevExpress.XtraEditors;
using HL_FristAidPlatform_DTO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Public
{
public partial class Form_SelectDiseaseTemplate : XtraForm
{
#region 变量
///
/// 当前筛选的类型编号
///
private int CurType = 1;
///
/// 当前选择的ID集合
///
public string SelDiseaseTemplateIDS = string.Empty;
///
/// 当前选择的名称集合
///
public string SelDiseaseTemplateS = string.Empty;
#endregion 变量
///
/// 选择病情模板
///
///
public Form_SelectDiseaseTemplate(int type)
{
InitializeComponent();
CurType = type;
}
///
/// 窗体加载
///
///
///
private void Form_SelectDiseaseTemplate_Load(object sender, EventArgs e)
{
if (CurType == 100005)
{
labelControl1.Visible = false;
txt_Key.Visible = false;
BindTraumaDiseaseTemplate();
}
else
{
labelControl1.Visible = true;
txt_Key.Visible = true;
BindDiseaseTemplate();
}
}
///
/// 绑定用户
///
private void BindDiseaseTemplate()
{
try
{
DataTable ResultDT = DBHelpClass.Get(string.Format("/api/base/T_Base_DiseaseTemplate/GetList?type={0}&keyWord={1}", CurType, txt_Key.Text.ToString().Trim()));
grid_Disease.DataSource = ResultDT;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定用户:\r\n" + ex);
}
}
///
/// 绑定创伤病情模板
///
private void BindTraumaDiseaseTemplate()
{
try
{
List ResultDT = DBHelpClass.GetList(string.Format("/api/base/T_Base_Diagnosis/GetDiagnosisTreeList"));
grid_Disease.DataSource = ResultDT;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "绑定用户:\r\n" + ex);
}
}
///
/// 确认选择
///
///
///
private void btn_Sure_Click(object sender, EventArgs e)
{
try
{
int[] rownumber = grv_Disease.GetSelectedRows();//获取选中行号;
SelDiseaseTemplateIDS = string.Empty;
SelDiseaseTemplateS = string.Empty;
foreach (int i in rownumber)
{
//根据行号获取相应行的数据;
SelDiseaseTemplateIDS += grv_Disease.GetRowCellValue(i, "ID").ToString() + ",";
SelDiseaseTemplateS += grv_Disease.GetRowCellValue(i, "Content").ToString() + ";";
}
if (!string.IsNullOrEmpty(SelDiseaseTemplateIDS))
{
SelDiseaseTemplateIDS = SelDiseaseTemplateIDS.Substring(0, SelDiseaseTemplateIDS.Length - 1);
DialogResult = DialogResult.OK;
Close();
}
else
{
XtraMessageBox.Show("请先勾选您要选择的病情模板!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "确认选择:\r\n" + ex);
}
}
}
}