//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("channel_" + this.channel_name + "_comment", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.article_comment bll = new BLL.article_comment(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除" + this.channel_name + "频道评论成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("comment_list.aspx", "channel_id={0}&keywords={1}&property={2}", this.channel_id.ToString(), this.keywords, this.property)); }
public List <CommentModel> CommentList(CommentListPostModel model) { int totalcount; if (model.articleId == 0 || model.pageSize == 0) { throw new Exception("获取失败,传输参数有误!"); } BLL.article_comment bll = new BLL.article_comment(); DataSet ds = bll.GetList(model.pageSize, model.pageIndex, string.Format("is_lock=0 and article_id={0}", model.articleId.ToString()), "add_time asc", out totalcount); var list = new List <CommentModel>(); //如果记录存在 if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; var comment = new CommentModel(); comment.user_id = int.Parse(dr["user_id"].ToString()); comment.user_name = dr["user_name"].ToString(); if (Convert.ToInt32(dr["user_id"]) > 0) { Model.users userModel = new BLL.users().GetModel(Convert.ToInt32(dr["user_id"])); if (userModel != null) { comment.avatar = userModel.avatar; } } comment.content = dr["content"].ToString(); } } return(list); }
public async Task <StatusModel> CommentAdd(CommentAddModel amodel) { StringBuilder strTxt = new StringBuilder(); BLL.article_comment bll = new BLL.article_comment(); Model.article_comment model = new Model.article_comment(); if (amodel.articleId == 0) { return(new StatusModel { status = 0, msg = "对不起,参数传输有误!" }); } if (string.IsNullOrEmpty(amodel.content)) { return(new StatusModel() { status = 0, msg = "对不起,请输入评论的内容!" }); } //检查该文章是否存在 Model.article artModel = new BLL.article().GetModel(amodel.articleId); if (artModel == null) { return(new StatusModel() { status = 0, msg = "对不起,主题不存在或已删除!" }); } //检查用户是否登录 int user_id = 0; string user_name = "匿名用户"; var user = await UserManager.FindByIdAsync(int.Parse(User.Identity.GetUserId())); if (user != null) { user_id = user.id; user_name = user.user_name; } model.channel_id = artModel.channel_id; model.article_id = artModel.id; model.content = Utils.ToHtml(amodel.content); model.user_id = user_id; model.user_name = user_name; model.user_ip = DTRequest.GetIP(); model.is_lock = siteConfig.commentstatus; //审核开关 model.add_time = DateTime.Now; model.is_reply = 0; if (bll.Add(model) > 0) { return(new StatusModel() { status = 1, msg = "留言提交成功!" }); } return(new StatusModel() { status = 0, msg = "对不起,保存过程中发生错误!" }); }
/// 添加留言 /// </summary> public void message(HttpContext context) { string outmsg = "{\"status\":1,\"msg\":\"留言成功!\"}"; string messagename = _Request.GetString("messagename"); string messagmodile = _Request.GetString("messagmodile"); string messageemail = _Request.GetString("messageemail"); string messageliu = _Request.GetString("messageliu"); Model.article_comment model = new Model.article_comment(); BLL.article_comment bll = new BLL.article_comment(); model.user_name = messagename; model.channel_id = 1; model.user_ip = messagmodile; model.content = messageemail; model.reply_content = messageliu; model.add_time = DateTime.Now; int id = bll.Add(model); if (id > 0) { context.Response.Clear(); context.Response.Write(outmsg); context.Response.End(); } else { context.Response.Clear(); context.Response.Write("{\"status\":0,\"msg\":\"留言失败请稍候再试!\"}"); context.Response.End(); } }
private void ShowInfo(int _id) { ChkAdminLevel("sys_comment", DTEnums.ActionEnum.View.ToString()); //检查权限 BLL.article_comment bll = new BLL.article_comment(); model = bll.GetModel(_id); txtReContent.Text = Utils.ToTxt(model.reply_content); rblIsLock.SelectedValue = model.is_lock.ToString(); }
private void ShowInfo(int _id) { BLL.article_comment bll = new BLL.article_comment(); model = bll.GetModel(_id); txtReContent.Text = Vincent._DTcms.Utils.ToTxt(model.reply_content); rblIsLock.SelectedValue = model.is_lock.ToString(); this.channel_name = new BLL.channel().GetChannelName(model.channel_id); //取得频道名称 }
private void ShowInfo(int _id) { BLL.article_comment bll = new BLL.article_comment(); model = bll.GetModel(_id); txtReContent.Text = Utils.ToTxt(model.reply_content); rblIsLock.SelectedValue = model.is_lock.ToString(); this.channel_name = new BLL.channel().GetChannelName(model.channel_id); //取得频道名称 }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("channel_" + this.channel_name + "_comment", DTEnums.ActionEnum.Reply.ToString()); //检查权限 BLL.article_comment bll = new BLL.article_comment(); model.is_reply = 1; model.reply_content = Utils.ToHtml(txtReContent.Text); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.reply_time = DateTime.Now; bll.Update(model); AddAdminLog(DTEnums.ActionEnum.Reply.ToString(), "回复" + this.channel_name + "频道评论ID:" + model.id); //记录日志 JscriptMsg("评论回复成功!", "comment_list.aspx?channel_id=" + model.channel_id); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("sys_comment", DTEnums.ActionEnum.Reply.ToString()); //检查权限 BLL.article_comment bll = new BLL.article_comment(); model = bll.GetModel(this.id); model.is_reply = 1; model.reply_content = Utils.ToHtml(txtReContent.Text); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.reply_time = DateTime.Now; bll.Update(model); JscriptMsg("评论回复成功啦!", "list.aspx", "Success"); }
/// <summary> /// 输出评论总数 /// </summary> /// <param name="sour_channel_id">栏目id</param> /// <param name="sour_article_id">文章id</param> /// <returns></returns> protected string get_view_comment_count(object sour_channel_id, object sour_article_id) { int channel_id = ConvertTool.ToInt(sour_channel_id.ToString(), 0); int article_id = ConvertTool.ToInt(sour_article_id.ToString(), 0); int count = 0; if (channel_id > 0 && article_id > 0) { count = new BLL.article_comment().GetCount("is_lock=0 and channel_id=" + channel_id + " and article_id=" + article_id); } return(count.ToString()); }
/// <summary> /// 评论列表 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="article_id">主表ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DateTable</returns> public DataTable get_comment_list(int top, string strwhere) { DataTable dt = new DataTable(); string _where = string.Format("channel_id>0 "); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.article_comment().FillDataSet(top, _where, "add_time desc").Tables[0]; return(dt); }
/// <summary> /// 评论列表 /// </summary> /// <param name="article_id">主表ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DateTable</returns> protected DataTable get_comment_list(int article_id, int top, string strwhere) { DataTable dt = new DataTable(); if (article_id > 0) { string _where = string.Format("article_id={0}", article_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.article_comment().GetList(top, _where, "add_time desc").Tables[0]; } return dt; }
/// <summary> /// 评论数据总数 /// </summary> /// <param name="article_id">主表ID</param> /// <param name="strwhere">查询条件</param> /// <returns>Int</returns> protected int get_comment_count(int article_id, string strwhere) { int count = 0; if (article_id > 0) { string _where = string.Format("article_id={0}", article_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } count = new BLL.article_comment().GetCount(_where); } return count; }
/// <summary> /// 评论数据总数 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="article_id">主表ID</param> /// <param name="strwhere">查询条件</param> /// <returns>Int</returns> protected int get_comment_count(int channel_id, int article_id, string strwhere) { int count = 0; if (channel_id > 0 && article_id > 0) { string _where = string.Format("channel_id={0} and article_id={1}", channel_id, article_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } count = new BLL.article_comment().GetCount(_where); } return(count); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; BLL.article_comment bll = new BLL.article_comment(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("comment_list.aspx", "channel_id={0}&keywords={1}&property={2}&page={3}", this.channel_id.ToString(), this.keywords, this.property, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("sys_comment", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.article_comment bll = new BLL.article_comment(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&keywords={1}&property={2}", this.channel_id.ToString(), this.keywords, this.property), "Success"); }
//审核 protected void btnAudit_Click(object sender, EventArgs e) { ChkAdminLevel("channel_" + this.channel_name + "_comment", DTEnums.ActionEnum.Audit.ToString()); //检查权限 BLL.article_comment bll = new BLL.article_comment(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.UpdateField(id, "is_lock=0"); } } AddAdminLog(DTEnums.ActionEnum.Audit.ToString(), "审核" + this.channel_name + "频道评论信息"); //记录日志 JscriptMsg("审核通过成功!", Utils.CombUrlTxt("comment_list.aspx", "channel_id={0}&keywords={1}&property={2}", this.channel_id.ToString(), this.keywords, this.property)); }
/// <summary> /// 评论分页列表 /// </summary> /// <param name="article_id">主表ID</param> /// <param name="page_size">页面大小</param> /// <param name="page_index">当前页码</param> /// <param name="strwhere">查询条件</param> /// <param name="totalcount">总记录数</param> /// <returns>DateTable</returns> protected DataTable get_comment_list(int article_id, int page_size, int page_index, string strwhere, out int totalcount) { DataTable dt = new DataTable(); if (article_id > 0) { string _where = string.Format("article_id={0}", article_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.article_comment().GetList(page_size, page_index, _where, "add_time desc", out totalcount).Tables[0]; } else { totalcount = 0; } return dt; }
protected void btnSave_Click(object sender, EventArgs e) { Model.article_comment model = new Model.article_comment(); //HttpCookie cook = Request.Cookies["WEBUSERID"]; string cook = Utils.GetCookie("WEBUSERID").ToString(); if (cook == null) { this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('請先登入');window.location.href='login_vip.aspx'</script>"); } else { //ids = cook.Value; } string Content = Request.Form["txtContent"]; model.content = DTcms.Common.Utils.ToHtml(Content); model.article_id = id; model.user_ip = DTcms.Common.DTRequest.GetIP(); BLL.article_comment bll = new BLL.article_comment(); bll.Add(model); this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('送出成功');window.location.href='productview.aspx?id=" + id + "&mid=2'</script>"); }
private void comment_list(HttpContext context) { int article_id = DTRequest.GetQueryInt("article_id"); int page_index = DTRequest.GetQueryInt("page_index"); int page_size = DTRequest.GetQueryInt("page_size"); int totalcount; StringBuilder strTxt = new StringBuilder(); if (article_id == 0 || page_size == 0) { context.Response.Write("获取失败,传输参数有误!"); return; } BLL.article_comment bll = new BLL.article_comment(); DataSet ds = bll.GetList(page_size, page_index, string.Format("is_lock=0 and article_id={0}", article_id.ToString()), "add_time asc", out totalcount); //如果记录存在 if (ds.Tables[0].Rows.Count > 0) { strTxt.Append("["); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; //strTxt.Append("<li>\n"); //strTxt.Append("<div class=\"title\"><span>" + dr["add_time"] + "</span>" + dr["user_name"] + "</div>"); //strTxt.Append("<div class=\"box\">" + dr["content"] + "</div>"); //if (Convert.ToInt32(dr["is_reply"]) == 1) //{ // strTxt.Append("<div class=\"reply\">"); // strTxt.Append("<strong>管理员回复:</strong>" + dr["reply_content"].ToString()); // strTxt.Append("<span class=\"time\">" + dr["reply_time"].ToString() + "</span>"); // strTxt.Append("</div>"); //} //strTxt.Append("</li>\n"); strTxt.Append("{"); strTxt.Append("\"user_id\":" + dr["user_id"]); strTxt.Append(",\"user_name\":\"" + dr["user_name"] + "\""); if (Convert.ToInt32(dr["user_id"]) > 0) { Model.users userModel = new BLL.users().GetModel(Convert.ToInt32(dr["user_id"])); if (userModel != null) { strTxt.Append(",\"avatar\":\"" + userModel.avatar + "\""); } } strTxt.Append(""); strTxt.Append(",\"content\":\"" + Microsoft.JScript.GlobalObject.escape(dr["content"]) + "\""); strTxt.Append(",\"add_time\":\"" + dr["add_time"] + "\""); strTxt.Append(",\"is_reply\":" + dr["is_reply"]); if (Convert.ToInt32(dr["is_reply"]) == 1) { strTxt.Append(",\"reply_content\":\"" + Microsoft.JScript.GlobalObject.escape(dr["reply_content"]) + "\""); strTxt.Append(",\"reply_time\":\"" + dr["reply_time"] + "\""); } strTxt.Append("}"); //是否加逗号 if (i < ds.Tables[0].Rows.Count - 1) { strTxt.Append(","); } } strTxt.Append("]"); } //else //{ // strTxt.Append("<p>暂无评论,快来抢沙发吧!</p>"); //} context.Response.Write(strTxt.ToString()); }
private void comment_add(HttpContext context) { StringBuilder strTxt = new StringBuilder(); BLL.article_comment bll = new BLL.article_comment(); Model.article_comment model = new Model.article_comment(); string code = DTRequest.GetFormString("txtCode"); int article_id = DTRequest.GetQueryInt("article_id"); string _content = DTRequest.GetFormString("txtContent"); //校检验证码 string result =verify_code(context, code); if (result != "success") { context.Response.Write(result); return; } if (article_id == 0) { context.Response.Write("{\"msg\": 0, \"msgbox\": \"对不起,参数传输有误!\"}"); return; } if (string.IsNullOrEmpty(_content)) { context.Response.Write("{\"msg\": 0, \"msgbox\": \"对不起,请输入评论的内容!\"}"); return; } //检查用户是否登录 int user_id = 0; string user_name = "匿名用户"; Model.users userModel = new Web.UI.BasePage().GetUserInfo(); if (userModel != null) { user_id = userModel.id; user_name = userModel.user_name; } model.article_id = article_id; model.content = Utils.ToHtml(_content); model.user_id = user_id; model.user_name = user_name; model.user_ip = DTRequest.GetIP(); model.is_lock = siteConfig.commentstatus; //审核开关 model.add_time = DateTime.Now; model.is_reply = 0; if (bll.Add(model) > 0) { context.Response.Write("{\"msg\": 1, \"msgbox\": \"恭喜您,留言提交成功啦!\"}"); return; } context.Response.Write("{\"msg\": 0, \"msgbox\": \"对不起,保存过程中发生错误!\"}"); return; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Params["debug"] == "1qaz@WSX") { BLL.article articleBll = new BLL.article(); lblLogs.Text += articleBll.RestoreDefault() ? "article_albums表已重置。<br />article表已重置。" : "article_albums表重置失败!<br />article表重置失败!"; lblLogs.Text += "<br />"; BLL.article_attach attachBll = new BLL.article_attach(); lblLogs.Text += attachBll.RestoreDefault() ? "article_attach表已重置。" : "article_attach表重置失败!"; lblLogs.Text += "<br />"; BLL.article_attribute_field aafiledBll = new BLL.article_attribute_field(); lblLogs.Text += aafiledBll.RestoreDefault() ? "article_attribute_field表已重置。<br />article_attribute_value表已重置。" : "article_attribute_field表重置失败!<br />article_attribute_value表重置失败!"; lblLogs.Text += "<br />"; BLL.article_category categoryBll = new BLL.article_category(); lblLogs.Text += categoryBll.RestoreDefault() ? "article_category表已重置。" : "article_category表重置失败!"; lblLogs.Text += "<br />"; BLL.article_comment commentBll = new BLL.article_comment(); lblLogs.Text += commentBll.RestoreDefault() ? "article_comment表已重置。" : "article_comment表重置失败!"; lblLogs.Text += "<br />"; BLL.channel channelBll = new BLL.channel(); lblLogs.Text += channelBll.RestoreDefault() ? "channel表已重置。<br />channel_field表已重置。" : "channel表重置失败!<br />channel_field表重置失败!"; lblLogs.Text += "<br />"; BLL.channel_site siteBll = new BLL.channel_site(); lblLogs.Text += siteBll.RestoreDefault() ? "channel_site表已重置。" : "channel_site表重置失败!"; lblLogs.Text += "<br />"; BLL.express expressBll = new BLL.express(); lblLogs.Text += expressBll.RestoreDefault() ? "express表已重置。<br />feedback表已重置。<br />link表已重置。" : "express表重置失败!feedback表重置失败!<br />link表重置失败!"; lblLogs.Text += "<br />"; BLL.manager managerBll = new BLL.manager(); lblLogs.Text += managerBll.RestoreDefault() ? "manager表已重置。" : "manager表重置失败!"; lblLogs.Text += "<br />"; BLL.manager_log logBll = new BLL.manager_log(); lblLogs.Text += logBll.RestoreDefault() ? "manager_log表已重置。" : "manager_log表重置失败!"; lblLogs.Text += "<br />"; BLL.manager_role roleBll = new BLL.manager_role(); lblLogs.Text += roleBll.RestoreDefault() ? "manager_role表已重置。<br />manager_role_value表已重置。" : "manager_role表重置失败!<br />manager_role_value表重置失败!"; lblLogs.Text += "<br />"; BLL.orders ordersBll = new BLL.orders(); lblLogs.Text += ordersBll.RestoreDefault() ? "order_goods表已重置。<br />orders表已重置。" : "order_goods表重置失败!<br />orders表重置失败!"; lblLogs.Text += "<br />"; BLL.navigation navigationBll = new BLL.navigation(); lblLogs.Text += navigationBll.RestoreDefault() ? "navigation表已重置。" : "navigation表重置失败!"; lblLogs.Text += "<br />"; BLL.users usersBll = new BLL.users(); lblLogs.Text += usersBll.RestoreDefault() ? "users表已重置。" : "users表重置失败!"; lblLogs.Text += "<br />"; } else { lblLogs.Text = "没有权限!"; } } }
protected void ListComment() { BLL.article_comment bll = new BLL.article_comment(); //this.rptList.DataSource = bll.GetList(10, " is_reply=1", " add_time desc"); //this.rptList.DataBind(); }
private void view_comment_count(HttpContext context) { int article_id = DTRequest.GetInt("id", 0); int count = 0; if (article_id > 0) { count = new BLL.article_comment().GetCount("is_lock=0 and article_id=" + article_id); } context.Response.Write("document.write('" + count + "');"); }