本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalController类的典型用法代码示例。如果您正苦于以下问题:C# PortalController类的具体用法?C# PortalController怎么用?C# PortalController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PortalController类属于DotNetNuke.Entities.Portals命名空间,在下文中一共展示了PortalController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindSettingControls
private void BindSettingControls()
{
// Toggle fields if a redirect already exists for the Portal Home Page
var defaultRedirect = HomePageRedirectExists();
// Populating Portals dropdown
var portalController = new PortalController();
var portals = portalController.GetPortals().Cast<PortalInfo>().Where(p => p.PortalID != ModuleContext.PortalId).ToList();
if (portals.Count > 0)
{
cboPortal.DataSource = portals;
cboPortal.DataTextField = "PortalName";
cboPortal.DataValueField = "PortalID";
cboPortal.DataBind();
}
else
{
optRedirectTarget.Items[0].Enabled = false;
optRedirectTarget.Items[0].Selected = false;
optRedirectTarget.Items[1].Selected = true;
}
cboSourcePage.Visible = defaultRedirect;
lblHomePage.Visible = !defaultRedirect;
lblRedirectName.Visible = defaultRedirect;
txtRedirectName.Visible = defaultRedirect;
}
示例2: AddAdminPages
public static void AddAdminPages(string tabName, string description, string tabIconFile, string tabIconFileLarge, bool isVisible, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions)
{
var portalController = new PortalController();
ArrayList portals = portalController.GetPortals();
//Add Page to Admin Menu of all configured Portals
for (int intPortal = 0; intPortal <= portals.Count - 1; intPortal++)
{
var portal = (PortalInfo)portals[intPortal];
//Create New Admin Page (or get existing one)
TabInfo newPage = Upgrade.AddAdminPage(portal, tabName, description, tabIconFile, tabIconFileLarge, isVisible);
//Add Module To Page
Upgrade.AddModuleToPage(newPage, moduleDefId, moduleTitle, moduleIconFile, inheritPermissions);
var moduleController = new ModuleController();
if (newPage != null) {
foreach (var module in moduleController.GetTabModules(newPage.TabID).Values)
{
moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true");
}
}
}
}
示例3: CreateNewUser
public UserCreateStatus CreateNewUser(string firstName, string lastName, string emailAddress, int portalId)
{
var ctlPortal = new PortalController();
var portalSettings = ctlPortal.GetPortals().Cast<PortalInfo>().FirstOrDefault(p => p.PortalID == portalId);
var user = new UserInfo()
{
FirstName = firstName,
LastName = lastName,
Email = emailAddress,
Username = emailAddress,
DisplayName = string.Concat(firstName, " ", lastName),
PortalID = portalId
};
user.Profile.PreferredLocale = portalSettings.DefaultLanguage;
user.Profile.FirstName = firstName;
user.Profile.LastName = lastName;
user.Membership.Approved = true;
user.Membership.Password = PasswordGenerator.GeneratePassword();
user.Membership.UpdatePassword = true;
var status = UserController.CreateUser(ref user);
User = user;
return status;
}
示例4: DeleteUserRoleInternal
private static bool DeleteUserRoleInternal(int portalId, int userId, int roleId)
{
var roleController = new RoleController();
var user = UserController.GetUserById(portalId, userId);
var userRole = roleController.GetUserRole(portalId, userId, roleId);
var portalController = new PortalController();
bool delete = true;
var portal = portalController.GetPortal(portalId);
if (portal != null && userRole != null)
{
if (CanRemoveUserFromRole(portal, userId, roleId))
{
provider.RemoveUserFromRole(portalId, user, userRole);
var objEventLog = new EventLogController();
objEventLog.AddLog(userRole, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.ROLE_UPDATED);
//Remove the UserInfo from the Cache, as it has been modified
DataCache.ClearUserCache(portalId, user.Username);
TestableRoleController.Instance.ClearRoleCache(portalId);
}
else
{
delete = false;
}
}
return delete;
}
示例5: GetDnnHttpHandler
public IHttpHandler GetDnnHttpHandler(RequestContext requestContext, int portal, int tab, string[] passThrough)
{
PortalController pcontroller = new PortalController();
PortalInfo pinfo = pcontroller.GetPortal(portal);
PortalAliasController pacontroller = new PortalAliasController();
PortalAliasCollection pacollection = pacontroller.GetPortalAliasByPortalID(portal);
//pacollection.
//PortalSettings psettings = new PortalSettings(pinfo);
PortalSettings psettings = new PortalSettings(tab, portal); // 64 is the stats tab. TODO: get by page name and not hardcoded id
foreach (string key in pacollection.Keys)
{
psettings.PortalAlias = pacollection[key];
}
TabController tcontroller = new TabController();
// psettings.ActiveTab = tcontroller.GetTab(57, 0, true); // 57 is the profile tab.
requestContext.HttpContext.Items["PortalSettings"] = psettings;
requestContext.HttpContext.Items["UrlRewrite:OriginalUrl"] = requestContext.HttpContext.Request.RawUrl;
//UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetUserByName(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetCachedUser(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
requestContext.HttpContext.Items["UserInfo"] = uinfo;
foreach (string s in passThrough)
{
requestContext.HttpContext.Items[s] = requestContext.RouteData.Values[s];
}
IHttpHandler page = BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(DotNetNuke.Framework.PageBase)) as IHttpHandler;
return page;
}
示例6: BindDetailData
private void BindDetailData()
{
var pc = new PortalController();
cboLogTypePortalID.DataTextField = "PortalName";
cboLogTypePortalID.DataValueField = "PortalID";
cboLogTypePortalID.DataSource = pc.GetPortals();
cboLogTypePortalID.DataBind();
// ReSharper disable LocalizableElement
var i = new DnnComboBoxItem{Text = Localization.GetString("All"), Value = "*"};
// ReSharper restore LocalizableElement
cboLogTypePortalID.Items.Insert(0, i);
pnlEditLogTypeConfigInfo.Visible = true;
pnlLogTypeConfigInfo.Visible = false;
var logController = new LogController();
var arrLogTypeInfo = logController.GetLogTypeInfoDictionary().Values.OrderBy(t => t.LogTypeFriendlyName);
cboLogTypeKey.DataTextField = "LogTypeFriendlyName";
cboLogTypeKey.DataValueField = "LogTypeKey";
cboLogTypeKey.DataSource = arrLogTypeInfo;
cboLogTypeKey.DataBind();
int[] items = {1, 2, 3, 4, 5, 10, 25, 100, 250, 500};
cboKeepMostRecent.Items.Clear();
cboKeepMostRecent.Items.Add(new DnnComboBoxItem(Localization.GetString("All"), "*"));
foreach (int item in items)
{
cboKeepMostRecent.Items.Add(item == 1
? new DnnComboBoxItem(item + Localization.GetString("LogEntry", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture))
: new DnnComboBoxItem(item + Localization.GetString("LogEntries", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture)));
}
int[] items2 = {1, 2, 3, 4, 5, 10, 25, 100, 250, 500, 1000};
cboThreshold.Items.Clear();
foreach (int item in items2)
{
cboThreshold.Items.Add(item == 1
? new DnnComboBoxItem(item + Localization.GetString("Occurence", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture))
: new DnnComboBoxItem(item + Localization.GetString("Occurences", LocalResourceFile), item.ToString(CultureInfo.InvariantCulture)));
}
cboThresholdNotificationTime.Items.Clear();
foreach (int item in new []{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 60, 90, 120})
{
cboThresholdNotificationTime.Items.Add(new DnnComboBoxItem(item.ToString(CultureInfo.InvariantCulture), item.ToString(CultureInfo.InvariantCulture)));
}
cboThresholdNotificationTimeType.Items.Clear();
foreach (int item in new[] { 1, 2, 3, 4 })
{
cboThresholdNotificationTimeType.Items.Add(new DnnComboBoxItem(Localization.GetString(string.Format("TimeType_{0}", item), LocalResourceFile), item.ToString(CultureInfo.InvariantCulture)));
}
// ReSharper disable LocalizableElement
var j = new DnnComboBoxItem{Text = Localization.GetString("All"), Value = "*"};
// ReSharper restore LocalizableElement
cboLogTypeKey.Items.Insert(0, j);
}
示例7: ClearCache
private static void ClearCache()
{
var portalController = new PortalController();
foreach (PortalAliasInfo portal in portalController.GetPortals())
{
ClearCache(portal.PortalID);
}
}
示例8: UpgradeModule
public string UpgradeModule(string Version)
{
try
{
switch (Version)
{
case "06.02.00":
var portalController = new PortalController();
var moduleController = new ModuleController();
var tabController = new TabController();
var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Message Center");
if (moduleDefinition != null)
{
var portals = portalController.GetPortals();
foreach (PortalInfo portal in portals)
{
if (portal.UserTabId > Null.NullInteger)
{
//Find TabInfo
var tab = tabController.GetTab(portal.UserTabId, portal.PortalID, true);
if (tab != null)
{
foreach (var module in moduleController.GetTabModules(portal.UserTabId).Values)
{
if (module.DesktopModule.FriendlyName == "Messaging")
{
//Delete the Module from the Modules list
moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
//Add new module to the page
Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "Message Center", "", true);
break;
}
}
}
}
}
}
break;
}
return "Success";
}
catch (Exception exc)
{
Logger.Error(exc);
return "Failed";
}
}
示例9: MustHaveSandboxedPaymentSettings
public void MustHaveSandboxedPaymentSettings()
{
var portalController = new PortalController();
var site = portalController.GetPortal(0);
if (site.ProcessorPassword == string.Empty)
{
PortalController.UpdatePortalSetting(0, "paypalsandbox", "true");
//uses PayPal sandbox account.
site.ProcessorUserId = "PayPal";
site.ProcessorPassword = "320122999";
site.ProcessorUserId = "[email protected]";
portalController.UpdatePortalInfo(site);
}
WebConfigManager.TouchConfig(PhysicalPath);
}
示例10: CacheMappedDirectory
/// -----------------------------------------------------------------------------
/// <summary>
/// CacheMappedDirectory caches the Portal Mapped Directory(s)
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [cnurse] 1/27/2005 Moved back to App_Start from Caching Module
/// </history>
/// -----------------------------------------------------------------------------
private static void CacheMappedDirectory()
{
//This code is only retained for binary compatability.
#pragma warning disable 612,618
var objFolderController = new FolderController();
var objPortalController = new PortalController();
ArrayList arrPortals = objPortalController.GetPortals();
int i;
for (i = 0; i <= arrPortals.Count - 1; i++)
{
var objPortalInfo = (PortalInfo)arrPortals[i];
objFolderController.SetMappedDirectory(objPortalInfo, HttpContext.Current);
}
#pragma warning restore 612,618
}
示例11: GetContent
/// <Summary>
/// GetContent gets all the content and passes it to the Indexer
/// </Summary>
/// <Param name="Indexer">
/// The Index Provider that will index the content of the portal
/// </Param>
protected SearchItemInfoCollection GetContent( IndexingProvider Indexer )
{
SearchItemInfoCollection SearchItems = new SearchItemInfoCollection();
PortalController objPortals = new PortalController();
PortalInfo objPortal;
ArrayList arrPortals = objPortals.GetPortals();
int intPortal;
for (intPortal = 0; intPortal <= arrPortals.Count - 1; intPortal++)
{
objPortal = (PortalInfo)arrPortals[intPortal];
SearchItems.AddRange(Indexer.GetSearchIndexItems(objPortal.PortalID));
}
return SearchItems;
}
示例12: Synchronize
private void Synchronize()
{
PortalController objPortals = new PortalController();
ArrayList arrPortals = objPortals.GetPortals();
PortalInfo objPortal;
//Sync Host
FileSystemUtils.Synchronize(Null.NullInteger, Null.NullInteger, Globals.HostMapPath);
//Sync Portals
int intIndex;
for (intIndex = 0; intIndex <= arrPortals.Count - 1; intIndex++)
{
objPortal = (PortalInfo)arrPortals[intIndex];
FileSystemUtils.Synchronize(objPortal.PortalID, objPortal.AdministratorRoleId, objPortal.HomeDirectoryMapPath);
}
}
示例13: Synchronize
private void Synchronize()
{
var folderManager = FolderManager.Instance;
folderManager.Synchronize(Null.NullInteger);
PortalInfo objPortal;
var objPortals = new PortalController();
var arrPortals = objPortals.GetPortals();
//Sync Portals
for (int intIndex = 0; intIndex <= arrPortals.Count - 1; intIndex++)
{
objPortal = (PortalInfo) arrPortals[intIndex];
folderManager.Synchronize(objPortal.PortalID);
}
}
示例14: DoPurgeSiteLog
private void DoPurgeSiteLog()
{
var objSiteLog = new SiteLogController();
var objPortals = new PortalController();
ArrayList arrPortals = objPortals.GetPortals();
PortalInfo objPortal;
DateTime PurgeDate;
int intIndex;
for (intIndex = 0; intIndex <= arrPortals.Count - 1; intIndex++)
{
objPortal = (PortalInfo) arrPortals[intIndex];
if (objPortal.SiteLogHistory > 0)
{
PurgeDate = DateTime.Now.AddDays(-(objPortal.SiteLogHistory));
objSiteLog.DeleteSiteLog(PurgeDate, objPortal.PortalID);
}
}
}
示例15: GetSkins
private Dictionary<string, string> GetSkins(string skinRoot)
{
// load host skins
var skins = SkinController.GetSkins(null, skinRoot, SkinScope.Host).ToDictionary(skin => skin.Key, skin => skin.Value);
if (IncludePortalSkins)
{
// load portal skins
var portalController = new PortalController();
var portal = portalController.GetPortal(PortalId);
foreach (var skin in SkinController.GetSkins(portal, skinRoot, SkinScope.Site))
{
skins.Add(skin.Key, skin.Value);
}
}
return skins;
}