Example #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CardCenter.Entity.Para_BGLB DataRowToModel(DataRow row)
 {
     CardCenter.Entity.Para_BGLB model = new CardCenter.Entity.Para_BGLB();
     if (row != null)
     {
         if (row["BGLB_Value"] != null)
         {
             model.BGLB_Value = row["BGLB_Value"].ToString();
         }
         if (row["BGLB_Name"] != null)
         {
             model.BGLB_Name = row["BGLB_Name"].ToString();
         }
     }
     return(model);
 }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(CardCenter.Entity.Para_BGLB model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Para_BGLB set ");
            strSql.Append("BGLB_Name=@BGLB_Name");
            strSql.Append(" where BGLB_Value=@BGLB_Value ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BGLB_Name",  SqlDbType.NVarChar, 64),
                new SqlParameter("@BGLB_Value", SqlDbType.NVarChar, 1)
            };
            parameters[0].Value = model.BGLB_Name;
            parameters[1].Value = model.BGLB_Value;

            TranHelper.AddTran(strSql, parameters);
        }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(CardCenter.Entity.Para_BGLB model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Para_BGLB(");
            strSql.Append("BGLB_Value,BGLB_Name)");
            strSql.Append(" values (");
            strSql.Append("@BGLB_Value,@BGLB_Name)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BGLB_Value", SqlDbType.NVarChar, 1),
                new SqlParameter("@BGLB_Name",  SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = model.BGLB_Value;
            parameters[1].Value = model.BGLB_Name;

            TranHelper.AddTran(strSql, parameters);
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CardCenter.Entity.Para_BGLB GetModel(string BGLB_Value)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 BGLB_Value,BGLB_Name from Para_BGLB ");
            strSql.Append(" where BGLB_Value=@BGLB_Value ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BGLB_Value", SqlDbType.NVarChar, 1)
            };
            parameters[0].Value = BGLB_Value;

            CardCenter.Entity.Para_BGLB model = new CardCenter.Entity.Para_BGLB();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }