//批量移动 protected void ddlMoveId_SelectedIndexChanged(object sender, EventArgs e) { ChkAdminLevel("plugin_forum_post", DTEnums.ActionEnum.Edit.ToString()); //检查权限 int sucCount = 0; //成功数量 int postcount = 0; int replycount = 0; if (ddlMoveId.SelectedValue == "") { ddlMoveId.SelectedIndex = 0; JscriptMsg("请选择要移动的类别!", string.Empty); return; } BLL.forum_posts bll = new BLL.forum_posts(); BLL.forum_board bbll = new BLL.forum_board(); Model.forum_board bmodel = new Model.forum_board(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int oldboardid = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidBid")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { DataTable dt = bll.GetList(0, "id=" + id + " or parent_post_id=" + id, "id desc").Tables[0]; foreach (DataRow dr in dt.Rows) { if (int.Parse(dr["parent_post_id"].ToString()) == 0) { postcount += 1; replycount += 1; } else { replycount += 1; } sucCount++; bll.UpdateField(int.Parse(dr["id"].ToString()), "board_id=" + ddlMoveId.SelectedValue); } bmodel = bbll.GetModel(oldboardid); bmodel.subject_count -= postcount; bmodel.post_count -= replycount; bbll.Update(bmodel); bmodel = bbll.GetModel(int.Parse(ddlMoveId.SelectedValue)); bmodel.subject_count += postcount; bmodel.post_count += replycount; bbll.Update(bmodel); } } AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "批量移动频道内容分类"); //记录日志 JscriptMsg("批量移动成功" + sucCount + "条", Utils.CombUrlTxt("post_list.aspx", "board_id={0}&keywords={1}&property={2}", this.board_id.ToString(), this.keywords, this.property)); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel("plugin_forum_post", DTEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.forum_posts bll = new BLL.forum_posts(); Model.forum_posts model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIsTop": if (model.is_top == 1) { bll.UpdateField(id, "is_top=0"); } else { bll.UpdateField(id, "is_top=1"); } break; case "lbtnIsRed": if (model.is_red == 1) { bll.UpdateField(id, "is_red=0"); } else { bll.UpdateField(id, "is_red=1"); } break; case "lbtnIsHot": if (model.is_hot == 1) { bll.UpdateField(id, "is_hot=0"); } else { bll.UpdateField(id, "is_hot=1"); } break; case "lbtnIsLock": if (model.is_lock == 1) { bll.UpdateField(id, "is_lock=0"); } else { bll.UpdateField(id, "is_lock=1"); } break; } this.RptBind(this.board_id, "post_type=1" + CombSqlTxt(this.keywords, this.property), "add_time desc,id desc"); }
//批量审核 protected void btnAudit_Click(object sender, EventArgs e) { ChkAdminLevel("plugin_forum_post", DTEnums.ActionEnum.Audit.ToString()); //检查权限 BLL.forum_posts bll = new BLL.forum_posts(); Repeater rptList = new Repeater(); rptList = this.rptList1; 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(), "审核频道内容信息"); //记录日志 JscriptMsg("批量审核成功!", Utils.CombUrlTxt("post_list.aspx", "board_id={0}&keywords={1}&property={2}", this.board_id.ToString(), this.keywords, this.property)); }