/// <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="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> /// 用户注册 /// </summary> /// <returns></returns> public static int User_Regist(string username, string pwd, string nickname) { if (GetUserByLoginId(username) != null) { //用户存在 return(-1); } else { string sql = "INSERT Users(LoginId,LoginPwd,Name,QQ,Mail) " + "VALUES('" + username + "','" + pwd + "','" + nickname + "','Default','Default')"; sql += " ; SELECT @@IDENTITY"; int newId = SSMS.GetScalar(sql); if (newId != 0) { return(newId); } else { return(-1); } } }
/// <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); } }