Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BCW.SSE.Model.SseFastVal model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_SseFastVal set ");
            strSql.Append("fastVal=@fastVal");
            strSql.Append(" where userId=@userId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@fastVal", SqlDbType.NVarChar, 500),
                new SqlParameter("@userId",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.fastVal;
            parameters[1].Value = model.userId;

            int rows = SqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(BCW.SSE.Model.SseFastVal model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_SseFastVal(");
            strSql.Append("userId,fastVal)");
            strSql.Append(" values (");
            strSql.Append("@userId,@fastVal)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userId",  SqlDbType.Int,      4),
                new SqlParameter("@fastVal", SqlDbType.NVarChar, 500)
            };
            parameters[0].Value = model.userId;
            parameters[1].Value = model.fastVal;

            int rows = SqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public BCW.SSE.Model.SseFastVal DataRowToModel(DataRow row)
 {
     BCW.SSE.Model.SseFastVal model = new BCW.SSE.Model.SseFastVal();
     if (row != null)
     {
         if (row["userId"] != null && row["userId"].ToString() != "")
         {
             model.userId = int.Parse(row["userId"].ToString());
         }
         if (row["fastVal"] != null)
         {
             model.fastVal = row["fastVal"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BCW.SSE.Model.SseFastVal GetModel(int userId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 userId,fastVal from tb_SseFastVal ");
            strSql.Append(" where userId=@userId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userId", SqlDbType.Int, 4)
            };
            parameters[0].Value = userId;

            BCW.SSE.Model.SseFastVal model = new BCW.SSE.Model.SseFastVal();
            DataSet ds = SqlHelper.Query(strSql.ToString(), parameters);

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