using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HL_FristAidPlatform_Base { public partial class Form_Accident : XtraForm { public Form_Accident() { InitializeComponent(); } private void Form_InpatientDepartment_Load(object sender, EventArgs e) { GetList(); } private void btn_Insert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Form_AccidentInfo frm = new Form_AccidentInfo(0, "", 0); frm.Owner = this; frm.Show(); } public void GetList() { int str = 0; if (!string.IsNullOrEmpty(comboBoxEdit1.EditValue+"")) { string val = comboBoxEdit1.EditValue + ""; if (val == "一级") { str = 1; } if (val == "二级") { str = 2; } if (val == "三级") { str = 3; } } List list = DBHelpClass.GetList(string.Format("api/base/T_Base_AccidentInfo/GetList?name={0}&AccidentLevel={1}", textEdit1.Text, str)); gridControl1.DataSource = list; } private void btn_Select_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { GetList(); } private void btn_Update_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.DataRowCount > 0) { int selectRow = gridView1.GetSelectedRows()[0]; int id = int.Parse(gridView1.GetRowCellValue(selectRow, "ID").ToString(), 0); string ParentName = gridView1.GetRowCellValue(selectRow, "ParentName").ToString(); int AccidentLevel = int.Parse(gridView1.GetRowCellValue(selectRow, "AccidentLevel").ToString(), 0); Form_AccidentInfo frm = new Form_AccidentInfo(id, ParentName, AccidentLevel); frm.Owner = this; frm.Show(); } } private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "AccidentLevel") { string value = e.Value.ToString(); if (value == "1") e.DisplayText = "一级"; if (value == "2") e.DisplayText = "二级"; if (value == "3") e.DisplayText = "三级"; } } private void btn_Delete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { } } }