/// <summary> /// obtm uma NamedPageCollection com todas as namedPages /// </summary> /// <returns>a collections com as NamedPages</returns> public static UtilityCollection getAllNamedPages() { HttpContext context = HttpContext.Current; UtilityCollection namedPageCollection = (UtilityCollection)context.Cache["NamedPages"]; if (namedPageCollection == null) { string value = OrionGlobals.getConfigurationValue("utilities", NamedPageUtilityBase.getNamedPageUtilityKey()); NamedPageUtilityBase namedPageUtilityBase = (NamedPageUtilityBase)Activator.CreateInstance(Type.GetType(value, true)); namedPageCollection = namedPageUtilityBase.getAllNamedPagesFromDB(); #if DEBUG Log.log("---- NamedPages ----"); IDictionaryEnumerator it = namedPageCollection.GetEnumerator(); while (it.MoveNext()) { PageInfo info = (PageInfo)it.Value; Log.log("{0} - {1}", it.Key, info.pageName); } #endif context.Cache["NamedPages"] = namedPageCollection; } return(namedPageCollection); }
/// <summary> /// retorna a informacao tendo em conta o path base /// </summary> /// <param name="basePath">path base</param> /// <returns>a section do path</returns> public static SectionInfo getSectionInfoFromBasePath(string basePath) { UtilityCollection sectionCollection = getAllSections(); Log.log("Setting up requestPath '{0}'...", basePath); basePath = basePath.Replace(OrionGlobals.InternalAppPath, OrionGlobals.AppPath); basePath = basePath.Replace(OrionGlobals.InternalAppPath, OrionGlobals.AppPath); Log.log("\tGot: '{0}'", basePath); return((SectionInfo)sectionCollection [basePath + "default.aspx"]); }
public UtilityCollection storeNamedPages( DataSet dsNamedPages ) { UtilityCollection namedPageCollection = new UtilityCollection(); DataTable dataTable = dsNamedPages.Tables[0]; foreach( DataRow dataRow in dataTable.Rows ) { PageInfo info = populateNamedPages( dataRow ); //Console.WriteLine("url: "+((string)dataRow["namedPage_path"]) + " skin: " + info.pageSkin); namedPageCollection.Add( (string)dataRow["namedPage_path"], info ); } return namedPageCollection; }
public UtilityCollection storeSkins( DataSet dsSkins ) { UtilityCollection masterSkinsCollection = new UtilityCollection(); DataTable dataTable = dsSkins.Tables[0]; if( dataTable.Rows.Count == 0 ) throw new AlnitakException("Não existem skins disponiveis na base de dados!!!"); foreach( DataRow dataRow in dataTable.Rows ) { masterSkinsCollection.Add((int)dataRow["masterSkin_id"],new MasterSkinInfo(dataRow) ); } return masterSkinsCollection; }
public UtilityCollection storeNamedPages(DataSet dsNamedPages) { UtilityCollection namedPageCollection = new UtilityCollection(); DataTable dataTable = dsNamedPages.Tables[0]; foreach (DataRow dataRow in dataTable.Rows) { PageInfo info = populateNamedPages(dataRow); //Console.WriteLine("url: "+((string)dataRow["namedPage_path"]) + " skin: " + info.pageSkin); namedPageCollection.Add((string)dataRow["namedPage_path"], info); } return(namedPageCollection); }
public UtilityCollection storeSkins(DataSet dsSkins) { UtilityCollection masterSkinsCollection = new UtilityCollection(); DataTable dataTable = dsSkins.Tables[0]; if (dataTable.Rows.Count == 0) { throw new AlnitakException("Não existem skins disponiveis na base de dados!!!"); } foreach (DataRow dataRow in dataTable.Rows) { masterSkinsCollection.Add((int)dataRow["masterSkin_id"], new MasterSkinInfo(dataRow)); } return(masterSkinsCollection); }
/// <summary>Povoa a DropDownLost das linguas</summary> private void povoateSkin() { User user = (User)HttpContext.Current.User; UtilityCollection skins = MasterSkinUtility.getAllMasterSkins(); foreach (MasterSkinInfo info in skins.Values) { ListItem item = new ListItem(); item.Text = info.masterSkinDescription; item.Value = info.masterSkinId.ToString(); if (info.masterSkinId == user.Skin) { item.Selected = true; } skin.Items.Add(item); } }
public static UtilityCollection getAllMasterSkins() { HttpContext context = HttpContext.Current; UtilityCollection masterSkinCollection = (UtilityCollection)context.Cache["masterSkins"]; lock ( lockObj ) { if (masterSkinCollection == null) { string value = OrionGlobals.getConfigurationValue("utilities", MasterSkinUtilityBase.getMasterSkinUtilityKey()); MasterSkinUtilityBase masterSkinUtilityBase = (MasterSkinUtilityBase)Activator.CreateInstance(Type.GetType(value, true)); masterSkinCollection = masterSkinUtilityBase.getAllMasterSkinsFromDB(); context.Cache["masterSkins"] = masterSkinCollection; } } return(masterSkinCollection); }
/// <summary> /// Obtm todas as seccoes existentes na base de dados /// </summary> /// <returns>um objecto do tipo SectionCollection com todas as collections</returns> public static UtilityCollection getAllSections() { HttpContext context = HttpContext.Current; UtilityCollection sectionCollection = null; //SectionCollection sectionCollection = null; lock ( lockObj ) { sectionCollection = (UtilityCollection)context.Cache["sections"]; if (sectionCollection == null) { string value = OrionGlobals.getConfigurationValue("utilities", SectionUtilityBase.getSectionUtilityKey()); SectionUtilityBase sectionUtilityBase = (SectionUtilityBase)Activator.CreateInstance(Type.GetType(value, true)); sectionCollection = sectionUtilityBase.getAllSectionsFromDB(); context.Cache["sections"] = sectionCollection; } } return(sectionCollection); }
/// <summary> /// retorna a informao da seco baseado no path do pedido /// </summary> /// <param name="requestPath">path do pedido</param> /// <returns>a section do path</returns> public static SectionInfo getSectionInfoFromFullPath(string requestPath) { Log.log("Setting up requestPath '{0}'...", requestPath); requestPath = requestPath.Replace(OrionGlobals.InternalAppPath, OrionGlobals.AppPath); requestPath = requestPath.Replace(OrionGlobals.InternalAppPath, OrionGlobals.AppPath); Log.log("\tGot: '{0}'", requestPath); UtilityCollection sectionCollection = getAllSections(); Log.log("Getting SectionInfo for '{0}'", requestPath); SectionInfo info = (SectionInfo)sectionCollection[requestPath]; #if DEBUG if (info == null) { Log.log("\tNot Found!"); } else { Log.log("\tFound!"); } #endif return(info); }
public static MasterSkinInfo getMasterSkinInfoFromId(int id) { UtilityCollection masterSkinCollection = getAllMasterSkins(); return((MasterSkinInfo)masterSkinCollection[id]); }
/// <summary> /// retorna a informao da seco baseado no path do pedido /// </summary> /// <param name="requestedFile">path do pedido</param> /// <returns>a section do path</returns> public static PageInfo getNamedPageInfo(string requestedFile) { UtilityCollection namedPageCollection = getAllNamedPages(); return((PageInfo)namedPageCollection[requestedFile]); }