本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.GetModuleByCulture方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.GetModuleByCulture方法的具体用法?C# ModuleController.GetModuleByCulture怎么用?C# ModuleController.GetModuleByCulture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Modules.ModuleController
的用法示例。
在下文中一共展示了ModuleController.GetModuleByCulture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateModuleSettingForAllLanguages
/// <summary>
/// Update a setting for all language-versions of a module
/// </summary>
public static void UpdateModuleSettingForAllLanguages(int moduleId, string key, string value)
{
var moduleController = new ModuleController();
// Find this module in other languages and update contentGroupGuid
var originalModule = moduleController.GetModule(moduleId);
var languages = LocaleController.Instance.GetLocales(originalModule.PortalID);
if (!originalModule.IsDefaultLanguage && originalModule.DefaultLanguageModule != null)
originalModule = originalModule.DefaultLanguageModule;
foreach (var language in languages)
{
// Find module for given Culture
var moduleByCulture = moduleController.GetModuleByCulture(originalModule.ModuleID, originalModule.TabID, originalModule.PortalID, language.Value);
// Break if no module found
if (moduleByCulture == null)
continue;
if (value == null)
moduleController.DeleteModuleSetting(moduleByCulture.ModuleID, key);
else
moduleController.UpdateModuleSetting(moduleByCulture.ModuleID, key, value);
}
}
示例2: UpdateModuleTitleIfNecessary
protected void UpdateModuleTitleIfNecessary(Entity entity)
{
// Creating new Context, because EntityTitle gets not refreshed otherwise
var sexyContext = new SexyContent(ZoneId, AppId, true);
// Get ContentGroup
var listContentGroupItem = ContentGroup.ListContent;
var entityModel = new DbLoadIntoEavDataStructure(sexyContext.ContentContext).GetEavEntity(entity.EntityID); // sexyContext.ContentContext.GetEntityModel(entity.EntityID);
// If this is the list title, or no list-title exists, set module title
if (ItemType == "ListContent" || (listContentGroupItem == null && ItemType == "Content" && SortOrder == 0) && entityModel.IsPublished)
{
var languages = Sexy.ContentContext.Dimensions.GetLanguages();
// Find Module for default language
var moduleController = new ModuleController();
var originalModule = moduleController.GetModule(ModuleID);
// Update Original Module if no languages active
if (languages.Count == 0)
{
// Get Title value of Entitiy in current language
var titleValue = entityModel.Title[0].ToString();
originalModule.ModuleTitle = titleValue;
moduleController.UpdateModule(originalModule);
}
foreach (var dimension in languages)
{
// Get Title value of Entitiy in current language
var titleValue = entityModel.Title[dimension.DimensionID].ToString();
if(!originalModule.IsDefaultLanguage)
originalModule = originalModule.DefaultLanguageModule;
// Break if default language module is null
if (originalModule == null)
return;
// Find module for given Culture
var moduleByCulture = moduleController.GetModuleByCulture(originalModule.ModuleID, originalModule.TabID, PortalId, LocaleController.Instance.GetLocale(dimension.ExternalKey));
// Break if no module found
if (moduleByCulture == null)
return;
moduleByCulture.ModuleTitle = titleValue;
moduleController.UpdateModule(moduleByCulture);
}
}
}