918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/b8bcf8c8/45c44a59/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/b8bcf8c8/45c44a59/App_Web_mkxow-q2.9.cs
?#pragma checksum "D:\wwwroot\patena\wwwroot\usercontrols\NewsPage.ascx.cs" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "E992F27F1FF293A8208607270CAB1A30"

#line 1 "D:\wwwroot\patena\wwwroot\usercontrols\NewsPage.ascx.cs"
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.Data.OleDb;
using TCLinkDAL;
public partial class usercontrols_NewsPage : System.Web.UI.UserControl
{
    OleDbConnection MyConn;
    int PageSize, RecordCount, PageCount, StartIndex;
    protected int ntid;
    public void Page_Load(Object src, EventArgs e)
    {
        //设定PageSize
        PageSize = 8;
        //衔接语句
        DBCon dbcon = new DBCon();
        MyConn = dbcon.getConn();
        MyConn.Open();

        //第一次要求执行
        if (!Page.IsPostBack)
        {
            ListBind();

        }
    }
    
    //推算总共有几多笔纪录
    public int CalculateRecord()
    {
        int intCount;
 
            ntid =208;
        

        string strCount = "select count(*) as co from News a , NewsType b, NewsClass c where a.ntid = b.ntid and a.cid = c.cid and a.cid=" + ntid + "";
        OleDbCommand MyComm = new OleDbCommand(strCount, MyConn);
        OleDbDataReader dr = MyComm.ExecuteReader();
        
        if (dr.Read())
        {
            intCount = Int32.Parse(dr["co"].ToString());
        }
        else
        {
            intCount = 0;
        }
        dr.Close();
        return intCount;
    }

    public void ListBind()
    {
       
        //当前页数
        string pageIndex = Request.QueryString["page"] ?? "1";
        int index = 1;
        int.TryParse(pageIndex, out index);
        //推算总共有几多纪录
        RecordCount = CalculateRecord();
        //推算总共有几多页
        if (RecordCount % PageSize != 0)
        {
            PageCount = RecordCount / PageSize + 1;
        }
        else
        {
            PageCount = RecordCount / PageSize;
        }

        StartIndex = (index-1) * PageSize;
  
            ntid =208;
      

        string strSel = "select * from News a,NewsType b,NewsClass c  where a.ntid = b.ntid and a.cid = c.cid and a.cid=" + ntid + " order by a.RoId desc";  
        DataSet ds = new DataSet();

        OleDbDataAdapter MyAdapter = new OleDbDataAdapter(strSel, MyConn);
        MyAdapter.Fill(ds,StartIndex, PageSize, "News");

        this.ddlNews.DataSource = ds.Tables["News"].DefaultView;
        this.ddlNews.DataBind();


        PagingBar bar = new PagingBar("sabrosus");
        bar.LeftSize = 4;
        bar.PageCount = PageCount;
        bar.PageIndex = index;
        bar.Url = "?cid=" + ntid + "&page={0}";
        li_page.Text = bar.BuildLinkHtml();
        
    }

    

    protected string str(string myobj, int count)
    {
        string mystr = myobj.ToString();
        string returnstr = mystr;
        if (mystr.Length > count)
        {
            returnstr = mystr.Substring(0, count) + "...";
        }
        return returnstr;
    }

}




#line default
#line hidden