public ICategoryView GetRootCategoryView(int storeID, string cultureCode) { ICategoryView nodeView = new CategoryNodeView(); nodeView.CurrentNode = GetRootCatalogueNode(storeID, cultureCode); nodeView.ChildNodes = GetCatalogueNodeChildren(storeID, cultureCode, nodeView.CurrentNode.NodeID); nodeView.BreadCrumbTrail = GetCategoryBreadCrumb(nodeView.CurrentNode); return nodeView; }
public ICategoryView GetCategoryView(int storeID, string cultureCode, long nodeID, int offset, int limit, string orderBy) { ICategoryView nodeView = new CategoryNodeView(); nodeView.CurrentNode = GetCatalogueNode(storeID, cultureCode, nodeID); nodeView.ChildNodes = GetCatalogueNodeChildren(storeID, cultureCode, nodeID); nodeView.BreadCrumbTrail = GetCategoryBreadCrumb(nodeView.CurrentNode); if (nodeView.ChildNodes.Count < 1) { IQuery pQuery = this._sessionManager.OpenSession().CreateSQLQuery("select pc.* from ECommerce_ProductCategory pc inner join ECommerce_Product p on pc.productID = p.productID WHERE pc.categoryID = :id Order By " + orderBy, "pc", typeof(ProductCategory)); pQuery.SetMaxResults(limit); pQuery.SetFirstResult(offset); pQuery.SetInt64("id", nodeID); IList productCategories = pQuery.List(); //im sure this is repeated foreach (ProductCategory pc in productCategories) { if (pc.Product.IsPublished) { nodeView.ProductList.Add(pc.Product.CreateFullProductSummary()); } } } return nodeView; }
public ICategoryView GetCategoryView(int storeID, string cultureCode, long nodeID) { ICategoryView nodeView = new CategoryNodeView(); nodeView.CurrentNode = GetCatalogueNode(storeID, cultureCode, nodeID); nodeView.ChildNodes = GetCatalogueNodeChildren(storeID, cultureCode, nodeID); nodeView.BreadCrumbTrail = GetCategoryBreadCrumb(nodeView.CurrentNode); if (nodeView.ChildNodes.Count < 1) { IQuery pQuery = this._sessionManager.OpenSession().CreateQuery("from ProductCategory WHERE categoryID = :id Order By sortOrder"); pQuery.SetInt64("id", nodeID); IList productCategories = pQuery.List(); //im sure this is repeated foreach (ProductCategory pc in productCategories) { if (pc.Product.IsPublished) { nodeView.ProductList.Add(pc.Product.CreateFullProductSummary()); } } } return nodeView; }