void btnResOk_Click(object sender, EventArgs e) { Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); Tz888.BLL.LeaveMsg msgBLL = new Tz888.BLL.LeaveMsg(); Button btn = new Button(); string infoId = ""; string commentId = ""; btn = (Button)sender; string btnSubName = btn.ID.Substring(btn.ID.IndexOf("_") + 1); TextBox tbText = new TextBox(); tbText = (TextBox)btn.Parent.FindControl("txtRes_" + btnSubName); infoId = btn.ID.Substring(btn.ID.IndexOf("_") + 1, btn.ID.LastIndexOf("_") - btn.ID.IndexOf("_") - 1); commentId = btn.ID.Substring(btn.ID.LastIndexOf("_") + 1); model.CommentContent = tbText.Text; //当前用户名称 model.LoginName = loginname; // model.InfoID = Convert.ToInt32(infoId); model.FatherID = Convert.ToInt32(commentId); model.CommentTime = DateTime.Now; bool result = msgBLL.SetResponse(model); //Response.Redirect("commentReceive.aspx"); Response.Redirect("commentReceive.aspx?infoId=" + infoId + "&commentId=" + commentId + "&content=" + tbText.Text); }
protected void btnOk_Click(object sender, EventArgs e) { if (this.txtName.Text.Trim() == "") { Response.Write("<script>alert('姓名不能为空')</script>"); } if (this.txtComment.Text.Trim() == "") { Response.Write("<script>alert('评论不能为空')</script>"); } else { Tz888.BLL.LeaveMsg msgBll = new Tz888.BLL.LeaveMsg(); Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); model.CommentTime = DateTime.Now; model.InfoID = infoID; model.FatherID = 0; model.CommentContent = this.txtComment.Text; //model.LoginName = loginname; model.LoginName = this.txtName.Text.Trim(); bool result = msgBll.SetResponse(model); Response.Write("<script>alert('留言成功')</script>"); this.txtComment.Text = ""; this.txtEmail.Text = ""; this.txtName.Text = ""; this.txtTel.Text = ""; } }
protected void btnOk_Click(object sender, EventArgs e) { string commentName = ""; if (isLogin) { commentName = strLoginName; //Response.Write("<script>alert('姓名不能为空')</script>"); } else { Tz888.Common.MessageBox.ShowAndHref("不能评论,请您登录后评论!", this.Request.Url.ToString()); return; } if (this.txtComment.Text.Trim() == "") { Tz888.Common.MessageBox.ShowAndHref("评论不能为空!", this.Request.Url.ToString()); } else { Tz888.BLL.LeaveMsg msgBll = new Tz888.BLL.LeaveMsg(); Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); model.CommentTime = DateTime.Now; model.InfoID = infoId; model.FatherID = 0; model.CommentContent = this.txtComment.Text; //model.LoginName = loginname; model.LoginName = commentName; bool result = msgBll.SetResponse(model); Tz888.Common.MessageBox.ShowAndHref("留言成功", this.Request.Url.ToString()); this.txtComment.Text = ""; } }
public string AddComment(int infoId, string commentName, string telNum, string email, string commentText) { try { Tz888.BLL.LeaveMsg msgBll = new Tz888.BLL.LeaveMsg(); Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); model.InfoID = infoId; model.LoginName = commentName.Trim(); model.CommentContent = commentText.Trim(); model.FatherID = 0; model.CommentTime = DateTime.Now; bool result = msgBll.SetResponse(model); if (result) { return("ok"); } else { return("failed"); } } catch (Exception e) { string err = e.Message.ToString(); return(err); } }
//发布评论 public void SendComment() { string commentName = ""; Tz888.BLL.LeaveMsg msgBll = new Tz888.BLL.LeaveMsg(); Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); model.CommentTime = DateTime.Now; model.InfoID = Convert.ToInt32(InfoID); model.FatherID = 0; model.CommentContent = this.txtContent.Text; model.LoginName = Page.User.Identity.Name; bool result = msgBll.SetResponse(model); if (result) { if (pageurl != "") { Response.Write("<script>parent.location.href='" + pageurl + "';</script>"); } else { lblMsg.Text = "评论提交成功!请等待审核!"; } } else { lblMsg.Text = "评论提交失败"; } }
protected void btnRes_Click(object sender, EventArgs e) { Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); Tz888.BLL.LeaveMsg msgBLL = new Tz888.BLL.LeaveMsg(); model.CommentContent = this.commentRes.Text; //当前用户名称 model.LoginName = Page.User.Identity.Name;//"sunray"; // model.InfoID = infoId; model.FatherID = Convert.ToInt32(Request.QueryString["commentId"]); model.CommentTime = DateTime.Now; bool result = msgBLL.SetResponse(model); Response.Redirect("CommentReceive.aspx"); }
public string ToReply(string strtmp) { Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); Tz888.BLL.LeaveMsg msgBLL = new Tz888.BLL.LeaveMsg(); string strComment = strtmp.Trim().Substring(strtmp.Trim().IndexOf("^") + 1); string strId = strtmp.Trim().Substring(0, strtmp.Trim().IndexOf("^")).Trim(); model.CommentContent = strComment; //当前用户名称 model.LoginName = "sunray";//Page.User.Identity.Name; // //model.InfoID = infoId; model.InfoID = 6612; model.FatherID = Convert.ToInt32(strId); model.CommentTime = DateTime.Now; bool result = msgBLL.SetResponse(model); return("ok"); }
//发布评论 public void SendComment() { string commentName = ""; Tz888.BLL.LeaveMsg msgBll = new Tz888.BLL.LeaveMsg(); Tz888.Model.LeaveMsg model = new Tz888.Model.LeaveMsg(); model.CommentTime = DateTime.Now; model.InfoID = Convert.ToInt32(InfoID); model.FatherID = 0; model.CommentContent = this.txtContent.Text; model.LoginName = Page.User.Identity.Name; bool result = msgBll.SetResponse(model); if (result) { Tz888.Common.MessageBox.ShowAndHref("评论留言成功!", this.Request.Url.ToString()); } else { Tz888.Common.MessageBox.ShowAndHref("评论留言失败!", this.Request.Url.ToString()); } }