Esempio n. 1
0
    /// <summary>
    /// 绑定repeater 控件
    /// </summary>
    /// <param name="sql"></param>
    void ProBin(string sql)
    {
        DataTable dt = bp.SelectPro(sql);

        this.Repeater1.DataSource = dt;
        this.Repeater1.DataBind();
    }
Esempio n. 2
0
    private void databind(string Sql)//datalist2数据绑定和分页
    {
        int       curpage = Convert.ToInt32(this.labPage.Text);
        DataTable dt      = B_pro.SelectPro(Sql);

        this.CountProLab.Text = dt.Rows.Count.ToString();
        PagedDataSource ps = new PagedDataSource();

        ps.DataSource           = dt.DefaultView;
        ps.AllowPaging          = true;        //可以分页
        ps.PageSize             = 10;          //页面大小
        ps.CurrentPageIndex     = curpage - 1; //当前页
        this.lnkbtnUp.Enabled   = true;
        this.lnkbtnNext.Enabled = true;
        this.lnkbtnBack.Enabled = true;
        this.lnkbtnOne.Enabled  = true;
        if (curpage == 1)
        {
            this.lnkbtnOne.Enabled = false; //不显示第一页按钮
            this.lnkbtnUp.Enabled  = false; //不显示上一页按钮
        }
        if (curpage == ps.PageCount)
        {
            this.lnkbtnNext.Enabled = false; //不显示下一页
            this.lnkbtnBack.Enabled = false; //不显示最后一页
        }
        this.labBackPage.Text     = Convert.ToString(ps.PageCount);
        this.TextBox1.Text        = this.labPage.Text;
        this.Repeater1.DataSource = ps;
        this.Repeater1.DataBind();
    }
Esempio n. 3
0
    void fillshopitem()
    {
        string s = Session["language"].ToString() == "zh-cn" ? "select productID,productName,productClassID,ikangName,ikangID,meinianName,meinianID,cimingNmae,cimingID,ex1Name,ex1ID,type,unit,uplimit,downlimit,productUnitPrice,productMarketPrice,productContent,productDate,productImg,productCount,msg,px from tab_products where type=N'商城' and unit='发布' and productID in( select   min( productID)  id from tab_products group by productName) order by px desc" :
                   "select productID,productName_eng as productName,productClassID,ikangName_eng as ikangName,ikangID,meinianName_eng as meinianName,meinianID,cimingName_eng as cimingNmae,cimingID,ex1Name_eng as ex1Name,ex1ID_eng as ex1ID,type,unit,uplimit,downlimit_eng as downlimit,productUnitPrice,productMarketPrice,productContent_eng as productContent,productDate,productImg_eng as productImg,productCount,msg_eng as msg,px from tab_products where type=N'商城' and unit='发布' and productID in( select   min( productID)  id from tab_products group by productName) order by px desc";
        DataTable dt = pb.SelectPro(s);

        if (dt != null)
        {
            this.Repeater1.DataSource = dt;
            this.Repeater1.DataBind();
        }
        else
        {
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "message", " <script>alert('没有商品')</script>");
            return;
        }
    }
Esempio n. 4
0
    void init()
    {
        Bll.ProductBll pb = new Bll.ProductBll();
        DataTable      dt = pb.SelectPro("select * from tab_products where type=N'商城' and productID=176");

        // DataTable dt = pb.SelectPro("select * from tab_products where type=N'商城' and productID=" + Request.QueryString["productID"]);
        this.Label1.Text            = DateTime.Parse(dt.Rows[0]["productDate"].ToString()).ToShortDateString();
        this.HyperLink1.NavigateUrl = this.HyperLink2.NavigateUrl = "#";
        this.HyperLink1.Text        = dt.Rows[0]["productName"].ToString();
        content                 = dt.Rows[0]["msg"].ToString();
        this.Label2.Text        = dt.Rows[0]["productUnitPrice"].ToString();
        ViewState["shopitemid"] = dt.Rows[0]["productID"];

        itemid = ViewState["shopitemid"].ToString();
    }
    void init(object sender, EventArgs e)
    {
        if (Request.QueryString["productID"] != null)
        {
            ViewState["shopitemid"]     = Request.QueryString["productID"];
            Session["currentproductid"] = ViewState["shopitemid"];
        }
        else
        {
            if (Session["currentproductid"] != null)
            {
                ViewState["shopitemid"] = Session["currentproductid"];
            }
        }


        string s = Session["language"].ToString() == "zh-cn" ? "select productID,productName,productClassID,ikangName,ikangID,meinianName,meinianID,cimingNmae,cimingID,ex1Name,ex1ID,type,unit,uplimit,downlimit,productUnitPrice,productMarketPrice,productContent,productDate,productImg,productCount,msg,px from tab_products where type=N'商城' and productID=" + ViewState["shopitemid"] :
                   "select productID,productName_eng as productName,productClassID,ikangName_eng as ikangName,ikangID,meinianName_eng as meinianName,meinianID,cimingName_eng as cimingNmae,cimingID,ex1Name_eng as ex1Name,ex1ID_eng as ex1ID,type,unit,uplimit,downlimit_eng as downlimit,productUnitPrice,productMarketPrice,productContent_eng as productContent,productDate,productImg_eng as productImg,productCount,msg_eng as msg,px from tab_products where type=N'商城' and productID=" + ViewState["shopitemid"];
        DataTable dt = pb.SelectPro(s);

        //this.Label1.Text = DateTime.Parse(dt.Rows[0]["productDate"].ToString()).ToShortDateString();
        //this.HyperLink1.NavigateUrl = this.HyperLink2.NavigateUrl = "#";
        this.Label1.Text = dt.Rows[0]["productName"].ToString();
        content          = dt.Rows[0]["msg"].ToString();
        shuoming         = dt.Rows[0]["ikangName"].ToString();
        parameter        = dt.Rows[0]["meinianName"].ToString();
        brandintro       = dt.Rows[0]["cimingNmae"].ToString();
        if (shuoming == "")
        {
            shuomingclass = "hide";
        }
        if (parameter == "")
        {
            parameterclass = "hide";
        }
        if (brandintro == "")
        {
            brandintroclass = "hide";
        }



        displayimg = dt.Rows[0]["productImg"].ToString();

        int productCount = Convert.ToInt32(dt.Rows[0]["productCount"]);

        if (productCount < this.NumericUpDownExtender1.Maximum)
        {
            this.NumericUpDownExtender1.Maximum = productCount;
        }
        if (productCount <= 0)
        {
            this.paybutton.Attributes["class"] = "xbtn_cart_disabled";
            this.num.Text    = "0";
            this.num.Enabled = false;
        }
        this.Label4.Text = this.Label2.Text = dt.Rows[0]["productUnitPrice"].ToString();
        this.Label3.Text = dt.Rows[0]["ex1ID"].ToString(); //品类
        this.Label6.Text = dt.Rows[0]["productMarketPrice"].ToString();



        itemid = ViewState["shopitemid"].ToString();
        fillsameproduct(dt.Rows[0]["productName"].ToString());
        fillpics(dt.Rows[0]["ex1Name"].ToString());
        if (Session["cartitems"] != null && ((DataTable)Session["cartitems"]).Rows.Count > 0)
        {
            this.Label5.Text = caltotalprice().ToString();
        }
        else
        {
            this.Label5.Text = "0";
        }
        if (this.Label5.Text != "0")
        {
            this.HyperLink2.NavigateUrl = "healthshop.aspx?tocart=true";
        }

        dt = sb.GetAny("select distinct province from tab_shopsuppliers where hospid='" + ViewState["shopitemid"] + "' ");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            this.com_Province.Items.Add(dt.Rows[i][0].ToString());
        }
        if (dt.Rows.Count > 0)
        {
            this.com_Province.SelectedIndex = 1;
        }
        else
        {
            this.Panel1.Visible = false;
        }
    }
Esempio n. 6
0
    void showProduct(string proID)
    {
        DataTable dt = B_pro.SelectPro("select * from tab_products,tab_productClass where tab_products.productClassID=tab_productClass.productClassID and productID=" + proID);

        if (Session["language"] != null && Session["language"].ToString() == "zh-cn")
        {
            this.TextBox1.Text = dt.Rows[0]["productName"].ToString();
            this.TextBox2.Text = dt.Rows[0]["productUnitPrice"].ToString();
            this.TextBox3.Text = dt.Rows[0]["productCount"].ToString();

            this.TextBox4.Text = dt.Rows[0]["productContent"].ToString();
            this.TextBox5.Text = dt.Rows[0]["ex1ID"].ToString();
            this.TextBox6.Text = dt.Rows[0]["productMarketPrice"].ToString();
            content1.Value     = dt.Rows[0]["msg"].ToString();
            content2.Value     = dt.Rows[0]["ikangName"].ToString();
            content3.Value     = dt.Rows[0]["meinianName"].ToString();
            content4.Value     = dt.Rows[0]["cimingNmae"].ToString();



            this.Image1.ImageUrl   = "~/" + dt.Rows[0]["productImg"].ToString();
            this.TextBox21.Text    = dt.Rows[0]["productImg"].ToString();
            this.Image6.ImageUrl   = "~/" + dt.Rows[0]["downlimit"].ToString();
            this.TextBox26.Text    = dt.Rows[0]["downlimit"].ToString();
            this.CheckBox1.Checked = dt.Rows[0]["unit"].ToString() == "发布" ? true : false;
            if (dt.Rows[0]["uplimit"].ToString() != "电子码")
            {
                this.RadioButton1.Checked = true;
            }
            else
            {
                this.RadioButton2.Checked = true;
            }

            if (dt.Rows[0]["ex1Name"].ToString() != "")
            {
                string[] simg = dt.Rows[0]["ex1Name"].ToString().Split(';');
                for (int i = 0; i < simg.Length; i++)
                {
                    switch (i)
                    {
                    case 0: this.Image2.ImageUrl = "~/" + simg[i];
                        this.TextBox22.Text      = simg[i];
                        break;

                    case 1: this.Image3.ImageUrl = "~/" + simg[i];
                        this.TextBox23.Text      = simg[i];
                        break;

                    case 2: this.Image4.ImageUrl = "~/" + simg[i];
                        this.TextBox24.Text      = simg[i];
                        break;

                    case 3: this.Image5.ImageUrl = "~/" + simg[i];
                        this.TextBox25.Text      = simg[i];
                        break;
                    }
                }
            }
        }
        else
        {
            this.TextBox1.Text = dt.Rows[0]["productName_eng"].ToString();
            this.TextBox2.Text = dt.Rows[0]["productUnitPrice"].ToString();
            this.TextBox3.Text = dt.Rows[0]["productCount"].ToString();

            this.TextBox4.Text = dt.Rows[0]["productContent_eng"].ToString();
            this.TextBox5.Text = dt.Rows[0]["ex1ID_eng"].ToString();
            this.TextBox6.Text = dt.Rows[0]["productMarketPrice"].ToString();
            content1.Value     = dt.Rows[0]["msg_eng"].ToString();
            content2.Value     = dt.Rows[0]["ikangName_eng"].ToString();
            content3.Value     = dt.Rows[0]["meinianName_eng"].ToString();
            content4.Value     = dt.Rows[0]["cimingName_eng"].ToString();



            this.Image1.ImageUrl   = "~/" + dt.Rows[0]["productImg_eng"].ToString();
            this.TextBox21.Text    = dt.Rows[0]["productImg_eng"].ToString();
            this.Image6.ImageUrl   = "~/" + dt.Rows[0]["downlimit_eng"].ToString();
            this.TextBox26.Text    = dt.Rows[0]["downlimit_eng"].ToString();
            this.CheckBox1.Checked = dt.Rows[0]["unit"].ToString() == "发布" ? true : false;
            if (dt.Rows[0]["uplimit"].ToString() != "电子码")
            {
                this.RadioButton1.Checked = true;
            }
            else
            {
                this.RadioButton2.Checked = true;
            }

            if (dt.Rows[0]["ex1Name_eng"].ToString() != "")
            {
                string[] simg = dt.Rows[0]["ex1Name_eng"].ToString().Split(';');
                for (int i = 0; i < simg.Length; i++)
                {
                    switch (i)
                    {
                    case 0: this.Image2.ImageUrl = "~/" + simg[i];
                        this.TextBox22.Text      = simg[i];
                        break;

                    case 1: this.Image3.ImageUrl = "~/" + simg[i];
                        this.TextBox23.Text      = simg[i];
                        break;

                    case 2: this.Image4.ImageUrl = "~/" + simg[i];
                        this.TextBox24.Text      = simg[i];
                        break;

                    case 3: this.Image5.ImageUrl = "~/" + simg[i];
                        this.TextBox25.Text      = simg[i];
                        break;
                    }
                }
            }
        }

        for (int i = 0; i < this.DropDownList1.Items.Count; i++)
        {
            if (this.DropDownList1.Items[i].Value == dt.Rows[0]["productClassID"].ToString())
            {
                this.DropDownList1.SelectedIndex = i;
            }
        }
    }