protected void Page_Load(object sender, EventArgs e) { //占位标签 SearchBigId = Int32.Parse(Request["SearchBigId"]); BigClassService bigclassService = new BigClassService(); BigClass bigClass = new BigClass(); bigClass = bigclassService.GetModel(SearchBigId); nav = bigClass.bigname; SearchSmallId = Int32.Parse(Request["SearchSmallId"]); if (SearchSmallId > 0) { SmallClassService smallclassService = new SmallClassService(); SmallClass smallClass = new SmallClass(); smallClass = smallclassService.GetModel(SearchSmallId); Code = smallClass.smallname; NoticeService noticeService = new NoticeService(); NoticeList = noticeService.GetModelList(""); //分页 int pageNumber = 1; if (!Int32.TryParse(Request["page"], out pageNumber)) { pageNumber = 1; } GoodsService goodsService = new GoodsService(); //goodsList = goodsService.GetModelList("smallid=" +SearchSmallId); int maxPage = 0; int recordCount = goodsService.GetRecordCount("smallid=" + SearchSmallId); if (recordCount % goodsService.pageCount == 0) { maxPage = recordCount / goodsService.pageCount; } else { maxPage = recordCount / goodsService.pageCount + 1; } if (pageNumber > maxPage) { pageNumber = maxPage; } goodsList = goodsService.FindAllGoodsList(pageNumber, "smallid=" + SearchSmallId); pageCode = PageUtil.genPagination("/goods/GoodsList.aspx", recordCount, pageNumber, goodsService.pageCount, "SearchSmallId=" + SearchSmallId.ToString() + "&SearchBigId=" + SearchBigId); } else { } }
} //最近浏览 protected void Page_Load(object sender, EventArgs e) { BigClassService bigclassService = new BigClassService(); SmallClassService smallclassService = new SmallClassService(); GoodsService goodsService = new GoodsService(); BigClassList = bigclassService.GetModelList(""); foreach (BigClass bigclass in BigClassList) { bigclass.SmallClassList = smallclassService.GetModelList("bigid = " + bigclass.bigid); } }
protected void show(object sender, EventArgs e) { SmallClassService smallclassService = new SmallClassService(); BigClassService bigclassService = new BigClassService(); GoodsService goodsService = new GoodsService(); smallclassList = smallclassService.GetModelList(""); int pageNumber = 1; if (!Int32.TryParse(Request["page"], out pageNumber)) { pageNumber = 1; } if (IsPostBack) { goname = Request.Form["goname"]; bysmall = Request.Form["bysmall"]; iste = Request.Form["iste"]; isre = Request.Form["isre"]; } else { goname = Request.QueryString["goname"]; bysmall = Request.QueryString["bysmall"]; iste = Request.QueryString["iste"]; isre = Request.QueryString["isre"]; } ArrayList list = goodsService.GetSmallList(pageNumber, goname, bysmall, iste, isre); GoodsList = (List <Goods>)list[0]; pageCode = list[1].ToString(); //将小类封装到Goodsmodel中 foreach (Goods goods in GoodsList) { goods.smallclass = smallclassService.GetModel(goods.smallid); } }