本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalController.GetPortal方法的典型用法代码示例。如果您正苦于以下问题:C# PortalController.GetPortal方法的具体用法?C# PortalController.GetPortal怎么用?C# PortalController.GetPortal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Portals.PortalController
的用法示例。
在下文中一共展示了PortalController.GetPortal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
示例4: 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;
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "application/json";
object json = new { Status = "Login Failed" };
if (!string.IsNullOrWhiteSpace(Request.Form["u"]))
{
aqufitEntities entities = new aqufitEntities();
string uname = Request.Form["u"];
string password = Request.Form["p"];
if (uname.Contains("@"))
{ // this is an email login
User user = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.UserEmail == uname);
if (user == null)
{
json = new { Status = "Email ERROR" };
Response.Write(json);
Response.Flush();
Response.End();
return;
}
uname = user.UserName;
}
uname = uname.ToLower();
DotNetNuke.Security.Membership.UserLoginStatus status = DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_FAILURE;
DotNetNuke.Entities.Portals.PortalController pc = new DotNetNuke.Entities.Portals.PortalController();
DotNetNuke.Entities.Portals.PortalInfo pi = pc.GetPortal(0);
UserInfo uinfo = UserController.UserLogin(0, uname, password, null, pi.PortalName, DotNetNuke.Services.Authentication.AuthenticationLoginBase.GetIPAddress(), ref status, true);
if (status == DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUCCESS || status == DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUPERUSER)
{
UserSettings usersettings = entities.UserSettings.OfType<User>().FirstOrDefault(u => u.UserKey == uinfo.UserID && u.PortalKey == 0);
if (!usersettings.Guid.HasValue)
{ // we only add a UUID if there was none before.. this is so the "remember me" on the desktop site will still work.
usersettings.Guid = Guid.NewGuid();
entities.SaveChanges();
}
json = new { Status = "SUCCESS", Token = usersettings.Guid.ToString(), UserId = usersettings.Id, Username = usersettings.UserName };
}
}
Response.Write(serializer.Serialize( json ));
Response.Flush();
Response.End();
}
示例6: LoadStyleSheet
/// <summary>
/// LoadStyleSheet loads the stylesheet
/// </summary>
/// <history>
/// [cnurse] 9/8/2004 Created
/// </history>
private void LoadStyleSheet()
{
string strUploadDirectory = "";
PortalController objPortalController = new PortalController();
PortalInfo objPortal = objPortalController.GetPortal( intPortalId );
if( objPortal != null )
{
strUploadDirectory = objPortal.HomeDirectoryMapPath;
}
// read CSS file
if( File.Exists( strUploadDirectory + "portal.css" ) )
{
StreamReader objStreamReader;
objStreamReader = File.OpenText( strUploadDirectory + "portal.css" );
txtStyleSheet.Text = objStreamReader.ReadToEnd();
objStreamReader.Close();
}
}
示例7: DeleteUserRole
/// <summary>
/// Delete/Remove a User from a Role
/// </summary>
/// <param name="PortalId">The Id of the Portal</param>
/// <param name="UserId">The Id of the User</param>
/// <param name="RoleId">The Id of the Role</param>
/// <returns></returns>
public bool DeleteUserRole(int PortalId, int UserId, int RoleId)
{
UserInfo objUser = UserController.GetUser(PortalId, UserId, false);
UserRoleInfo objUserRole = GetUserRole(PortalId, UserId, RoleId);
PortalController objPortals = new PortalController();
bool blnDelete = true;
PortalInfo objPortal = objPortals.GetPortal(PortalId);
if (objPortal != null)
{
if ((objPortal.AdministratorId != UserId || objPortal.AdministratorRoleId != RoleId) && objPortal.RegisteredRoleId != RoleId)
{
provider.RemoveUserFromRole(PortalId, objUser, objUserRole);
}
else
{
blnDelete = false;
}
}
return blnDelete;
}
示例8: BindSkinsAndContainers
private void BindSkinsAndContainers()
{
var portalController = new PortalController();
var portal = portalController.GetPortal(PortalSettings.PortalId);
var skins = SkinController.GetSkins(portal, SkinController.RootSkin, SkinScope.All)
.ToDictionary(skin => skin.Key, skin => skin.Value);
var containers = SkinController.GetSkins(portal, SkinController.RootContainer, SkinScope.All)
.ToDictionary(skin => skin.Key, skin => skin.Value);
drpSkin.Items.Clear();
drpSkin.DataSource = skins;
drpSkin.DataBind();
//drpSkin.Items.Insert(0, new ListItem(Localization.GetString("DefaultSkin", LocalResourceFile), ""));
drpSkin.InsertItem(0, Localization.GetString("DefaultSkin", LocalResourceFile), "");
drpContainer.Items.Clear();
drpContainer.DataSource = containers;
drpContainer.DataBind();
//drpContainer.Items.Insert(0, new ListItem(Localization.GetString("DefaultContainer", LocalResourceFile), ""));
drpContainer.InsertItem(0, Localization.GetString("DefaultContainer", LocalResourceFile), "");
}
示例9: OnLoad
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
UserInfo objUserInfo = null;
int intUserID = -1;
if (Request.IsAuthenticated)
{
objUserInfo = UserController.GetCurrentUserInfo();
if (objUserInfo != null)
{
intUserID = objUserInfo.UserID;
}
}
int intRoleId = -1;
if (Request.QueryString["roleid"] != null)
{
intRoleId = int.Parse(Request.QueryString["roleid"]);
}
string strProcessorUserId = "";
var objPortalController = new PortalController();
PortalInfo objPortalInfo = objPortalController.GetPortal(PortalSettings.PortalId);
if (objPortalInfo != null)
{
strProcessorUserId = objPortalInfo.ProcessorUserId;
}
Dictionary<string, string> settings = PortalController.GetPortalSettingsDictionary(PortalSettings.PortalId);
string strPayPalURL;
if (intUserID != -1 && intRoleId != -1 && !String.IsNullOrEmpty(strProcessorUserId))
{
// Sandbox mode
if (settings.ContainsKey("paypalsandbox") && !String.IsNullOrEmpty(settings["paypalsandbox"]) && settings["paypalsandbox"] == "true")
{
strPayPalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?";
}
else
{
strPayPalURL = "https://www.paypal.com/cgi-bin/webscr?";
}
if (Request.QueryString["cancel"] != null)
{
//build the cancellation PayPal URL
strPayPalURL += "cmd=_subscr-find&alias=" + Globals.HTTPPOSTEncode(strProcessorUserId);
}
else
{
strPayPalURL += "cmd=_ext-enter";
var objRoles = new RoleController();
RoleInfo objRole = objRoles.GetRole(intRoleId, PortalSettings.PortalId);
if (objRole.RoleID != -1)
{
int intTrialPeriod = 1;
if (objRole.TrialPeriod != 0)
{
intTrialPeriod = objRole.TrialPeriod;
}
int intBillingPeriod = 1;
if (objRole.BillingPeriod != 0)
{
intBillingPeriod = objRole.BillingPeriod;
}
//explicitely format numbers using en-US so numbers are correctly built
var enFormat = new CultureInfo("en-US");
string strService = string.Format(enFormat.NumberFormat, "{0:#####0.00}", objRole.ServiceFee);
string strTrial = string.Format(enFormat.NumberFormat, "{0:#####0.00}", objRole.TrialFee);
if (objRole.BillingFrequency == "O" || objRole.TrialFrequency == "O")
{
//build the payment PayPal URL
strPayPalURL += "&redirect_cmd=_xclick&business=" + Globals.HTTPPOSTEncode(strProcessorUserId);
strPayPalURL += "&item_name=" +
Globals.HTTPPOSTEncode(PortalSettings.PortalName + " - " + objRole.RoleName + " ( " + objRole.ServiceFee.ToString("#.##") + " " +
PortalSettings.Currency + " )");
strPayPalURL += "&item_number=" + Globals.HTTPPOSTEncode(intRoleId.ToString());
strPayPalURL += "&no_shipping=1&no_note=1";
strPayPalURL += "&quantity=1";
strPayPalURL += "&amount=" + Globals.HTTPPOSTEncode(strService);
strPayPalURL += "¤cy_code=" + Globals.HTTPPOSTEncode(PortalSettings.Currency);
}
else //recurring payments
{
//build the subscription PayPal URL
strPayPalURL += "&redirect_cmd=_xclick-subscriptions&business=" + Globals.HTTPPOSTEncode(strProcessorUserId);
strPayPalURL += "&item_name=" +
Globals.HTTPPOSTEncode(PortalSettings.PortalName + " - " + objRole.RoleName + " ( " + objRole.ServiceFee.ToString("#.##") + " " +
PortalSettings.Currency + " every " + intBillingPeriod + " " + GetBillingFrequencyCode(objRole.BillingFrequency) + " )");
strPayPalURL += "&item_number=" + Globals.HTTPPOSTEncode(intRoleId.ToString());
strPayPalURL += "&no_shipping=1&no_note=1";
if (objRole.TrialFrequency != "N")
{
strPayPalURL += "&a1=" + Globals.HTTPPOSTEncode(strTrial);
strPayPalURL += "&p1=" + Globals.HTTPPOSTEncode(intTrialPeriod.ToString());
strPayPalURL += "&t1=" + Globals.HTTPPOSTEncode(objRole.TrialFrequency);
}
strPayPalURL += "&a3=" + Globals.HTTPPOSTEncode(strService);
strPayPalURL += "&p3=" + Globals.HTTPPOSTEncode(intBillingPeriod.ToString());
strPayPalURL += "&t3=" + Globals.HTTPPOSTEncode(objRole.BillingFrequency);
strPayPalURL += "&src=1";
//.........这里部分代码省略.........
示例10: GetAboutTooltip
protected string GetAboutTooltip(object dataItem)
{
string returnValue = string.Empty;
try
{
if ((ModuleContext.PortalSettings.ActiveTab.IsSuperTab))
{
int portalID = Convert.ToInt32(DataBinder.Eval(dataItem, "PortalID"));
if ((portalID != Null.NullInteger && portalID != int.MinValue))
{
var controller = new PortalController();
PortalInfo portal = controller.GetPortal(portalID);
returnValue = string.Format(Localization.GetString("InstalledOnPortal.Tooltip", LocalResourceFile), portal.PortalName);
}
else
{
returnValue = Localization.GetString("InstalledOnHost.Tooltip", LocalResourceFile);
}
}
}
catch (Exception ex)
{
Exceptions.ProcessModuleLoadException(this, ex);
}
return returnValue;
}
示例11: TokeniseLinks
private string TokeniseLinks(string content, int portalId)
{
//Replace any relative portal root reference by a token "{{PortalRoot}}"
var portalController = new PortalController();
var portal = portalController.GetPortal(portalId);
var portalRoot = UrlUtils.Combine(Globals.ApplicationPath, portal.HomeDirectory);
if (!portalRoot.StartsWith("/"))
{
portalRoot = "/" + portalRoot;
}
Regex exp = new Regex(portalRoot, RegexOptions.IgnoreCase);
content = exp.Replace(content, PortalRootToken);
return content;
}
示例12: cmdExport_Click
/// <summary>
/// Exports the selected portal
/// </summary>
/// <remarks>
/// Template will be saved in Portals\_default folder.
/// An extension of .template will be added to filename if not entered
/// </remarks>
/// <history>
/// [VMasanas] 23/09/2004 Created
/// [cnurse] 11/08/2004 Addition of files to template
/// </history>
protected void cmdExport_Click( Object sender, EventArgs e )
{
try
{
if( ! Page.IsValid )
{
return;
}
string filename = Globals.HostMapPath + txtTemplateName.Text;
if( ! filename.EndsWith( ".template" ) )
{
filename += ".template";
}
XmlDocument xmlTemplate = new XmlDocument();
XmlNode nodePortal = xmlTemplate.AppendChild( xmlTemplate.CreateElement( "portal" ) );
nodePortal.Attributes.Append( XmlUtils.CreateAttribute( xmlTemplate, "version", "3.0" ) );
//Add template description
XmlElement node = xmlTemplate.CreateElement( "description" );
node.InnerXml = Server.HtmlEncode( txtDescription.Text );
nodePortal.AppendChild( node );
//Serialize portal settings
PortalController objportals = new PortalController();
PortalInfo objportal = objportals.GetPortal( Convert.ToInt32( cboPortals.SelectedValue ) );
SerializeSettings(xmlTemplate, nodePortal, objportal);
// Serialize Profile Definitions
XmlNode nodeProfileDefinitions = nodePortal.AppendChild(xmlTemplate.CreateElement("profiledefinitions"));
SerializeProfileDefinitions(xmlTemplate, nodeProfileDefinitions, objportal);
SerializeSettings( xmlTemplate, nodePortal, objportal );
//Serialize Roles
XmlNode nodeRoles = nodePortal.AppendChild( xmlTemplate.CreateElement( "roles" ) );
Hashtable hRoles = SerializeRoles( xmlTemplate, nodeRoles, objportal );
// Serialize tabs
XmlNode nodeTabs = nodePortal.AppendChild( xmlTemplate.CreateElement( "tabs" ) );
SerializeTabs( xmlTemplate, nodeTabs, objportal, hRoles );
if( chkContent.Checked )
{
//Create Zip File to hold files
ZipOutputStream resourcesFile = new ZipOutputStream( File.Create( filename + ".resources" ) );
resourcesFile.SetLevel( 6 );
// Serialize folders (while adding files to zip file)
XmlNode nodeFolders;
nodeFolders = nodePortal.AppendChild( xmlTemplate.CreateElement( "folders" ) );
SerializeFolders( xmlTemplate, nodeFolders, objportal, ref resourcesFile );
//Finish and Close Zip file
resourcesFile.Finish();
resourcesFile.Close();
}
xmlTemplate.Save( filename );
lblMessage.Text = string.Format( Localization.GetString( "ExportedMessage", this.LocalResourceFile ), filename, null );
}
catch( Exception exc )
{
Exceptions.ProcessModuleLoadException( this, exc );
}
}
示例13: UpdateHomeTab
private int UpdateHomeTab(int homeTabId)
{
var portalController = new PortalController();
var portalInfo = portalController.GetPortal(PortalId);
int oldHomeTabId = portalInfo.HomeTabId;
portalInfo.HomeTabId = homeTabId;
return oldHomeTabId;
}
示例14: cmdUpdate_Click
//.........这里部分代码省略.........
else
{
if (!Globals.IsHostTab(PortalSettings.ActiveTab.TabID))
{
strPortalAlias = Globals.GetDomainName(Request, true) + "/" + strPortalAlias;
}
else
{
strPortalAlias = txtPortalName.Text;
}
}
}
}
//Get Home Directory
string homeDir = txtHomeDirectory.Text != @"Portals/[PortalID]" ? txtHomeDirectory.Text : "";
//Validate Home Folder
if (!string.IsNullOrEmpty(homeDir))
{
if (string.IsNullOrEmpty(String.Format("{0}\\{1}\\", Globals.ApplicationMapPath, homeDir).Replace("/", "\\")))
{
message = Localization.GetString("InvalidHomeFolder", LocalResourceFile);
}
if (homeDir.Contains("admin") || homeDir.Contains("DesktopModules") || homeDir.ToLowerInvariant() == "portals/")
{
message = Localization.GetString("InvalidHomeFolder", LocalResourceFile);
}
}
//Validate Portal Alias
if (!string.IsNullOrEmpty(strPortalAlias))
{
PortalAliasInfo portalAlias = PortalAliasController.GetPortalAliasLookup(strPortalAlias.ToLower());
if (portalAlias != null)
{
message = Localization.GetString("DuplicatePortalAlias", LocalResourceFile);
}
}
//Create Portal
if (String.IsNullOrEmpty(message))
{
string strTemplateFile = cboTemplate.SelectedItem.Text + ".template";
//Attempt to create the portal
var objAdminUser = new UserInfo();
int intPortalId;
try
{
objAdminUser.FirstName = txtFirstName.Text;
objAdminUser.LastName = txtLastName.Text;
objAdminUser.Username = txtUsername.Text;
objAdminUser.DisplayName = txtFirstName.Text + " " + txtLastName.Text;
objAdminUser.Email = txtEmail.Text;
objAdminUser.IsSuperUser = false;
objAdminUser.Membership.Approved = true;
objAdminUser.Membership.Password = txtPassword.Text;
objAdminUser.Membership.PasswordQuestion = txtQuestion.Text;
objAdminUser.Membership.PasswordAnswer = txtAnswer.Text;
objAdminUser.Profile.FirstName = txtFirstName.Text;
objAdminUser.Profile.LastName = txtLastName.Text;
intPortalId = objPortalController.CreatePortal(txtTitle.Text,
objAdminUser,
示例15: GetSubFolderPath
/// -----------------------------------------------------------------------------
/// <summary>
/// Returns the folder path under the root for the portal
/// </summary>
/// <param name="strFileNamePath">The folder the absolute path</param>
/// <param name="portalId">Portal Id.</param>
/// <remarks>
/// </remarks>
/// <history>
/// [cnurse] 16/9/2004 Updated for localization, Help and 508
/// [Philip Beadle] 6 October 2004 Moved to Globals from WebUpload.ascx.vb so can be accessed by URLControl.ascx
/// </history>
/// -----------------------------------------------------------------------------
public static string GetSubFolderPath(string strFileNamePath, int portalId)
{
string ParentFolderName;
if (portalId == Null.NullInteger)
{
ParentFolderName = HostMapPath.Replace("/", "\\");
}
else
{
var objPortals = new PortalController();
PortalInfo objPortal = objPortals.GetPortal(portalId);
ParentFolderName = objPortal.HomeDirectoryMapPath.Replace("/", "\\");
}
string strFolderpath = strFileNamePath.Substring(0, strFileNamePath.LastIndexOf("\\") + 1);
return strFolderpath.Substring(ParentFolderName.Length).Replace("\\", "/");
}