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

public partial class cn_Product_Product_more : System.Web.UI.Page
{
    public string tppath;
    HKMS.SQLHelper g_Help = new HKMS.SQLHelper();
    public string l_sqlp, l_sqln;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["ID"] != null)
            {
                string l_sql = "select * from CN_PRODUCT where P_ID=" + Request.QueryString["ID"];
                l_sqlp = "select * from CN_PRODUCT where P_ID in (select to 1 P_ID from CN_PRODUCT where P_ID<" + Request.QueryString["ID"].ToString() + " order by P_ID DESC)";
                l_sqln = "select * from CN_PRODUCT where P_ID in (select to 1 P_ID from CN_PRODUCT where P_ID>" + Request.QueryString["ID"].ToString() + " order by P_ID ASC)";
                loader(l_sql);
                jjsq();
            }
        }
    }

    //=============================================
    //函数名称:loaderData()
    //作    用:将查询到的内容绑定到控件上
    //=============================================
    private void loader(string l_str)
    {
        DataTable dt = new DataTable();
        g_Help.FillDataTable(ref dt, l_str);
        if (dt.Rows.Count > 0)
        {
            tppath = dt.Rows[0].ItemArray.GetValue(3).ToString();
            name.Text = dt.Rows[0].ItemArray.GetValue(1).ToString();
            price.Text = dt.Rows[0].ItemArray.GetValue(5).ToString();
            nianfen.Text = dt.Rows[0].ItemArray.GetValue(6).ToString();
            shu.Text = dt.Rows[0].ItemArray.GetValue(7).ToString();
            contacter.Text = dt.Rows[0].ItemArray.GetValue(8).ToString();
            tel.Text = dt.Rows[0].ItemArray.GetValue(9).ToString();
            qita.Text = dt.Rows[0].ItemArray.GetValue(10).ToString();
            source.Text = dt.Rows[0].ItemArray.GetValue(11).ToString();
            xx.Text = dt.Rows[0].ItemArray.GetValue(2).ToString();
            configuration.Text = dt.Rows[0].ItemArray.GetValue(12).ToString();
        }
        DataTable dtp = new DataTable();
        g_Help.FillDataTable(ref dtp, l_sqlp);
        if (dtp.Rows.Count > 0)
        {
            p.Text = "上一个:" + dtp.Rows[0].ItemArray.GetValue(1).ToString();
        }
        else
        {
            p.Text = "";
        }
        DataTable dtn = new DataTable();
        g_Help.FillDataTable(ref dtn, l_sqln);
        if (dtn.Rows.Count > 0)
        {
            n.Text = "下一个:" + dtn.Rows[0].ItemArray.GetValue(1).ToString();
        }
        else
        {
            n.Text = "";
        }
    }
    protected void jjsq()
    {
        string str = "Update CN_PRODUCT set [Count]=CStr(CInt([Count])+1) where P_ID=" + Request.QueryString["ID"];
        g_Help.UpdateDate(str);
    }
    protected void p_Click(object sender, EventArgs e)
    {
        int i;
        i = int.Parse(Request.QueryString["ID"].ToString()) - 1;
        Response.Redirect("Product_more.aspx?ID=" + i);
    }
    protected void n_Click(object sender, EventArgs e)
    {
        int ii;
        ii = int.Parse(Request.QueryString["ID"].ToString()) - 1;
        Response.Redirect("Product_more.aspx?ID=" + ii);
    }
}

 posted on 2010-07-20 16:23  ddxgc  阅读(387)  评论(0编辑  收藏  举报