public static string getDefLarga(sTipoElem sTE) { string sRes = ""; int iInd = 0; List <Estructura> listaEstructura = Estructura.ListaGlobal(); switch (sTE) { case sTipoElem.SUBNODO: iInd = 1; break; case sTipoElem.NODO: iInd = 2; break; case sTipoElem.SUPERNODO1: iInd = 3; break; case sTipoElem.SUPERNODO2: iInd = 4; break; case sTipoElem.SUPERNODO3: iInd = 5; break; case sTipoElem.SUPERNODO4: iInd = 6; break; } foreach (Estructura oEL in listaEstructura) { if (oEL.nCodigo == iInd) { sRes = oEL.sDesLarga; break; } } return(sRes.Replace((char)34, (char)39)); }
public static bool EstructuraActiva(string sNivel) { bool bActiva = false; if (HttpContext.Current.Cache.Get("EstructuraActiva") == null) { Hashtable htNivel = new Hashtable(); List <Estructura> oLista = Estructura.ListaGlobal(); foreach (Estructura oEstr in oLista) { switch (oEstr.nCodigo) { case 6: if (oEstr.bUtilizado) { htNivel.Add("SN4", true); } else { htNivel.Add("SN4", false); } break; case 5: if (oEstr.bUtilizado) { htNivel.Add("SN3", true); } else { htNivel.Add("SN3", false); } break; case 4: if (oEstr.bUtilizado) { htNivel.Add("SN2", true); } else { htNivel.Add("SN2", false); } break; case 3: if (oEstr.bUtilizado) { htNivel.Add("SN1", true); } else { htNivel.Add("SN1", false); } break; } } bActiva = (bool)htNivel[sNivel]; HttpContext.Current.Cache.Insert("EstructuraActiva", htNivel, null, DateTime.Now.AddDays(1), TimeSpan.Zero); } else { Hashtable htNivel = (Hashtable)HttpContext.Current.Cache.Get("EstructuraActiva"); bActiva = (bool)htNivel[sNivel]; } return(bActiva); }