StableVersion4.3/HL_FristAidPlatform_Trauma/Form_HealthCheckupInfo.cs

151 lines
5.7 KiB
C#

using DevExpress.XtraEditors;
using HL_FristAidPlatform_Public;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Trauma
{
public partial class Form_HealthCheckupInfo : XtraForm
{
public string Guid;
public string id;
public string name;
public Dictionary<string, string> Distionary;
public Form_HealthCheckupInfo(string guid)
{
InitializeComponent();
Guid = guid;
Distionary = new Dictionary<string, string>();
}
private void Form_HealthCheckupInfo_Load(object sender, EventArgs e)
{
//DataTable dt = DBHelpClass.Get(string.Format("api/base/T_Base_PreHospitalBasicData/GetFristAidRescueMeasures?type=1"));
//checkedListBoxControl1.DataSource = dt;//显示分页结果
//this.checkedListBoxControl1.DisplayMember = "Name";
//this.checkedListBoxControl1.ValueMember = "ID";
//DataTable dt1 = DBHelpClass.Get(string.Format("api/base/T_Base_PreHospitalBasicData/GetFristAidRescueMeasures?type=2"));
//if (dt1 != null && dt.Rows.Count > 0)
//{
// Dictionary<string, string> dic = dt1.Rows.Cast<DataRow>().ToDictionary(x => x["ID"].ToString(), x => x["Name"].ToString());
// ucButtonsGroup2.DataSource = dic;
//}
//DataTable dt2 = DBHelpClass.Get(string.Format("api/base/T_Base_PreHospitalBasicData/GetFristAidRescueMeasures?type=3"));
//if (dt2 != null && dt.Rows.Count > 0)
//{
// Dictionary<string, string> dic = dt2.Rows.Cast<DataRow>().ToDictionary(x => x["ID"].ToString(), x => x["Name"].ToString());
// ucButtonsGroup1.DataSource = dic;
//}
//List<TestGridModel> lst = DBHelpClass.GetList<TestGridModel>(string.Format("api/base/T_Base_Diagnosis/GetDiagnosisDetailsList"));
//List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>();
//List<object> list = new List<object>();
//lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "ID", HeadText = "编号", Width = 80 });
//lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "诊断", Width = 390 });
//this.ucComboxGrid1.GridColumns = lstCulumns;
//List<object> lstSourceGrid = new List<object>();
//for (int i = 0; i < lst.Count; i++)
//{
// TestGridModel model = new TestGridModel()
// {
// ID = lst[i].ID,
// Name = lst[i].Name,
// };
// lstSourceGrid.Add(model);
//}
//this.ucComboxGrid1.GridDataSource = lstSourceGrid;
}
private void RiChenck_ButtonClick(object sender, EventArgs e)
{
//int index = ((System.Windows.Forms.Control)sender).TabIndex;
//foreach (Control ctrl in panelControl19.Controls)
//{
// if (ctrl is CheckBox)
// {
// if (ctrl.TabIndex == index)
// {
// Distionary.Remove(ctrl.TabIndex.ToString()); ;
// }
// }
//}
//panelControl19.Controls.Clear();
//if (Distionary.Count > 0)
//{
// foreach (var item in Distionary)
// {
// CheckBox checkBox = new CheckBox();
// checkBox.Text = item.Value;
// checkBox.Font = new Font("Tahoma", 13, checkBox.Font.Style);
// checkBox.TabIndex = int.Parse(item.Key);
// checkBox.AutoSize = true;
// checkBox.Checked = true;
// checkBox.Dock = System.Windows.Forms.DockStyle.Left;
// checkBox.Click += RiChenck_ButtonClick;
// panelControl19.Controls.Add(checkBox);
// }
//}
}
/// <summary>
/// 动态添加组件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ucComboxGrid3_SelectedChangedEvent(object sender, EventArgs e)
{
// panelControl19.Controls.Clear();
TestGridModel model = (TestGridModel)sender;
if (!Distionary.ContainsKey(model.ID.ToString()))
{
Distionary.Add(model.ID.ToString(), model.Name);
}
if (Distionary.Count > 0)
{
foreach (var item in Distionary)
{
CheckBox checkBox = new CheckBox();
checkBox.Text = item.Value;
checkBox.Font = new Font("Tahoma", 13, checkBox.Font.Style);
checkBox.TabIndex = int.Parse(item.Key);
checkBox.AutoSize = true;
checkBox.Checked = true;
checkBox.Dock = System.Windows.Forms.DockStyle.Left;
checkBox.Click += RiChenck_ButtonClick;
}
}
}
private void simpleButton1_Click(object sender, EventArgs e)
{
try
{
this.Close();
}
catch (Exception)
{
throw;
}
}
}
}
public class TestGridModel
{
public int ID { get; set; }
public string Name { get; set; }
//public DateTime Birthday { get; set; }
//public int Sex { get; set; }
//public int Age { get; set; }
//public List<TestGridModel> Childrens { get; set; }
}