Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(CZB.Model.TB_MessageRecord model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_MessageRecord(");
            strSql.Append("Id,SendPhone,SendContent,SendTime,SendCode)");
            strSql.Append(" values (");
            strSql.Append("@Id,@SendPhone,@SendContent,@SendTime,@SendCode)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",          SqlDbType.NVarChar,   50),
                new SqlParameter("@SendPhone",   SqlDbType.NVarChar,   50),
                new SqlParameter("@SendContent", SqlDbType.NVarChar,  500),
                new SqlParameter("@SendTime",    SqlDbType.DateTime),
                new SqlParameter("@SendCode",    SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.SendPhone;
            parameters[2].Value = model.SendContent;
            parameters[3].Value = model.SendTime;
            parameters[4].Value = model.SendCode;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CZB.Model.TB_MessageRecord model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_MessageRecord set ");
            strSql.Append("SendPhone=@SendPhone,");
            strSql.Append("SendContent=@SendContent,");
            strSql.Append("SendTime=@SendTime,");
            strSql.Append("SendCode=@SendCode");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SendPhone",   SqlDbType.NVarChar,   50),
                new SqlParameter("@SendContent", SqlDbType.NVarChar,  500),
                new SqlParameter("@SendTime",    SqlDbType.DateTime),
                new SqlParameter("@SendCode",    SqlDbType.NVarChar,   50),
                new SqlParameter("@Id",          SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.SendPhone;
            parameters[1].Value = model.SendContent;
            parameters[2].Value = model.SendTime;
            parameters[3].Value = model.SendCode;
            parameters[4].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DataSet GetModel(string Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,SendPhone,SendContent,SendTime,SendCode from TB_MessageRecord ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = Id;

            CZB.Model.TB_MessageRecord model = new CZB.Model.TB_MessageRecord();
            return(DbHelperSQL.Query(strSql.ToString(), parameters));
        }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CZB.Model.TB_MessageRecord model)
 {
     return(dal.Update(model));
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(CZB.Model.TB_MessageRecord model)
 {
     return(dal.Add(model));
 }