/// <summary> /// Converte i dati visualizzati nella Treeview in un file XML /// </summary> /// <returns></returns> private XmlDocument exportToXML() { XmlDocument xmldoc = new XmlDocument(); if (this.treeViewUO.Nodes.Count > 0) { myTreeNode nodo = (myTreeNode)treeViewUO.GetNodeFromIndex("0"); //gestione RF string titoloPDF = string.Empty; if (this.verificaStatoRicercaRF()) { titoloPDF = "Composizione RF: " + this.ddl_RF.Items[this.ddl_RF.SelectedIndex].Text; } else { titoloPDF = "Organigramma"; } XmlNode organigramma = xmldoc.AppendChild(xmldoc.CreateElement("ORGANIGRAMMA")); XmlAttribute attrRoot = xmldoc.CreateAttribute("title"); attrRoot.InnerText = titoloPDF; organigramma.Attributes.Append(attrRoot); XmlElement record = xmldoc.CreateElement("RECORD"); record.SetAttribute("tipo", nodo.getTipoNodo()); record.SetAttribute("desc", nodo.Text); xmldoc.DocumentElement.AppendChild(record); this.addElement(nodo, xmldoc, 1); } return(xmldoc); }
/// <summary> /// Ricorsione del metodo "pulisceNodiOrfaniRF" /// </summary> /// <param name="nodo"></param> private void ricorsioneCercaFigliOrfaniRF(myTreeNode nodo) { if (nodo.getTipoNodo().Equals("U")) { if (nodo.Nodes.Count > 0) { try { foreach (myTreeNode currentNode in nodo.Nodes) { if (currentNode.Nodes.Count == 0 && currentNode.getTipoNodo().Equals("U")) { currentNode.Remove(); } else { this.ricorsioneCercaFigliOrfaniRF(currentNode); } } } catch { this.pulisceNodiOrfaniRF(); return; } } } }
/// <summary> /// Ricorsione sui nodi figli della treeview /// </summary> /// <param name="nodo"></param> private void ricorsioneCercaFigli(myTreeNode nodo) { if (nodo.getTipoNodo().Equals("U")) { this.executeExpand(nodo.GetNodeIndex()); foreach (myTreeNode currentNode in nodo.Nodes) { this.ricorsioneCercaFigli(currentNode); } } }
/// <summary> /// Salto alla pagina web chiamante dopo aver selezionato una ricerca /// </summary> /// <param name="TreeNodo"></param> private void TornaAllaWndChiamante(myTreeNode TreeNodo) { bool gotoParent = false; string idGeneric = string.Empty; // potrebbe essere idGroup (x i ruoli) o idPeople (x gli utenti) o uguale a idCorrGlob (x le UO) try { switch (TreeNodo.getTipoNodo()) { case "U": if (this.SelezionePossibile("U")) { gotoParent = true; idGeneric = TreeNodo.getIDCorrGlobale(); } break; case "R": if (this.SelezionePossibile("R")) { gotoParent = true; idGeneric = TreeNodo.getIDGruppo(); } break; case "P": if (this.SelezionePossibile("P")) { gotoParent = true; idGeneric = TreeNodo.getIDPeople(); } break; } if (gotoParent) { string codice = TreeNodo.getCodice(); string descrizione = TreeNodo.getDescrizione(); string idCorrGlob = TreeNodo.getIDCorrGlobale(); string retValue = codice + "|" + descrizione + "|" + idCorrGlob + "|" + idGeneric; this.executeJS("<SCRIPT>window.returnValue='" + retValue + "'; window.close()</SCRIPT>"); } } catch { this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>"); } }
/// <summary> /// Esegue l'espansione del nodo /// </summary> /// <param name="indice"></param> private void executeExpand(string indice) { DocsPaWR.OrgUO currentUO; myTreeNode TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex(indice); TreeNodo.Expanded = true; // this.treeViewUO.SelectedNodeIndex = indice; if (TreeNodo.Nodes.Count > 0) { TreeNodo.Nodes.Clear(); } switch (TreeNodo.getTipoNodo()) { case "U": currentUO = new DocsPAWA.DocsPaWR.OrgUO(); currentUO.IDCorrGlobale = TreeNodo.ID; currentUO.IDAmministrazione = this.hd_idAmm.Value; currentUO.Ruoli = TreeNodo.getRuoliUO(); currentUO.SottoUo = TreeNodo.getSottoUO(); currentUO.Livello = TreeNodo.getLivello(); if (this.GetTipoNavigazione() > 1 && Convert.ToInt32(currentUO.Ruoli) > 0) { this.RuoliUO(currentUO, indice); } if (Convert.ToInt32(currentUO.SottoUo) > 0) { this.SottoUO(currentUO, indice); } break; } }