Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TravelAgent.Model.TourComment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TourComment set ");
            strSql.Append(" contents=@contents,comment_type=@comment_type,comment_rel_id=@comment_rel_id,user_id=@user_id,nickname=@nickname,create_time=@create_time");

            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@contents",       SqlDbType.VarChar,   100),
                new SqlParameter("@comment_type",   SqlDbType.Int,        11),
                new SqlParameter("@comment_rel_id", SqlDbType.Int,        11),
                new SqlParameter("@user_id",        SqlDbType.Int,        11),
                new SqlParameter("@nickname",       SqlDbType.VarChar,   100),
                new SqlParameter("@create_time",    SqlDbType.DateTime),
                new SqlParameter("@id",             SqlDbType.Int, 10)
            };
            parameters[0].Value = model.contents;
            parameters[1].Value = model.comment_type;
            parameters[2].Value = model.comment_rel_id;
            parameters[3].Value = model.user_id;
            parameters[4].Value = model.nickname;
            parameters[5].Value = model.create_time;
            parameters[6].Value = model.id;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(TravelAgent.Model.TourComment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TourComment(");
            strSql.Append(" contents,comment_type,comment_rel_id,user_id,nickname,create_time)");
            strSql.Append(" values (");
            strSql.Append("  @contents,@comment_type,@comment_rel_id,@user_id,@nickname,@create_time)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@contents",       SqlDbType.VarChar, 100),
                new SqlParameter("@comment_type",   SqlDbType.Int,      11),
                new SqlParameter("@comment_rel_id", SqlDbType.Int,      11),
                new SqlParameter("@user_id",        SqlDbType.Int,      11),
                new SqlParameter("@nickname",       SqlDbType.VarChar, 100),
                new SqlParameter("@create_time",    SqlDbType.DateTime)
            };

            parameters[0].Value = model.contents;
            parameters[1].Value = model.comment_type;
            parameters[2].Value = model.comment_rel_id;
            parameters[3].Value = model.user_id;
            parameters[4].Value = model.nickname;
            parameters[5].Value = model.create_time;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 3
0
        public List <TravelAgent.Model.TourComment> GetList(int comment_rel_id)
        {
            List <TravelAgent.Model.TourComment> dt = new List <Model.TourComment>();
            string    sql = string.Format("select * from TourComment where comment_rel_id='{0}' order by id desc ", comment_rel_id);
            DataTable dts = DbHelperSQL.Query(sql).Tables[0];

            for (int i = 0; i < dts.Rows.Count; i++)
            {
                int sid = Convert.ToInt32(dts.Rows[i]["id"]);
                TravelAgent.Model.TourComment ty = GetModel(sid);
                dt.Add(ty);
            }
            return(dt);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 取得所有游记列表
        /// </summary>
        /// <param name="PId">父ID</param>
        /// <param name="KId">种类ID</param>
        /// <returns></returns>
        public List <TravelAgent.Model.TourComment> GetList()
        {
            List <TravelAgent.Model.TourComment> dt = new List <Model.TourComment>();
            string    sql = "select * from TourComment ";
            DataTable dts = DbHelperSQL.Query(sql).Tables[0];

            for (int i = 0; i < dts.Rows.Count; i++)
            {
                int sid = Convert.ToInt32(dts.Rows[i]["id"]);
                TravelAgent.Model.TourComment ty = GetModel(sid);
                dt.Add(ty);
            }
            return(dt);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TravelAgent.Model.TourComment model)
 {
     TourGuideDAL.Update(model);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TravelAgent.Model.TourComment model)
 {
     TourGuideDAL.Add(model);
     return(TourGuideDAL.GetMaxID("Id"));
 }