Exemplo n.º 1
0
    private void BindDatalist(int currentpage)
    {
        pds.AllowPaging      = true;
        pds.PageSize         = 8;
        pds.CurrentPageIndex = currentpage;

        if (Session["ShopId"] != null)
        {
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter HotPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable HotPhoneDT = HotPhoneDA.GetHotByShopId(long.Parse(Session["ShopId"].ToString()));
            if (HotPhoneDT.Rows.Count != 0)
            {
                lblShopName.Text     = HotPhoneDT.Rows[0][22].ToString();
                imgShopLogo.ImageUrl = HotPhoneDT.Rows[0][29].ToString();
                for (int i = 0; i < HotPhoneDT.Rows.Count; i++)
                {
                    switch (i)
                    {
                    case 0:
                    {
                        img1.ImageUrl             = HotPhoneDT.Rows[i][16].ToString();
                        lbtnName1.Text            = HotPhoneDT.Rows[i][1].ToString();
                        lbtnName1.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                        break;
                    }

                    case 1:
                    {
                        img2.ImageUrl             = HotPhoneDT.Rows[i][16].ToString();
                        lbtnName2.Text            = HotPhoneDT.Rows[i][1].ToString();
                        lbtnName2.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                        break;
                    }

                    case 2:
                    {
                        img3.ImageUrl             = HotPhoneDT.Rows[i][16].ToString();
                        lbtnName3.Text            = HotPhoneDT.Rows[i][1].ToString();
                        lbtnName3.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                        break;
                    }
                    }
                }
            }
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter AllPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable AllPhoneDT = AllPhoneDA.GetDataByShopId(long.Parse(Session["ShopId"].ToString()));
            if (AllPhoneDT.Rows.Count != 0)
            {
                pds.DataSource     = AllPhoneDT.DefaultView;
                dlPhone.DataSource = pds;
                dlPhone.DataBind();
            }
        }
    }
Exemplo n.º 2
0
    protected void dlShop_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Footer)
        {
            Label      lblCurrent = e.Item.FindControl("lblCurrentPage") as Label;
            Label      lblCount   = e.Item.FindControl("lblCount") as Label;
            LinkButton lbtnFirst  = e.Item.FindControl("lbtnFirst") as LinkButton;
            LinkButton lbtnPre    = e.Item.FindControl("lbtnPre") as LinkButton;
            LinkButton lbtnNext   = e.Item.FindControl("lbtnNext") as LinkButton;
            LinkButton lbtnLast   = e.Item.FindControl("lbtnLast") as LinkButton;

            lblCurrent.Text = "第" + (pds.CurrentPageIndex + 1).ToString() + "页";
            lblCount.Text   = "共" + pds.PageCount.ToString() + "页";
            if (pds.IsFirstPage)
            {
                lbtnFirst.Enabled = false;
                lbtnPre.Enabled   = false;
            }
            if (pds.IsLastPage)
            {
                lbtnNext.Enabled = false;
                lbtnLast.Enabled = false;
            }
        }
        else
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataList dlPhoneInShop = (DataList)e.Item.FindControl("dlPhoneInShop");

                string ShopId = dlShop.DataKeys[e.Item.ItemIndex].ToString().Trim();

                if (ShopId != "")
                {
                    BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                    DataTable phoneDT = phoneDA.GetHotByShopId(long.Parse(ShopId));
                    if (phoneDT.Rows.Count > 0)
                    {
                        dlPhoneInShop.DataSource = phoneDT;
                        dlPhoneInShop.DataBind();
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     dlPhone.Visible = true;
     if (txtLower.Text == "" && txtHigher.Text == "" && txtSearch.Text == "")
     {
         Response.Write("<Script>alert('请输入查询条件!')</Script>");
         //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('请输入查询条件!');", true);
     }
     else
     {
         if (txtSearch.Text != "")
         {
             if (txtLower.Text == "" && txtHigher.Text == "")
             {
                 BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                 DataTable phoneDT = phoneDA.GetDataByInPhone(long.Parse(Session["ShopId"].ToString()), txtSearch.Text);
                 dlPhone.DataSource = phoneDT;
                 dlPhone.DataBind();
                 if (phoneDT.Rows.Count == 0)
                 {
                     dlPhone.Visible = false;
                     Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                     //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                 }
             }
             else
             {
                 if (txtHigher.Text != "" && txtLower.Text != "")
                 {
                     BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                     DataTable phoneDT = phoneDA.GetDataByPriceAndName(long.Parse(Session["ShopId"].ToString()), txtSearch.Text, int.Parse(txtLower.Text.Trim()), int.Parse(txtHigher.Text.Trim()));
                     dlPhone.DataSource = phoneDT;
                     dlPhone.DataBind();
                     if (phoneDT.Rows.Count == 0)
                     {
                         dlPhone.Visible = false;
                         Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                         //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                     }
                 }
                 else
                 {
                     if (txtHigher.Text == "" && txtLower.Text != "")
                     {
                         BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                         DataTable phoneDT = phoneDA.GetDataByPriceAndName(long.Parse(Session["ShopId"].ToString()), txtSearch.Text, int.Parse(txtLower.Text.Trim()), 10000);
                         dlPhone.DataSource = phoneDT;
                         dlPhone.DataBind();
                         if (phoneDT.Rows.Count == 0)
                         {
                             dlPhone.Visible = false;
                             Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                             //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                         }
                     }
                     else
                     {
                         BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                         DataTable phoneDT = phoneDA.GetDataByPriceAndName(long.Parse(Session["ShopId"].ToString()), txtSearch.Text, 0, int.Parse(txtHigher.Text.Trim()));
                         dlPhone.DataSource = phoneDT;
                         dlPhone.DataBind();
                         if (phoneDT.Rows.Count == 0)
                         {
                             dlPhone.Visible = false;
                             Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                             //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                         }
                     }
                 }
             }
         }
         else
         {
             if (txtLower.Text != "" && txtHigher.Text != "")
             {
                 BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                 DataTable phoneDT = phoneDA.GetDataByPrice(long.Parse(Session["ShopId"].ToString()), int.Parse(txtLower.Text.Trim()), int.Parse(txtHigher.Text.Trim()));
                 dlPhone.DataSource = phoneDT;
                 dlPhone.DataBind();
                 if (phoneDT.Rows.Count == 0)
                 {
                     dlPhone.Visible = false;
                     Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                     //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                 }
             }
             else
             {
                 if (txtHigher.Text == "" && txtLower.Text != "")
                 {
                     BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                     DataTable phoneDT = phoneDA.GetDataByPrice(long.Parse(Session["ShopId"].ToString()), int.Parse(txtLower.Text.Trim()), 10000);
                     dlPhone.DataSource = phoneDT;
                     dlPhone.DataBind();
                     if (phoneDT.Rows.Count == 0)
                     {
                         dlPhone.Visible = false;
                         Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                         //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                     }
                 }
                 else
                 {
                     BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                     DataTable phoneDT = phoneDA.GetDataByPrice(long.Parse(Session["ShopId"].ToString()), 0, int.Parse(txtHigher.Text.Trim()));
                     dlPhone.DataSource = phoneDT;
                     dlPhone.DataBind();
                     if (phoneDT.Rows.Count == 0)
                     {
                         dlPhone.Visible = false;
                         Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                         //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
    protected void dlShop_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Footer)
        {
            Label lblCurrent = e.Item.FindControl("lblCurrentPage") as Label;
            Label lblCount = e.Item.FindControl("lblCount") as Label;
            LinkButton lbtnFirst = e.Item.FindControl("lbtnFirst") as LinkButton;
            LinkButton lbtnPre = e.Item.FindControl("lbtnPre") as LinkButton;
            LinkButton lbtnNext = e.Item.FindControl("lbtnNext") as LinkButton;
            LinkButton lbtnLast = e.Item.FindControl("lbtnLast") as LinkButton;

            lblCurrent.Text = "第" + (pds.CurrentPageIndex + 1).ToString() + "页";
            lblCount.Text = "共" + pds.PageCount.ToString() + "页";
            if (pds.IsFirstPage)
            {
                lbtnFirst.Enabled = false;
                lbtnPre.Enabled = false;
            }
            if (pds.IsLastPage)
            {
                lbtnNext.Enabled = false;
                lbtnLast.Enabled = false;
            }
        }
        else
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataList dlPhoneInShop = (DataList)e.Item.FindControl("dlPhoneInShop");

                string ShopId = dlShop.DataKeys[e.Item.ItemIndex].ToString().Trim();

                if (ShopId != "")
                {
                    BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                    DataTable phoneDT = phoneDA.GetHotByShopId(long.Parse(ShopId));
                    if (phoneDT.Rows.Count > 0)
                    {
                        dlPhoneInShop.DataSource = phoneDT;
                        dlPhoneInShop.DataBind();
                    }
                }
            }
        }
    }
Exemplo n.º 5
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        dlPhone.Visible = true;
        if (txtLower.Text == "" && txtHigher.Text == "" && txtSearch.Text == "")
        {
            Response.Write("<Script>alert('请输入查询条件!')</Script>");
            //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('请输入查询条件!');", true);
        }
        else
        {
            if (txtSearch.Text != "")
            {
                if (txtLower.Text == "" && txtHigher.Text == "")
                {
                    BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                    DataTable phoneDT = phoneDA.GetDataByInPhone(long.Parse(Session["ShopId"].ToString()), txtSearch.Text);
                    dlPhone.DataSource = phoneDT;
                    dlPhone.DataBind();
                    if (phoneDT.Rows.Count == 0)
                    {
                        dlPhone.Visible = false;
                        Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                        //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                    }
                }
                else
                {
                    if (txtHigher.Text != "" && txtLower.Text != "")
                    {
                        BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                        DataTable phoneDT = phoneDA.GetDataByPriceAndName(long.Parse(Session["ShopId"].ToString()), txtSearch.Text, int.Parse(txtLower.Text.Trim()), int.Parse(txtHigher.Text.Trim()));
                        dlPhone.DataSource = phoneDT;
                        dlPhone.DataBind();
                        if (phoneDT.Rows.Count == 0)
                        {
                            dlPhone.Visible = false;
                            Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                            //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                        }
                    }
                    else
                    {
                        if (txtHigher.Text == "" && txtLower.Text != "")
                        {
                            BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                            DataTable phoneDT = phoneDA.GetDataByPriceAndName(long.Parse(Session["ShopId"].ToString()), txtSearch.Text, int.Parse(txtLower.Text.Trim()), 10000);
                            dlPhone.DataSource = phoneDT;
                            dlPhone.DataBind();
                            if (phoneDT.Rows.Count == 0)
                            {
                                dlPhone.Visible = false;
                                Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                                //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                            }
                        }
                        else
                        {
                            BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                            DataTable phoneDT = phoneDA.GetDataByPriceAndName(long.Parse(Session["ShopId"].ToString()), txtSearch.Text, 0, int.Parse(txtHigher.Text.Trim()));
                            dlPhone.DataSource = phoneDT;
                            dlPhone.DataBind();
                            if (phoneDT.Rows.Count == 0)
                            {
                                dlPhone.Visible = false;
                                Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                                //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                            }
                        }
                    }

                }
            }
            else
            {
                if (txtLower.Text != "" && txtHigher.Text != "")
                {
                    BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                    DataTable phoneDT = phoneDA.GetDataByPrice(long.Parse(Session["ShopId"].ToString()), int.Parse(txtLower.Text.Trim()), int.Parse(txtHigher.Text.Trim()));
                    dlPhone.DataSource = phoneDT;
                    dlPhone.DataBind();
                    if (phoneDT.Rows.Count == 0)
                    {
                        dlPhone.Visible = false;
                        Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                       //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                    }
                }
                else
                {
                    if (txtHigher.Text == "" && txtLower.Text != "")
                    {
                        BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                        DataTable phoneDT = phoneDA.GetDataByPrice(long.Parse(Session["ShopId"].ToString()), int.Parse(txtLower.Text.Trim()), 10000);
                        dlPhone.DataSource = phoneDT;
                        dlPhone.DataBind();
                        if (phoneDT.Rows.Count == 0)
                        {
                            dlPhone.Visible = false;
                            Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                            //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                        }
                    }
                    else
                    {
                        BuyerDSTableAdapters.View_Phone_ShopTableAdapter phoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
                        DataTable phoneDT = phoneDA.GetDataByPrice(long.Parse(Session["ShopId"].ToString()), 0, int.Parse(txtHigher.Text.Trim()));
                        dlPhone.DataSource = phoneDT;
                        dlPhone.DataBind();
                        if (phoneDT.Rows.Count == 0)
                        {
                            dlPhone.Visible = false;
                            Response.Write("<Script>alert('没有满足条件的商品!')</Script>");
                            //ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('没有满足条件的商品!');", true);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 6
0
    private void BindDatalist(int currentpage)
    {
        pds.AllowPaging = true;
        pds.PageSize = 8;
        pds.CurrentPageIndex = currentpage;

        if (Session["ShopId"] != null)
        {
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter HotPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable HotPhoneDT = HotPhoneDA.GetHotByShopId(long.Parse(Session["ShopId"].ToString()));
            if (HotPhoneDT.Rows.Count != 0)
            {
                lblShopName.Text = HotPhoneDT.Rows[0][22].ToString();
                imgShopLogo.ImageUrl = HotPhoneDT.Rows[0][29].ToString();
                for (int i = 0; i < HotPhoneDT.Rows.Count; i++)
                {
                    switch (i)
                    {
                        case 0:
                            {
                                img1.ImageUrl = HotPhoneDT.Rows[i][16].ToString();
                                lbtnName1.Text = HotPhoneDT.Rows[i][1].ToString();
                                lbtnName1.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                                break;
                            }
                        case 1:
                            {
                                img2.ImageUrl = HotPhoneDT.Rows[i][16].ToString();
                                lbtnName2.Text = HotPhoneDT.Rows[i][1].ToString();
                                lbtnName2.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                                break;
                            }
                        case 2:
                            {
                                img3.ImageUrl = HotPhoneDT.Rows[i][16].ToString();
                                lbtnName3.Text = HotPhoneDT.Rows[i][1].ToString();
                                lbtnName3.CommandArgument = HotPhoneDT.Rows[i][0].ToString();
                                break;
                            }
                    }
                }
            }
            BuyerDSTableAdapters.View_Phone_ShopTableAdapter AllPhoneDA = new BuyerDSTableAdapters.View_Phone_ShopTableAdapter();
            DataTable AllPhoneDT = AllPhoneDA.GetDataByShopId(long.Parse(Session["ShopId"].ToString()));
            if (AllPhoneDT.Rows.Count != 0)
            {
                pds.DataSource = AllPhoneDT.DefaultView;
                dlPhone.DataSource = pds;
                dlPhone.DataBind();
            }
        }
    }