/// <summary> /// 限时秒杀 /// </summary> private void miaosha() { System.Data.DataTable dtxsms = new webs_YueyxShop.BLL.SKUBase().GetDefaultSKUDetial(" and p_id in( select p_ID from ProductRecommendDetail where prt_ID=15 and prd_Status=0 and prd_IsDelete=0 ) and pi_type=1 and pt_IsDel=0 and pt_StatusCode=0 and b_IsDel=0 and sku_IsDel=0 and sku_StatusCode=0 and pi_StatusCode=0 and pi_IsDel=0 and p_IsDel=0 and p_StatusCode=0"); if (dtxsms.Rows.Count > 0) { ViewData["pc首页限时秒杀"] = dtxsms; } else { ViewData["pc首页限时秒杀"] = ""; } }
/// <summary> /// 促销商品推荐 /// </summary> private void cuixiao() { System.Data.DataTable dtcuxiao = new webs_YueyxShop.BLL.SKUBase().GetDefaultSKUDetial(" and p_id in( select p_ID from ProductRecommendDetail where prt_ID=7 and prd_Status=0 and prd_IsDelete=0 ) and pi_type=1 and pt_IsDel=0 and pt_StatusCode=0 and b_IsDel=0 and sku_IsDel=0 and sku_StatusCode=0 and pi_StatusCode=0 and pi_IsDel=0 and p_IsDel=0 and p_StatusCode=0"); ViewData["pc首页促销"] = dtcuxiao; }
public ActionResult Commodity() { ViewBag.Title = "商品列表-书生网"; //商品导航 StringBuilder sb = new StringBuilder(); DataTable dtptb1 = new BLL.ProductTypeBase().GetList(" pt_Layer=1 and pt_StatusCode=0 and pt_IsDel=0 order by pt_Sort asc").Tables[0];//一级商品类型 if (dtptb1.Rows.Count > 0) { for (int i = 0; i < dtptb1.Rows.Count; i++) { sb.Append("<dt class=\"odd\">" + dtptb1.Rows[i]["pt_Name"] + "</dt>"); DataTable dtptb2 = new BLL.ProductTypeBase().GetList(" pt_Layer=2 and pt_StatusCode=0 and pt_IsDel=0 and pt_ParentId="+dtptb1.Rows[i]["pt_ID"]+" order by pt_Sort asc").Tables[0];//二级商品类型 if (dtptb2.Rows.Count > 0) { sb.Append("<dd class=\"odd\">"); sb.Append("<ol>"); for (int n = 0; n < dtptb2.Rows.Count; n++) { sb.Append("<li>"); sb.Append("<a href='/sswCommodity/Commodity?pt_id="+dtptb2.Rows[n]["pt_ID"]+"'><span class=\"price1\">"+dtptb2.Rows[n]["pt_Name"]+"</span></a>("+dtptb2.Rows.Count+")"); sb.Append("</li>"); } sb.Append("</ol>"); sb.Append("</dd>"); } ViewBag.CommodityTitle = sb.ToString(); } } string ptb_id = Request.QueryString["pt_id"] == null ? "0" : Request.QueryString["pt_id"].ToString(); string brand_id = Request.QueryString["b_id"] == null ? "0" : Request.QueryString["b_id"].ToString(); DataTable dtmztm=null; if (ptb_id != "0") { dtmztm = new webs_YueyxShop.BLL.SKUBase().GetDefaultSKUDetial(" and pt_ID=" + ptb_id + " and pi_type=0 and pt_IsDel=0 and pt_StatusCode=0 and b_IsDel=0 and sku_IsDel=0 and sku_StatusCode=0 and pi_StatusCode=0 and pi_IsDel=0 and p_IsDel=0 and p_StatusCode=0"); } else if(brand_id!="0") { dtmztm = new webs_YueyxShop.BLL.SKUBase().GetDefaultSKUDetial(" and b_ID=" + brand_id + " and pi_type=0 and pt_IsDel=0 and pt_StatusCode=0 and b_IsDel=0 and sku_IsDel=0 and sku_StatusCode=0 and pi_StatusCode=0 and pi_IsDel=0 and p_IsDel=0 and p_StatusCode=0"); } else { dtmztm = new webs_YueyxShop.BLL.SKUBase().GetDefaultSKUDetial(" and pi_type=0 and pt_IsDel=0 and pt_StatusCode=0 and b_IsDel=0 and sku_IsDel=0 and sku_StatusCode=0 and pi_StatusCode=0 and pi_IsDel=0 and p_IsDel=0 and p_StatusCode=0"); } //得到全部商品列表 ViewData["pcCommodityList"] = dtmztm; //List<Model.SKUBase> list= new webs_YueyxShop.BLL.SKUBase().DataTableToList(dtmztm); //int total = 0;//总行数 //int pageSize = 300;//每页25行 //int pageNumber = 1;//当前页 //var skucc= new BLL.SKUBase().GetModelList(" sku_StatusCode=0 and sku_IsDel=0 "); //total = skucc.Count(); //this.ViewData["TotalCount"] = total.ToString(); //this.ViewData["NumberPage"] = pageSize.ToString(); //this.ViewData["PagenumShown"] = "10"; //this.ViewData["CurrentPage"] = pageNumber.ToString(); //return View(skucc.ToPagedList(pageNumber, pageSize)); return View(); }