Esempio n. 1
0
        }                                 //最近浏览
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        //返回商品小类与其数量转换为json返回前台
        protected void smallcountlist()
        {
            List <SmallClass> smallclassList = new List <SmallClass>();

            smallclassList = smallclassService.GetModelList("");
            //
            foreach (SmallClass smallclass in smallclassList)
            {
                smallclass.smallclasscount = goodsService.GetRecordCount("smallid=" + smallclass.smallid);
            }
            //存放小类名以及其下商品的数量
            ArrayList smallcountlist = new ArrayList();

            for (int i = 0; i < smallclassList.Count; i++)
            {
                Hashtable ht = new Hashtable();
                if (smallclassList[i].smallclasscount > 0)
                {
                    ht.Add("smallname", smallclassList[i].smallname);
                    ht.Add("smallclasscount", "" + smallclassList[i].smallclasscount + "");
                }
                else
                {
                    ht.Add("smallname", smallclassList[i].smallname);
                    ht.Add("smallclasscount", "0");
                }
                smallcountlist.Add(ht);
            }
            //JavaScriptSerializer  生成JSON数据
            JavaScriptSerializer ser = new JavaScriptSerializer();

            jsonStr = ser.Serialize(smallcountlist);

            Response.Write(jsonStr);

            Response.End();
        }