int PopulateTreeView(TagElements parentTag, int curentPosition, TreeNode parentNode) { // parentTag.hierarchicalPosition = curentPosition; int j = 0; foreach (TagElements tag in tagMap) { if (tag == null) break; if (tag.parentName == parentTag.tagName) { TreeNode curentNode = new TreeNode(); curentNode.Text = tag.tagName; curentNode.NavigateUrl = "TagInfo.aspx?tagName=" + tag.tagName; curentNode.Collapse(); parentNode.ChildNodes.Add(curentNode); PopulateTreeView(tag, curentPosition + 1, curentNode); } j++; // Response.Write(tag.tagName + " " + tag.parentName + "<br />"); } return 0; }
void LoadTags() { MongoClient mclient = new MongoClient(GlobalVariables.mongolabConection); var db = mclient.GetDatabase(GlobalVariables.mongoDatabase); var collection = db.GetCollection<TagsCollection>("Tags"); //inputValue = "ev"; // var filter = Builders<IndividualData>.Filter.Eq("id", id); int i = 0; collection.Find(_ => true).ForEachAsync(d => { TagElements tagElement = new TagElements(); tagElement.tagName = d.tagName; tagElement.parentName = d.parentTags[0]["parentName"].ToString(); tagMap[i] = tagElement; i++; }).Wait(); }
/// <summary> /// Gets the product tags. /// </summary> /// <returns></returns> public virtual IEnumerable <string> GetProductTags() { return(TagElements .Select(e => e.TextHelper().InnerText)); }
int SetHierarhicalPosition(TagElements curentTag, int curentPosition) { curentTag.hierarchicalPosition = curentPosition; int j = 0; foreach (TagElements tag in tagMap) { if (tag == null) break; if (tag.parentName == curentTag.tagName) { SetHierarhicalPosition(tag, curentPosition + 1); } j++; // Response.Write(tag.tagName + " " + tag.parentName + "<br />"); } return 0; }