Exemple #1
0
        private void Bind(int page)
        {
            BLL.article  bll    = new BLL.article();
            BLL.category bllCat = new BLL.category();
            int          totalCount;
            int          pageSize = 20;

            //最新商品
            string where = "";
            if (!string.IsNullOrEmpty(Request.QueryString["Catacid"]) && DTRequest.GetQueryInt("Catacid") != 0)
            {
                where = " and category_id =" + Request.QueryString["Catacid"];
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.QueryString["Pcid"]) && DTRequest.GetQueryInt("Pcid") != 0)
                {
                    if (bllCat.GetNextList(this.PartentID, channel_id).Rows.Count > 0)
                    {
                        where = " and category_id in (select ID from dt_category where  parent_id= " + Request.QueryString["Pcid"] + ")";
                    }
                    else
                    {
                        where = " and category_id =" + Request.QueryString["Pcid"];
                    }
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["key"]) && Request.QueryString["key"] != "請輸入商品名稱")
            {
                where += " and title like '%" + Request.QueryString["key"] + "%'";
            }
            this.rptList.DataSource = bll.list_pagesWhere(page, this.pageSize, " and  channel_id=" + channel_id + "  and Status=1" + where, "  order by add_time desc");
            this.rptList.DataBind();


            //綁定頁碼
            this.totalCount = bll.GetTatalNum(" channel_id=" + channel_id + "  and Status=1" + where);
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Search.aspx", "mid={0}&Pcid={1}&keywords={2}&property={3}&Catacid={4}&page={5}",
                                              this.channel_id.ToString(), this.PartentID.ToString(), Request.QueryString["key"], this.property, this.cataID.ToString(), "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemple #2
0
        void list()
        {
            BLL.category bll       = new BLL.category();
            string       CatList   = string.Empty;
            string       FirstName = bll.GetTitle(PartentID);
            string       keyWords  = string.Empty;

            // CatList = "<h3><a href='Search.aspx?Pcid=" + PartentID + "&mid=" + channel_id + "&Catacid=" + PartentID + "'>" + FirstName + "</a></h3>";
            CatList = "<h3>" + FirstName + "</h3>";
            if (!string.IsNullOrEmpty(Request.QueryString["key"]) && Request.QueryString["key"] != "請輸入商品名稱")
            {
                keyWords = Request.QueryString["key"];
            }
            DataTable dt = bll.GetNextList(this.PartentID, channel_id, keyWords);

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int    pID        = Utils.StringToNum(dt.Rows[i]["ID"].ToString());
                    string SecondName = dt.Rows[i]["title"].ToString();
                    CatList += "<h1><a href='Search.aspx?Pcid=" + PartentID + "&mid=" + channel_id + "&Catacid=" + pID + "'>" + SecondName + "</a></h1>";
                    DataTable dt1 = bll.GetList(pID, channel_id);
                    if (dt1 != null)
                    {
                        for (int j = 0; j < dt1.Rows.Count; j++)
                        {
                            pID = Utils.StringToNum(dt1.Rows[j]["ID"].ToString());
                            string ThreeName = dt1.Rows[j]["title"].ToString();
                            CatList += "<h2><a href='Search.aspx?Pcid=" + PartentID + "&mid=" + channel_id + "&Catacid=" + pID + "'>" + ThreeName + "</a></h2>";
                        }
                    }
                }
            }
            HtmlList.InnerHtml = CatList;
        }