/// <summary> /// 初始化身份列表 /// </summary> private void InitIdentityDictList() { if (this.cboIdentity == null || this.cboIdentity.IsDisposed) { return; } if (this.cboIdentity.Items.Count > 0) { return; } //加载科室列表 List <IDentityDictInfo> lstIDentityDictInfos = null; if (EMRDBAccess.Instance.GetIdentityDictInfos(ref lstIDentityDictInfos) != SystemData.ReturnValue.OK) { MessageBoxEx.Show("身份列表下载失败!"); return; } if (lstIDentityDictInfos == null || lstIDentityDictInfos.Count <= 0) { return; } for (int index = 0; index < lstIDentityDictInfos.Count; index++) { IDentityDictInfo iDentityDictInfo = lstIDentityDictInfos[index]; this.cboIdentity.Items.Add(iDentityDictInfo); } }
public short GetIdentityDictInfos(ref List <IDentityDictInfo> lstIDentityDictInfo) { string szField = string.Format("{0},{1},{2}" , SystemData.IDentityDicView.SERIAL_NO, SystemData.IDentityDicView.IDENTITY_CODE , SystemData.IDentityDicView.IDENTITY_NAME ); string szSQL = string.Format(SystemData.SQL.SELECT_FROM, szField, SystemData.DataView.IDENTITY_DICT_V ); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (lstIDentityDictInfo == null) { lstIDentityDictInfo = new List <IDentityDictInfo>(); } do { IDentityDictInfo iDentityDictInfo = new IDentityDictInfo(); if (!dataReader.IsDBNull(0)) { iDentityDictInfo.SerialNo = int.Parse(dataReader.GetValue(0).ToString()); } if (!dataReader.IsDBNull(1)) { iDentityDictInfo.IdentityCode = dataReader.GetString(1); } if (!dataReader.IsDBNull(2)) { iDentityDictInfo.IdentityName = dataReader.GetString(2); } lstIDentityDictInfo.Add(iDentityDictInfo); } while (dataReader.Read()); return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("EMRDBAccess.GetChargeTypeDictInfos", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { if (dataReader != null) { dataReader.Close(); dataReader.Dispose(); dataReader = null; } base.MedQCAccess.CloseConnnection(false); } }