Beispiel #1
0
        /// <summary>
        /// 添加新闻栏目,执行成功返回true,否则返回false
        /// </summary>
        /// <param name="name">栏目名称</param>
        /// <returns>true,false</returns>
        public bool AddBigClass(string name)
        {
            int    cindex = GetMaxCindex() + 1;
            string strSQL = "insert into BigClass (name,cindex) values ('" + name + "'," + cindex + ")";

            return(db.ExecuteNonQuery(false, strSQL));
        }
Beispiel #2
0
        /// <summary>
        /// 添加新闻,添加成功返回true,否则返回false
        /// </summary>
        /// <param name="M_news">参数</param>
        /// <returns>bool值</returns>
        public bool AddNews(Model.news M_news)
        {
            string times  = System.DateTime.Now.ToString();
            int    cindex = GetMaxCindex() + 1;
            string strSQL = "insert news (title,info,BigClassID,username,infotime,cindex) values('" + M_news.title + "','" + M_news.info + "'," + M_news.BigClassID + ",'" + M_news.username + "','" + times + "', " + cindex + " )";

            return(db.ExecuteNonQuery(false, strSQL));
        }
Beispiel #3
0
        /// <summary>
        /// 添加管理员用户,语句执行成功返回true,否则返回false
        /// </summary>
        /// <param name="del_ad">实体层类的对象</param>
        /// <returns>true,false</returns>
        public bool AddUser(Model.admin del_ad)
        {
            string strSQL = "insert into admin (username,password,email,aleave) values ('" + del_ad.username + "','" + del_ad.password + "','" + del_ad.useremail + "','" + del_ad.aleave + "')";

            return(db.ExecuteNonQuery(false, strSQL));
        }
Beispiel #4
0
        /// <summary>
        /// 根据新闻ID删除该新闻的全部评论
        /// </summary>
        /// <param name="NewsID">新闻ID</param>
        /// <returns>true,false</returns>
        public bool DeleteAllByNewsID(int NewsID)
        {
            string strSQL = "delete from answer where newsID=" + NewsID;

            return(db.ExecuteNonQuery(false, strSQL));
        }