private bool LanguageEnabled(int portalId, string secondLanguage) { var portalLanguages = CBO.FillDictionary <string, Locale>("CultureCode", DataProvider.Instance().GetLanguagesByPortal(portalId)); if (!portalLanguages.ContainsKey(secondLanguage)) { var connector = WebApiTestHelper.LoginHost(); connector.PostJson($"API/PersonaBar/Extensions/ParseLanguagePackage?cultureCode={secondLanguage}", new { }); connector.PostJson($"API/PersonaBar/Extensions/InstallAvailablePackage", new { PackageType = "CoreLanguagePack", FileName = "installlanguage.resources", }); var language = CBO.FillDictionary <string, Locale>("CultureCode", DataProvider.Instance().GetLanguages())[secondLanguage]; connector.PostJson("API/PersonaBar/SiteSettings/UpdateLanguage", new { PortalId = PortalId, LanguageId = language.LanguageId, Code = language.Code, Enabled = true, IsDefault = false, Roles = "Administrators", }); } return(false); }
private static object GetLocalesCallBack(CacheItemArgs cacheItemArgs) { var portalID = (int)cacheItemArgs.ParamList[0]; Dictionary <string, Locale> locales = CBO.FillDictionary("CultureCode", portalID > Null.NullInteger ? DataProvider.Instance().GetLanguagesByPortal(portalID) : DataProvider.Instance().GetLanguages(), new Dictionary <string, Locale>(StringComparer.OrdinalIgnoreCase)); return(locales); }
internal Dictionary <string, PortalAliasInfo> GetPortalAliasesInternal() { return(CBO.GetCachedObject <Dictionary <string, PortalAliasInfo> >(new CacheItemArgs(DataCache.PortalAliasCacheKey, DataCache.PortalAliasCacheTimeOut, DataCache.PortalAliasCachePriority), c => { var dic = CBO.FillDictionary <string, PortalAliasInfo>("HTTPAlias", DataProvider.Instance().GetPortalAliases()); return dic.Keys.ToDictionary(key => key.ToLowerInvariant(), key => dic[key]); }, true)); }
public Locale GetLocale(string code) { var locale = LocaleController.Instance.GetLocale(GetPortalId(), code); if (locale == null) { // workaround to explicitly fill and retrieve the locales under some conditions // under these (unknown) conditions, the CMS API doesn't aways fill the locale collection var locales = CBO.FillDictionary("CultureCode", DataProvider.Instance().GetLanguages(), new Dictionary <string, Locale>(StringComparer.OrdinalIgnoreCase)); locales.TryGetValue(code, out locale); } return(locale); }
public static Dictionary <int, DesktopModuleInfo> GetDesktopModules(int portalID) { Dictionary <int, DesktopModuleInfo> desktopModules = new Dictionary <int, DesktopModuleInfo>(); if (portalID == Null.NullInteger) { desktopModules = CBO.FillDictionary <int, DesktopModuleInfo>("DesktopModuleID", dataProvider.GetDesktopModules(), new Dictionary <int, DesktopModuleInfo>()); } else { string cacheKey = string.Format(DataCache.DesktopModuleCacheKey, portalID.ToString()); desktopModules = CBO.GetCachedObject <Dictionary <int, DesktopModuleInfo> >(new CacheItemArgs(cacheKey, DataCache.DesktopModuleCacheTimeOut, DataCache.DesktopModuleCachePriority, portalID), GetDesktopModulesByPortalCallBack); } return(desktopModules); }
/// <summary> /// Gets the locales. /// </summary> /// <param name="portalID">The portal ID.</param> /// <returns></returns> public Dictionary <string, Locale> GetLocales(int portalID) { if (Globals.Status != Globals.UpgradeStatus.Error) { Dictionary <string, Locale> locales; if (Globals.Status != Globals.UpgradeStatus.Install) { string cacheKey = string.Format(DataCache.LocalesCacheKey, portalID); locales = CBO.GetCachedObject <Dictionary <string, Locale> >(new CacheItemArgs(cacheKey, DataCache.LocalesCacheTimeOut, DataCache.LocalesCachePriority, portalID), GetLocalesCallBack, true); } else { locales = CBO.FillDictionary("CultureCode", DataProvider.Instance().GetLanguages(), new Dictionary <string, Locale>(StringComparer.OrdinalIgnoreCase)); } return(locales); } return(null); }
private IDictionary <string, Services.FileSystem.FileInfo> GetDNNFiles(int dnnFolderID) { System.Data.IDataReader drFiles = null; IDictionary <string, Services.FileSystem.FileInfo> dnnFiles; try { drFiles = DNNFileCtrl.GetFiles(PortalSettings.PortalId, dnnFolderID); dnnFiles = CBO.FillDictionary <string, Services.FileSystem.FileInfo>("FileName", drFiles); } finally { if (drFiles != null) { if (!drFiles.IsClosed) { drFiles.Close(); } } } return(dnnFiles); }
public static IDictionary <int, PackageInfo> GetModulePackagesInUse(int portalID, bool forHost) { return(CBO.FillDictionary <int, PackageInfo>("PackageID", provider.GetModulePackagesInUse(portalID, forHost))); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetModuleControlsCallBack gets a Dictionary of Module Controls from /// the Database. /// </summary> /// <param name="cacheItemArgs">The CacheItemArgs object that contains the parameters /// needed for the database call</param> /// ----------------------------------------------------------------------------- private static object GetModuleControlsCallBack(CacheItemArgs cacheItemArgs) { return(CBO.FillDictionary(key, dataProvider.GetModuleControls(), new Dictionary <int, ModuleControlInfo>())); }
private static object GetPortalDesktopModulesByPortalIDCallBack(CacheItemArgs cacheItemArgs) { var portalId = (int)cacheItemArgs.ParamList[0]; return(CBO.FillDictionary("PortalDesktopModuleID", DataProvider.Instance().GetPortalDesktopModules(portalId, Null.NullInteger), new Dictionary <int, PortalDesktopModuleInfo>())); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetDesktopModulesByPortalCallBack gets a Dictionary of Desktop Modules by /// Portal from the the Database. /// </summary> /// <param name="cacheItemArgs">The CacheItemArgs object that contains the parameters /// needed for the database call</param> /// ----------------------------------------------------------------------------- private static object GetDesktopModulesByPortalCallBack(CacheItemArgs cacheItemArgs) { var portalId = (int)cacheItemArgs.ParamList[0]; return(CBO.FillDictionary("DesktopModuleID", DataProvider.GetDesktopModulesByPortal(portalId), new Dictionary <int, DesktopModuleInfo>())); }
private static object GetDesktopModulesCallBack(CacheItemArgs cacheItemArgs) { return(CBO.FillDictionary("DesktopModuleID", DataProvider.GetDesktopModules(), new Dictionary <int, DesktopModuleInfo>())); }
public static Dictionary <int, PortalDesktopModuleInfo> GetPortalDesktopModulesByDesktopModuleID(int desktopModuleId) { return(CBO.FillDictionary <int, PortalDesktopModuleInfo>("PortalDesktopModuleID", DataProvider.Instance().GetPortalDesktopModules(Null.NullInteger, desktopModuleId))); }
/// ----------------------------------------------------------------------------- /// <summary> /// GetSkinControls gets all the Skin Controls from the database /// </summary> /// <history> /// [cnurse] 03/28/2008 Created /// </history> /// ----------------------------------------------------------------------------- public static Dictionary <string, SkinControlInfo> GetSkinControls() { return(CBO.FillDictionary("ControlKey", dataProvider.GetSkinControls(), new Dictionary <string, SkinControlInfo>())); }
public static Dictionary <string, SearchItemInfo> GetSearchItems(int ModuleId) { return(CBO.FillDictionary <string, SearchItemInfo>("SearchKey", DataProvider.Instance().GetSearchItems(Null.NullInteger, Null.NullInteger, ModuleId))); }
private static object GetPortalAliasesCallBack(CacheItemArgs cacheItemArgs) { var dic = CBO.FillDictionary <string, PortalAliasInfo>("HTTPAlias", DataProvider.Instance().GetPortalAliasByPortalID(-1)); return(dic.Keys.ToDictionary(key => key.ToLowerInvariant(), key => dic[key])); }