/// <summary> /// 初始化科室 /// edit by Yanqiao.Cai 2012-11-06 /// add try ... catch /// </summary> private void InitDepartment() { try { lookUpWindowDepartment.SqlHelper = m_app.SqlHelper; #region old //string sql = string.Format(@"select DEPT_ID ID,DEPT_NAME NAME,py,wb from EMRDEPT a"); //DataTable Dept = m_app.SqlHelper.ExecuteDataTable(sql); SQLManger sqlmanger = new SQLManger(m_app); //edit by cyq 2013-02-19 edit by cyq 2013-03-08 //DataTable Dept = sqlmanger.GetSubDeptListByUser(); DataTable Dept = sqlmanger.GetDeptListByUser(); m_depts = Dept; Dept.Columns["ID"].Caption = "科室代码"; Dept.Columns["NAME"].Caption = "科室名称"; Dictionary <string, int> cols = new Dictionary <string, int>(); cols.Add("ID", 80); cols.Add("NAME", 188); SqlWordbook deptWordBook = new SqlWordbook("querybook", Dept, "ID", "NAME", cols, "ID//NAME//PY//WB"); lookUpEditorDepartment.SqlWordbook = deptWordBook; lookUpEditorDepartment.CodeValue = "0000"; #endregion } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 初始化科室 /// edit by Yanqiao.Cai 2012-11-06 /// add try ... catch /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDepartment() { try { lookUpWindowDepartment.SqlHelper = m_app.SqlHelper; #region //string sql = string.Format(@"select DEPT_ID ID,DEPT_NAME NAME,py,wb from EMRDEPT a"); //DataTable Dept = m_app.SqlHelper.ExecuteDataTable(sql); DataTable Dept = m_SqlManger.GetDeptListByUser(); Dept.Columns["ID"].Caption = "科室编码"; Dept.Columns["NAME"].Caption = "科室名称"; Dictionary <string, int> cols = new Dictionary <string, int>(); cols.Add("ID", 60); cols.Add("NAME", 90); SqlWordbook deptWordBook = new SqlWordbook("querybook", Dept, "ID", "NAME", cols, "ID//NAME//PY//WB"); lookUpEditorDepartment.SqlWordbook = deptWordBook; lookUpEditorDepartment.CodeValue = "0000"; btn_Query.Focus(); //if (Dept.Rows.Count == 0) // btn_Query.Enabled = false; #endregion } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }