private void addChildToolStripMenuItem_Click(object sender, EventArgs e) { try { ComparisonCategoryTreeNode comparisonCategoryTreeNode = tvResultsCategories.SelectedNode as ComparisonCategoryTreeNode; if (comparisonCategoryTreeNode.Level < 1) { EnvComparisonCategoryForm form = new EnvComparisonCategoryForm(); DialogResult dial = form.ShowDialog(); if (dial == DialogResult.Yes) { ComparisonCategory cat = form.workingCompCategory; if (cat.categoryId == 0) { //add button was pressed //add button was pressed ComparisonCategoryTreeNode childComparisonCategoryTreeNode = new ComparisonCategoryTreeNode(cat.categoryName); childComparisonCategoryTreeNode.comparisonCategory = new ComparisonCategory(cat.categoryName, cat.categoryDescription, cat.categoryPath); comparisonCategoryTreeNode.Nodes.Add(childComparisonCategoryTreeNode); } else { // save button was pressed } } } } catch (Exception ex) { CommonUtils.ShowError(ex.Message, ex); } }
private ComparisonCategoryTreeNode CreateNode(DataRow dataRow, bool p) { ComparisonCategoryTreeNode node = new ComparisonCategoryTreeNode(dataRow["name"].ToString()); node.comparisonCategory = new ComparisonCategory(Convert.ToInt32(dataRow["id"]), dataRow["name"].ToString(), dataRow["description"].ToString(), dataRow["path"].ToString(), dataRow["parentId"] == DBNull.Value ? -1 : Convert.ToInt32(dataRow["parentId"])); return node; }
private void RecursivelyPopulate(DataRow dbRow, ComparisonCategoryTreeNode node) { foreach (DataRow childRow in dbRow.GetChildRows("NodeRelation")) { ComparisonCategoryTreeNode childNode = CreateNode(childRow, true); node.Nodes.Add(childNode); RecursivelyPopulate(childRow, childNode); } }
private void ParseAllChildren(ComparisonCategoryTreeNode treeNode) { foreach (ComparisonCategoryTreeNode childNode in treeNode.Nodes) { allTreeNodes.Add(childNode); if (childNode.Nodes.Count > 0) { ParseAllChildren(childNode); } } }