private void BindCbo() { SysLookUpCodeInfo bCode = new SysLookUpCodeInfo(); SysLookupCodeModel mCode = new SysLookupCodeModel(); mCode.TableName = "BAS_ROOM_INFO"; mCode.ColumnName = "STATUS"; oCtrl.Reset(); oCtrl.Add(MCtrl.ByTableName); oCtrl.Add(MCtrl.ByColumnName); List<SysLookupCodeModel> listRoomCode = bCode.GetSysLookUpCode(mCode, oCtrl); if (cmn.CheckEOF(listRoomCode)) { SysLookupCodeModel mc = new SysLookupCodeModel(); mc.CodeNo = "A"; mc.CodeDesc = "所有房间"; listRoomCode.Insert(0, mc); cboRoomStatus.DataSource = listRoomCode; cboRoomStatus.DisplayMember = "CodeDesc"; cboRoomStatus.ValueMember = "CodeNo"; } cboPayType.DataSource = listCodePay; cboPayType.DisplayMember = "CodeDesc"; cboPayType.ValueMember = "CodeNo"; }
private void BindCbo() { SysLookupCodeModel mCode = new SysLookupCodeModel(); mCode.CodeNo = "A"; mCode.CodeDesc = "所有宾客"; listCode.Insert(0, mCode); cboStayStaus.DataSource = listCode; cboStayStaus.DisplayMember = "CodeDesc"; cboStayStaus.ValueMember = "CodeNo"; }
/// <summary> /// 绑定系统代码与描述.用于ComboBox的显示与选取. /// </summary> /// <param name="cboTarget"></param> /// <param name="sTableName"></param> /// <param name="sColumnName"></param> public void BindCodeInfo(ComboBox cboTarget, string sTableName, string sColumnName) { SysLookUpCodeInfo bSysLookupCode = new SysLookUpCodeInfo(); SysLookupCodeModel mSysLookupCode = new SysLookupCodeModel(); mSysLookupCode.TableName = sTableName; mSysLookupCode.ColumnName = sColumnName; ObjectControls oLookCode = new ObjectControls(); oLookCode.Add(MCtrl.ByColumnName); oLookCode.Add(MCtrl.ByTableName); cboTarget.DataSource = bSysLookupCode.GetSysLookUpCode(mSysLookupCode, oLookCode); cboTarget.DisplayMember = "CodeDesc"; cboTarget.ValueMember = "CodeNo"; }
public List<SysLookupCodeModel> GetSysLookUpCode(SysLookupCodeModel mSysLookupCode,ObjectControls oCtrl) { string sql = "SELECT A.CODE_ID,A.CODE_NO,A.TABLE_NAME,A.COLUMN_NAME,A.CODE_DESC FROM SYS_LOOKUP_CODE A WHERE 1=1"; oCtrl.Helper(oCtrl.Exsit(MCtrl.ByCodeId) && oCtrl.Append(ref sql, " AND A.CODE_ID=" +mSysLookupCode.CodeId)); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByCodeNo) && oCtrl.Append(ref sql, " AND A.CODE_NO=" + SQL(mSysLookupCode.CodeNo))); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByTableName) && oCtrl.Append(ref sql, " AND A.TABLE_NAME=" + SQL(mSysLookupCode.TableName))); oCtrl.Helper(oCtrl.Exsit(MCtrl.ByColumnName) && oCtrl.Append(ref sql, " AND A.COLUMN_NAME=" + SQL(mSysLookupCode.ColumnName))); sdr = ExecuteReader(sql); List<SysLookupCodeModel> listLookupCode = new List<SysLookupCodeModel>(); using (sdr) { while (sdr.Read()) { SysLookupCodeModel mCode = new SysLookupCodeModel(); mCode.CodeId = ToInt32(sdr["CODE_ID"]); mCode.CodeNo = ToString(sdr["CODE_NO"]); mCode.TableName = ToString(sdr["TABLE_NAME"]); mCode.ColumnName = ToString(sdr["COLUMN_NAME"]); mCode.CodeDesc = ToString(sdr["CODE_DESC"]); listLookupCode.Add(mCode); } } return listLookupCode; }
/// <summary> /// 根据编号表名列名,获取对应的描述 /// </summary> /// <param name="sTableName"></param> /// <param name="sColumn"></param> /// <param name="sCodeNo"></param> /// <returns></returns> public string ToLookupCodeDesc(string sTableName, string sColumn, string sCodeNo) { SysLookupCodeModel mCode = new SysLookupCodeModel(); mCode.TableName = sTableName; mCode.ColumnName = sColumn; mCode.CodeNo = sCodeNo; ObjectControls oCtrl = new ObjectControls(); oCtrl.Add(MCtrl.ByCodeNo); oCtrl.Add(MCtrl.ByColumnName); oCtrl.Add(MCtrl.ByTableName); List<SysLookupCodeModel> listLookUpCode = bLookUpCode.GetSysLookUpCode(mCode, oCtrl); if (Cmn.CheckEOF(listLookUpCode)) { return listLookUpCode[0].CodeDesc; } return string.Empty; }
public List<SysLookupCodeModel> GetCodeDesc(string sTable, string sColumn) { SysLookupCodeModel mSysLookupCode = new SysLookupCodeModel(); mSysLookupCode.TableName = sTable; mSysLookupCode.ColumnName = sColumn; ObjectControls oLookCode = new ObjectControls(); oLookCode.Add(MCtrl.ByColumnName); oLookCode.Add(MCtrl.ByTableName); return bLookUpCode.GetSysLookUpCode(mSysLookupCode, oLookCode); }
/// <summary> /// 获取系统代码描述 /// </summary> /// <param name="mSysLookupCode"></param> /// <param name="oCtrl"></param> /// <returns></returns> public List<SysLookupCodeModel> GetSysLookUpCode(SysLookupCodeModel mSysLookupCode, ObjectControls oCtrl) { return dSysLookupCode.GetSysLookUpCode(mSysLookupCode, oCtrl); }