StableVersion4.3/HL_FristAidPlatform_Base/Form_AccidentLevel.cs

107 lines
3.5 KiB
C#
Raw Permalink Normal View History

2024-03-11 09:47:34 +08:00
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_AccidentLevel : XtraForm
{
public Form_AccidentLevel()
{
InitializeComponent();
}
private void Form_InpatientDepartment_Load(object sender, EventArgs e)
{
GetList();
}
private void btn_Insert_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
Form_AccidentLevelInfo frm = new Form_AccidentLevelInfo(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;
}
if (val == "四级")
{
str = 4;
}
}
List<T_Base_AccidentLevelDTO> list = DBHelpClass.GetList<T_Base_AccidentLevelDTO>(string.Format("api/base/T_Base_AccidentInfo/GetAccidentLevelList?name={0}&AccidentLevel={1}", textEdit1.Text, str));
gridControl1.DataSource = list;
this.gridView1.BestFitColumns();
}
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 LevelName = gridView1.GetRowCellValue(selectRow, "LevelName").ToString();
int AccidentLevel = int.Parse(gridView1.GetRowCellValue(selectRow, "AccidentLevel").ToString(), 0);
string Describe = gridView1.GetRowCellValue(selectRow, "Describe").ToString();
Form_AccidentLevelInfo frm = new Form_AccidentLevelInfo(id, LevelName, AccidentLevel, Describe);
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 = "三级";
if (value == "4")
e.DisplayText = "四级";
}
}
private void btn_Delete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
}
}
}