private void ShowInfo(int _id) { BLL.comment bll = new BLL.comment(); model = bll.GetModel(_id); txtReContent.Text = Utils.ToTxt(model.reply_content); rblIsLock.SelectedValue = model.is_lock.ToString(); }
public ActionResult Info(int id) { //获取用户的id int userID = Common.User.GetUserID(Session["Username"].ToString()); //获取我加入的社团数据 //获取每个社团审核通过的活动 var activities = new BLL.clubActivity().GetModel(p => p.id == id & p.state == 1); //将需要的社团活动信息填充入list var model = new Activity(); model.ActivityID = activities.id; model.ActivityInfo = activities.other; model.ActivityName = activities.name; model.ActivityPlace = activities.place; model.ActivityTime = activities.time; model.ClubID = activities.clubID; model.ClubName = Common.Club.getClubName(activities.clubID); var info = new ActivityMoreInfo(); info.Activity = model; //获取活动的所有评论 var comments = new BLL.comment().GetModels(p => p.actID == id).ToList(); info.Comments = comments; return(View(info)); }
private void comment_add(HttpContext context) { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); StringBuilder strTxt = new StringBuilder(); BLL.comment bll = new BLL.comment(); Model.comment model = new Model.comment(); string _code = DTRequest.GetFormString("txtCode"); int _channel_id = DTRequest.GetQueryInt("channel_id"); int _content_id = DTRequest.GetQueryInt("content_id"); string _title = DTRequest.GetFormString("txtTitle"); string _content = DTRequest.GetFormString("txtContent"); //校检验证码 if (string.IsNullOrEmpty(_code)) { context.Response.Write("{msg:0, msgbox:\"对不起,请输入验证码!\"}"); return; } if (context.Session[DTKeys.SESSION_CODE] == null) { context.Response.Write("{msg:0, msgbox:\"对不起,系统找不到生成的验证码!\"}"); return; } if (_code.ToLower() != (context.Session[DTKeys.SESSION_CODE].ToString()).ToLower()) { context.Response.Write("{msg:0, msgbox:\"您输入的验证码与系统的不一致!\"}"); return; } if (_channel_id == 0 || _content_id == 0) { context.Response.Write("{msg: 0, msgbox: \"对不起,参数传输有误!\"}"); return; } if (string.IsNullOrEmpty(_content)) { context.Response.Write("{msg: 0, msgbox: \"对不起,请输入评论的内容!\"}"); return; } model.channel_id = _channel_id; model.content_id = _content_id; model.title = _title; model.content = Utils.ToHtml(_content); model.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 btnSubmit_Click(object sender, EventArgs e) { BLL.comment bll = new BLL.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?channel_id=" + model.channel_id, "Success"); }
//审核 protected void btnAudit_Click(object sender, EventArgs e) { BLL.comment bll = new BLL.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"); } } JscriptMsg("审核通过成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&keywords={1}&property={2}", this.channel_id.ToString(), this.keywords, this.property), "Success"); }
/// <summary> /// 评论列表 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="content_id">信息ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DateTable</returns> protected DataTable get_comment_list(int channel_id, int content_id, int top, string strwhere) { DataTable dt = new DataTable(); if (channel_id > 0 && content_id > 0) { string _where = string.Format("channel_id={0} and content_id={1}", channel_id, content_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.comment().GetList(top, _where, "add_time desc").Tables[0]; } return(dt); }
/// <summary> /// 评论数据总数 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="content_id">信息ID</param> /// <param name="strwhere">查询条件</param> /// <returns>Int</returns> protected int get_comment_count(int channel_id, int content_id, string strwhere) { int count = 0; if (channel_id > 0 && content_id > 0) { string _where = string.Format("channel_id={0} and content_id={1}", channel_id, content_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } count = new BLL.comment().GetCount(_where); } return(count); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel(channel_id, ActionEnum.Delete.ToString()); //检查权限 BLL.comment bll = new BLL.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"); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; BLL.comment bll = new BLL.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("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); }
/// <summary> /// 评论分页列表 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="content_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 channel_id, int content_id, int page_size, int page_index, string strwhere, out int totalcount) { DataTable dt = new DataTable(); if (channel_id > 0 && content_id > 0) { string _where = string.Format("channel_id={0} and content_id={1}", channel_id, content_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.comment().GetList(page_size, page_index, _where, "add_time desc", out totalcount).Tables[0]; } else { totalcount = 0; } return(dt); }
private void comment_list(HttpContext context) { int _channel_id = DTRequest.GetQueryInt("channel_id"); int _content_id = DTRequest.GetQueryInt("content_id"); int _page_index = DTRequest.GetQueryInt("page_index"); int _page_size = DTRequest.GetQueryInt("page_size"); int totalcount; StringBuilder strTxt = new StringBuilder(); if (_channel_id == 0 || _content_id == 0 || _page_size == 0) { context.Response.Write("获取失败,传输参数有误!"); return; } BLL.comment bll = new BLL.comment(); DataSet ds = bll.GetList(_page_size, _page_index, string.Format("is_lock=0 and channel_id={0} and content_id={1}", _channel_id.ToString(), _content_id.ToString()), "add_time desc", out totalcount); //如果记录存在 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]; 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"); } } else { strTxt.Append("<p>暂无评论,快来抢沙发吧!</p>"); } context.Response.Write(strTxt.ToString()); }
/// <summary> /// 评论数据总数 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="content_id">信息ID</param> /// <param name="strwhere">查询条件</param> /// <returns>Int</returns> protected int get_comment_count(int channel_id, int content_id, string strwhere) { int count = 0; if (channel_id > 0 && content_id > 0) { string _where = string.Format("channel_id={0} and content_id={1}", channel_id, content_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } count = new BLL.comment().GetCount(_where); } return count; }
/// <summary> /// 评论分页列表 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="content_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 channel_id, int content_id, int page_size, int page_index, string strwhere, out int totalcount) { DataTable dt = new DataTable(); if (channel_id > 0 && content_id > 0) { string _where = string.Format("channel_id={0} and content_id={1}", channel_id, content_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.comment().GetList(page_size, page_index, _where, "add_time desc", out totalcount).Tables[0]; } else { totalcount = 0; } return dt; }
/// <summary> /// 评论列表 /// </summary> /// <param name="channel_id">频道ID</param> /// <param name="content_id">信息ID</param> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DateTable</returns> protected DataTable get_comment_list(int channel_id, int content_id, int top, string strwhere) { DataTable dt = new DataTable(); if (channel_id > 0 && content_id > 0) { string _where = string.Format("channel_id={0} and content_id={1}", channel_id, content_id); if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.comment().GetList(top, _where, "add_time desc").Tables[0]; } return dt; }