⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cipher_list.aspx.cs

📁 大家一起研究研究,全部都是开源的CSHARP代码.带数据库的
💻 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;

public partial class Cipher_List : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sql = "";
            string sql1 = "";
            int proClassId = -1;
            if (Request.QueryString["proClassId"] != null)
            {
                proClassId = Convert.ToInt32(Request.QueryString["proClassId"]);
            }
            if (proClassId == -1)
            {
                sql = "Select Top 10 A.*,B.* From [NcProducts] As A Left Join [NcClass] As B On A.[ProductClassId]=B.[ClassId] Where  B.[ClassType]=1 Order By A.[ProductId] DESC";
            }
            else
            {
                sql = "Select Top 10 A.*,B.* From [NcProducts] As A Left Join [NcClass] As B On A.[ProductClassId]=B.[ClassId] Where A.[ProductClassId]=" + proClassId + " And B.[ClassType]=1 Order By A.[ProductId] DESC";
            }
            
            sql1 = "Select * From [NcClass] Where [CLassId]=" + proClassId;
            WebConfig.CreateCon();
            OleDbDataAdapter daa = new OleDbDataAdapter(sql1, WebConfig.con);
            DataSet ds1 = new DataSet();
            daa.Fill(ds1);
            if (ds1.Tables[0].Rows.Count < 1)
            {
                this.Head1.Title = "OEM订制品--" + Application["webName"].ToString();
                this.Label1.Text = "OEM订制品";
            }
            else
            {
                this.Head1.Title = ds1.Tables[0].Rows[0]["ClassName"].ToString() + "--" + Application["webName"].ToString();
                this.Label1.Text = ds1.Tables[0].Rows[0]["ClassName"].ToString();
            }
            OleDbDataAdapter da = new OleDbDataAdapter(sql, WebConfig.con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = ds.Tables[0].DefaultView;
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (ds.Tables[0].Rows[i]["ProductPic"] == null)
                {
                    
                    ds.Tables[0].Rows[i]["ProductPic"] = "images/no_pic.gif";
                }
                else
                {
                    if (ds.Tables[0].Rows[i]["ProductPic"].ToString().Length < 1)
                    {
                        ds.Tables[0].Rows[i]["ProductPic"] = "images/no_pic.gif";
                    }
                    else
                    {
                        ds.Tables[0].Rows[i]["ProductPic"] = "upload/" + ds.Tables[0].Rows[i]["ProductPic"].ToString();
                    }
                }
                //Response.Write(ds.Tables[0].Rows[i]["ProductPic"].ToString());
            }
            pds.AllowPaging = true;
            pds.PageSize = Convert.ToInt32(Application["ProductListPageSize"]);
            int curPage;

            if (Request.QueryString["page"] != null)
            {
                curPage = Convert.ToInt32(Request.QueryString["page"]);
            }
            else
            {
                curPage = 1;
            }

            pds.CurrentPageIndex = curPage - 1;
            this.Repeater1.DataSource = pds;
            this.Repeater1.DataBind();
            this.Label2.Text += "<a>共有"+ds.Tables[0].Rows.Count.ToString()+"个产品</a>";
            this.Label2.Text += "<a>分" + pds.PageCount.ToString() + "页</a>";
            this.Label2.Text += "<a>第" + curPage.ToString() +"页</a>";
            //this.LbNewsCount.Text = ds.Tables[0].Rows.Count.ToString();
            //this.LbPageCount.Text = pds.PageCount.ToString();
            //this.LbCurPage.Text = curPage.ToString();
            if (curPage == 1)
            {
                this.Label2.Text += "<a>上一页</a>";
            }
            else
            {
                if(proClassId==-1)
                    this.Label2.Text += "<a href='Cipher_List-" + (curPage - 1).ToString() + ".aspx'>上一页</a>";
                else
                    this.Label2.Text += "<a href='Cipher_List_" + proClassId.ToString() + "_" + (curPage - 1).ToString() + ".aspx'>上一页</a>";
            }
            if (curPage == pds.PageCount)
            {
                this.Label2.Text += "<a>下一页</a>";
            }
            else
            {
                if(proClassId==-1)
                    this.Label2.Text += "<a href='Cipher_List-" + (curPage + 1).ToString() + ".aspx'>下一页</a>";
                else
                    this.Label2.Text += "<a href='Cipher_List_" + proClassId.ToString() + "_" + (curPage + 1).ToString() + ".aspx'>下一页</a>";
            }
            ds.Dispose();
            da.Dispose();
            WebConfig.CloseCon();
        }
    }

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -