本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalAliasController.UpdatePortalAliasInfo方法的典型用法代码示例。如果您正苦于以下问题:C# PortalAliasController.UpdatePortalAliasInfo方法的具体用法?C# PortalAliasController.UpdatePortalAliasInfo怎么用?C# PortalAliasController.UpdatePortalAliasInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Portals.PortalAliasController
的用法示例。
在下文中一共展示了PortalAliasController.UpdatePortalAliasInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveAlias
protected void SaveAlias(object source, CommandEventArgs e)
{
var controller = new PortalAliasController();
bool isChild = false;
string childPath = string.Empty;
string message = string.Empty;
//Get the index of the row to save
int index = dgPortalAlias.EditItemIndex;
var portalAlias = (PortalAliasInfo) Aliases[index];
var ctlAlias = (TextBox) dgPortalAlias.Items[index].Cells[1].FindControl("txtHTTPAlias");
var chkChild = (CheckBox) dgPortalAlias.Items[index].Cells[2].FindControl("chkChild");
string strAlias = ctlAlias.Text.Trim();
if (string.IsNullOrEmpty(strAlias))
{
message = Localization.GetString("InvalidAlias", LocalResourceFile);
}
else
{
if (strAlias.IndexOf("://") != -1)
{
strAlias = strAlias.Remove(0, strAlias.IndexOf("://") + 3);
}
if (strAlias.IndexOf("\\\\") != -1)
{
strAlias = strAlias.Remove(0, strAlias.IndexOf("\\\\") + 2);
}
isChild = (chkChild != null && chkChild.Checked);
//Validate Alias
if (!PortalAliasController.ValidateAlias(strAlias, false))
{
message = Localization.GetString("InvalidAlias", LocalResourceFile);
}
//Validate Child Folder Name
if (isChild)
{
childPath = strAlias.Substring(strAlias.LastIndexOf("/") + 1);
if (!PortalAliasController.ValidateAlias(childPath, true))
{
message = Localization.GetString("InvalidAlias", LocalResourceFile);
}
}
}
if (string.IsNullOrEmpty(message) && isChild)
{
//Attempt to create child folder
string childPhysicalPath = Server.MapPath(childPath);
if (Directory.Exists(childPhysicalPath))
{
message = Localization.GetString("ChildExists", LocalResourceFile);
}
else
{
message = PortalController.CreateChildPortalFolder(childPhysicalPath);
}
}
if (string.IsNullOrEmpty(message))
{
portalAlias.HTTPAlias = strAlias;
if (AddMode)
{
controller.AddPortalAlias(portalAlias);
}
else
{
controller.UpdatePortalAliasInfo(portalAlias);
}
//Reset Edit Index
lblError.Visible = false;
dgPortalAlias.EditItemIndex = -1;
_Aliases = null;
}
else
{
lblError.Text = message;
lblError.Visible = true;
}
BindAliases();
}
示例2: cmdUpdate_Click
/// <summary>
/// cmdUpdate_Click runs when the Update button is clicked
/// </summary>
/// <history>
/// [cnurse] 01/17/2005 documented
/// </history>
protected void cmdUpdate_Click( Object sender, EventArgs e )
{
try
{
string strAlias = txtAlias.Text;
if( !String.IsNullOrEmpty(strAlias) )
{
if( strAlias.IndexOf( "://" ) != - 1 )
{
strAlias = strAlias.Remove( 0, strAlias.IndexOf( "://" ) + 3 );
}
if( strAlias.IndexOf( "\\\\" ) != - 1 )
{
strAlias = strAlias.Remove( 0, strAlias.IndexOf( "\\\\" ) + 2 );
}
PortalAliasController p = new PortalAliasController();
if( ViewState["PortalAliasID"] != null )
{
PortalAliasInfo objPortalAliasInfo = new PortalAliasInfo();
objPortalAliasInfo.PortalAliasID = Convert.ToInt32( ViewState["PortalAliasID"] );
objPortalAliasInfo.PortalID = Convert.ToInt32( ViewState["PortalID"] );
objPortalAliasInfo.HTTPAlias = strAlias;
try
{
p.UpdatePortalAliasInfo(objPortalAliasInfo);
}
catch
{
UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateAlias", this.LocalResourceFile), ModuleMessageType.RedError);
return;
}
}
else
{
PortalAliasInfo objPortalAliasInfo;
objPortalAliasInfo = p.GetPortalAlias( strAlias, Convert.ToInt32( ViewState["PortalAliasID"] ) );
if( objPortalAliasInfo == null )
{
objPortalAliasInfo = new PortalAliasInfo();
objPortalAliasInfo.PortalID = Convert.ToInt32( ViewState["PortalID"] );
objPortalAliasInfo.HTTPAlias = strAlias;
p.AddPortalAlias( objPortalAliasInfo );
}
else
{
UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "DuplicateAlias", this.LocalResourceFile ), ModuleMessageType.RedError );
return;
}
}
UI.Skins.Skin.AddModuleMessage( this, Localization.GetString( "Success", this.LocalResourceFile ), ModuleMessageType.GreenSuccess );
Response.Redirect( Convert.ToString( ViewState["UrlReferrer"] ), true );
}
}
catch( Exception exc ) //Module failed to load
{
Exceptions.ProcessModuleLoadException( this, exc );
}
}