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

📄 picturesee.aspx.cs

📁 自己开发的一个wap手机网站源代码 公开代码供大家学习下载
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
//using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Web.UI.HtmlControls;
using System.Configuration;

public partial class PictureSee : System.Web.UI.MobileControls.MobilePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AdRotator child = new AdRotator();
        child.AdvertisementFile="~/ad.xml";
        this.Form1.Controls.Add(child);
        Label label = new Label();
        label.Text="图片列表";
        this.Form1.Controls.Add(label);
        if (base.Request.QueryString["size"] != null)
        {
            this.GetBySize();
        }
        else if (base.Request.QueryString["type"] != null)
        {
            this.GetByType();
        }
        else
        {
            this.GetByAll();
        }

    }

    private void GetByAll()
    {
        int num = 1;
        DataSet dataSet = new DataSet();
        string connString = GetConnString();
        string selectCommandText = "select  [id] as 顺序, [picname] as 名称 from [Pictures] where DeleteFlag = False Order by id Desc";
        new OleDbDataAdapter(selectCommandText, connString).Fill(dataSet, "Tb2");
        int count = dataSet.Tables[0].Rows.Count;
        new Label().Text="所有图片";
        this.Form1.Title="所有图片";
        if (count != 0)
        {
            int num4;
            Link[] linkArray = new Link[count];
            if (base.Request.QueryString["page"] != null)
            {
                num = Convert.ToInt32(base.Request.QueryString["page"].ToString());
            }
            for (int i = 0; ((((num - 1) * 10) + i) < count) && (i < 10); i++)
            {
                linkArray[i] = new Link();
                linkArray[i].Text=dataSet.Tables[0].Rows[((num - 1) * 10) + i]["名称"].ToString();
                linkArray[i].NavigateUrl="See.aspx?id=" + dataSet.Tables[0].Rows[((num - 1) * 10) + i]["顺序"].ToString();
                this.Form1.Controls.Add(linkArray[i]);
            }
            if ((dataSet.Tables[0].Rows.Count % 10) != 0)
            {
                num4 = (dataSet.Tables[0].Rows.Count / 10) + 1;
            }
            else
            {
                num4 = dataSet.Tables[0].Rows.Count / 10;
            }
            if (num < num4)
            {
                Link link = new Link();
                link.Text="下一页";
                link.NavigateUrl="PictureSee.aspx?page=" + Convert.ToString((int)(num + 1));
                link.BreakAfter=false;
                this.Form1.Controls.Add(link);
            }
            Label label2 = new Label();
            label2.Text=num.ToString() + "/" + num4.ToString();
            this.Form1.Controls.Add(label2);
            label2.BreakAfter=false;
            if (num != 1)
            {
                Link link2 = new Link();
                link2.Text="前一页";
                link2.NavigateUrl="PictureSee.aspx?page=" + Convert.ToString((int)(num - 1));
                this.Form1.Controls.Add(link2);
                link2.BreakAfter=true;
            }
            Label label3 = new Label();
            label3.Text="";
            this.Form1.Controls.Add(label3);
            if ((num4 != 1) && (num != 1))
            {
                label3.BreakAfter=false;
            }
        }
        Link child = new Link();
        child.Text="返回类型选择";
        child.NavigateUrl="PictureList.aspx";
        this.Form1.Controls.Add(child);
    }

    private void GetBySize()
    {
        int num = 1;
        string str = base.Request.QueryString["size"].ToString();
        DataSet dataSet = new DataSet();
        string connString = GetConnString();
        new OleDbDataAdapter("select  [id] as 顺序, [picname] as 名称 from [Pictures] where [size]= '" + str + "' and DeleteFlag = False Order by id Desc", connString).Fill(dataSet, "Tb2");
        int count = dataSet.Tables[0].Rows.Count;
        new Label().Text=str + "图片";
        this.Form1.Title=str + "图片";
        if (count != 0)
        {
            int num4;
            Link[] linkArray = new Link[count];
            if (base.Request.QueryString["page"] != null)
            {
                num = Convert.ToInt32(base.Request.QueryString["page"].ToString());
            }
            for (int i = 0; ((((num - 1) * 10) + i) < count) && (i < 10); i++)
            {
                linkArray[i] = new Link();
                linkArray[i].Text=dataSet.Tables[0].Rows[((num - 1) * 10) + i]["名称"].ToString();
                linkArray[i].NavigateUrl="See.aspx?id=" + dataSet.Tables[0].Rows[((num - 1) * 10) + i]["顺序"].ToString();
                this.Form1.Controls.Add(linkArray[i]);
            }
            if ((dataSet.Tables[0].Rows.Count % 10) != 0)
            {
                num4 = (dataSet.Tables[0].Rows.Count / 10) + 1;
            }
            else
            {
                num4 = dataSet.Tables[0].Rows.Count / 10;
            }
            if (num < num4)
            {
                Link link = new Link();
                link.Text="下一页";
                link.NavigateUrl="PictureSee.aspx?size=" + str + "&page=" + Convert.ToString((int)(num + 1));
                link.BreakAfter=false;
                this.Form1.Controls.Add(link);
            }
            Label label2 = new Label();
            label2.Text=num.ToString() + "/" + num4.ToString();
            this.Form1.Controls.Add(label2);
            label2.BreakAfter=false;
            if (num != 1)
            {
                Link link2 = new Link();
                link2.Text="前一页";
                link2.NavigateUrl="PictureSee.aspx?size=" + str + "&page=" + Convert.ToString((int)(num - 1));
                this.Form1.Controls.Add(link2);
                link2.BreakAfter=true;
            }
            Label label3 = new Label();
            label3.Text="";
            this.Form1.Controls.Add(label3);
            if ((num4 != 1) && (num != 1))
            {
                label3.BreakAfter=false;
            }
        }
        Link child = new Link();
        child.Text="返回类型选择";
        child.NavigateUrl="PictureList.aspx";
        this.Form1.Controls.Add(child);
    }

    private void GetByType()
    {
        int num = 1;
        string str = base.Request.QueryString["type"].ToString();
        DataSet dataSet = new DataSet();
        string connString = GetConnString();
        new OleDbDataAdapter("select  [id] as 顺序, [picname] as 名称 from [Pictures] where [type]= '" + str + "' and DeleteFlag = False Order by id Desc", connString).Fill(dataSet, "Tb2");
        int count = dataSet.Tables[0].Rows.Count;
        new Label().Text=str + "图片";
        this.Form1.Title=str + "图片";
        if (count != 0)
        {
            int num4;
            Link[] linkArray = new Link[count];
            if (base.Request.QueryString["page"] != null)
            {
                num = Convert.ToInt32(base.Request.QueryString["page"].ToString());
            }
            for (int i = 0; ((((num - 1) * 10) + i) < count) && (i < 10); i++)
            {
                linkArray[i] = new Link();
                linkArray[i].Text=dataSet.Tables[0].Rows[((num - 1) * 10) + i]["名称"].ToString();
                linkArray[i].NavigateUrl="See.aspx?id=" + dataSet.Tables[0].Rows[((num - 1) * 10) + i]["顺序"].ToString();
                this.Form1.Controls.Add(linkArray[i]);
            }
            if ((dataSet.Tables[0].Rows.Count % 10) != 0)
            {
                num4 = (dataSet.Tables[0].Rows.Count / 10) + 1;
            }
            else
            {
                num4 = dataSet.Tables[0].Rows.Count / 10;
            }
            if (num < num4)
            {
                Link link = new Link();
                link.Text="下一页";
                link.NavigateUrl="PictureSee.aspx?type=" + str + "&page=" + Convert.ToString((int)(num + 1));
                link.BreakAfter=false;
                this.Form1.Controls.Add(link);
            }
            Label label2 = new Label();
            label2.Text=num.ToString() + "/" + num4.ToString();
            this.Form1.Controls.Add(label2);
            label2.BreakAfter=false;
            if (num != 1)
            {
                Link link2 = new Link();
                link2.Text="前一页";
                link2.NavigateUrl="PictureSee.aspx?type=" + str + "&page=" + Convert.ToString((int)(num - 1));
                this.Form1.Controls.Add(link2);
                link2.BreakAfter=true;
            }
            Label label3 = new Label();
            label3.Text="";
            this.Form1.Controls.Add(label3);
            if ((num4 != 1) && (num != 1))
            {
                label3.BreakAfter=false;
            }
        }
        Link child = new Link();
        child.Text="返回类型选择";
        child.NavigateUrl="PictureList.aspx";
        this.Form1.Controls.Add(child);
    }

    protected static string GetConnString()
    {
        string str2 = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        string path = ConfigurationManager.ConnectionStrings["DBPaths"].ConnectionString;
        string str4 = HttpContext.Current.Server.MapPath(path);
        return (str2 + str4 + ";");
    }


}

⌨️ 快捷键说明

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