private void BtnKey_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.txtkey.Value.Trim())) { this.ShowMsg("关键词不能为空!", false); return; } ReplyKeyInfo replyKeyInfo = new ReplyKeyInfo(); replyKeyInfo.Keys = this.txtkey.Value; replyKeyInfo.Type = 1; if (!string.IsNullOrEmpty(this.hidid.Value)) { replyKeyInfo.Id = int.Parse(this.hidid.Value); if (WeiboHelper.UpdateReplyKeyInfo(replyKeyInfo)) { this.ShowMsg("关键词修改成功!", true); this.bind(); return; } this.ShowMsg("关键词修改失败!", false); return; } else { if (WeiboHelper.SaveReplyKeyInfo(replyKeyInfo)) { this.ShowMsg("关键词添加成功!", true); this.bind(); return; } this.ShowMsg("关键词添加失败!", false); return; } }
public bool SaveReplyKeyInfo(ReplyKeyInfo replyKeyInfo) { System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO Weibo_ReplyKeys (Keys,Type,Matching) VALUES(@Keys, @Type,0)"); this.database.AddInParameter(sqlStringCommand, "Keys", System.Data.DbType.String, replyKeyInfo.Keys); this.database.AddInParameter(sqlStringCommand, "Type", System.Data.DbType.Int32, replyKeyInfo.Type); return(this.database.ExecuteNonQuery(sqlStringCommand) == 1); }
public bool UpdateMatching(ReplyKeyInfo replyKeyInfo) { System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Weibo_ReplyKeys SET Matching = @Matching WHERE id = @id"); this.database.AddInParameter(sqlStringCommand, "Matching", System.Data.DbType.Int32, replyKeyInfo.Matching); this.database.AddInParameter(sqlStringCommand, "id", System.Data.DbType.Int32, replyKeyInfo.Id); return(this.database.ExecuteNonQuery(sqlStringCommand) == 1); }
public bool UpdateReplyKeyInfo(ReplyKeyInfo replyKeyInfo) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE Weibo_ReplyKeys SET Keys = @Keys WHERE id = @id"); this.database.AddInParameter(sqlStringCommand, "Keys", DbType.String, replyKeyInfo.Keys); this.database.AddInParameter(sqlStringCommand, "id", DbType.Int32, replyKeyInfo.Id); return(this.database.ExecuteNonQuery(sqlStringCommand) == 1); }
public void reply(HttpContext context) { ReplyKeyInfo replyKeyInfo = new ReplyKeyInfo(); string s = "{\"status\":\"0\"}"; replyKeyInfo.Id = int.Parse(context.Request["ID"]); replyKeyInfo.Matching = context.Request["Matching"]; if (WeiboHelper.UpdateMatching(replyKeyInfo)) { s = "{\"status\":\"1\"}"; } context.Response.Write(s); }
public static bool SaveReplyKeyInfo(ReplyKeyInfo replyKeyInfo) { return(new ReplyDao().SaveReplyKeyInfo(replyKeyInfo)); }
public static bool UpdateMatching(ReplyKeyInfo replyKeyInfo) { return(new ReplyDao().UpdateMatching(replyKeyInfo)); }
public static bool UpdateReplyKeyInfo(ReplyKeyInfo replyKeyInfo) { return(new ReplyDao().UpdateReplyKeyInfo(replyKeyInfo)); }