Beispiel #1
0
        public List<CodeMasterInfo> FindRecord(CodeMasterFindInfo codeMasterFindInfo)
        {
            string sqlString = string.Empty;
            string sqlWhere = string.Empty;

            if (codeMasterFindInfo == null)
            {
                return null;
            }

            sqlWhere = " WHERE 1=1 ";
            if (codeMasterFindInfo.CmtCKey1.Trim() != "")
            {
                sqlWhere += " AND " + this._dataBaseDic[CodeMasterInfoEnum.CmtCKey1.ToString()] + "='" + codeMasterFindInfo.CmtCKey1.Replace("'", "''") + "'";
            }
            if (codeMasterFindInfo.CmtCKey2.Trim() != "")
            {
                sqlWhere += " AND " + this._dataBaseDic[CodeMasterInfoEnum.CmtCKey2.ToString()] + "='" + codeMasterFindInfo.CmtCKey2.Replace("'", "''") + "'";
            }
            if (codeMasterFindInfo.CmtCValue.Trim() != "")
            {
                sqlWhere += " AND " + this._dataBaseDic[CodeMasterInfoEnum.CmtCValue.ToString()] + "='" + codeMasterFindInfo.CmtCValue.Replace("'", "''") + "'";
            }

            sqlString = "SELECT * FROM " + this._dataBaseDic[CodeMasterInfoEnum.TableName.ToString()] + sqlWhere;

            DataBaseCommand<CodeMasterInfo> dbCommand = new DataBaseCommand<CodeMasterInfo>();
            List<CodeMasterInfo> codeMasterList=null;

            try
            {
                //codeMasterList = dbCommand.GetRecordList(sqlString, DataBaseDictionary.Instance.GetCodeMasterDBD());
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            return codeMasterList;
        }
Beispiel #2
0
        /// <summary>
        /// 从字码主档中获得Combobox数据列表
        /// </summary>
        /// <param name="codeMasterKey1">主键一</param>
        /// <returns></returns>
        public List<ComboboxDataInfo> GetComboboxDataInfoListFromCodeMaster(string codeMasterKey1)
        {
            List<ComboboxDataInfo> comboboxDataInfoList = null;
            List<CodeMasterInfo> codeMasterInfoList = null;
            CodeMasterFindInfo codeMasterFindInfo = new CodeMasterFindInfo();
            ICodeMasterDA iCodeMasterDA = null;

            codeMasterFindInfo.CmtCKey1 = codeMasterKey1;

            iCodeMasterDA = CodeMasterDAFactory.Instance.GetCodeMasterDA();

            try
            {
                codeMasterInfoList = iCodeMasterDA.FindRecord(codeMasterFindInfo);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            if (codeMasterInfoList != null)
            {
                if (codeMasterInfoList.Count > 0)
                {
                    ComboboxDataInfo comboboxDataInfo = null;
                    comboboxDataInfoList = new List<ComboboxDataInfo>();
                    for (int i = 0; i < codeMasterInfoList.Count; i++)
                    {
                        comboboxDataInfo = new ComboboxDataInfo();
                        comboboxDataInfo.DisplayMember = codeMasterInfoList[i].CmtCValue;
                        comboboxDataInfo.ValueMember = codeMasterInfoList[i].CmtCKey2;

                        comboboxDataInfoList.Add(comboboxDataInfo);
                    }
                }
            }

            return comboboxDataInfoList;
        }