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;
using System.IO;

public partial class uc_product_Pall : System.Web.UI.UserControl
{
    private string id;
    private string lx;
    public string pId
    {
        set
        {
             id = value.ToString().Trim();
        }
    }
    public string LX
    {
        set
        {
            lx = value.ToString().Trim();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = CDatabase.wtoconn();
        con.Open();
        SqlCommand cmd = new SqlCommand("select * from ProductInfo where id="+id, con);
        SqlDataReader sdr2 = cmd.ExecuteReader();
        sdr2.Read();
        TableRow tr;
        TableCell tc;
        Label l1;
        ImageButton pimg;
        LinkButton li1;

        switch (lx)
        {
            #region 最热销配置
            case "hot":
                //编号
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pnn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(4), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //名称
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "phn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(3), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //描述
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pder") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    l1 = new Label();
                    l1.Text = SubStr(sdr2.GetString(8), 20);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);

                }

                //市场价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pprice") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pmakasname") == null)
                    {
                        l1.Text = "市场价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pmakasname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(18).ToString("0.00"));
                    l1.Font.Strikeout = true;
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //优惠价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pvipp") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pvippname") == null)
                    {
                        l1.Text = "优惠价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pvippname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //立刻节省

                if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pli") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "节省：";
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(Convert.ToDecimal(sdr2.GetDecimal(18).ToString("0.00")) - Convert.ToDecimal(sdr2.GetDecimal(19).ToString("0.00")));
                    tc.Controls.Add(l1);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //购买 
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pbuy") == "y" || xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pshow") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;

                    li1 = new LinkButton();
                    li1.Text = "购买";
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.PostBackUrl = "~/china/cart.aspx?pid=" + sdr2.GetInt32(0) + "&do=addPP&price=" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pbuy") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    li1 = new LinkButton();
                    li1.Text = "详细";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pshow") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //图片
               
               this.Pimg.ImageUrl = "~/upfile/" + sdr2.GetString(25).Trim();
               this.Pimg.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
               if (xmlwebconfig.GetXMLvalue("pro", "index", "ish", "ispicset") == "y")
               {
                   this.Pimg.Width=Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "ish", "picw"));
                   this.Pimg.Height =Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "ish", "pich"));
               }
                 break;
            #endregion
            #region 最新
                 //编号
             case "new":
                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pnn") == "y")
                 {
                     tr = new TableRow();
                     tc = new TableCell();
                     tc.ColumnSpan = 2;
                     li1 = new LinkButton();
                     li1.Text = SubStr(sdr2.GetString(4), 8);
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     li1.CssClass = "fonttb2";
                     li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                     tc.Controls.Add(li1);
                     tr.Controls.Add(tc);
                     TBUP.Controls.Add(tr);
                 }

                 //名称
                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "phn") == "y")
                 {
                     tr = new TableRow();
                     tc = new TableCell();
                     tc.ColumnSpan = 2;
                     li1 = new LinkButton();
                     li1.Text = SubStr(sdr2.GetString(3), 8);
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     li1.CssClass = "fonttb2";
                     li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                     tc.Controls.Add(li1);
                     tr.Controls.Add(tc);
                     TBUP.Controls.Add(tr);
                 }

                 //描述
                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pder") == "y")
                 {
                     tr = new TableRow();
                     tc = new TableCell();
                     tc.ColumnSpan = 2;
                     l1 = new Label();
                     l1.Text = SubStr(sdr2.GetString(8), 20);
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     tc.Controls.Add(l1);
                     tr.Controls.Add(tc);
                     TBnew.Controls.Add(tr);

                 }

                 //市场价
                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pprice") == "y")
                 {
                     tr = new TableRow();
                     tc = new TableCell();
                     l1 = new Label();
                     if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pmakasname") == null)
                     {
                         l1.Text = "市场价：";
                     }
                     else
                     {
                         l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pmakasname");
                     }
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     tc.Controls.Add(l1);
                     tr.Controls.Add(tc);
                     tc = new TableCell();
                     l1 = new Label();
                     l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(18).ToString("0.00"));
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     l1.Font.Strikeout = true;
                     tc.Controls.Add(l1);
                     tr.Controls.Add(tc);
                     TBnew.Controls.Add(tr);
                 }
                 //优惠价
                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pvipp") == "y")
                 {
                     tr = new TableRow();
                     tc = new TableCell();
                     l1 = new Label();
                     if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pvippname") == null)
                     {
                         l1.Text = "优惠价：";
                     }
                     else
                     {
                         l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pvippname");
                     }
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     tc.Controls.Add(l1);
                     tr.Controls.Add(tc);
                     tc = new TableCell();
                     l1 = new Label();
                     l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     tc.Controls.Add(l1);
                     tr.Controls.Add(tc);
                     TBnew.Controls.Add(tr);
                 }
                 //立刻节省

                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pli") == "y")
                 {
                     tr = new TableRow();
                     tc = new TableCell();
                     l1 = new Label();
                     l1.Text = "节省：";
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     tc.Controls.Add(l1);
                     tr.Controls.Add(tc);
                     tc = new TableCell();
                     l1 = new Label();
                     l1.Text = "￥" + Convert.ToString(Convert.ToDecimal(sdr2.GetDecimal(18).ToString("0.00")) - Convert.ToDecimal(sdr2.GetDecimal(19).ToString("0.00")));
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     tc.Controls.Add(l1);
                     tr.Controls.Add(tc);
                     TBnew.Controls.Add(tr);
                 }
                 //购买 
                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pbuy") == "y" || xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pshow") == "y")
                 {
                     tr = new TableRow();
                     tc = new TableCell();
                     tc.ColumnSpan = 2;

                     li1 = new LinkButton();
                     li1.Text = "购买";
                     li1.PostBackUrl = "~/china/cart.aspx?pid=" + sdr2.GetInt32(0) + "&do=addPP&price=" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                     if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pbuy") == "n")
                     {
                         li1.Visible = false;
                     }
                     tc.HorizontalAlign = HorizontalAlign.Left;
                     tc.Controls.Add(li1);
                     li1 = new LinkButton();
                     li1.Text = "详细";
                     li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                     if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pshow") == "n")
                     {
                         li1.Visible = false;
                     }
                     tc.Controls.Add(li1);
                     tr.Controls.Add(tc);
                     TBnew.Controls.Add(tr);
                 }
                 //图片

                 this.Pimg.ImageUrl = "~/upfile/" + sdr2.GetString(25).Trim();
                 this.Pimg.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                 if (xmlwebconfig.GetXMLvalue("pro", "index", "isn", "ispicset") == "y")
                 {
                     this.Pimg.Width = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "isn", "picw"));
                     this.Pimg.Height = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "isn", "pich"));
                 }
           


                break;
             #endregion
            #region 推荐
            //编号
            case "IsRecommended":
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pnn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(4), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //名称
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "phn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(3), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //描述
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pder") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    l1 = new Label();
                    l1.Text = SubStr(sdr2.GetString(8), 20);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);

                }

                //市场价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pprice") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pmakasname") == null)
                    {
                        l1.Text = "市场价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pmakasname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(18).ToString("0.00"));
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    l1.Font.Strikeout = true;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //优惠价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pvipp") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pvippname") == null)
                    {
                        l1.Text = "优惠价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pvippname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    tc.Controls.Add(l1);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //立刻节省

                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pli") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "节省：";
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(Convert.ToDecimal(sdr2.GetDecimal(18).ToString("0.00")) - Convert.ToDecimal(sdr2.GetDecimal(19).ToString("0.00")));
                    tc.Controls.Add(l1);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //购买 
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pbuy") == "y" || xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pshow") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;

                    li1 = new LinkButton();
                    li1.Text = "购买";
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.PostBackUrl = "~/china/cart.aspx?pid=" + sdr2.GetInt32(0) + "&do=addPP&price=" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pbuy") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    li1 = new LinkButton();
                    li1.Text = "详细";
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pshow") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //图片

                this.Pimg.ImageUrl = "~/upfile/" + sdr2.GetString(25).Trim();
                this.Pimg.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                if (xmlwebconfig.GetXMLvalue("pro", "index", "ist", "ispicset") == "y")
                {
                    this.Pimg.Width = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "ist", "picw"));
                    this.Pimg.Height = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pich"));
                }



                break;
            #endregion
            #region 特价
            //编号
            case "isspecials":
                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pnn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(4), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //名称
                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "phn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(3), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //描述
                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pder") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    l1 = new Label();
                    l1.Text = SubStr(sdr2.GetString(8), 20);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);

                }

                //市场价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pprice") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pmakasname") == null)
                    {
                        l1.Text = "市场价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pmakasname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(18).ToString("0.00"));
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    l1.Font.Strikeout = true;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //优惠价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pvipp") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pvippname") == null)
                    {
                        l1.Text = "优惠价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pvippname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //立刻节省

                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pli") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "节省：";
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(Convert.ToDecimal(sdr2.GetDecimal(18).ToString("0.00")) - Convert.ToDecimal(sdr2.GetDecimal(19).ToString("0.00")));
                    tc.HorizontalAlign = HorizontalAlign.Left;                    
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //购买 
                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pbuy") == "y" || xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pshow") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;

                    li1 = new LinkButton();
                    li1.Text = "购买";
                    tc.HorizontalAlign = HorizontalAlign.Left;

                    li1.PostBackUrl = "~/china/cart.aspx?pid=" + sdr2.GetInt32(0) + "&do=addPP&price=" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pbuy") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    li1 = new LinkButton();
                    li1.Text = "详细";
                    tc.HorizontalAlign = HorizontalAlign.Left;

                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pshow") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //图片

                this.Pimg.ImageUrl = "~/upfile/" + sdr2.GetString(25).Trim();
                this.Pimg.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                if (xmlwebconfig.GetXMLvalue("pro", "index", "iss", "ispicset") == "y")
                {
                    this.Pimg.Width = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "iss", "picw"));
                    this.Pimg.Height = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "iss", "pich"));
                }



                break;
            #endregion
            #region 普通
            //编号
            case "ispt":
                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pnn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(4), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //名称
                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "phn") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    li1 = new LinkButton();
                    li1.Text = SubStr(sdr2.GetString(3), 8);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1.CssClass = "fonttb2";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBUP.Controls.Add(tr);
                }

                //描述
                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pder") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    l1 = new Label();
                    l1.Text = SubStr(sdr2.GetString(8), 20);
                    tc.Controls.Add(l1);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);

                }

                //市场价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pprice") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pmakasname") == null)
                    {
                        l1.Text = "市场价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pmakasname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(18).ToString("0.00"));
                    l1.Font.Strikeout = true;
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //优惠价
                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pvipp") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pvippname") == null)
                    {
                        l1.Text = "优惠价：";
                    }
                    else
                    {
                        l1.Text = xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pvippname");
                    }
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    tc.Controls.Add(l1);
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //立刻节省

                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pli") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "节省：";
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    tc = new TableCell();
                    l1 = new Label();
                    l1.Text = "￥" + Convert.ToString(Convert.ToDecimal(sdr2.GetDecimal(18).ToString("0.00")) - Convert.ToDecimal(sdr2.GetDecimal(19).ToString("0.00")));
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    tc.Controls.Add(l1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //购买 
                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pbuy") == "y" || xmlwebconfig.GetXMLvalue("pro", "index", "ist", "pshow") == "y")
                {
                    tr = new TableRow();
                    tc = new TableCell();
                    tc.ColumnSpan = 2;
                    tc.HorizontalAlign = HorizontalAlign.Left;
                    li1 = new LinkButton();
                    li1.Text = "购买";
                    li1.PostBackUrl = "~/china/cart.aspx?pid=" + sdr2.GetInt32(0) + "&do=addPP&price=" + Convert.ToString(sdr2.GetDecimal(19).ToString("0.00"));
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pbuy") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    li1 = new LinkButton();
                    li1.Text = "详细";
                    li1.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                    if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pshow") == "n")
                    {
                        li1.Visible = false;
                    }
                    tc.Controls.Add(li1);
                    tr.Controls.Add(tc);
                    TBnew.Controls.Add(tr);
                }
                //图片

                this.Pimg.ImageUrl = "~/upfile/" + sdr2.GetString(25).Trim();
                this.Pimg.PostBackUrl = "~/china/productlist.aspx?id=" + sdr2.GetInt32(0);
                if (xmlwebconfig.GetXMLvalue("pro", "index", "isp", "ispicset") == "y")
                {
                    this.Pimg.Width = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "isp", "picw"));
                    this.Pimg.Height = Convert.ToInt32(xmlwebconfig.GetXMLvalue("pro", "index", "isp", "pich"));
                }



                break;
                  #endregion
        }
        sdr2.Close();
        con.Close();
    }

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