예제 #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 List<ProductCategory> GetChildByMenu()
 {
     List<Maticsoft.Model.SNS.Categories> menuByCategory = this.GetMenuByCategory(-1);
     List<ProductCategory> list2 = new List<ProductCategory>();
     foreach (Maticsoft.Model.SNS.Categories categories in menuByCategory)
     {
         ProductCategory item = new ProductCategory {
             ParentModel = categories
         };
         List<Maticsoft.Model.SNS.Categories> childrenListById = this.GetChildrenListById(categories.CategoryId);
         item.ChildList = childrenListById.Take<Maticsoft.Model.SNS.Categories>(10).ToList<Maticsoft.Model.SNS.Categories>();
         list2.Add(item);
     }
     return list2;
 }
예제 #3
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);
 }
예제 #4
0
 public ProductCategory GetCateListByParentIdEx(int ParentID)
 {
     ProductCategory category = new ProductCategory();
     if (ParentID != 0)
     {
         Maticsoft.Model.SNS.Categories model = this.GetModel(ParentID);
         category.CurrentCateName = (model == null) ? "暂无" : model.Name;
         category.CurrentCid = ParentID;
         foreach (Maticsoft.Model.SNS.Categories categories2 in this.GetModelList("ParentID=" + ParentID))
         {
             SonCategory item = new SonCategory {
                 ParentModel = categories2,
                 Grandson = this.DataTableToList(this.GetListByPage("ParentID=" + categories2.CategoryId, "", 1, 5).Tables[0])
             };
             category.SonList.Add(item);
         }
     }
     return category;
 }