using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Windows.Forms; namespace HL_FristAidPlatform_PreHospitalEmergency { public partial class Form_DrugExamine : XtraForm { public Form_DrugExamine() { InitializeComponent(); } private void Form_DrugExamine_Load(object sender, EventArgs e) { QueryDate(); } public void QueryDate() { string Url = string.Format("api/service/T_Service_FirstAid_DrugManagement/GetGrugExamineList?hospitalGuid={0}", Information.Hospital.GUID); DataTable ResultDT = DBHelpClass.Get(Url); gridControl1.DataSource = ResultDT;//显示分页结果 gridView1.Appearance.EvenRow.BackColor = Color.FromArgb(245, 245, 245); gridView1.Appearance.OddRow.BackColor = Color.FromArgb(255, 255, 255); gridView1.OptionsView.EnableAppearanceEvenRow = true; gridView1.OptionsView.EnableAppearanceOddRow = true; } private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (gridView1.GetRow(e.RowHandle) == null) { return; } else { if (e.Column.FieldName == "TermOfValidity") { DateTime dt = Convert.ToDateTime(gridView1.GetRowCellValue(e.RowHandle, "TermOfValidity").ToString()); int days = new TimeSpan(dt.Ticks - DateTime.Now.Ticks).Days; if (days <= 30) //条件判断 { e.Appearance.BackColor = Color.LightSkyBlue; e.Appearance.ForeColor = Color.White; } if (dt < DateTime.Now) { e.Appearance.BackColor = Color.PaleVioletRed; e.Appearance.ForeColor = Color.White; } } } } private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { int selectRow = gridView1.GetSelectedRows()[0]; if (selectRow <= -1) { MessageBox.Show("请先选中一行数据"); return; } string managementGUID = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "ManagementGUID"), ""); List list = new List(); AuditDTO dto = new AuditDTO(); dto.GUID = managementGUID; dto.ReviewerUserID = Information.User.ID; switch (e.Button.Caption) { case "审核通过": DialogResult dr = XtraMessageBox.Show("是否确定审核通过", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { dto.Type = 1; } break; case "审核不通过": DialogResult dr1 = XtraMessageBox.Show("是否确定审不核通过", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr1 == DialogResult.Yes) { dto.Type = 2; } break; } if (dto.Type <= 0) return; list.Add(dto); string Url = "api/service/FristAidTran/ExamineGrug"; //初始化两个工厂 ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); //访问 ListEntity t = client.Post(Url, list); if (t.Success) { MessageBox.Show("操作成功"); QueryDate(); } else { MessageBox.Show("操作失败"); } } catch (Exception) { throw; } } } }