private void UpdateNode(T dataNode, CT.Node treeNode, bool recursive) { if (dataNode == _data) // special handling for "root node changed" { if (recursive) { UpdateNodeList(dataNode.Nodes, _treeList.Nodes); } } else { if (treeNode == null) { return; } _nodeMapper.UpdateNode(dataNode, treeNode, _treeList); if (recursive) { if (dataNode.HasChildren) { UpdateNodeList(dataNode.Nodes, treeNode.Nodes); } else { treeNode.Nodes.Clear(); } } } }
public T GetDataNode(CT.Node viewNode) { if (viewNode == null) { return(null); } return(_nodeMapper.GetNodeInfo(viewNode) as T); }
public void UpdateNode(CT.Node viewNode, bool recursive) { var selectedNode = SelectedNode; _treeList.BeginUpdate(); UpdateNode(GetDataNode(viewNode), viewNode, recursive); _treeList.EndUpdate(); SelectedNode = selectedNode; }
private void loadTree(TreeListView treelistview, string connectionString) { //Service Source is not ready so fake action connectionString = "Server=TR00011565;Database=CRMOntology_Staging;Trusted_Connection=True;"; DataSet dsTable = new DataSet(); try { dsTable = new BusinessLayer.DataDescription(connectionString).GetTables(); } catch (Exception exp) { MessageBox.Show(exp.Message + "\n" + exp.StackTrace); return; } foreach (DataTable dtTable in dsTable.Tables) { foreach (DataRow drTable in dtTable.Rows) { CommonTools.Node tableNode = new CommonTools.Node(drTable["name"].ToString()); tableNode.ImageId = 0; DataSet dsColumn = new DataSet(); try { dsColumn = new BusinessLayer.DataDescription(connectionString).GetColumnsByTableId(drTable["object_id"].ToString()); } catch (Exception exp) { MessageBox.Show(exp.Message + "\n" + exp.StackTrace); return; } foreach (DataTable dtColumn in dsColumn.Tables) { foreach (DataRow drColumn in dtColumn.Rows) { CommonTools.Node columnNode = new CommonTools.Node(new object[] { drColumn["name"].ToString(), drColumn["type"].ToString(), drColumn["size"].ToString() }); columnNode.ImageId = 1; tableNode.Nodes.Add(columnNode); } } treelistview.Nodes.Add(tableNode); } } }
private void AccurateSettings_Load(object sender, EventArgs e) { BL.OWLConfiguration owlConfig = new BL.OWLConfiguration(); XElement xElement = owlConfig.OWLConfigurations.Count > 0 ? owlConfig.OWLConfigurations[0] : null; if (xElement != null) { BL.OWLDescription OWLDesc = new BL.OWLDescription(xElement); //set account - contact related tables to calculate accuration of a customer record DataSet dsTable = new DataSet(); try { dsTable = new BusinessLayer.DataDescription(OWLDesc.StagingDatabase.ConnectionString).GetCustomerReferencedTables(); } catch (Exception exp) { MessageBox.Show(exp.Message + "\n" + exp.StackTrace); return; } foreach (DataTable dtTable in dsTable.Tables) { foreach (DataRow drColumn in dtTable.Rows) { CommonTools.Node tableNode = new CommonTools.Node(drColumn["ParentObject"].ToString()); tableNode.ImageId = 0; DataSet dsTableChild = new BusinessLayer.DataDescription(OWLDesc.StagingDatabase.ConnectionString).GetColumnsByTableId(drColumn["ParentObjectId"].ToString()); foreach (DataTable dtTableChild in dsTableChild.Tables) { foreach (DataRow drColumnChild in dtTableChild.Rows) { CommonTools.Node columnNode = new CommonTools.Node(new object[] { drColumnChild["name"].ToString() }); columnNode.ImageId = 1; tableNode.Nodes.Add(columnNode); } } treeListViewStaging.Nodes.Add(tableNode); } } } }
public void UpdateNode(Node dataNode, CT.Node treeNode, CT.TreeListView view) { treeNode.Tag = dataNode; treeNode.ImageId = dataNode.ImageListIndex; var nameColumn = view.Columns["Name"]; treeNode[nameColumn.Index] = dataNode.NodeName; var typeColumn = view.Columns["Type"]; treeNode[typeColumn.Index] = dataNode.NodeType; var paramsColumn = view.Columns["Parameters"]; treeNode[paramsColumn.Index] = dataNode.NodeParameters; }
private void btnBusinessRequired_Click(object sender, EventArgs e) { //check selections NodesSelection selectionsDB = treeListViewStaging.NodesSelection; if (selectionsDB.Count < 1) { MessageBox.Show("Please select one item from Staging"); return; } for (int x = 0; x < selectionsDB.Count; x++) { CommonTools.Node nodeStaging = selectionsDB[x]; if (nodeStaging.Parent == null) { MessageBox.Show("You are not allowed to select " + nodeStaging[0].ToString() + ". Please select columns instead of Table"); continue; } CommonTools.Node nodeMapping; nodeMapping = new CommonTools.Node(new object[] { nodeStaging.Parent["name"].ToString() + "." + nodeStaging["name"].ToString(), BusinessConstraint.BusinessRequired.ToString() }) { ImageId = 0 }; int currentNodeIndex = CRMOntology.BusinessLayer.Node.GetNodeIndex(treeListViewAccurateXML.Nodes, nodeMapping[0]); if (currentNodeIndex < 0) { treeListViewAccurateXML.Nodes.Add(nodeMapping); } else { MessageBox.Show("double map is not allowed"); return; } } calculateAccuracy(); }
private void UpdateNodeList(TreeNodeCollection <T> dataNodes, CT.NodeCollection viewNodes) { var list = new List <T>(dataNodes); if (_nodeCompare != null) { list.Sort(_nodeCompare); } // update existing nodes int existing = Math.Min(list.Count, viewNodes.Count); for (int i = 0; i < existing; ++i) { UpdateNode(list[i], viewNodes[i], true); } // add items if necessary if (list.Count > viewNodes.Count) { for (int i = viewNodes.Count; i < list.Count; ++i) { CT.Node node = new CT.Node(); viewNodes.Add(node); UpdateNode(list[i], node, true); } } else if (list.Count < viewNodes.Count) // ..or else remove items if necessary { int removeCount = viewNodes.Count - list.Count; for (int i = 0; i < removeCount; ++i) { viewNodes.Remove(viewNodes.NodeAtIndex(viewNodes.Count - 1)); } } }
public T GetNodeInfo(CT.Node treeNode) { return((T)treeNode.Tag); }
public void UpdateNode(T dataNode, CT.Node treeNode, CT.TreeListView view) { treeNode.Tag = dataNode; }
public Node GetNodeInfo(CT.Node treeNode) { return((Node)treeNode.Tag); }
private void loadTree() { DataSet dsTable = new DataSet(); try { dsTable = new BusinessLayer.DataDescription(connectionString).GetAllPrimaryKeys(); } catch (Exception exp) { MessageBox.Show(exp.Message + "\n" + exp.StackTrace); return; } foreach (DataTable dtTable in dsTable.Tables) { foreach (DataRow drTable in dtTable.Rows) { if (drTable["table_name"].ToString() == "TransferHistoryBase" || drTable["table_name"].ToString() == "OWLMapBase") { //remove TransferHistoryBase from checkList since it is administrative table. continue; } CommonTools.Node tableNode = new CommonTools.Node(drTable["table_name"].ToString()); if (CRMOntology.BusinessLayer.Node.GetNodeIndex(treeListView1.Nodes, drTable["table_name"].ToString()) >= 0) { continue; } CommonTools.Node columnNode = new CommonTools.Node(new object[] { "Primary Key" }); if (CRMOntology.BusinessLayer.Node.GetNodeIndex(nodes, drTable["table_name"].ToString() + "." + drTable["column_name"].ToString()) >= 0) { columnNode.ImageId = 0; } else { columnNode.ImageId = 1; DatabaseMappingForm.isValid = false; } tableNode.Nodes.Add(columnNode); columnNode = new CommonTools.Node(new object[] { "CreatedOn" }); if (CRMOntology.BusinessLayer.Node.GetNodeIndex(nodes, drTable["table_name"].ToString() + "." + "CreatedOn") >= 0) { columnNode.ImageId = 0; } else { columnNode.ImageId = 1; DatabaseMappingForm.isValid = false; } tableNode.Nodes.Add(columnNode); columnNode = new CommonTools.Node(new object[] { "ModifiedOn" }); if (CRMOntology.BusinessLayer.Node.GetNodeIndex(nodes, drTable["table_name"].ToString() + "." + "ModifiedOn") >= 0) { columnNode.ImageId = 0; } else { columnNode.ImageId = 1; DatabaseMappingForm.isValid = false; } tableNode.Nodes.Add(columnNode); tableNode.ExpandAll(); treeListView1.Nodes.Add(tableNode); } } }