using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using BoyunBase;
using SiteCore;

public partial class Part_GoodsDetail : System.Web.UI.UserControl
{
    protected void Page_Load( object sender, EventArgs e )
    {
        try {
            if( IsPostBack ) return;

            int pid = Todo.GetInt( "pid", Request, -1 );
            if( pid <= 0 ) return;

            string virPath = Page.AppRelativeVirtualPath;

            if( pid == 1 ) lnkPrev.Disabled = true;
            else lnkPrev.HRef = virPath + "?pid=" + (pid - 1);
            lnkNext.HRef = virPath + "?pid=" + (pid + 1);

            // 读取内容，并绑定显示
            ContentAccess ca = new ContentAccess( this, "TableName" );
            DataTable dt = ca.Read( "[@ID=" + pid + "]", "name" );
            if( dt == null || dt.Rows.Count < 1 ) {
                lbResult.Visible = true;
                lbResult.Text = "没有找到该产品!";
                return;
            }
            rpDetail.DataSource = dt;
            rpDetail.DataBind();

        } catch( Exception ex ) {
            Todo.DebugOut( "加载 Part_GoodsDetail 出现异常：" + ex.Message );
        }
    }
}

            //_pAcs = new PartAccess( this );
            //if( !_pAcs.IsReady ) return;

            //PartShow();
            // Request.FilePath;
    //int _aid = pid - 1;
            //if( _aid == 0 ) { lnkPrev.Visible = false; }
            //int _Aid = pid + 1;
                //if( pid == 1 ) lnkUp.Enabled = false;
            //ViewState["DetailId"] = DetailId;

    /*
    private void PartShow()
    {
        // 显示产品的材质
        DataRow dr = dt.Rows[0];
        string Material = Todo.Get( "Material", dr );
        //lbHeading.InnerText = heading;
        lbMaterial.Text = Material;

        // 显示产地
        string ProducingArea = Todo.Get( "ProducingArea", dr );
        lbProducing.Text = ProducingArea;

        // 显示种类
        string TypeGood = Todo.Get( "Type", dr );
        laType.Text = TypeGood;

        // 显示 图片
        string ThumbPath = Todo.Get( "ThumbPath", dr );
        imgPic.Src = ThumbPath;
        //产品详细信息
        //laGoodsNote.Text = Todo.Get( "GoodsNote", dr );
        string GoodsNote = Todo.Get( "GoodsNote", dr );
        // txtGoodsNote.Value=GoodsNote;
        txtGoodsNote.Text = GoodsNote;
        //Session.Add( "GoodsDetail_GoodsDetail", DetailId );
    }*/
