public List<ICategory> GetCatalogueNodeChildren(int storeID, string cultureCode, long parentNodeID) { IQuery query = this._sessionManager.OpenSession().CreateQuery("from Category where parentcategoryID = :id AND (categoryID <> :id ) AND isPublished = 1 order by sortOrder"); query.SetInt64("id", parentNodeID); IList cats2 = query.List(); List<ICategory> children = new List<ICategory>(); if (cats2.Count > 0) { foreach (Category epc in cats2) { if (epc.IsPublished) { ICategory node = new CategoryNode(); node.Name = epc.CategoryName; node.NodeID = Convert.ToInt64(epc.CategoryID); node.ParentNodeID = Convert.ToInt64(epc.ParentCategory.CategoryID); node.Description = epc.CategoryDescription; node.Style = epc.CssClass; IImage image = new Domain.Catalogue.Image(); ImageHelper.CopyImage(epc, image); node.Image = image; node.SortOrder = epc.SortOrder; children.Add(node); } } } return children; }
private HtmlControl BuildListItemFromCategory(CategoryNode cNode) { HtmlGenericControl listItem = new HtmlGenericControl("li"); HyperLink hpl = new HyperLink(); hpl.NavigateUrl = Cuyahoga.Web.Util.UrlHelper.GetSiteUrl() + "/" + ECommerceURLHelper.GetECommerceSectionId(_page.RootNode.Site.Id) + "/section.aspx/view/catnav/node/" + +cNode.NodeID; hpl.Text = cNode.Name; listItem.Controls.Add(hpl); return listItem; }
private List<CategoryNode> GetProductCategories() { try { List<CategoryNode> categoryList = new List<CategoryNode>(); using (SpHandler sph = new SpHandler("getProductLines")) { sph.ExecuteReader(); while (sph.DataReader.Read()) { CategoryNode c = new CategoryNode(); c.NodeID = Convert.ToInt64(sph.DataReader["categoryID"]); c.Name = sph.DataReader["categoryName"] as string; categoryList.Add(c); } return categoryList; } } catch (Exception e) { LogManager.GetLogger(GetType()).Error(e); } return null; }
public ICategory GetRootCatalogueNode(int storeID, string cultureCode) { ICategory node = new CategoryNode(); IQuery query = this._sessionManager.OpenSession().CreateQuery("from Category where parentcategoryID IS Null AND isPublished = 1 order by sortOrder"); IList cats = query.List(); if (cats.Count > 0) { foreach (Category epc in cats) { node.Name = epc.CategoryName; node.NodeID = Convert.ToInt32(epc.CategoryID); node.Description = epc.CategoryDescription; node.BannerImageUrl = epc.BannerImageUrl; IImage image = new Domain.Catalogue.Image(); ImageHelper.CopyImage(epc, image); node.Image = image; } } return node; }
public ICategory GetCatalogueNode(int storeID, string cultureCode, long nodeID) { ICategory node = new CategoryNode(); Category cat = (Category)_dao.GetObjectById(typeof(Category), nodeID); if (cat != null) { node.Name = cat.CategoryName; node.NodeID = Convert.ToInt64(cat.CategoryID); if (cat.ParentCategory != null) { node.ParentNodeID = Convert.ToInt32(cat.ParentCategory.CategoryID); } node.Style = cat.CssClass; node.Description = cat.CategoryDescription; node.Links = cat.Links; node.BannerImageUrl = cat.BannerImageUrl; if (node.Image == null) { node.Image = new Domain.Catalogue.Image(); } ImageHelper.CopyImage(cat, node.Image); } return node; }