|
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/ |
?#pragma checksum "D:\wwwroot\patena\wwwroot\usercontrols\BrandPage.ascx.cs" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "ECCF61934F684548F77FF3C4ACDE42CB"
#line 1 "D:\wwwroot\patena\wwwroot\usercontrols\BrandPage.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_BrandPage : System.Web.UI.UserControl
{
OleDbConnection MyConn;
int PageSize, RecordCount, PageCount, StartIndex;
protected int ntid;
protected int cid;
string strCount = "";
string strSel = "";
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;
string strCount = "";
cid = 201;
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=" + cid + "";
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;
string strSel = "";
cid = 201;
strSel = "select * from News a,NewsType b,NewsClass c where a.ntid = b.ntid and a.cid = c.cid and a.cid=" + cid + " 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 = "?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