//批量删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int        sucCount   = 0; //成功数量
        int        errorCount = 0; //失败数量
        ps_article bll        = new ps_article();

        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++;
                }
                else
                {
                    errorCount++;
                }
            }
        }
        mym.AddAdminLog("删除", "删除公告成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
        mym.JscriptMsg(this.Page, " 删除公告成功" + sucCount + "条,失败" + errorCount + "条", Utils.CombUrlTxt("article_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success");
    }
Example #2
0
    private bool DoEdit(int _id)
    {
        bool result = false;

        ps_article model = new ps_article();

        model.GetModel(_id);

        model.title    = txttitle.Text.Trim();
        model.content  = txtContent.Value;
        model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim());
        model.sort_id  = int.Parse(txtSortId.Text.Trim());
        if (cbIsLock.Checked == true)
        {
            model.status = 1;
        }
        else
        {
            model.status = 2;
        }
        if (model.Update())
        {
            mym.AddAdminLog("修改", "修改通知公告:" + txttitle.Text); //记录日志
            result = true;
        }

        return(result);
    }
Example #3
0
    protected void noticeBind()
    {
        ps_article bll = new ps_article();

        this.rptList_notice.DataSource = bll.GetList(13, " status=1 ", " sort_id asc, add_time desc");
        this.rptList_notice.DataBind();
    }
    // 单个删除
    protected void lbtnDelCa_Click(object sender, EventArgs e)
    {
        // 当前点击的按钮
        LinkButton lb   = (LinkButton)sender;
        int        caId = int.Parse(lb.CommandArgument);
        ps_article bll  = new ps_article();

        bll.GetModel(caId);
        string title = bll.title;

        bll.Delete(caId);
        mym.AddAdminLog("删除", "删除公告:" + title + ""); //记录日志
        mym.JscriptMsg(this.Page, " 成功删除公告:" + title + "", Utils.CombUrlTxt("article_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success");
    }
    private void RptBind(string _strWhere, string _orderby)
    {
        this.page        = AXRequest.GetQueryInt("page", 1);
        txtKeywords.Text = this.keywords;
        ps_article bll = new ps_article();

        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("article_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

        PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
    private void ShowInfo(int _id)
    {
        ps_article model = new ps_article();

        model.GetModel(_id);
        Littitle.Text      = model.title;
        LitContent.Text    = model.content;
        LitAddTime.Text    = Convert.ToDateTime(model.add_time).ToString("yyyy-MM-dd HH:mm:ss");
        LitClickCount.Text = model.click.ToString();

        //更新浏览次数
        int click = int.Parse(model.click.ToString()) + 1;

        model.UpdateField(id, "click=" + click);
    }
Example #7
0
    private void ShowInfo(int _id)
    {
        ps_article model = new ps_article();

        model.GetModel(_id);
        txttitle.Text    = model.title;
        txtContent.Value = model.content;
        txtAddTime.Text  = Convert.ToDateTime(model.add_time).ToString("yyyy-MM-dd HH:mm:ss");
        txtSortId.Text   = model.sort_id.ToString();
        if (model.status == 1)
        {
            cbIsLock.Checked = true;
        }
        else
        {
            cbIsLock.Checked = false;
        }
    }
    //保存排序
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ps_article bll     = new ps_article();
        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());
        }
        mym.JscriptMsg(this.Page, " 排序保存成功", Utils.CombUrlTxt("article_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success");
    }
Example #9
0
    private bool DoAdd()
    {
        ps_article model = new ps_article();

        model.title    = txttitle.Text.Trim();
        model.content  = txtContent.Value;
        model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim());
        model.sort_id  = int.Parse(txtSortId.Text.Trim());
        if (cbIsLock.Checked == true)
        {
            model.status = 1;
        }
        else
        {
            model.status = 2;
        }
        if (model.Add() > 0)
        {
            mym.AddAdminLog("增加", "添加通知公告:" + txttitle.Text); //记录日志
            return(true);
        }

        return(false);
    }