/// <summary> /// 发表(增加)评论 /// </summary> /// <param name=commentInfo"></param> /// <returns>返回True/False</returns> bool ID_Comment.Add(M_Comment commentInfo) { string sqlStr = "PR_Comments_Add"; SqlParameter[] parameter = GetParameters(commentInfo); return(SqlHelper.ExecuteProc(sqlStr, parameter)); }
public string Comment_Reply() { if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"])) { return("-1"); } M_CommonData cdata = conBll.GetCommonData(ItemID); M_Node mnode = nodeBll.GetNodeXML(cdata.NodeID); M_Comment comment = new M_Comment(); comment.GeneralID = ItemID; comment.UserID = mu.UserID; comment.Audited = true; comment.Pid = DataConverter.CLng(Request.Form["id"]); comment.Contents = Request.Form["content"]; if (mnode.CommentType.Equals("2") && mu.IsNull) { return("-2"); } else if (string.IsNullOrEmpty(comment.Contents)) { return("-3"); } else { AddComment(comment); return("1"); } }
/// <summary> /// 发表评论 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { if (this.Page.IsValid) { if (!buser.CheckLogin()) { function.WriteErrMsg("只有登陆用户才能发表评论!"); } string UserID = HttpContext.Current.Request.Cookies["UserState"]["UserID"]; M_Comment comment = new M_Comment(); comment.CommentID = 0; comment.GeneralID = DataConverter.CLng(this.HdnItemID.Value); m_ItemID = DataConverter.CLng(this.HdnItemID.Value); comment.UserID = DataConverter.CLng(UserID); comment.Title = this.HdnTitle.Value; m_Title = this.HdnTitle.Value; comment.Contents = this.TxtContents.Text.Trim(); comment.Score = DataConverter.CLng(this.DDLScore.SelectedValue); comment.PK = DataConverter.CBool(this.RBLPK.SelectedValue); comment.Audited = true; comment.CommentTime = DateTime.Now; bcomment.Add(comment); Response.Write("<script language=\"javascript\" type=\"text/javascript\">alert(\"评论添加成功\")</script>"); RepBind(); } }
public M_Comment m_create(M_Comment comment) { CommentService dbcom = new CommentService(); var result = dbcom.AddEntity(comment); return(result); }
protected void Sure_Btn_Click(object sender, EventArgs e) { comMod = comBll.SelReturnModel(Mid); comMod.Contents = Contents.Text; comMod.Title = Title_T.Text; comMod.CommentTime = DataConvert.CDate(CommentTime.Text); comBll.UpdateByID(comMod); function.WriteSuccessMsg("修改成功", "ShowContent.aspx?Gid=" + Gid + "&Modeid=" + modeid); }
protected void Save_Btn_Click(object sender, EventArgs e) { M_Comment model = commentBll.SelReturnModel(MainID); model.Contents = MsgContent_T.Text; model.CommentTime = DataConverter.CDate(CDate_T.Text); commentBll.UpdateByID(model); Response.Redirect("CommentManage.aspx"); }
public void MyBind() { comMod = comBll.SelReturnModel(Mid); CommentID.Text = comMod.CommentID.ToString(); Title_T.Text = comMod.Title; Contents.Text = comMod.Contents; CommentTime.Text = comMod.CommentTime.ToString(); commScore.Text = comMod.Score.ToString(); commStatus.Text = comMod.Audited ? "已审核" : "未审核"; }
// 发表评论 private string SendComm() { if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"])) { return("-1"); } //内容为空不允许发送 if (string.IsNullOrEmpty(Request.Form["content"])) { return("-3"); } M_UserInfo mu = buser.GetLogin(false); M_Comment comment = new M_Comment(); M_CommonData cdata = conBll.GetCommonData(ItemID); comment.GeneralID = ItemID; //是否开放评论 if (cdata.IsComm == 0) { return("-4"); } //节点是否开启评论权限 M_Node nodeMod = nodeBll.SelReturnModel(cdata.NodeID); //需要登录,但用户未登录 if (nodeMod.CommentType.Equals("2") && !buser.CheckLogin()) { return("-2"); } comment.UserID = mu.UserID;//支持一个支持匿名方法 comment.Contents = BaseClass.CheckInjection(Request.Form["content"]); comment.Audited = true; //DataTable dts = cmtBll.SeachComment_ByGeneralID2(ItemID); //if (nodeMod.Purview != null && nodeMod.Purview != "") //{ // string Purview = nodeMod.Purview; // DataTable AuitDT = nodeBll.GetNodeAuitDT(nodeMod.Purview); // if (AuitDT == null && AuitDT.Rows.Count <= 0) { return "-4"; } // DataRow auitdr = AuitDT.Rows[0]; // string forum_v = auitdr["forum"].ToString(); // if (string.IsNullOrEmpty(forum_v)) { return "-4"; } // string[] forumarr = forum_v.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); // //不允许评论 // if (!forumarr.Contains("1")) { return "-4"; } // //不需要审核 // if (!forumarr.Contains("2")) { comment.Audited = true; } // if (forumarr.Contains("3")) //一个文章只评论一次 // { // if (cmtBll.SearchByUser(mu.UserID, cdata.NodeID).Rows.Count > 0) { return "-5"; } // } //} AddComment(comment); return(comment.Audited ? "2" : "1"); }
//-------------Tools private void AddComment(M_Comment cmtMod) { cmtBll.Add(cmtMod); if (SiteConfig.UserConfig.CommentRule > 0 && cmtMod.UserID > 0)//增加积分 { buser.ChangeVirtualMoney(cmtMod.UserID, new M_UserExpHis() { score = SiteConfig.UserConfig.CommentRule, detail = "发表评论增加积分", ScoreType = (int)M_UserExpHis.SType.Point }); } }
void MyBind() { M_Comment model = commentBll.SelReturnModel(MainID); ID_L.Text = model.CommentID.ToString(); M_CommonData coninfo = contentBll.GetCommonData(DataConverter.CLng(model.GeneralID)); Title_L.Text = coninfo.Title; CUser_LB.Text = userbll.SeachByID(model.UserID).UserName; CID_L.Text = model.GeneralID.ToString(); MsgContent_T.Text = model.Contents; CDate_T.Text = model.CommentTime.ToString(); }
private static M_Comment GetInfoFromReader(SqlDataReader rdr) { M_Comment info = new M_Comment(); info.CommentID = DataConverter.CLng(rdr["CommentID"]); info.GeneralID = DataConverter.CLng(rdr["GeneralID"]); info.Title = rdr["Title"].ToString(); info.Contents = rdr["Contents"].ToString(); info.Audited = DataConverter.CBool(rdr["Audited"].ToString());; info.UserID = DataConverter.CLng(rdr["UserID"]); info.CommentTime = DataConverter.CDate(rdr["CommentTime"]); info.Score = DataConverter.CLng(rdr["Score"]); info.PK = DataConverter.CBool(rdr["PK"].ToString()); return(info); }
private WxCommentViewModel _transformviewmodel(M_Comment comment) { return(new WxCommentViewModel() { caseid = comment.CaseId, content = comment.Content, created_at = comment.Date.ToString("yyyy-MM-dd HH:mm:ss"), id = comment.ID, pid = "0", pusername = "******", uid = comment.UserID, username = comment.UserName, avatar_url = UserInfo.Current.GetUserById(comment.UserID) != null?UserInfo.Current.GetUserById(comment.UserID).Avatar_url : null, }); }
//回复 private string btnHuiFu() { if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"])) { return("-1"); } M_UserInfo mu = buser.GetLogin(); M_Comment comment = new M_Comment(); comment.CommentID = 0; comment.GeneralID = ItemID; M_CommonData cdata = bll.GetCommonData(ItemID); M_Node mnode = nodeBll.GetNodeXML(cdata.NodeID); if (mnode.CommentType.Equals("2") && !buser.CheckLogin()) { return("-2"); } //GetNodePreate(cdata.NodeID); comment.UserID = mu.UserID; comment.Title = BaseClass.CheckInjection(this.HdnTitle.Value); if (string.IsNullOrEmpty(Request.Form["content"])) { return("-3"); } comment.Contents = BaseClass.CheckInjection(sll.ProcessSen(Request.Form["content"].ToString())); comment.Audited = false; comment.CommentTime = DateTime.Now; comment.Status = 0; comment.Pid = DataConverter.CLng(Request.Form["id"]); if (bcomment.Add(comment)) { if (SiteConfig.UserConfig.CommentRule > 0 && mu.UserID > 0) { buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() { score = SiteConfig.UserConfig.CommentRule, detail = "发表评论增加积分", ScoreType = (int)M_UserExpHis.SType.Point }); } } return("1"); //Response.Redirect(Request.RawUrl); }
/// <summary> /// 传参 /// </summary> /// <param name="userGroup"></param> /// <returns>返回SqlParameter[]</returns> private static SqlParameter[] GetParameters(M_Comment commentInfo) { SqlParameter[] parameter = new SqlParameter[9]; parameter[0] = new SqlParameter("@CommentID", SqlDbType.Int); //有时候不需要用这条属性,值为 null 时,会不会报错?比如 Add 添加评论 parameter[0].Value = commentInfo.CommentID; parameter[1] = new SqlParameter("@GeneralID", SqlDbType.Int); parameter[1].Value = commentInfo.GeneralID; parameter[2] = new SqlParameter("@Title", SqlDbType.NVarChar, 255); parameter[2].Value = commentInfo.Title; parameter[3] = new SqlParameter("@Contents", SqlDbType.NVarChar, 300); parameter[3].Value = commentInfo.Contents; parameter[4] = new SqlParameter("@Audited", SqlDbType.Bit); parameter[4].Value = commentInfo.Audited; parameter[5] = new SqlParameter("@UserID", SqlDbType.Int); parameter[5].Value = commentInfo.UserID; parameter[6] = new SqlParameter("@CommentTime", SqlDbType.DateTime); parameter[6].Value = commentInfo.CommentTime; parameter[7] = new SqlParameter("@Score", SqlDbType.Int); parameter[7].Value = commentInfo.Score; parameter[8] = new SqlParameter("@PK", SqlDbType.Bit); parameter[8].Value = commentInfo.PK; return(parameter); }
/// <summary> /// 发表(增加)评论 /// </summary> /// <param name="commentInfo"></param> /// <returns></returns> public bool Add(M_Comment model) { return(Sql.insertID(TbName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)) > 0); }
public bool UpdateByID(M_Comment model) { return(Sql.UpdateByIDs(TbName, PK, model.CommentID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }
public int insert(M_Comment model) { return(DBCenter.Insert(model)); }
public bool UpdateByID(M_Comment model) { return(DBCenter.UpdateByID(model, model.CommentID)); }
public int insert(M_Comment model) { return(Sql.insertID(TbName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
// 发表评论 protected string SenderComm() { M_UserInfo mu = buser.GetLogin(false); if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))//Need { return("-1"); } M_Comment comment = new M_Comment(); comment.CommentID = 0; comment.GeneralID = ItemID; M_CommonData cdata = bll.GetCommonData(ItemID); if (cdata.IsComm != 1) { return("-4"); } //GetNodePreate(cdata.NodeID); M_Node mnode = nodeBll.GetNodeXML(cdata.NodeID); if (mnode.CommentType.Equals("2") && !buser.CheckLogin()) { return("-2"); } comment.UserID = mu.UserID;//支持一个支持匿名方法 comment.Title = BaseClass.CheckInjection(this.HdnTitle.Value); if (string.IsNullOrEmpty(Request.Form["content"])) { return("-3"); } comment.Contents = BaseClass.CheckInjection(sll.ProcessSen(Request.Form["content"])); comment.Audited = false; DataTable dts = bcomment.SeachComment_ByGeneralID2(ItemID); if (mnode.Purview != null && mnode.Purview != "") { string Purview = mnode.Purview; DataTable AuitDT = nodeBll.GetNodeAuitDT(mnode.Purview); if (AuitDT == null && AuitDT.Rows.Count <= 0) { return("-4"); } DataRow auitdr = AuitDT.Rows[0]; string forum_v = auitdr["forum"].ToString(); if (string.IsNullOrEmpty(forum_v)) { return("-4"); } string[] forumarr = forum_v.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (!forumarr.Contains("1"))//不允许评论 { return("-4"); } if (!forumarr.Contains("2"))//不需要审核 { comment.Audited = true; } if (forumarr.Contains("3")) //一个文章只评论一次 { if (bcomment.SearchByUser(mu.UserID, cdata.NodeID).Rows.Count > 0) { return("-5"); } } } comment.Status = 0; comment.Score = DataConverter.CLng(Request.Form["Score"]); comment.CommentTime = DateTime.Now; DataTable dt = bcomment.SeachComment_ByGeneralID2(ItemID); if (bcomment.Add(comment)) { if (SiteConfig.UserConfig.CommentRule > 0 && mu.UserID > 0)//增加积分 { buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() { score = SiteConfig.UserConfig.CommentRule, detail = "发表评论增加积分", ScoreType = (int)M_UserExpHis.SType.Point }); } } return(comment.Audited ? "2" : "1"); }
/// <summary> /// 发表(增加)评论 /// </summary> /// <param name="commentInfo"></param> /// <returns></returns> public bool Add(M_Comment commentInfo) { return(comment.Add(commentInfo)); }
/// <summary> /// 发表(增加)评论 /// </summary> /// <param name="commentInfo"></param> /// <returns></returns> public bool Add(M_Comment model) { return(DBCenter.Insert(model) > 0); }