private void buttonOK_Click(object sender, EventArgs e) { if ((lookUpEditorDepart.DisplayValue != null) && (lookUpEditorDepart.DisplayValue != "")) { string getDeptWards = @"select * from ( SELECT a.id||b.id FLOWID , a.id DEPTID, b.id WARDID, a.name DEPTNAME , b.name WardName FROM department a, ward b, dept2ward c WHERE a.id = c.deptid and b.id = c.wardid and a.valid = '1' and b.valid = '1' ORDER BY a.name) where FLOWID=" + "'" + lookUpEditorDepart.CodeValue.ToString() + "'"; DataTable dt = ((IEmrHost)FormMain.Instance).SqlHelper.ExecuteDataTable(getDeptWards); if (dt.Rows.Count > 0) { DeptWardInfo newDeptWardInfo = new DeptWardInfo(dt.Rows[0]["DeptID"].ToString().Trim(), dt.Rows[0]["DeptName"].ToString().Trim(), dt.Rows[0]["WardID"].ToString().Trim(), dt.Rows[0]["WardName"].ToString().Trim()); _selectDept = newDeptWardInfo; this.DialogResult = DialogResult.OK; } else { FormMain.Instance.MessageShow("请选择病区!", CustomMessageBoxKind.InformationOk); } } else { FormMain.Instance.MessageShow("请选择病区!", CustomMessageBoxKind.InformationOk); } }
void tsddbdeptward_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { DeptWardInfo dwi = (DeptWardInfo)e.ClickedItem.Tag; if (dwi != null) { (sender as ToolStripDropDownButton).Text = dwi.ToString(); } }
private void buttonOK_Click(object sender, EventArgs e) { if (this.comboBoxEdit_Dt.SelectedItem != null && this.comboBoxEdit_Dt.SelectedItem is DeptWardInfo) { this._selectDept = (DeptWardInfo)this.comboBoxEdit_Dt.SelectedItem; base.DialogResult = DialogResult.OK; } else { FormMain.Instance.MessageShow("请选择病区!", CustomMessageBoxKind.InformationOk); } }
private void InitWardInfo() { try { string config = AppConfigReader.GetAppConfig("ChangeWardLookAllWard").Config; string[] array = config.Split(new char[] { ',' }); string[] array2 = FormMain.Instance.User.GWCodes.Split(new char[] { ',' }); bool flag = false; string commandText = "select id from jobs "; ArrayList arrayList = new ArrayList(); DataTable dataTable = ((IEmrHost)FormMain.Instance).SqlHelper.ExecuteDataTable(commandText); if (dataTable.Rows.Count > 0) { for (int i = 0; i < dataTable.Rows.Count; i++) { arrayList.Add(dataTable.Rows[i]["ID"].ToString()); } } string[] array3 = array; for (int j = 0; j < array3.Length; j++) { string text = array3[j]; string[] array4 = array2; for (int k = 0; k < array4.Length; k++) { string b = array4[k]; if (text == b && text != "") { if (arrayList.Contains(text)) { flag = true; } } } } if (flag) { string commandText2 = "SELECT a.id deptid, a.name deptname, b.id wardid, b.name wardname \r\n FROM department a, ward b, dept2ward c\r\n WHERE a.id = c.deptid and b.id = c.wardid and a.valid = '1' and b.valid = '1'\r\n ORDER BY a.name "; DataTable dataTable2 = ((IEmrHost)FormMain.Instance).SqlHelper.ExecuteDataTable(commandText2); foreach (DataRow dataRow in dataTable2.Rows) { DeptWardInfo current = new DeptWardInfo(dataRow["deptid"].ToString(), dataRow["deptname"].ToString(), dataRow["wardid"].ToString(), dataRow["wardname"].ToString()); this.comboBoxEdit_Dt.Properties.Items.Add(current); } } else { foreach (DeptWardInfo current in FormMain.Instance.User.RelateDeptWards) { this.comboBoxEdit_Dt.Properties.Items.Add(current); } } } catch (SqlException message) { FormMain.Instance.Logger.Error(message); } catch (Exception message2) { FormMain.Instance.Logger.Error(message2); } }