/// <summary> /// 更新评论信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateComment(MSForumComment model) { string safeslq = ""; safeslq = "UPDATE MS_ForumComment SET "; if (model.UpID != null && model.UpID != "") { safeslq += "UpID='" + model.UpID + "',"; } if (model.TID != null && model.TID.ToString() != "") { safeslq += "TID='" + model.TID + "',"; } if (model.UID != null && model.UID.ToString() != "") { safeslq += "UID='" + model.UID + "',"; } if (model.Ctext != null && model.Ctext != "") { safeslq += "Ctext='" + model.Ctext + "',"; } safeslq += " Cstate=" + (model.Cstate == 1 ? 1 : 0) + " "; safeslq += " where ID='" + model.ID + "'"; int rowsAffected = DbHelperSQL.ExecuteSql(safeslq.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 添加评论 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddComment(MSForumComment model) { string sql = @"INSERT INTO [MS_ForumComment] ([ID],[UpID],[TID],[UID],[Ctext],[Review],[Cstate],[AddTime]) VALUES (@ID,@UpID,@TID,@UID,@Ctext,@Review,@Cstate,@AddTime)"; System.Data.SqlClient.SqlParameter[] paras = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@ID", model.ID), new System.Data.SqlClient.SqlParameter("@UpID", model.UpID), new System.Data.SqlClient.SqlParameter("@TID", model.TID), new System.Data.SqlClient.SqlParameter("@UID", model.UID), new System.Data.SqlClient.SqlParameter("@Ctext", model.Ctext), new System.Data.SqlClient.SqlParameter("@Review", (model.Review == 1?1:0)), new System.Data.SqlClient.SqlParameter("@Cstate", (model.Cstate == 1?1:0)), new System.Data.SqlClient.SqlParameter("@AddTime", DateTime.Now) }; int rowsAffected = DbHelperSQL.ExecuteSql(sql.ToString(), paras); if (rowsAffected > 0) { return(true); } else { return(false); } }
void repcomment() { string commentdesc = string.Empty; StreamReader rd = new StreamReader(Server.MapPath("emotion/key.txt")); string keyword = rd.ReadLine(); try { commentdesc = HttpContext.Current.Request.Form.Get("commentdesc").ToString(); } catch (Exception) { commentdesc = ""; } if (commentdesc.Trim() != null && commentdesc.Trim() != "") { commentdesc = JQDialog.FilterKeyWord(commentdesc, keyword); commentdesc = JQDialog.GetTextFromHTML(commentdesc); MSForumComment commentModel = new MSForumComment(); MSForumCommentDAL commentDal = new MSForumCommentDAL(); commentModel.ID = Guid.NewGuid().ToString("N").ToUpper(); commentModel.Ctext = commentdesc; commentModel.Review = 1; commentModel.TID = strTid; commentModel.UID = strUid; commentModel.UpID = strupid; commentModel.Cstate = 0; if (commentDal.AddComment(commentModel)) { errorscript = JQDialog.alertOKMsgBox(3, "回复成功", "MyCommentList.aspx?fid=" + strfid, "error"); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请核对后再操作!", true); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请重新再操作!", true); } }
void pubcomment() { string commentdesc = string.Empty; try { commentdesc = HttpContext.Current.Request.Form.Get("commentdesc").ToString(); } catch (Exception) { commentdesc = ""; } if (commentdesc.Trim() != null && commentdesc.Trim() != "") { MSForumComment commentModel = new MSForumComment(); MSForumCommentDAL commentDal = new MSForumCommentDAL(); strcommid = Guid.NewGuid().ToString("N").ToUpper(); commentModel.ID = strcommid; commentModel.Ctext = commentdesc; commentModel.Review = 1; commentModel.TID = strTid; commentModel.UID = strUid; commentModel.UpID = ""; commentModel.Cstate = 0; SaveImages(); if (commentDal.AddComment(commentModel)) { errorscript = JQDialog.alertOKMsgBox(3, "评论成功", "CommentList.aspx?fid=" + strfid + "&tid=" + strTid, "succeed"); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请核对后再操作!", true); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请重新再操作!", true); } }
void showdetailinfo() { MSForumCommentDAL CommDal = new MSForumCommentDAL(); DataSet ds = CommDal.GetCommentDetail(strID); MSForumComment CommModel = DataConvert.DataRowToModel <MSForumComment>(ds.Tables[0].Rows[0]); hd_content.Value = CommModel.Ctext; MSForumTopicAtlasDAL AtlasDal = new MSForumTopicAtlasDAL(); DataSet atlasds = AtlasDal.GetMSFTAtlasList(" AND TID='comm" + strID + "' "); if (atlasds != null && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0) { topicaltaslist = ""; string atlasimg = ""; for (int i = 0; i < atlasds.Tables[0].Rows.Count; i++) { atlasimg = atlasds.Tables[0].Rows[i]["ImgUrl"].ToString(); topicaltaslist += "<img src=\"../../Comment/" + atlasimg + "\" />"; } } }