using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class Article : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string p = Request.QueryString["p"];
        string[] s = noPlay.Split('|');
        if (!IsPostBack)
        {
            getArticle(p, s);
        }
        
    }

    string noPlay = "妈妈|fuck|妈的|妈逼|妈比|江泽民|共产党|法轮功|台湾|政治|强奸|A片|a片|骗子|黄片|色情";
    void getArticle(string p, string[] splay)
    {
        int pagion = 5;
        int cpage = 1;//当前页
        try
        {
            if (!string.IsNullOrEmpty(p))
                cpage = int.Parse(p);
            else
                cpage = 1;
        }
        catch { cpage = 1; }
        try
        {
            string sql = "";
            if (!string.IsNullOrEmpty(p))
            {
                if (cpage == 1)
                {
                    sql = string.Format("SELECT top {0} * FROM ARTICLE ORDER BY ID DESC ", pagion);
                }
                else
                {
                    sql = string.Format("SELECT TOP {0} * FROM ARTICLE WHERE  ID NOT IN(SELECT TOP {1} ID FROM ARTICLE ORDER BY ID DESC) ORDER BY ID DESC", pagion, pagion * (cpage - 1));
                }
            }
            else
                sql = sql = string.Format("SELECT top {0} * FROM ARTICLE ORDER BY ID DESC ", pagion);
            StringBuilder sb = new StringBuilder();
            using (System.Data.OleDb.OleDbDataReader reader = SqlHelper.ExecuteReader(sql))
            {
                while (reader.Read())
                {
                    sb.Append("<tr><td valign=\"top\"><div><span style=\"color:blue;font-size:13px; font-weight:bold;\">");
                    sb.AppendFormat("<a href=\"ShowArticle.aspx?id={0}\" target=_black ><font color=blue>{1}</font></a></span><div class=\"artdiv\">",reader["id"],reader["arttitle"]);
                    sb.AppendFormat("<li><font color=blue>摘要：</font>{0}</li><div style=\"text-align:right;padding:10px;\">", reader["artDesc"]);
                    sb.AppendFormat("<span>文档来源：<font color=red>{0}</font> 文档作者：<a href=\"javascript:;\"><font color=red>{1}</font></a> 浏览次数：<font color=red>{2}</font></span></div>", reader["artFrom"], reader["artAuthor"], reader["artHit"]);
                    sb.Append("</div></div><div style=\"margin:10px;\"></div></td></tr> ");
                }
                this.artList.InnerHtml = sb.ToString();
                this.Pagion1.GetString("id", cpage, pagion, "Article", " 1=1 ", "Article.aspx", "?p=");
            }
        }
        catch (Exception ex)
        {
            this.artList.InnerHtml = "<div >读取数据错误"+ex.Message+"</div>";
        }
    }
}




















  //<tr>
  //  <td valign="top">
  //    <div>
  //      <span style="color:blue;font-size:13px; font-weight:bold;">您也可以提交查询网站哦：</span>
  //      <div class="artdiv">
  //      <li>由于人力有限,每天去网络中搜索查询网站很费力,希望各位找到了可查询网站在此提交,待审核后入库
  //      您的帮助将会使我们的<font color=red>宣传工具提交的数据库</font>更多数据，方便您和他人
  //      如果您提交的网站适合，我们<font color=red>免费把您的网站显示</font>在此
  //      什么网站才是查询网站？比如<font color=red>查询IP：http://www.xxx.com/chaxun.php?site=www.13sb.cn...等此类网站</font></li>

//        <span>文档来源：CnBeta 文档作者：匿名 浏览次数：1 评论次数：0</span>
  //      </div>
  //    </div>
  //    <div style="margin:10px;"></div>  
  //  </td>
  //  </tr>