Exemplo n.º 1
0
    ////保存
    protected void Button_Save_Click(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() == "")
            this.Response.Redirect("../login.aspx");

        string ls_tip = "发表文章成功!";

        HyoaClass.Hyoa_boke_main Hyoa_boke_main = new HyoaClass.Hyoa_boke_main();
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        Hyoa_boke_main.DOCID = Hyoa_global.GetRandom();
        Hyoa_boke_main.hy_djrid = this.Session["hyuid"].ToString();
        Hyoa_boke_main.hy_djrname = this.Session["hyuname"].ToString();
        Hyoa_boke_main.hy_djsj = System.DateTime.Now.ToString();
        Hyoa_boke_main.hy_bt = this.txtbt.Text;
        Hyoa_boke_main.hy_content = this.Content.Value;
        Hyoa_boke_main.hy_visits = 0;

        if (Hyoa_boke_main.Insert() == true)
        {
            Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>");
        }
        else
        {
            this.Response.Write("<script>alert('发表文章失败,请联系管理员!')</script>");
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() =="")
            this.Response.Redirect("../login.aspx?url="+this.Request.RawUrl);

        if (!IsPostBack)
        {
            string lsdocid = "";
            if (this.Request.QueryString["DOCID"] != null)
            {
                lsdocid =this.Request.QueryString["DOCID"].ToString();//得到文档ID
                HyoaClass.Hyoa_boke_main Hyoa_boke_main = new HyoaClass.Hyoa_boke_main();
                Hyoa_boke_main.DOCID = lsdocid;
                Hyoa_boke_main.Delete();
                HyoaClass.Hyoa_boke_reback Hyoa_boke_reback = new HyoaClass.Hyoa_boke_reback();
                Hyoa_boke_reback.DeleteByfatherid(lsdocid);
                this.Response.Write("<script>alert('删除成功!');window.close();window.opener.location.reload();</script>");
            }

        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() =="")
            this.Response.Redirect("../login.aspx?url="+this.Request.RawUrl);

        if (!IsPostBack)
        {

            string lsnr="";
            int curpage = 1;
            int perpage = 5;
            int sumpage = 0;  //总页数
            if (this.Request.QueryString["page"] != null)
            {
                curpage = System.Int32.Parse(this.Request.QueryString["page"].ToString());
            }
            HyoaClass.Hyoa_boke_main Hyoa_boke_main = new HyoaClass.Hyoa_boke_main();
            DataTable dt = Hyoa_boke_main.Getboke_mains();
            HyoaClass.Hyoa_boke_reback Hyoa_boke_reback = new HyoaClass.Hyoa_boke_reback();
            DataTable dtreback;
            string lsbt = "";
            for (int i = (curpage - 1) * perpage; i < curpage * perpage; i++)
            {
                if (i < dt.Rows.Count)
                {
                    lsnr += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"xx-xb2\">";
                    lsnr += "<tr>";
                    lsnr += "<td height=\"50\" class=\"lmbt\">" + dt.Rows[i]["hy_bt"].ToString() + "&nbsp;&nbsp;[发布人:" + dt.Rows[i]["hy_djrname"].ToString() + "&nbsp;&nbsp;发布时间:" + dt.Rows[i]["hy_djsj"].ToString() + "]</td>";
                    lsnr += "</tr>";
                    lsnr += "<tr>";
                    lsbt = dt.Rows[i]["hy_content"].ToString();
                    if (lsbt.Length > 240)
                        lsbt = lsbt.Substring(0, 240)+"......";
                    lsnr += "<td>   " + lsbt + "</td>";
                    lsnr += "</tr>";
                    lsnr += "<tr>";
                    lsnr += "<td height=\"50\">";
                    lsnr += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"lj2\">";
                    lsnr += "<tr>";
                    dtreback = Hyoa_boke_reback.Getboke_rebackbyfatherid(dt.Rows[i]["DOCID"].ToString());
                    lsnr += "<td>评论("+dtreback.Rows.Count.ToString()+")</td>";
                    lsnr += "<td align=\"right\"><a href=\"detail.aspx?DOCID=" + dt.Rows[i]["DOCID"].ToString() + "\">查看全文&gt;&gt;</a></td>";
                    lsnr += "</tr>";
                    lsnr += "</table>";
                    lsnr += "</td>";
                    lsnr += "</tr>";
                    lsnr += "</table>";
                }
            }
            this.lblnr.Text = lsnr;
            //得到上页的数码
            string lsuppage = "1";
            if ((curpage - 1) < 1)
                lsuppage = "1";
            else
                lsuppage = (curpage - 1).ToString();
            //得到总页数
            if (dt.Rows.Count % perpage != 0)
            {
                sumpage = dt.Rows.Count / perpage + 1;
            }
            else
            {
                sumpage = dt.Rows.Count / perpage;
            }
            //得到下一页页码
            string lsdownpage = (dt.Rows.Count / perpage).ToString();  //下一页
            if ((curpage + 1) <= sumpage)
                lsdownpage = (curpage + 1).ToString();
            else
                lsdownpage = sumpage.ToString();

            if (sumpage < 1)
                lsdownpage = "1";
            this.lblturnpage.Text = "<a href=\"#\" onclick=\"window.location='index.aspx?page=" + lsuppage + "'\">上一页</a>    <a href=\"#\" onclick=\"window.location='index.aspx?page=" + lsdownpage + "'\">下一页</a>";
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Session["hyuid"].ToString() =="")
            this.Response.Redirect("../login.aspx?url="+this.Request.RawUrl);

        if (!IsPostBack)
        {

            string lsdocic = "";
            if (this.Request.QueryString["DOCID"] != null)
            {
                lsdocic = this.Request.QueryString["DOCID"].ToString();   //是否弹出窗口
                this.txtfatherid.Value = lsdocic;
            }
            else
            {
                this.Response.Write("<script>alert('文档ID不存在,请联系管理员!')</script>");
                return;
            }
            this.txturl.Value = "detail.aspx?DOCID=" + lsdocic;     //返回URL
            HyoaClass.Hyoa_boke_main Hyoa_boke_main = new HyoaClass.Hyoa_boke_main();
            DataTable dt = Hyoa_boke_main.Getboke_mainbyDOCID(lsdocic);
            HyoaClass.Hyoa_boke_reback Hyoa_boke_reback = new HyoaClass.Hyoa_boke_reback();
            DataTable dtreback = Hyoa_boke_reback.Getboke_rebackbyfatherid(lsdocic);
            string lsreback = "";
            if (dt.Rows.Count > 0)
            {
                this.lblbt.Text = dt.Rows[0]["hy_bt"].ToString() + "&nbsp;&nbsp;[发布人:" + dt.Rows[0]["hy_djrname"].ToString() + "&nbsp;&nbsp;发布时间:" + dt.Rows[0]["hy_djsj"].ToString() + "]";
                this.lblnr.Text = dt.Rows[0]["hy_content"].ToString();

                for (int j = 0; j < dtreback.Rows.Count; j++)
                {

                    lsreback += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"xx-xb2\">";
                    lsreback += "<tr>";
                    lsreback += "<td width=30px><img src=\"images/ico-rr.jpg\" width=\"27\" height=\"17\" /></td>";
                    lsreback += "<td height=\"30\" align=left>" + dtreback.Rows[j]["hy_djrname"].ToString() + "&nbsp;&nbsp;[评论时间:" + dtreback.Rows[j]["hy_djsj"].ToString() + "&nbsp;&nbsp;IP:" + dtreback.Rows[j]["hy_ip"].ToString() + "]" + "</td>";
                    lsreback += "</tr>";
                    lsreback += "<tr>";
                    lsreback += "<td>&nbsp;</td>";
                    lsreback += "<td>" + dtreback.Rows[j]["hy_content"].ToString() + "</td>";
                    lsreback += "</tr>";
                    lsreback += "</table>";
                }

                //向查看表中插入查看人员的记录
                HyoaClass.Hyoa_boke_lookinfo Hyoa_boke_lookinfo = new HyoaClass.Hyoa_boke_lookinfo();
                HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
                Hyoa_boke_lookinfo.DOCID = Hyoa_global.GetRandom();
                Hyoa_boke_lookinfo.hy_fatherid = this.txtfatherid.Value;
                Hyoa_boke_lookinfo.hy_fatheruserid = dt.Rows[0]["hy_djrid"].ToString();
                Hyoa_boke_lookinfo.hy_fatherusername = dt.Rows[0]["hy_djrname"].ToString();
                Hyoa_boke_lookinfo.hy_djsj = System.DateTime.Now.ToString();
                Hyoa_boke_lookinfo.hy_djrid = this.Session["hyuid"].ToString();
                Hyoa_boke_lookinfo.hy_djrname = this.Session["hyuname"].ToString();
                string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (userip == null || userip == "")
                {
                    userip = Request.ServerVariables["REMOTE_ADDR"];  //得到客户端IP
                }
                Hyoa_boke_lookinfo.hy_ip = userip;
                Hyoa_boke_lookinfo.Insert();

            }

            this.lblreback.Text = lsreback;

        }
    }