コード例 #1
0
ファイル: list_news.aspx.cs プロジェクト: wjszxli/xdjb
    //批量删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        TPortalClass.JpNewsBroke JpNewsBroke = new TPortalClass.JpNewsBroke();
        string ls_tip = "删除成功!";
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value;
            CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
            if (cb.Checked)
            {
                JpNewsBroke.id = int.Parse(id);
                JpNewsBroke.Delete();
            }
        }
        string pageUrl = JpCommon.CombUrlTxt("list_news.aspx", "page={0}&rnd={1}",
            "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "");

        //写系统日志

        string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        if (userip == null || userip == "")
        {
            userip = Request.ServerVariables["REMOTE_ADDR"];
        }
        JpCommon.WriteLog(userip, "删除", "批量删除新闻爆料记录", Session["uid"].ToString(), Session["uname"].ToString());
        Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
    }
コード例 #2
0
ファイル: news_form.aspx.cs プロジェクト: wjszxli/xdjb
 protected void btn_save_Click(object sender, EventArgs e)
 {
     JpNewsBroke jpNewsBroke = new JpNewsBroke();
     jpNewsBroke.docid = this.txtDocid.Value;
     jpNewsBroke.hy_addtime = DateTime.Now;
     jpNewsBroke.hy_content = this.txtData.Value;
     jpNewsBroke.hy_sort = jpNewsBroke.getMaxSort();
     jpNewsBroke.hy_tel = this.txtPhone.Value;
     jpNewsBroke.Insert();
     Response.Write("<script>alert('保存成功!');</script>");
 }
コード例 #3
0
ファイル: main_news.aspx.cs プロジェクト: wjszxli/xdjb
    private void DataPlay()
    {
        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改
        }

        if (this.Request.QueryString["id"] != null)
        {
            this.txtid.Value = this.Request.QueryString["id"].ToString();     //文档ID
        }
        TPortalClass.JpNewsBroke JpNewsBroke = new TPortalClass.JpNewsBroke();

        //旧文档
        if (this.txtop.Value == "modify")
        {
            DataTable dt = JpNewsBroke.Getdocbyid(int.Parse(this.txtid.Value));
            if (dt.Rows.Count > 0)
            {
                this.txtid.Value = dt.Rows[0]["id"].ToString();
                this.txthy_tel.Text = dt.Rows[0]["hy_tel"].ToString();
                this.txthy_content.Text = dt.Rows[0]["hy_content"].ToString();
                this.txthy_addtime.Text = Convert.ToDateTime(dt.Rows[0]["hy_addtime"].ToString()).ToString("yyyy-MM-dd");
                this.txthy_sort.Text = dt.Rows[0]["hy_sort"].ToString();
            }
        }
        else
        {
            TPortalClass.DAO db = new TPortalClass.DAO();
            string sql = "select top 1  hy_sort   from hy_news order by hy_sort desc ";
            DataTable dt = db.GetDataTable(sql);
            if (dt.Rows.Count > 0)
            {
                this.txthy_sort.Text = (Convert.ToInt32(dt.Rows[0]["hy_sort"].ToString()) + 1).ToString();
            }
            else
            {
                this.txthy_sort.Text = "1";
            }
        }
    }
コード例 #4
0
ファイル: list_news.aspx.cs プロジェクト: wjszxli/xdjb
    private void RptBind()
    {
        if (this.Request.QueryString["page"] != null)
            this.page = int.Parse(this.Request.QueryString["page"].ToString());
        else
            this.page = 1;

        this.txtKeywords.Text = this.keywords;
        txtPageNum.Text = this.pageSize.ToString();
        txtPage.Text = this.page.ToString();

        TPortalClass.JpNewsBroke JpNewsBroke = new TPortalClass.JpNewsBroke();

        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        string ls_key = JpCommon.Filter(this.txtKeywords.Text.Trim());

        DataTable dt = new DataTable();
        string ls_where = "  and   hy_content  like '%" + ls_key + "%' ";
        dt = JpNewsBroke.SearchdocsByKey(ls_where, "   order by hy_sort desc ", Convert.ToInt32(txtPage.Text), 10);
        this.totalCount = JpNewsBroke.SearchdocsByKeyNum(ls_where);

        rptList.DataSource = dt;

        rptList.DataBind();

        string pageUrl = JpCommon.CombUrlTxt("list_news.aspx", "page={0}&rnd={1}&keywords={2}",
            "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + "");
        PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }