/// <summary> /// Caricamento dati UO livello ZERO /// </summary> /// <param name="listaUO"></param> private void LoadTreeviewLivelloZero(ArrayList listaUO) { try { string myPath = DocsPAWA.Utils.getHttpFullPath(this); this.PulisceTuttaTreeView(); Microsoft.Web.UI.WebControls.TreeNode treenode = new Microsoft.Web.UI.WebControls.TreeNode(); treenode.Text = "Organigramma"; treeViewUO.Nodes.Add(treenode); Microsoft.Web.UI.WebControls.TreeNode tNode = new Microsoft.Web.UI.WebControls.TreeNode(); tNode = treeViewUO.Nodes[0]; myTreeNode nodoT; myTreeNode nodoFiglio; foreach (DocsPAWA.DocsPaWR.OrgUO uo in listaUO) { nodoT = new myTreeNode(); nodoT.ID = uo.IDCorrGlobale; nodoT.Text = uo.CodiceRubrica + " - " + uo.Descrizione; nodoT.ImageUrl = myPath + "/AdminTool/Images/uo.gif"; tNode.Nodes.Add(nodoT); nodoT.setTipoNodo("U"); nodoT.setIDCorrGlobale(uo.IDCorrGlobale); nodoT.setCodice(uo.Codice); nodoT.setCodiceRubrica(uo.CodiceRubrica); nodoT.setDescrizione(uo.Descrizione); nodoT.setLivello(uo.Livello); nodoT.setIDAmministrazione(uo.IDAmministrazione); if ((!uo.Ruoli.Equals("0")) || (!uo.SottoUo.Equals("0"))) { nodoFiglio = new myTreeNode(); nodoFiglio.Text = "<font color='#ff0000'> loading...</font>"; nodoT.Nodes.Add(nodoFiglio); } else { nodoT.Text = uo.CodiceRubrica + " - " + uo.Descrizione; } } tNode.Expanded = true; //this.SelezionaPrimo(); this.LoadTreeViewLivelloFigli("0.0", "U"); } catch { this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>"); } }
/// <summary> /// Imposta la Root nella Treeview /// </summary> /// <param name="currentUO"></param> /// <returns></returns> private myTreeNode SetRootTreeview(DocsPAWA.DocsPaWR.OrgUO currentUO) { this.PulisceTuttaTreeView(); myTreeNode treenode = new myTreeNode(); treenode.ID = currentUO.IDCorrGlobale; treenode.Text = currentUO.Codice + " - " + currentUO.Descrizione; treeViewUO.Nodes.Add(treenode); treenode.setTipoNodo("U"); treenode.setRuoliUO(currentUO.Ruoli); treenode.setSottoUO(currentUO.SottoUo); treenode.setLivello(currentUO.Livello); return(treenode); }
/// <summary> /// Caricamento dati UO livelli figli /// </summary> /// <param name="indice"></param> /// <param name="tipoNodo"></param> private void LoadTreeViewLivelloFigli(string indice, string tipoNodo) { try { string myPath = DocsPAWA.Utils.getHttpFullPath(this); if (this.GetReadOnly()) { treeViewUO.SelectedNodeIndex = indice; } ArrayList lista = new ArrayList(); myTreeNode TreeNodo; TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex(indice); TreeNodo.Expanded = true; if (TreeNodo.Nodes.Count > 0) { TreeNodo.Nodes.RemoveAt(0); } myTreeNode nodoRuoli; myTreeNode nodoUtenti; myTreeNode nodoUO; myTreeNode nodoFiglio; Manager.OrganigrammaManager theManager = new Amministrazione.Manager.OrganigrammaManager(); theManager.ListaRuoliUO(TreeNodo.getIDCorrGlobale()); if (this.GetTipoNavigazione() > 1) { lista = theManager.getListaRuoliUO(); // ... ruoli if (lista != null && lista.Count > 0) { foreach (DocsPAWA.DocsPaWR.OrgRuolo ruolo in lista) { nodoRuoli = new myTreeNode(); nodoRuoli.ID = ruolo.IDCorrGlobale; nodoRuoli.Text = ruolo.CodiceRubrica + " - " + ruolo.Descrizione; nodoRuoli.ImageUrl = myPath + "/AdminTool/Images/ruolo.gif"; TreeNodo.Nodes.Add(nodoRuoli); nodoRuoli.setTipoNodo("R"); nodoRuoli.setIDCorrGlobale(ruolo.IDCorrGlobale); nodoRuoli.setIDTipoRuolo(ruolo.IDTipoRuolo); nodoRuoli.setIDGruppo(ruolo.IDGruppo); nodoRuoli.setCodice(ruolo.Codice); nodoRuoli.setCodiceRubrica(ruolo.CodiceRubrica); nodoRuoli.setDescrizione(ruolo.Descrizione); nodoRuoli.setIDAmministrazione(ruolo.IDAmministrazione); // ... utenti if (ruolo.Utenti.Length > 0) { if (this.GetTipoNavigazione() > 2) { foreach (DocsPAWA.DocsPaWR.OrgUtente utente in ruolo.Utenti) { nodoUtenti = new myTreeNode(); nodoUtenti.ID = utente.IDCorrGlobale; nodoUtenti.Text = utente.CodiceRubrica + " - " + utente.Cognome + " " + utente.Nome; nodoUtenti.ImageUrl = myPath + "/AdminTool/Images/utente.gif"; nodoRuoli.Nodes.Add(nodoUtenti); nodoUtenti.setTipoNodo("P"); nodoUtenti.setIDCorrGlobale(utente.IDCorrGlobale); nodoUtenti.setIDPeople(utente.IDPeople); nodoUtenti.setCodice(utente.Codice); nodoUtenti.setCodiceRubrica(utente.CodiceRubrica); nodoUtenti.setIDAmministrazione(utente.IDAmministrazione); } } } // fine inserimento utenti else { nodoRuoli.Text = ruolo.CodiceRubrica + " - " + ruolo.Descrizione; } } // fine inserimento ruoli } } // ... uo sottostanti int livello = Convert.ToInt32(TreeNodo.getLivello()) + 1; theManager.ListaUO(TreeNodo.getIDCorrGlobale(), livello.ToString(), TreeNodo.getIDAmministrazione()); lista = theManager.getListaUO(); if (lista != null && lista.Count > 0) { foreach (DocsPAWA.DocsPaWR.OrgUO sub_uo in lista) { nodoUO = new myTreeNode(); nodoUO.ID = sub_uo.IDCorrGlobale; nodoUO.Text = sub_uo.CodiceRubrica + " - " + sub_uo.Descrizione; nodoUO.ImageUrl = myPath + "/AdminTool/Images/uo.gif"; TreeNodo.Nodes.Add(nodoUO); nodoUO.setTipoNodo("U"); nodoUO.setIDCorrGlobale(sub_uo.IDCorrGlobale); nodoUO.setCodice(sub_uo.Codice); nodoUO.setCodiceRubrica(sub_uo.CodiceRubrica); nodoUO.setDescrizione(sub_uo.Descrizione); nodoUO.setLivello(sub_uo.Livello); nodoUO.setIDAmministrazione(sub_uo.IDAmministrazione); if ((!sub_uo.Ruoli.Equals("0")) || (!sub_uo.SottoUo.Equals("0"))) { nodoFiglio = new myTreeNode(); nodoFiglio.Text = "<font color='#ff0000'> loading...</font>"; nodoUO.Nodes.Add(nodoFiglio); } else { nodoUO.Text = sub_uo.CodiceRubrica + " - " + sub_uo.Descrizione; } } // fine inserimento uo sottostanti } } catch { this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>"); } }
/// <summary> /// Visualizza le sotto UO /// </summary> /// <param name="currentUO"></param> /// <param name="indice"></param> /// <returns></returns> private bool SottoUO(DocsPAWA.DocsPaWR.OrgUO currentUO, string indice) { bool retValue = true; myTreeNode TreeNodo; myTreeNode TreeNodoFiglio; if (indice != null) { TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex(indice); } else { TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex(treeViewUO.SelectedNodeIndex); } myTreeNode nodoUO; ArrayList lista = new ArrayList(); int livello = Convert.ToInt32(currentUO.Livello) + 1; Amministrazione.Manager.OrganigrammaManager manager = new Amministrazione.Manager.OrganigrammaManager(); manager.ListaUO(currentUO.IDCorrGlobale, Convert.ToString(livello), currentUO.IDAmministrazione); lista = manager.getListaUO(); if (lista != null && lista.Count > 0) { if (!this.isOrdinamentoAbilitato()) { lista.Sort(new UOSort()); } foreach (DocsPAWA.DocsPaWR.OrgUO sottoUO in lista) { nodoUO = new myTreeNode(); nodoUO.ID = sottoUO.IDCorrGlobale; nodoUO.Text = sottoUO.CodiceRubrica + " - " + sottoUO.Descrizione; nodoUO.ImageUrl = HttpFullPath + "/AdminTool/Images/uo.gif"; TreeNodo.Nodes.Add(nodoUO); nodoUO.setTipoNodo("U"); nodoUO.setRuoliUO(sottoUO.Ruoli); nodoUO.setSottoUO(sottoUO.SottoUo); nodoUO.setLivello(sottoUO.Livello); if ((this.GetTipoNavigazione() > 1 && Convert.ToInt32(sottoUO.Ruoli) > 0) || Convert.ToInt32(sottoUO.SottoUo) > 0) { TreeNodoFiglio = new myTreeNode(); TreeNodoFiglio.Text = "<font color='#ff0000'> loading...</font>"; nodoUO.Nodes.Add(TreeNodoFiglio); } } } else { retValue = false; } return(retValue); }