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.SqlClient;
public partial class WebMain_Product_product_BigTc : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.HyperLink2.NavigateUrl = "~/china/BIGtc.aspx?pcount=20";
        this.HyperLink3.NavigateUrl = "~/china/BIGtc.aspx?pcount=40";
        databind();
    }
    public string SubStr(string sString, int nLeng)
    {
        if (sString.Length <= nLeng)
        {
            return sString;
        }
        string sNewStr = sString.Substring(0, nLeng);
        sNewStr = sNewStr;
        return sNewStr;
    }
    public void databind()
    {
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlCommand smd;
        SqlDataReader sdr;
        SqlDataAdapter sda;
        DataSet ds;
        switch (this.DropDownList1.SelectedValue.ToString().Trim())
        {
            case "time":
                sda = new SqlDataAdapter("select * from Package where isfp='y' order by adddate", conn);
                break;
            case "timedesc":
                sda = new SqlDataAdapter("select * from Package where isfp='y' order by adddate DESC", conn);
                break;
            case "times":
                sda = new SqlDataAdapter("select * from Package where isfp='y' order by times", conn);
                break;
            case "timesdesc":
                sda = new SqlDataAdapter("select * from Package where isfp='y' order by times desc", conn);
                break;
            default:
                sda = new SqlDataAdapter("select * from Package where isfp='y'", conn);
                break;
        }
        
        ds = new DataSet();
        sda.Fill(ds);
        if (ds.Tables[0].Rows.Count > 0)
        {
            if (Request.QueryString["pcount"] == "20")
            {
                this.prducttc.DataSource = Doadmin.psgb(ds, Table1, 20, 1);
            }
            else
            {
                this.prducttc.DataSource = Doadmin.psgb(ds, Table1, 40, 1);
            }
            this.prducttc.DataBind();
        }
        else
        {
            this.Panel1.Visible = false;
            this.Panel2.Visible = true;
        }
        conn.Close();
    }
}
