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"; }
/// <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"; }