当前位置: 首页>>代码示例>>C#>>正文


C# PortalAliasController.GetPortalAliasByPortalAliasID方法代码示例

本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalAliasController.GetPortalAliasByPortalAliasID方法的典型用法代码示例。如果您正苦于以下问题:C# PortalAliasController.GetPortalAliasByPortalAliasID方法的具体用法?C# PortalAliasController.GetPortalAliasByPortalAliasID怎么用?C# PortalAliasController.GetPortalAliasByPortalAliasID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Entities.Portals.PortalAliasController的用法示例。


在下文中一共展示了PortalAliasController.GetPortalAliasByPortalAliasID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BindData

        /// <summary>
        /// BindData fetches the data from the database and updates the controls
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/17/2005	documented
        /// </history>
        private void BindData()
        {
            if( Request.QueryString["paid"] != null )
            {
                PortalAliasInfo objPortalAliasInfo;
                int intPortalAliasID = Convert.ToInt32( Request.QueryString["paid"] );

                PortalAliasController p = new PortalAliasController();
                objPortalAliasInfo = p.GetPortalAliasByPortalAliasID( intPortalAliasID );

                ViewState.Add( "PortalAliasID", intPortalAliasID );
                ViewState.Add( "PortalID", objPortalAliasInfo.PortalID );

                if( ! UserInfo.IsSuperUser )
                {
                    if( objPortalAliasInfo.PortalID != PortalSettings.PortalId )
                    {
                        UI.Skins.Skin.AddModuleMessage( this, "You do not have access to view this Portal Alias.", ModuleMessageType.RedError );
                        return;
                    }
                }

                txtAlias.Text = objPortalAliasInfo.HTTPAlias;
                SetDeleteVisibility( objPortalAliasInfo.PortalID );
            }
            else if( Request.QueryString["pid"] != "" )
            {
                if( UserInfo.IsSuperUser )
                {
                    ViewState.Add( "PortalID", Convert.ToInt32( Request.QueryString["pid"] ) );
                }
                SetDeleteVisibility( Convert.ToInt32( Request.QueryString["pid"] ) );
            }
            else
            {
                ViewState.Add( "PortalID", PortalSettings.PortalId );
                SetDeleteVisibility( PortalSettings.PortalId );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:45,代码来源:EditPortalAlias.ascx.cs

示例2: AddCustomRedirectsToDictionary

        private static void AddCustomRedirectsToDictionary(SharedDictionary<string, string> tabIndex,
                                                    Dictionary<string, DupKeyCheck> dupCheck,
                                                    string httpAlias,
                                                    TabInfo tab,
                                                    FriendlyUrlSettings settings,
                                                    FriendlyUrlOptions options,
                                                    ref string rewritePath,
                                                    out int tabPathDepth,
                                                    ref List<string> customHttpAliasesUsed,
                                                    bool isDeleted,
                                                    Guid parentTraceId)
        {
            tabPathDepth = 1;
            var duplicateHandlingPreference = UrlEnums.TabKeyPreference.TabRedirected;
            bool checkForDupUrls = settings.CheckForDuplicateUrls;
            //697 : custom url rewrites with large number of path depths fail because of incorrect path depth calculation
            int maxTabPathDepth = 1;
            string newRewritePath = rewritePath;
            string aliasCulture = null;
            //get the culture for this alias
            var primaryAliases = TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(tab.PortalID).ToList();

            if (primaryAliases.Count > 0)
            {
                aliasCulture = primaryAliases.GetCultureByPortalIdAndAlias(tab.PortalID, httpAlias);
            }
            foreach (var redirect in tab.TabUrls)
            {
                //allow for additional qs parameters
                if (!String.IsNullOrEmpty(redirect.QueryString))
                {
                    rewritePath += (redirect.QueryString.StartsWith("&")) ? redirect.QueryString : "&" + redirect.QueryString;
                }

                string redirectTabPath = redirect.Url;
                string redirectedRewritePath = rewritePath;

                //770 : allow for custom portal aliases
                string redirectAlias = httpAlias;
                if (redirect.PortalAliasId > 0)
                {
                    //has a custom portal alias
                    var pac = new PortalAliasController();
                    PortalAliasInfo customAlias = pac.GetPortalAliasByPortalAliasID(redirect.PortalAliasId);
                    if (customAlias != null)
                    {
                        //this will be used to add the Url to the dictionary
                        redirectAlias = customAlias.HTTPAlias;
                        //add to the list of custom aliases used by the portal
                        if (customHttpAliasesUsed == null)
                        {
                            customHttpAliasesUsed = new List<string>();
                        }
                        if (!customHttpAliasesUsed.Contains(redirectAlias))
                        {
                            customHttpAliasesUsed.Add(redirectAlias);
                        }
                    }
                }
                //set the redirect status using the httpStatus
                switch (redirect.HttpStatus)
                {
                    case "301":
                        redirectedRewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath,
                                                                                        ActionType.Redirect301,
                                                                                        RedirectReason.Custom_Redirect);
                        break;
                    case "302":
                        redirectedRewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath,
                                                                                        ActionType.Redirect302,
                                                                                        RedirectReason.Custom_Redirect);
                        break;
                    case "404":
                        redirectedRewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath,
                                                                                        ActionType.Output404,
                                                                                        RedirectReason.Custom_Redirect);
                        break;
                    case "200":
                        //when there is a 200, then replace the 'standard' path
                        newRewritePath = RedirectTokens.AddRedirectReasonToRewritePath(newRewritePath,
                                                                                        ActionType.CheckFor301,
                                                                                        RedirectReason.Custom_Redirect);
                        //672 : replacement urls have preference over all redirects, deleted tabs and standard urls
                        duplicateHandlingPreference = UrlEnums.TabKeyPreference.TabOK;
                        break;
                }
                //check the culture of the redirect to see if it either doesn't match the alias or needs to specify
                //the language when requested
                if (redirect.CultureCode != null)
                {
                    if (redirect.CultureCode != "" && redirect.CultureCode != "Default")
                    {
                        //806 : specify duplicates where the alias culture doesn't match the redirect culture
                        //so that redirect to the best match between alias culture and redirect culture
                        //compare the supplied alias culture with the redirect culture
                        //856 : if alias culture == "" and a custom 301 redirect then redirects are forced
                        if (!string.IsNullOrEmpty(aliasCulture) && aliasCulture != redirect.CultureCode)
                        {
                            //the culture code and the specific culture alias don't match
                            //set 301 check status and set to delete if a duplicate is found
//.........这里部分代码省略.........
开发者ID:vsnobbert,项目名称:Dnn.Platform,代码行数:101,代码来源:TabIndexController.cs

示例3: BuildUrlDictionary

        /// <summary>
        /// Returns a list of tab and redirects from the database, for the specified portal
        /// Assumes that the dictionary should have any existing items replaced if the portalid is specified 
        /// and the portal tabs already exist in the dictionary.
        /// </summary>
        /// <param name="existingTabs"></param>
        /// <param name="portalId"></param>
        /// <param name="settings"></param>
        /// <param name="customAliasTabs"></param>
        /// <remarks>
        ///    Each dictionary entry in the return value is a complex data type of another dictionary that is indexed by the url culture.  If there is 
        ///    only one culture for the Url, it will be that culture.
        /// </remarks>
        /// <returns></returns>
        private static SharedDictionary<int, SharedDictionary<string, string>> BuildUrlDictionary(SharedDictionary<int, SharedDictionary<string, string>> existingTabs, 
                                                    int portalId,
                                                    FriendlyUrlSettings settings, 
                                                    ref SharedDictionary<string, string> customAliasTabs)
        {
            //fetch tabs with redirects
            var tabs = FriendlyUrlController.GetTabs(portalId, false, null, settings);
            if (existingTabs == null)
            {
                existingTabs = new SharedDictionary<int, SharedDictionary<string, string>>();
            }
            if (customAliasTabs == null)
            {
                customAliasTabs = new SharedDictionary<string, string>();
            }
            

            //go through each tab in the found list            
            foreach (TabInfo tab in tabs.Values)
            {
                //check the custom alias tabs collection and add to the dictionary where necessary
                foreach (var customAlias in tab.CustomAliases)
                {
                    string key = tab.TabID.ToString() + ":" + customAlias.Key;
                    using (customAliasTabs.GetWriteLock())  //obtain write lock on custom alias Tabs
                    {
                        if (customAliasTabs.ContainsKey(key) == false)
                        {
                            customAliasTabs.Add(key, customAlias.Value);
                        }
                    }
                }

                foreach (TabUrlInfo redirect in tab.TabUrls)
                {
                    if (redirect.HttpStatus == "200")
                    {
                        string url = redirect.Url;
                        //770 : add in custom alias into the tab path for the custom Urls
                        if (redirect.PortalAliasUsage != PortalAliasUsageType.Default && redirect.PortalAliasId > 0)
                        {
                            //there is a custom http alias specified for this portal alias
                            var pac = new PortalAliasController();
                            PortalAliasInfo alias = pac.GetPortalAliasByPortalAliasID(redirect.PortalAliasId);
                            if (alias != null)
                            {
                                string customHttpAlias = alias.HTTPAlias;
                                url = customHttpAlias + "::" + url;
                            }
                        }
                        string cultureKey = redirect.CultureCode.ToLower();
                        int tabid = tab.TabID;
                        using (existingTabs.GetWriteLock())
                        {
                            if (existingTabs.ContainsKey(tabid) == false)
                            {
                                var entry = new SharedDictionary<string, string>();
                                using (entry.GetWriteLock())
                                {
                                    entry.Add(cultureKey, url);
                                }
                                //871 : use lower case culture code as key
                                existingTabs.Add(tab.TabID, entry);
                            }
                            else
                            {
                                SharedDictionary<string, string> entry = existingTabs[tabid];
                                //replace tab if existing but was retreieved from tabs call
                                if (tab.PortalID == portalId || portalId == -1)
                                {
                                    using (entry.GetWriteLock())
                                    {
                                        if (entry.ContainsKey(cultureKey) == false)
                                        {
                                            //add the culture and set in parent dictionary
                                            //871 : use lower case culture code as key
                                            entry.Add(cultureKey, url);
                                            existingTabs[tabid] = entry;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:101,代码来源:CustomUrlDictController.cs

示例4: cmdDelete_Click

        /// <summary>
        /// cmdDelete_Click runs when the Delete button is clicked
        /// </summary>
        /// <history>
        /// 	[cnurse]	01/17/2005	documented
        /// </history>
        protected void cmdDelete_Click( Object sender, EventArgs e )
        {
            try
            {
                int intPortalAliasID;
                intPortalAliasID = Convert.ToInt32( ViewState["PortalAliasID"] );
                PortalAliasInfo objPortalAliasInfo;
                PortalAliasController p = new PortalAliasController();
                objPortalAliasInfo = p.GetPortalAliasByPortalAliasID( intPortalAliasID );

                if( ! UserInfo.IsSuperUser )
                {
                    if( objPortalAliasInfo.PortalID != PortalSettings.PortalId )
                    {
                        UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "AccessDenied", this.LocalResourceFile ), ModuleMessageType.RedError );
                        return;
                    }
                }
                p.DeletePortalAlias( intPortalAliasID );

                Response.Redirect( Convert.ToString( ViewState["UrlReferrer"] ), true );
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:33,代码来源:EditPortalAlias.ascx.cs


注:本文中的DotNetNuke.Entities.Portals.PortalAliasController.GetPortalAliasByPortalAliasID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。