예제 #1
0
        /// <summary>
        /// 获取投注方式
        /// </summary>
        /// <param name="code">代码</param>
        /// <returns>投注方式对象</returns>
        public virtual TBBetMode Get(string code)
        {
            TBBetMode tbBetMode = null;

            try
            {
                string strSQL = "select * from TBBetMode where code=@code";
                Param  param  = new Param();
                param.Clear();
                param.Add("@code", code);
                db.Open();
                ComDataReader dr = db.ExecuteReader(CommandType.Text, strSQL, param);
                if (dr.Read())
                {
                    tbBetMode = ReadData(dr);
                }
                dr.Close();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                db.Close();
            }
            return(tbBetMode);
        }
예제 #2
0
        /// <summary>
        /// 读取投注方式信息
        /// </summary>
        /// <param name="dr">记录指针</param>
        /// <returns>投注方式对象</returns>
        protected virtual TBBetMode ReadData(ComDataReader dr)
        {
            TBBetMode tbBetMode = new TBBetMode();

            tbBetMode.code = dr["code"].ToString(); //代码
            tbBetMode.name = dr["name"].ToString(); //名称
            return(tbBetMode);
        }
예제 #3
0
        /// <summary>
        /// 修改投注方式
        /// </summary>
        /// <param name="data">数据库连接</param>
        /// <param name="tbBetMode">投注方式</param>
        public virtual void Edit(DataAccess data, TBBetMode tbBetMode)
        {
            string strSQL = "update TBBetMode set name=@name where code=@code";
            Param  param  = new Param();

            param.Clear();
            param.Add("@name", tbBetMode.name); //名称
            param.Add("@code", tbBetMode.code); //代码
            data.ExecuteNonQuery(CommandType.Text, strSQL, param);
        }
예제 #4
0
        protected DataAccess db = new DataAccess(DataAccess.DBConn);//数据库连接

        #region 代码生成器自动生成


        /// <summary>
        /// 增加投注方式
        /// </summary>
        /// <param name="data">数据库连接</param>
        /// <param name="tbBetMode">投注方式</param>
        public virtual void Add(DataAccess data, TBBetMode tbBetMode)
        {
            string strSQL = "insert into TBBetMode (code,name) values (@code,@name)";
            Param  param  = new Param();

            param.Clear();
            param.Add("@code", tbBetMode.code); //代码
            param.Add("@name", tbBetMode.name); //名称
            data.ExecuteNonQuery(CommandType.Text, strSQL, param);
        }
예제 #5
0
 /// <summary>
 /// 修改投注方式
 /// </summary>
 /// <param name="tbBetMode">投注方式</param>
 public virtual void Edit(TBBetMode tbBetMode)
 {
     try
     {
         db.Open();
         Edit(db, tbBetMode);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         db.Close();
     }
 }