Exemplo n.º 1
0
        private void TreeBind()
        {
            BLL.forum_board bll = new BLL.forum_board();
            DataTable       dt  = bll.GetAllList(0);

            this.ddlParentId.Items.Clear();
            this.ddlParentId.Items.Add(new ListItem("无父级分类", "0"));
            foreach (DataRow dr in dt.Rows)
            {
                string Id         = dr["id"].ToString();
                int    ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title      = dr["boardname"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlParentId.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlParentId.Items.Add(new ListItem(Title, Id));
                }
            }
        }
Exemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.forum_board   bll   = new BLL.forum_board();
            Model.forum_board model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            rblStatus.SelectedValue   = model.is_lock.ToString();
            txtBoardName.Text         = model.boardname;
            txtImgUrl.Text            = model.img_url;
            txtSortId.Text            = model.sort_id.ToString();
            txtContent.Text           = model.content;
            txtModeratorList.Text     = model.moderator_list;
            //赋值授予权限
            if (model.allow_usergroupid_list != null)
            {
                for (int i = 0; i < cblAllowUserGroupID.Items.Count; i++)
                {
                    string[] allowusergroupid = model.allow_usergroupid_list.Split(',');
                    foreach (string id in allowusergroupid)
                    {
                        if (id != "" && id == cblAllowUserGroupID.Items[i].Value)
                        {
                            cblAllowUserGroupID.Items[i].Selected = true;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private bool DoAdd()
        {
            bool result = false;

            Model.forum_board model = new Model.forum_board();
            BLL.forum_board   bll   = new BLL.forum_board();

            model.parent_id      = int.Parse(ddlParentId.SelectedValue);
            model.is_lock        = int.Parse(rblStatus.SelectedValue);
            model.boardname      = txtBoardName.Text;
            model.img_url        = txtImgUrl.Text;
            model.sort_id        = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.content        = txtContent.Text;
            model.moderator_list = txtModeratorList.Text;
            for (int i = 0; i < cblAllowUserGroupID.Items.Count; i++)
            {
                if (cblAllowUserGroupID.Items[i].Selected)
                {
                    model.allow_usergroupid_list += cblAllowUserGroupID.Items[i].Value + ",";
                }
            }
            model.allow_usergroupid_list = model.allow_usergroupid_list.TrimEnd(',');
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加论坛版块:" + model.boardname); //记录日志
                result = true;
            }
            return(result);
        }
Exemplo n.º 4
0
        //批量删除
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("plugin_forum", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.forum_board bll = new BLL.forum_board();
            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(), "删除留言成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("index.aspx", "keywords={0}", this.keywords));
        }
Exemplo n.º 5
0
        private void RptBind()
        {
            BLL.forum_board bll = new BLL.forum_board();
            DataTable       dt  = bll.GetAllList(0);

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
Exemplo n.º 6
0
        //批量移动
        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));
        }
Exemplo n.º 7
0
        private void RptBind(string _strWhere, string _orderby)
        {
            if (!int.TryParse(Request.QueryString["page"] as string, out this.page))
            {
                this.page = 1;
            }
            this.txtKeywords.Text = this.keywords;
            BLL.forum_board bll = new BLL.forum_board();
            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("board_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 8
0
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("plugin_forum", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.forum_board bll     = new BLL.forum_board();
            Repeater        rptList = new Repeater();

            rptList = this.rptList;
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;
                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "sort_id=" + sortId.ToString());
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存论坛版块排序"); //记录日志
            JscriptMsg("保存排序成功!", Utils.CombUrlTxt("board_list.aspx", "keywords={0}", this.keywords));
        }