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_Case_Case : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.databind();
        }

    }
    public void databind()
    {
        string id = Request.QueryString["SmallId"];
        SqlConnection conn = CDatabase.wtoconn();
        conn.Open();
        SqlDataAdapter sda;
        if (Request.QueryString["isnew"] != "yes")
        {
            sda = new SqlDataAdapter("select * from Caseinfo where ISPublished='y' and SmallProductId=" + id + " order by AddDate", conn);
        }
        else
        {
            sda = new SqlDataAdapter("select * from Caseinfo where ISPublished='y' order by AddDate", conn);
        }

        DataSet ds = new DataSet();
        sda.Fill(ds,"cu");
        this.prductpt.DataSource = Doadmin.ps(ds, Table1, Convert.ToInt32(xmlwebconfig.GetXMLvalue("case", "ny", "", "cou")), 1);//分页类调用
        this.prductpt.DataBind();
        this.prductpt.RepeatColumns = Convert.ToInt32(xmlwebconfig.GetXMLvalue("case", "ny", "", "hc"));
        
        conn.Close();
    }

    public string SubStr(string sString, int nLeng)
    {
        if (sString.Length <= nLeng)
        {
            return sString;
        }
        string sNewStr = sString.Substring(0, nLeng);
        sNewStr = sNewStr + "...";
        return sNewStr;
    }

    public string getimgurl(string no)
    {
        return "fd";
    }

}
