/// <summary> /// 通过文章id修改文章 /// </summary> /// <param name="title"></param> /// <param name="content"></param> /// <param name="aname"></param> /// <returns></returns> public static bool RePubArticleById(string title, string content, string aname, int nid) { string zhaiyao = content.Length > 50 ? content.Substring(0, 50) : content;//摘要 string pubtime = Now_User.GetNowTime(); if (aname == "") { aname = "未分类"; } string sql = "UPDATE news SET " + "ntitle=" + "'" + title + "'," + "ncontent=" + "'" + content + "'," + "nkey=" + "'" + zhaiyao + "'," + "aname=" + "'" + aname + "'," + "ndate=" + "'" + pubtime + "' " + " WHERE nid=" + nid; int result = SSMS.ExecuteCommand(sql); if (result > 0) { return(true); } else { return(false); } }
/// <summary> /// 通过文章id添加新回复 /// </summary> /// <param name="title"></param> /// <param name="huifu"></param> /// <param name="aid"></param> /// <returns></returns> public static bool AddNewComment(string title, string huifu, int blogid, int id) { //id=0,为游客 string sql = "INSERT comment(id,huifu,Publictime,blogid,title)" + " VALUES(" + id + ",'" + huifu + "','" + Now_User.GetNowTime() + "'," + blogid + ",'" + title + "')"; sql += " ; SELECT @@IDENTITY"; int result = SSMS.GetScalar(sql); if (result > 0) { return(true); } else { return(false); } }
/// <summary> /// 通过用户uid添加新友链 /// </summary> /// <returns></returns> public static bool AddNewFLink(string title, string href, int uid) { //id=0,为游客 string sql = "INSERT FriendLink(ltitle,lhref,fltime,luid)" + " VALUES('" + title + "','" + href + "','" + Now_User.GetNowTime() + "'," + uid + ")"; sql += " ; SELECT @@IDENTITY"; int result = SSMS.GetScalar(sql); if (result > 0) { return(true); } else { return(false); } }
/// <summary> /// 通过评论id修改评论 /// </summary> /// <param name="title"></param> /// <param name="huifu"></param> /// <param name="Cid"></param> /// <returns></returns> public static bool UpdateCommentByCid(string title, string huifu, int Cid) { string Publictime = Now_User.GetNowTime(); int uid = Now_User.now_user_id; string sql = "UPDATE comment SET " + "title=" + "'" + title + "'," + "huifu=" + "'" + huifu + "'," + "Publictime=" + "'" + Publictime + "' " + " WHERE cid=" + Cid; int result = SSMS.ExecuteCommand(sql); if (result > 0) { return(true); } else { return(false); } }
/// <summary> /// 添加新文章(当前用户id和用户名已知) /// </summary> /// <returns></returns> public static bool AddNewArticle(string content, string title, string type) { if (type == "") { type = "未分类"; } string zhaiyao = content.Length > 50 ? content.Substring(0, 50) : content; string pubtime = Now_User.GetNowTime(); string sql = "INSERT news(id,ntitle,nkey,ncontent,ndate,aname) " + "VALUES('" + Now_User.now_user_id + "','" + title + "','" + zhaiyao + "','" + content + "','" + pubtime + "','" + type + "')"; sql += " ; SELECT @@IDENTITY"; int newid = SSMS.GetScalar(sql); if (newid > 0) { return(true); } else { return(false); } }