/// <summary>
        /// 取得欄位選項的資料
        /// </summary>
        /// <param name="field_id">欄位代號流水號</param>
        /// <returns>取得欄位選項的資料</returns>
        public List<VO.CustomFieldItemVO> SelectByField_id(int field_id)
        {
            SqlParameter[] sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@field_id", SqlDbType.Int);
            sqlParams[0].Value = field_id;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("SELECT field_id, field_item_id, field_item_name, field_item_text ");
            sb.AppendLine("FROM CustomFieldItem WHERE (field_id = @field_id) ");
            SqlConnection aconn = MyConn();
            SqlDataReader MyDataReader = SqlHelper.ExecuteReader(aconn, CommandType.Text, sb.ToString(), sqlParams);

            List<VO.CustomFieldItemVO> myCustomFieldItemVOList = new List<ACMS.VO.CustomFieldItemVO>();

            while (MyDataReader.Read())
            {
                VO.CustomFieldItemVO myCustomFieldItemVO = new ACMS.VO.CustomFieldItemVO();

                myCustomFieldItemVO.field_id = (int)MyDataReader["field_id"];
                myCustomFieldItemVO.field_item_id = (int)MyDataReader["field_item_id"];
                myCustomFieldItemVO.field_item_name = (string)MyDataReader["field_item_name"];
                myCustomFieldItemVO.field_item_text = (string)MyDataReader["field_item_text"];

                myCustomFieldItemVOList.Add(myCustomFieldItemVO);

            }
            MyDataReader.Close();
            aconn.Close();
            if (MyDataReader != null) MyDataReader.Dispose();
            if (aconn != null) aconn.Dispose();
            return myCustomFieldItemVOList;
        }
Esempio n. 2
0
        /// <summary>
        /// 取得欄位選項的資料
        /// </summary>
        /// <param name="field_id">欄位代號流水號</param>
        /// <returns>取得欄位選項的資料</returns>
        public List <VO.CustomFieldItemVO> SelectByField_id(int field_id)
        {
            SqlParameter[] sqlParams = new SqlParameter[1];

            sqlParams[0]       = new SqlParameter("@field_id", SqlDbType.Int);
            sqlParams[0].Value = field_id;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("SELECT field_id, field_item_id, field_item_name, field_item_text ");
            sb.AppendLine("FROM CustomFieldItem WHERE (field_id = @field_id) ");
            SqlConnection aconn        = MyConn();
            SqlDataReader MyDataReader = SqlHelper.ExecuteReader(aconn, CommandType.Text, sb.ToString(), sqlParams);

            List <VO.CustomFieldItemVO> myCustomFieldItemVOList = new List <ACMS.VO.CustomFieldItemVO>();

            while (MyDataReader.Read())
            {
                VO.CustomFieldItemVO myCustomFieldItemVO = new ACMS.VO.CustomFieldItemVO();

                myCustomFieldItemVO.field_id        = (int)MyDataReader["field_id"];
                myCustomFieldItemVO.field_item_id   = (int)MyDataReader["field_item_id"];
                myCustomFieldItemVO.field_item_name = (string)MyDataReader["field_item_name"];
                myCustomFieldItemVO.field_item_text = (string)MyDataReader["field_item_text"];

                myCustomFieldItemVOList.Add(myCustomFieldItemVO);
            }
            MyDataReader.Close();
            aconn.Close();
            if (MyDataReader != null)
            {
                MyDataReader.Dispose();
            }
            if (aconn != null)
            {
                aconn.Dispose();
            }
            return(myCustomFieldItemVOList);
        }