コード例 #1
0
 public ActionResult WaterfallProductListData(string keyword, string type, int startIndex)
 {
     keyword = InjectionFilter.Filter(keyword);
     ProductCategory model = new ProductCategory();
     ProductQuery query = new ProductQuery();
     Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products();
     query.Order = type;
     query.Keywords = keyword;
     query.CategoryID = -1;
     ((dynamic) base.ViewBag).BasePageSize = this._basePageSize;
     startIndex = (startIndex > 1) ? (startIndex + 1) : 0;
     int endIndex = (startIndex > 1) ? ((startIndex + this._waterfallDetailCount) - 1) : this._waterfallDetailCount;
     if (products.GetProductCount(query) < 1)
     {
         return new EmptyResult();
     }
     model.ProductListWaterfall = products.GetProductByPage(query, startIndex, endIndex);
     string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNSIsStatic");
     if ((model.ProductListWaterfall != null) && (model.ProductListWaterfall.Count > 0))
     {
         foreach (Maticsoft.Model.SNS.Products products2 in model.ProductListWaterfall)
         {
             if (valueByCache != "true")
             {
                 products2.StaticUrl = (string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID);
                 continue;
             }
             products2.StaticUrl = string.IsNullOrWhiteSpace(products2.StaticUrl) ? ((string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID)) : products2.StaticUrl;
         }
     }
     return base.View("ProductListWaterfall", model);
 }
コード例 #2
0
 public ActionResult Product(int pageIndex = 1)
 {
     ((dynamic) base.ViewBag).Title = "商品搜索";
     string inputString = string.IsNullOrWhiteSpace(base.Request.Params["keyword"]) ? "" : base.Server.UrlDecode(base.Request.Params["keyword"]);
     string str2 = string.IsNullOrWhiteSpace(base.Request.Params["type"]) ? "hot" : base.Request.Params["type"];
     inputString = InjectionFilter.Filter(inputString);
     this.LogKeyWord(inputString);
     ProductCategory model = new ProductCategory();
     Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products();
     ProductQuery query = new ProductQuery {
         Order = str2
     };
     ((dynamic) base.ViewBag).sequence = str2;
     query.Keywords = inputString;
     query.CategoryID = -1;
     int pageSize = this._basePageSize + this._waterfallSize;
     ((dynamic) base.ViewBag).BasePageSize = this._basePageSize;
     int startIndex = (pageIndex > 1) ? (((pageIndex - 1) * pageSize) + 1) : 0;
     int endIndex = (pageIndex > 1) ? ((startIndex + this._basePageSize) - 1) : this._basePageSize;
     int productCount = 0;
     ((dynamic) base.ViewBag).CurrentPageAjaxStartIndex = endIndex;
     ((dynamic) base.ViewBag).CurrentPageAjaxEndIndex = pageIndex * pageSize;
     query.QueryType = 0;
     productCount = products.GetProductCount(query);
     if (productCount >= 1)
     {
         query.QueryType = 1;
         model.ProductPagedList = products.GetProductByPage(query, startIndex, endIndex).ToPagedList<Maticsoft.Model.SNS.Products>(pageIndex, pageSize, new int?(productCount));
         string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNSIsStatic");
         if ((model.ProductPagedList != null) && (model.ProductPagedList.Count > 0))
         {
             foreach (Maticsoft.Model.SNS.Products products2 in model.ProductPagedList)
             {
                 if (valueByCache != "true")
                 {
                     products2.StaticUrl = (string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID);
                     continue;
                 }
                 products2.StaticUrl = string.IsNullOrWhiteSpace(products2.StaticUrl) ? ((string) ((((dynamic) base.ViewBag).BasePath + "Product/Detail/") + products2.ProductID)) : products2.StaticUrl;
             }
         }
         if (base.Request.IsAjaxRequest())
         {
             return this.PartialView("ProductList", model);
         }
     }
     return base.View(model);
 }