本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalAliasInfo类的典型用法代码示例。如果您正苦于以下问题:C# PortalAliasInfo类的具体用法?C# PortalAliasInfo怎么用?C# PortalAliasInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PortalAliasInfo类属于DotNetNuke.Entities.Portals命名空间,在下文中一共展示了PortalAliasInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DnnLink
/// <summary>
/// Generate WebAPI Links compatible with DNN Services Framework
/// </summary>
/// <param name="urlHelper">The UrlHelper</param>
/// <param name="moduleFolderName">ModuleFolderName for the route</param>
/// <param name="routeName">RouteName for the route</param>
/// <param name="routeValues">Values to be passed to the route</param>
/// <param name="portalAliasInfo">The PortalAlias to use in the Url </param>
/// <returns>a url</returns>
public static string DnnLink(this UrlHelper urlHelper, string moduleFolderName, string routeName, object routeValues, PortalAliasInfo portalAliasInfo)
{
var parm = new PortalAliasRouteManager();
var fullName = parm.GetRouteName(moduleFolderName, routeName, PortalController.Instance.GetCurrentPortalSettings().PortalAlias);
HttpRouteValueDictionary allRouteValues = parm.GetAllRouteValues(portalAliasInfo, routeValues);
return urlHelper.Link(fullName, allRouteValues);
}
示例2: PortalAliasInfo
public PortalAliasInfo(PortalAliasInfo alias)
{
HTTPAlias = alias.HTTPAlias;
PortalAliasID = alias.PortalAliasID;
PortalID = alias.PortalID;
IsPrimary = alias.IsPrimary;
Redirect = alias.Redirect;
BrowserType = alias.BrowserType;
CultureCode = alias.CultureCode;
Skin = alias.Skin;
}
示例3: AutoAddAlias
protected static void AutoAddAlias(HttpContext context)
{
var portalId = Host.Host.HostPortalID;
//the domain name was not found so try using the host portal's first alias
if (portalId > Null.NullInteger)
{
var portalAliasInfo = new PortalAliasInfo { PortalID = portalId, HTTPAlias = Globals.GetDomainName(context.Request, true) };
PortalAliasController.Instance.AddPortalAlias(portalAliasInfo);
context.Response.Redirect(context.Request.Url.ToString(), true);
}
}
示例4: GetAllRouteValues
public HttpRouteValueDictionary GetAllRouteValues(PortalAliasInfo portalAliasInfo, object routeValues)
{
var allRouteValues = new HttpRouteValueDictionary(routeValues);
var segments = portalAliasInfo.HTTPAlias.Split('/');
if(segments.Length > 1)
{
for(int i = 1; i < segments.Length; i++)
{
var key = "prefix" + (i - 1).ToString(CultureInfo.InvariantCulture);
var value = segments[i];
allRouteValues.Add(key, value);
}
}
return allRouteValues;
}
示例5: GetPortalAliasArrayByPortalID
public ArrayList GetPortalAliasArrayByPortalID(int PortalID)
{
IDataReader dr = DotNetNuke.Data.DataProvider.Instance().GetPortalAliasByPortalID(PortalID);
try
{
ArrayList arr = new ArrayList();
while (dr.Read())
{
PortalAliasInfo objPortalAliasInfo = new PortalAliasInfo();
objPortalAliasInfo.PortalAliasID = Convert.ToInt32(dr["PortalAliasID"]);
objPortalAliasInfo.PortalID = Convert.ToInt32(dr["PortalID"]);
objPortalAliasInfo.HTTPAlias = Convert.ToString(dr["HTTPAlias"]).ToLower();
arr.Add(objPortalAliasInfo);
}
return arr;
}
finally
{
if (dr != null)
{
dr.Close();
}
}
}
示例6: GetPortalAliasByPortalID
public PortalAliasCollection GetPortalAliasByPortalID(int PortalID)
{
IDataReader dr = DotNetNuke.Data.DataProvider.Instance().GetPortalAliasByPortalID(PortalID);
try
{
PortalAliasCollection objPortalAliasCollection = new PortalAliasCollection();
while (dr.Read())
{
PortalAliasInfo objPortalAliasInfo = new PortalAliasInfo();
objPortalAliasInfo.PortalAliasID = Convert.ToInt32(dr["PortalAliasID"]);
objPortalAliasInfo.PortalID = Convert.ToInt32(dr["PortalID"]);
objPortalAliasInfo.HTTPAlias = Convert.ToString(dr["HTTPAlias"]);
objPortalAliasCollection.Add(Convert.ToString(dr["HTTPAlias"]).ToLower(), objPortalAliasInfo);
}
return objPortalAliasCollection;
}
finally
{
if (dr != null)
{
dr.Close();
}
}
}
示例7: AdvancedUrlRewriter_PrimaryPortalAlias
public void AdvancedUrlRewriter_PrimaryPortalAlias(Dictionary<string, string> testFields)
{
string defaultAlias = testFields["DefaultAlias"];
var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);
settings.PortalId = PortalId;
string language = testFields["Language"].Trim();
string skin = testFields["Skin"].Trim();
if (!String.IsNullOrEmpty(language))
{
_customLocale = new Locale { Code = language, Fallback = "en-US" };
_customLocale.Text = CultureInfo.CreateSpecificCulture(_customLocale.Code).NativeName;
Localization.SaveLanguage(_customLocale);
Localization.AddLanguageToPortals(_customLocale.LanguageId);
}
if (testFields.ContainsKey("Final Url"))
{
testFields["Final Url"] = testFields["Final Url"].Replace("{useAlias}", defaultAlias);
}
if (!(String.IsNullOrEmpty(language) && String.IsNullOrEmpty(skin)))
{
//add new primary alias
_primaryAlias = new PortalAliasInfo
{
PortalID = PortalId,
HTTPAlias = defaultAlias,
CultureCode = language,
Skin = skin,
IsPrimary = true
};
_primaryAlias.PortalAliasID = TestablePortalAliasController.Instance.AddPortalAlias(_primaryAlias);
ExecuteTest(settings, testFields, true);
}
else
{
SetDefaultAlias(defaultAlias);
ExecuteTest(settings, testFields, false);
}
}
示例8: GetPortalAliasProperties
protected abstract void GetPortalAliasProperties(int index, PortalAliasInfo portalAlias);
示例9: AddLanguageHttpAlias
private static void AddLanguageHttpAlias(int portalId, Locale locale)
{
if (Config.GetFriendlyUrlProvider() == "advanced")
{
// create new HTTPAlias for language
var portalInfo = PortalController.Instance.GetPortal(portalId);
PortalAliasInfo currentAlias = null;
string httpAlias = null;
var portalAliasses = PortalAliasController.Instance.GetPortalAliasesByPortalId(portalId);
var portalAliasInfos = portalAliasses as IList<PortalAliasInfo> ?? portalAliasses.ToList();
if (portalAliasses != null && portalAliasInfos.Any())
{
currentAlias = portalAliasInfos.First();
httpAlias = currentAlias.HTTPAlias;
}
if (currentAlias != null && !string.IsNullOrEmpty(httpAlias) && portalInfo != null)
{
if (!string.IsNullOrEmpty(currentAlias.CultureCode))
{
// the portal alias is culture specific
if (currentAlias.CultureCode == portalInfo.CultureCode)
{
// remove the culture from the alias
httpAlias = httpAlias.Substring(0, httpAlias.LastIndexOf("/", StringComparison.Ordinal));
}
}
var alias = GetValidLanguageURL(portalId, httpAlias, locale.Code.ToLowerInvariant());
if (!String.IsNullOrEmpty(alias))
{
var newAlias = new PortalAliasInfo(currentAlias)
{
IsPrimary = true,
CultureCode = locale.Code,
HTTPAlias = GetValidLanguageURL(portalId, httpAlias, locale.Code.ToLowerInvariant())
};
PortalAliasController.Instance.AddPortalAlias(newAlias);
}
}
}
}
示例10: AddPortalAlias
protected string AddPortalAlias(string portalAlias, int portalID)
{
if (!String.IsNullOrEmpty(portalAlias))
{
if (portalAlias.IndexOf("://", StringComparison.Ordinal) != -1)
{
portalAlias = portalAlias.Remove(0, portalAlias.IndexOf("://", StringComparison.Ordinal) + 3);
}
var alias = PortalAliasController.Instance.GetPortalAlias(portalAlias, portalID);
if (alias == null)
{
alias = new PortalAliasInfo { PortalID = portalID, HTTPAlias = portalAlias };
PortalAliasController.Instance.AddPortalAlias(alias);
}
}
return portalAlias;
}
示例11: AddAlias
protected void AddAlias(object sender, EventArgs e)
{
//Add a new empty rule and set the editrow to the new row
var portalAlias = new PortalAliasInfo { PortalID = CurrentPortalId };
Aliases.Add(portalAlias);
Grid.EditItemIndex = Aliases.Count - 1;
//Set the AddMode to true
AddMode = true;
//Rebind the collection
BindAliases();
}
示例12: MakeUrlWithAlias
private static string MakeUrlWithAlias(Uri requestUri, PortalAliasInfo alias)
{
return MakeUrlWithAlias(requestUri, alias.HTTPAlias);
}
示例13: AdvancedUrlProvider_PrimaryPortalAlias
public void AdvancedUrlProvider_PrimaryPortalAlias(Dictionary<string, string> testFields)
{
string defaultAlias = testFields["DefaultAlias"];
string redirectMode = testFields["RedirectMode"];
var settings = UrlTestFactoryClass.GetSettings("FriendlyUrl", "PrimaryPortalAlias");
string language = testFields["Language"].Trim();
if (!String.IsNullOrEmpty(language))
{
_customLocale = new Locale { Code = language, Fallback = "en-US" };
_customLocale.Text = CultureInfo.CreateSpecificCulture(_customLocale.Code).NativeName;
Localization.SaveLanguage(_customLocale);
Localization.AddLanguageToPortals(_customLocale.LanguageId);
//add new primary alias
_primaryAlias = new PortalAliasInfo
{
PortalID = PortalId,
HTTPAlias = defaultAlias,
CultureCode = language,
IsPrimary = true
};
_primaryAlias.PortalAliasID = PortalAliasController.Instance.AddPortalAlias(_primaryAlias);
}
else
{
SetDefaultAlias(defaultAlias);
}
PortalController.UpdatePortalSetting(PortalId, "PortalAliasMapping", redirectMode);
ExecuteTest("Improved", settings, testFields);
}
示例14: GetHostPortalSettings
/// <summary>
/// Gets the host portal settings.
/// </summary>
/// <returns>Host portal settings</returns>
public static PortalSettings GetHostPortalSettings()
{
int TabId = -1;
int PortalId = -1;
PortalAliasInfo objPortalAliasInfo = null;
//if the portal alias exists
if (Host.HostPortalID > Null.NullInteger)
{
PortalId = Host.HostPortalID;
// use the host portal
objPortalAliasInfo = new PortalAliasInfo();
objPortalAliasInfo.PortalID = PortalId;
}
// load the PortalSettings into current context
return new PortalSettings(TabId, objPortalAliasInfo);
}
示例15: AddPortalAlias
protected string AddPortalAlias(string portalAlias, int portalID)
{
if (!String.IsNullOrEmpty(portalAlias))
{
if (portalAlias.IndexOf("://") != -1)
{
portalAlias = portalAlias.Remove(0, portalAlias.IndexOf("://") + 3);
}
var objPortalAliasController = new PortalAliasController();
var objPortalAlias = objPortalAliasController.GetPortalAlias(portalAlias, portalID);
if (objPortalAlias == null)
{
objPortalAlias = new PortalAliasInfo { PortalID = portalID, HTTPAlias = portalAlias };
objPortalAliasController.AddPortalAlias(objPortalAlias);
}
}
return portalAlias;
}