private void GenerateLevelTree(int?parent, TreeModel tree) { List <LevelModelView> levels = GetChildrenLevels(parent); if (levels != null) { foreach (LevelModelView level in levels) { LevelTreeCreation levelTree = new LevelTreeCreation(level.Name, level.TableName, level.LevelId, level.Id); if (levelTree.Tree != null) { if (tree.children == null) { tree.children = new List <TreeModel>(); } tree.children.Add(levelTree.Tree); } } foreach (TreeModel child in tree.children) { if (child.leaf == false && child.label != "Attributes") { AttributeNodeData nodeAttribute = (AttributeNodeData)child.data; GenerateLevelTree(nodeAttribute.Id, child); } } } }
public void init() { AttributeNodeData rootAttributes = new AttributeNodeData(); this.Tree = new TreeModel("Attributes", rootAttributes, false); this.Tree.parent = null; }
private void TreeTraversal(TreeModel tree, int?ParentId, int Id) { if (tree.children != null) { int parentId = Id; foreach (TreeModel child in tree.children) { if (child != null) { AttributeNodeData nodeAttribute = (AttributeNodeData)child.data; Id++; TreeListModelView treelistNode = new TreeListModelView(child.label, Id, parentId, nodeAttribute.TableName, nodeAttribute.ColumnName, nodeAttribute.ColumnType); TreeList.Add(treelistNode); TreeTraversal(child, parentId, Id); } } } }
public void init(int levelId, string levelName, string tableName, int Id) { AttributeNodeData rootAttributes = new AttributeNodeData(Id, levelId, tableName, null, null); this.Tree = new TreeModel(levelName, rootAttributes, false); var ParentSerialized = JsonConvert.SerializeObject(this.Tree); this.Parent = JsonConvert.DeserializeObject <TreeModel>(ParentSerialized); if (this.Tree.children == null) { this.Tree.children = new List <TreeModel>(); } TreeModel attrTree = new TreeModel("Attributes", rootAttributes, false); this.Tree.children.Add(attrTree); }
public AttributeNodeCreation(string DisplayName, string ColumnName, string ColumnType) { AttributeNodeData rootAttributes = new AttributeNodeData(0, 0, null, ColumnName, ColumnType); this.Tree = new TreeModel(DisplayName, rootAttributes, true); }