private TreeNodeCollection AddNodesServizi(DataRow Dr, TreeNodeCollection nodes) { string descrizione = Dr["ID"].ToString() + "&servizio_id=" + Dr["servizi_id"].ToString(); nodes.Add(Node(Dr["DESCRIZIONE"].ToString(), "servizio", descrizione, true, true)); return(nodes); }
private TreeNodeCollection AddTipoApparecchiatura(DataRow Dr, TreeNodeCollection nodes) { string descrizione = Dr["eq_std"].ToString() + " " + Dr["family_description"].ToString(); nodes.Add(Node(descrizione, "apparecchaiture", "", false, false)); return(nodes); }
private void RemoveNeedlessModuleType(Microsoft.Web.UI.WebControls.TreeNode parentNode) { Microsoft.Web.UI.WebControls.TreeNodeCollection childNodes = (parentNode == null ? tvModules.Nodes : parentNode.Nodes); ArrayList tobeRemoved = new ArrayList(); foreach (Microsoft.Web.UI.WebControls.TreeNode childNode in childNodes) { if (childNode.Type == "moduletype") { if (childNode.Nodes.Count > 0) { RemoveNeedlessModuleType(childNode); } if (childNode.Nodes.Count == 0) { tobeRemoved.Add(childNode); } } } foreach (object childNode in tobeRemoved) { (childNode as Microsoft.Web.UI.WebControls.TreeNode).Remove(); } }
private void PopolaTreeview(DataSet Ds) { //imposto lo style alla treeview SetStyleTreeVieew(); foreach (DataRow Dr in Ds.Tables[0].Rows) { TreeNode nox = new TreeNode(); nox.Type = "edificio"; nox.Expanded = true; string descrizione = ""; descrizione = Dr["DESCRIZIONE"].ToString(); nox.Text = descrizione; nox.Target = Dr["ID"].ToString(); TreeCtrl.Nodes.Add(nox); //Recupero i tutti i dati dell'edificio. DataRowCollection DrCollection = DatiEdificio(Int32.Parse(Dr["ID"].ToString())); //Ciclo per i servizi TreeNodeCollection nodePadre = null; foreach (DataRow DrDettagli in DrCollection) { nodePadre = AddNodesServizi(nox.Target, DrDettagli, NodeCollection()); } //Fine Ciclo Servizi per edifio } //Fine Ciclo Edifici }
/// <summary> /// Ricorsione /// </summary> /// <param name="nodo"></param> /// <param name="xmldoc"></param> /// <param name="indentazionePadre"></param> private void addElement(myTreeNode nodo, XmlDocument xmldoc, int indentazionePadre) { string prefisso = string.Empty; if (nodo.Expanded && nodo.Nodes.Count > 0) { indentazionePadre += 1; Microsoft.Web.UI.WebControls.TreeNodeCollection nodi = nodo.Nodes; foreach (myTreeNode n in nodi) { XmlElement record = xmldoc.CreateElement("RECORD"); record.SetAttribute("tipo", n.getTipoNodo()); switch (n.getTipoNodo()) { case "U": prefisso = "[UO] "; break; case "R": prefisso = "[R] "; break; case "P": prefisso = "[U] "; break; } record.SetAttribute("desc", this.addIndentation(indentazionePadre) + prefisso + n.Text); xmldoc.DocumentElement.AppendChild(record); this.addElement(n, xmldoc, indentazionePadre); } } }
private void ImpostaNodi(TreeNode nodopadre, TreeNodeCollection nodi, bool val) { //nodopadre = BL | nodofiglio=servizio foreach (TreeNode nodofiglio in nodi) { nodofiglio.Checked = val; } }
private TreeView _treeview; // parent #endregion Fields #region Constructors /// <summary> /// Initializes a new instance of a TreeNode. /// </summary> public TreeNode() : base() { _level = -1; _treeview = null; _strInheritedType = null; _NodeTypeIndex = -1; _bBound = false; _Nodes = new TreeNodeCollection(this); }
private void PopolaTreeview(DataSet Ds) { //imposto lo style alla treeview SetStyleTreeVieew(); foreach (DataRow Dr in Ds.Tables[0].Rows) { TreeNode nox = new TreeNode(); nox.Type = "edificio"; nox.Text = string.Format("({0}) {1}", Dr["BL_ID"], Dr["DENOMINAZIONE"]); nox.NavigateUrl = ""; nox.Target = ""; TreeCtrl.Nodes.Add(nox); //Recupero i tutti i dati dell'edificio. DataRowCollection DrCollection = DatiEdificio(Int32.Parse(Dr["ID"].ToString())); //Ciclo per i servizzi string servizio = string.Empty; string apparecchiatura = string.Empty; TreeNodeCollection nodePadre = null; foreach (DataRow DrDettagli in DrCollection) { if (DrDettagli["servizi_id"].ToString() == cmbsServizio.SelectedValue || cmbsServizio.SelectedIndex == 0) { if (servizio != DrDettagli["descrizione"].ToString()) { apparecchiatura = ""; nodePadre = null; servizio = DrDettagli["descrizione"].ToString(); nodePadre = AddNodesServizi(DrDettagli, NodeCollection()); } // if (DrDettagli["eqstdid"].ToString()==cmbsApparecchiatura.SelectedValue || cmbsApparecchiatura.SelectedIndex==0) // { // if (DrDettagli["description"]!=System.DBNull.Value) // { // if(apparecchiatura!=DrDettagli["description"].ToString()) // { // nodeFiglio=null; // apparecchiatura=DrDettagli["description"].ToString(); // nodeFiglio=AddTipoApparecchiatura(DrDettagli,nodePadre[nodePadre.Count -1].Nodes); // } // } // AddApparecchiatura(DrDettagli,nodeFiglio[nodeFiglio.Count -1].Nodes); // } } } //Fine Ciclo Servizi per edificio } //Fine Ciclo Edifici }
private void TViewDept_Generate(Microsoft.Web.UI.WebControls.TreeNodeCollection preNodes, DataTable deptDTable, string isjCode) { DataRow[] array = deptDTable.Select("i_sjdm=" + isjCode); DataRow[] array2 = array; for (int i = 0; i < array2.Length; i++) { DataRow dataRow = array2[i]; Microsoft.Web.UI.WebControls.TreeNode treeNode = new Microsoft.Web.UI.WebControls.TreeNode(); treeNode.NodeData = dataRow["i_bmdm"].ToString(); treeNode.Text = dataRow["v_bmmc"].ToString(); treeNode.Target = "_self"; treeNode.NavigateUrl = "javascript:clicknode('" + treeNode.NodeData + "');"; preNodes.Add(treeNode); this.TViewDept_Generate(treeNode.Nodes, deptDTable, dataRow["i_bmdm"].ToString()); } }
private TreeNodeCollection AddNodesServizi(string id_bl, DataRow Dr, TreeNodeCollection nodes) { TreeNode n = new TreeNode(); n.Type = "servizio"; n.Text = Dr["DESCRIZIONE"].ToString(); n.Target = Dr["ID"].ToString(); // Uso la proprietà Target per memorizzare l'ID n.CheckBox = true; //controllo se il servizio in esame è già associato al ruolo per quel BL Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); bool stato = _MailSend.ControllaEmailBlServizi(itemId, Int32.Parse(id_bl), Int32.Parse(n.Target)); n.Checked = stato; nodes.Add(n); return(nodes); }
/// <summary> /// This is called when the value property in the CollectionForm has changed. /// In it you should update your user interface to reflect the current value. /// </summary> protected override void OnEditValueChanged() { if (EditValue != null) { Microsoft.Web.UI.WebControls.TreeNodeCollection editCol = (Microsoft.Web.UI.WebControls.TreeNodeCollection)EditValue; tvWebNodes.Site = ((Microsoft.Web.UI.WebControls.TreeView)editCol.Parent).Site; object[] items = Items; System.Windows.Forms.TreeNode[] nodes = new System.Windows.Forms.TreeNode[items.Length]; tvWebNodes.Nodes.Clear(); for (int i = 0; i < items.Length; i++) { // We need to copy the nodes into our editor TreeView, not move them. // We overwrite the passed-in array with the new roots. // Microsoft.Web.UI.WebControls.TreeNode webnode = (Microsoft.Web.UI.WebControls.TreeNode)((ICloneable)((Microsoft.Web.UI.WebControls.TreeNode)items[i])).Clone(); nodes[i] = WebNodeToFormNode(webnode); tvWebNodes.Nodes.Add(webnode); } tvWebNodes.TreeNodeTypes.Clear(); foreach (TreeNodeType nodeType in ((Microsoft.Web.UI.WebControls.TreeView)editCol.Parent).TreeNodeTypes) { tvWebNodes.TreeNodeTypes.Add((TreeNodeType)nodeType.Clone()); } tvNodes.Nodes.Clear(); tvNodes.Nodes.AddRange(nodes); // Update current node related UI // if (tvNodes.Nodes.Count > 0) { SelectedNode = tvNodes.Nodes[0]; } else { SelectedNode = null; } btnApply.Enabled = false; } }
private void TViewDept_Generate(Microsoft.Web.UI.WebControls.TreeNodeCollection preNodes, DataTable deptDTable, string isjCode, int iSysID) { DataRow[] array = deptDTable.Select("i_sjdm=" + isjCode); DataRow[] array2 = array; for (int i = 0; i < array2.Length; i++) { DataRow dataRow = array2[i]; Microsoft.Web.UI.WebControls.TreeNode treeNode = new Microsoft.Web.UI.WebControls.TreeNode(); treeNode.NodeData = dataRow["i_bmdm"].ToString(); treeNode.Text = dataRow["v_bmmc"].ToString(); string hT; if (dataRow["i_bmdm"].ToString().Trim() != "1" && (hT = this.HT) != null) { if (!(hT == "1")) { if (!(hT == "2")) { if (hT == "3") { treeNode.NavigateUrl = "human3.aspx?sysid=" + this._iSysID.ToString() + "&deptid=" + dataRow["i_bmdm"].ToString(); treeNode.Target = "FraHuman"; } } else { treeNode.NavigateUrl = "human2.aspx?sysid=" + this._iSysID.ToString() + "&deptid=" + dataRow["i_bmdm"].ToString(); treeNode.Target = "FraHuman"; } } else { treeNode.NavigateUrl = "human.aspx?sysid=" + this._iSysID.ToString() + "&deptid=" + dataRow["i_bmdm"].ToString(); treeNode.Target = "FraHuman"; } } preNodes.Add(treeNode); this.TViewDept_Generate(treeNode.Nodes, deptDTable, dataRow["i_bmdm"].ToString(), iSysID); } }
private void AddApparecchiatura(DataRow Dr, TreeNodeCollection nodes) { string descrizione = Dr["eq_std"].ToString() + " " + Dr["EQ_ID"].ToString(); nodes.Add(Node(descrizione, "apparecchiatura", Dr["EQ_ID"].ToString(), true, false)); }
private void Salva(TreeNode nodopadre, TreeNodeCollection nodi) { int bl_id = Int32.Parse(nodopadre.Target); string bl_descrizione = nodopadre.Text; EliminaAssociazioni(bl_id); //nodopadre = BL | nodofiglio=servizio foreach (TreeNode nodofiglio in nodi) { if (nodofiglio.Checked == true) { int servizio_id = Int32.Parse(nodofiglio.Target); string servizio_descrizione = nodofiglio.Text; Classi.MailSend _MailSend = new TheSite.Classi.MailSend(); S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_email = new S_Controls.Collections.S_Object(); s_email.ParameterName = "p_email_Id"; s_email.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_email.Direction = ParameterDirection.Input; s_email.Index = 0; s_email.Value = itemId; S_Controls.Collections.S_Object s_Edificio_Id = new S_Controls.Collections.S_Object(); s_Edificio_Id.ParameterName = "p_Edificio_Id"; s_Edificio_Id.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Edificio_Id.Direction = ParameterDirection.Input; s_Edificio_Id.Index = 1; s_Edificio_Id.Value = bl_id; S_Controls.Collections.S_Object s_Servizio_Id = new S_Controls.Collections.S_Object(); s_Servizio_Id.ParameterName = "p_Servizio_Id"; s_Servizio_Id.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Servizio_Id.Direction = ParameterDirection.Input; s_Servizio_Id.Index = 2; s_Servizio_Id.Value = servizio_id; S_Controls.Collections.S_Object s_Operazione = new S_Object(); s_Operazione.ParameterName = "p_Operazione"; s_Operazione.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_Operazione.Direction = ParameterDirection.Input; s_Operazione.Index = 3; s_Operazione.Value = "Insert"; S_Controls.Collections.S_Object s_IdOut = new S_Object(); s_IdOut.ParameterName = "p_IdOut"; s_IdOut.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_IdOut.Direction = ParameterDirection.Output; s_IdOut.Index = 4; _SColl.Add(s_email); _SColl.Add(s_Edificio_Id); _SColl.Add(s_Servizio_Id); _SColl.Add(s_Operazione); _SColl.Add(s_IdOut); _MailSend.UpdateEmailEdificiServizi(_SColl); } } }
/// <summary> /// Render the downlevel version of the TreeNode. /// </summary> /// <param name="output">The HtmlTextWriter that will receive the markup.</param> protected override void RenderDownLevelPath(HtmlTextWriter output) { string href; String imageSrc = ""; int i; CssCollection cssStyle; char cJunction = CalcJunction(); object obj; // scratch object output.Write("<TR><TD valign='middle'>"); output.Write(" "); // // Walk up tree to draw lines/whitespace // Object obWalk = Parent; if (ParentTreeView.ShowLines == true) { int iCount = 0; string strLines = String.Empty; while (obWalk is TreeNode) { TreeNode elWalk = (TreeNode)obWalk; TreeNodeCollection kids = GetNodeCollection(elWalk.Parent); i = kids.IndexOf(elWalk) + 1; if (i < kids.Count) { if (iCount > 0) { strLines = "<IMG align='top' border='0' width='" + iCount * ParentTreeView.Indent + "px' height='1px' SRC='" + ParentTreeView.SystemImagesPath + "white.gif'>" + strLines; iCount = 0; } strLines = "<IMG align='top' border='0' SRC='" + ParentTreeView.SystemImagesPath + "I.gif'>" + strLines; } else { iCount++; } obWalk = elWalk.Parent; } if (iCount > 0) { strLines = "<IMG align='top' border='0' width='" + iCount * ParentTreeView.Indent + "px' height='1px' SRC='" + ParentTreeView.SystemImagesPath + "white.gif'>" + strLines; } output.Write(strLines); } else { if (cJunction != 'R' && cJunction != 'F') { int iIndent = 0; while (obWalk is TreeNode && ((TreeNode)obWalk).Parent != null) { iIndent += ParentTreeView.Indent; obWalk = ((TreeNode)obWalk).Parent; } output.Write("<IMG align='top' border='0' SRC='" + ParentTreeView.SystemImagesPath + "white.gif' WIDTH=" + iIndent + " HEIGHT=1>"); } } // is this a branch node? bool bParent = false; obj = FindNodeAttribute("Expandable"); if (obj == null) { obj = Expandable; // get default value if none is explicitly set } if (Nodes.Count > 0 || (ExpandableValue)obj == ExpandableValue.Always || ((ExpandableValue)obj == ExpandableValue.CheckOnce && !CheckedExpandable)) { bParent = true; } if (ParentTreeView.ShowLines == true || ParentTreeView.ShowPlus == true) { if (ParentTreeView.ShowLines == true) { switch (cJunction) { case 'L': imageSrc = "L"; break; case 'T': imageSrc = "T"; break; case 'R': imageSrc = "R"; break; case 'F': imageSrc = "F"; break; } } else { imageSrc = ""; } imageSrc = "'" + ParentTreeView.SystemImagesPath + imageSrc; if (bParent && ParentTreeView.ShowPlus == true) { if (Expanded == true) { imageSrc += "minus.gif'>"; } else { imageSrc += "plus.gif'>"; } if (ParentTreeView.Page != null) { href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()); } else { href = String.Empty; } output.AddAttribute(HtmlTextWriterAttribute.Href, href); output.RenderBeginTag(HtmlTextWriterTag.A); } else if (ParentTreeView.ShowLines == true) { imageSrc += ".gif'>"; } else { imageSrc = "'" + ParentTreeView.SystemImagesPath + "white.gif'>"; } output.Write("<IMG align='top' border='0' class='icon' SRC=" + imageSrc); if (bParent && ParentTreeView.ShowPlus == true) { output.RenderEndTag(); } } // Render a checkbox obj = FindNodeAttribute("CheckBox"); if (obj != null && (bool)obj == true) { string strOnclick = ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, "oncheck," + GetNodeIndex()); output.Write("<INPUT style='display:inline' align=middle type=checkbox " + (Checked ? " checked " : " ") + "onclick=\"" + strOnclick + "\" />"); } // if this node is a navigating leaf, use its nav information. obj = FindNodeAttribute("NavigateUrl"); if (obj != null && (!(ParentTreeView.SelectExpands && bParent && !Expanded))) { href = (string)obj; obj = FindNodeAttribute("Target"); if (obj != null) { output.AddAttribute(HtmlTextWriterAttribute.Target, (string)obj); obj = null; } } else if (ParentTreeView.Page != null) { if (!Selected) { href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, "onselectedindexchange," + ParentTreeView.SelectedNodeIndex + "," + GetNodeIndex()); if (bParent && ParentTreeView.SelectExpands == true) { href = href.Substring(0, href.Length - 2) + (";" + (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()) + "')"; } } else if (bParent && ParentTreeView.SelectExpands == true) { href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()); } else { href = String.Empty; } } else { href = String.Empty; } if (href != String.Empty) { output.AddAttribute(HtmlTextWriterAttribute.Href, href); output.RenderBeginTag(HtmlTextWriterTag.A); } obj = null; if (Selected == true) { obj = FindNodeAttribute("SelectedImageUrl"); } if (obj == null) { if (bParent == true && Expanded == true) { obj = FindNodeAttribute("ExpandedImageUrl"); } if (obj == null) { obj = FindNodeAttribute("ImageUrl"); } } if (obj != null) { output.Write("<IMG align='top' border='0' class='icon' SRC='" + (string)obj + "'>"); } cssStyle = new CssCollection("display:inline; font-size:10pt; font-face:Times; color: black; text-decoration:none; cursor: hand; overflow:hidden;"); object o = FindNodeAttribute("DefaultStyle"); if (o != null) { cssStyle.Merge((CssCollection)o, true); } if (Selected) { CssCollection temp = new CssCollection("color: #00FFFF; background-color: #08246B;"); o = FindNodeAttribute("SelectedStyle"); if (o != null) { temp.Merge((CssCollection)o, true); } cssStyle.Merge(temp, true); } /* * // Links will be blue by default. We want them to be the color specified in our style. * // So we have to override the link color by adding a font tag inside the A tag. * string curColor = cssStyle.GetColor(); * if (!Selected && (curColor != null) && (curColor != String.Empty)) * { * output.AddStyleAttribute(HtmlTextWriterStyle.Color, curColor); * } */ cssStyle.AddAttributesToRender(output); cssStyle.RenderBeginFontTag(output); cssStyle.RenderBeginModalTags(output); if (Text != null && Text != String.Empty) { output.Write(" " + Text); } cssStyle.RenderEndModalTags(output); cssStyle.RenderEndFontTag(output); if (href != String.Empty) { output.RenderEndTag(); } output.Write("</TD></TR>\n"); // Render child treenodes if (Expanded) { foreach (TreeNode item in Nodes) { item.Render(output, RenderPathID.DownLevelPath); } } }
private TreeNodeCollection AddNodesServizi(DataRow Dr, TreeNodeCollection nodes) { nodes.Add(Node(Dr["DESCRIZIONE"].ToString(), "servizio", "", false)); return(nodes); }