private void BindData(int PageIndex)
        {
            DataTable dt          = new DataTable();
            int       RecordCount = 0;

            if (CategoryID == 0)
            {
                dt = bll.GetList(PageIndex, AspNetPager.PageSize, " and starttime>getdate() and status=" + (int)AuctionProductStatus.审核通过, " auctionid desc", out RecordCount);
            }
            else
            {
                MagicCategoryModel cate = new MagicCategoryBll().GetModel(CategoryID);
                if (cate != null)
                {
                    dt = bll.GetList(PageIndex, AspNetPager.PageSize, " and starttime>getdate() and catepath+'/' like '" + cate.CategoryPath + "/%' and status=" + (int)AuctionProductStatus.审核通过, " auctionid desc", out RecordCount);
                }
                else
                {
                    Response.End();
                }
            }

            foreach (DataRow row in dt.Rows)
            {
                row["mediumimage"] = MagicWorldImageRule.GetMainImageUrl(row["mediumimage"].ToString());
            }

            Repeater_ProductList.DataSource = dt;
            Repeater_ProductList.DataBind();
            AspNetPager.RecordCount = RecordCount;
        }
Ejemplo n.º 2
0
        public void Load_Data()
        {
            void Load_Detail()
            {
                int        ID   = int.Parse(Request.QueryString["id"]);
                DBEntities db   = new DBEntities();
                var        data = db.Products.Where(x => x.ProductID == ID).Select(x => new
                {
                    x.Avatar,
                    x.Price,
                    x.Title
                });

                Repeater_Detail.DataSource = data.ToList();
                Repeater_Detail.DataBind();
            }

            Load_Detail();

            void Load_ProductList()
            {
                DBEntities db   = new DBEntities();
                var        data = db.Products.Where(x => x.Status == true).Select(x => new
                {
                    x.ProductID,
                    x.Avatar,
                    x.Price,
                    x.OldPrice,
                    x.Title
                });

                Repeater_ProductList.DataSource = data.Take(8).ToList();
                Repeater_ProductList.DataBind();
            }

            Load_ProductList();

            void Load_BestSeller()
            {
                DBEntities db   = new DBEntities();
                var        data = db.Products.Where(x => x.Status == true).OrderBy(x => x.Price).Select(x => new
                {
                    x.ProductID,
                    x.Avatar,
                    x.Title,
                    x.Price
                });

                Repeater_BestSeller.DataSource = data.Take(4).ToList();
                Repeater_BestSeller.DataBind();
            }

            Load_BestSeller();
        }
        protected void DropDownList_Option_SelectedIndexChanged(object sender, EventArgs e)
        {
            DBEntities db   = new DBEntities();
            var        data = from c in db.Products
                              where c.Status == true
                              select new
            {
                c.ProductID,
                c.Avatar,
                c.Title,
                c.OldPrice,
                c.Price,
                c.ViewTime
            };

            if (DropDownList_Option.SelectedItem.Value == 1.ToString())
            {
                int min = Convert.ToInt32(data.Min(x => x.Price));
                data            = data.Where(x => x.Price == min);
                SeeMore.Visible = false;
            }
            else
            if (DropDownList_Option.SelectedItem.Value == 2.ToString())
            {
                int max = Convert.ToInt32(data.Max(x => x.Price));
                data            = data.Where(x => x.Price == max);
                SeeMore.Visible = false;
            }
            else
            if (DropDownList_Option.SelectedItem.Value == 3.ToString())
            {
                int viewTime = Convert.ToInt32(data.Max(x => x.ViewTime));
                data            = data.Where(x => x.ViewTime == viewTime);
                SeeMore.Visible = false;
            }
            else if (DropDownList_Option.SelectedItem.Value == 0.ToString())
            {
                Load_Data();
                SeeMore.Visible = true;
            }
            else
            {
                return;
            }


            Repeater_ProductList.DataSource = data.Take(9).ToList();
            Repeater_ProductList.DataBind();
        }
Ejemplo n.º 4
0
        private void BindData()
        {
            int MatchCount = 0, PageCount = 0;

            List <ProductModel> SearchResult = GetSearchResult(out MatchCount, out PageCount);

            Literal_SearchInfo.Text = String.Format("以\"{0}\"为检索词,共搜索到{1}条数据,共{2}页", SearchWord, MatchCount, PageCount);

            Repeater_ProductList.DataSource = SearchResult;
            Repeater_ProductList.DataBind();



            Pagination.InnerHtml = GetPaginateHtml(PageCount);
        }
Ejemplo n.º 5
0
        public void Load_Data()
        {
            void Load_Product_List()
            {
                DBEntities db   = new DBEntities();
                var        data = (from c in db.Products
                                   orderby c.Price
                                   where c.Status == true
                                   select new
                {
                    c.ProductID,
                    c.Avatar,
                    c.Title,
                    c.OldPrice,
                    c.Price
                });

                Repeater_ProductList.DataSource = data.Take(8).ToList();
                Repeater_ProductList.DataBind();
            }

            Load_Product_List();

            void Load_Best_Seller()
            {
                DBEntities db2   = new DBEntities();
                var        query = (from b in db2.Products
                                    orderby b.Quantity
                                    where b.Status == true
                                    select new
                {
                    b.ProductID,
                    b.Avatar,
                    b.Title,
                    b.OldPrice,
                    b.Price
                });

                Repeater_Best_Seller.DataSource = query.Take(8).ToList();
                Repeater_Best_Seller.DataBind();
            }

            Load_Best_Seller();
        }
        public void Load_Data(int pageSize = 9)
        {
            void Load_ProductList()
            {
                DBEntities db   = new DBEntities();
                var        data = from c in db.ProductCategories
                                  from m in c.Products
                                  orderby m.Price
                                  where m.Status == true
                                  select new
                {
                    c.ProductCategoryID,
                    m.ProductID,
                    m.Avatar,
                    m.Title,
                    m.OldPrice,
                    m.Price
                };
                string url = Request.QueryString.ToString();

                if (url.Contains("keyword"))
                {
                    string keyword = Request.QueryString["keyword"].ToString();
                    data = data.Where(x => x.Title.Contains(keyword));
                }


                if (url.Contains("sid"))
                {
                    int sid = int.Parse(Request.QueryString["sid"]);
                    if (sid > 0)
                    {
                        data = data.Where(x => x.ProductCategoryID == sid);
                    }
                }


                Repeater_ProductList.DataSource = data.Take(pageSize).ToList();
                Repeater_ProductList.DataBind();
            }

            Load_ProductList();

            void Load_LeftData()
            {
                DBEntities db    = new DBEntities();
                var        query = from l in db.Products
                                   where l.Status == true
                                   orderby Guid.NewGuid()
                                   select new
                {
                    l.ProductID,
                    l.Avatar,
                    l.OldPrice,
                    l.Price,
                    l.Title
                };

                Repeater_leftData.DataSource = query.Take(5).ToList();
                Repeater_leftData.DataBind();
            }

            Load_LeftData();

            void Load_Category()
            {
                DBEntities db   = new DBEntities();
                var        data = db.ProductCategories.Where(x => x.Status == true).Select(x => new
                {
                    x.ProductCategoryID,
                    x.Title
                });

                Repeater_Category.DataSource = data.ToList();
                Repeater_Category.DataBind();
            }

            Load_Category();
        }