/// <summary> /// 查询 /// </summary> void Query() { try { if (this.dtmBegin.Text.Trim() == "" || this.dtmEnd.Text.Trim() == "") { MessageBox.Show("请输入查询开始时间和结束时间", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DateTime beginTime = Convert.ToDateTime(this.dtmBegin.Text + " 00:00:00"); DateTime endTime = Convert.ToDateTime(this.dtmEnd.Text + " 23:59:59"); if (beginTime > endTime) { MessageBox.Show("开始时间不能大于结束时间", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.Cursor = Cursors.WaitCursor; using (clsBIHOrderService svc = new clsDcl_GetSvcObject().m_GetOrderSvcObject()) { DataSource = svc.GetCureMed(beginTime.ToString("yyyy-MM-dd HH:mm:ss"), endTime.ToString("yyyy-MM-dd HH:mm:ss")); this.dgvData.DataSource = DataSource; this.SetRowBackColor(); } DataSourceDept.Clear(); this.cboDept.Items.Clear(); List <string> lstDeptId = new List <string>(); if (DataSource != null && DataSource.Count > 0) { DataSourceDept.Add(new EntityDept() { deptId = "00", deptName = "全 院" }); EntityDept vo = null; foreach (EntityCureMed item in DataSource) { vo = new EntityDept(); vo.deptId = item.deptId; vo.deptName = item.deptName; if (lstDeptId.IndexOf(vo.deptId) < 0) { lstDeptId.Add(vo.deptId); DataSourceDept.Add(vo); } } } foreach (EntityDept item in DataSourceDept) { this.cboDept.Items.Add(item.deptName); } } catch (Exception ex) { MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { this.Cursor = Cursors.Default; } }