本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalController.DeletePortalInfo方法的典型用法代码示例。如果您正苦于以下问题:C# PortalController.DeletePortalInfo方法的具体用法?C# PortalController.DeletePortalInfo怎么用?C# PortalController.DeletePortalInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Portals.PortalController
的用法示例。
在下文中一共展示了PortalController.DeletePortalInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeletePortal
public static string DeletePortal( PortalInfo portal, string serverPath )
{
string strPortalName = null;
string strMessage = string.Empty;
// check if this is the last portal
int portalCount = DataProvider.Instance().GetPortalCount();
if( portalCount > 1 )
{
if( portal != null )
{
// delete custom resource files
Globals.DeleteFilesRecursive( serverPath, ".Portal-" + portal.PortalID.ToString() + ".resx" );
//If child portal delete child folder
PortalAliasController objPortalAliasController = new PortalAliasController();
ArrayList arr = objPortalAliasController.GetPortalAliasArrayByPortalID( portal.PortalID );
PortalAliasInfo objPortalAliasInfo = (PortalAliasInfo)( arr[0] );
strPortalName = Globals.GetPortalDomainName( objPortalAliasInfo.HTTPAlias, null, true );
if( Convert.ToBoolean( ( objPortalAliasInfo.HTTPAlias.IndexOf( "/", 0 ) + 1 ) ) )
{
strPortalName = objPortalAliasInfo.HTTPAlias.Substring( ( objPortalAliasInfo.HTTPAlias.LastIndexOf( "/" ) + 1 ) );
}
if( strPortalName != "" && Directory.Exists( serverPath + strPortalName ) )
{
Globals.DeleteFolderRecursive( serverPath + strPortalName );
}
// delete upload directory
Globals.DeleteFolderRecursive( serverPath + "Portals\\" + portal.PortalID.ToString() );
string HomeDirectory = portal.HomeDirectoryMapPath;
if( Directory.Exists( HomeDirectory ) )
{
Globals.DeleteFolderRecursive( HomeDirectory );
}
// remove database references
PortalController objPortalController = new PortalController();
objPortalController.DeletePortalInfo( portal.PortalID );
}
}
else
{
strMessage = Localization.GetString( "LastPortal" );
}
return strMessage;
}
示例2: DeletePortal
/// <summary>
/// Deletes the portal.
/// </summary>
/// <param name="portal">The portal.</param>
/// <param name="serverPath">The server path.</param>
/// <returns>If the method executed successful, it will return NullString, otherwise return error message.</returns>
public static string DeletePortal(PortalInfo portal, string serverPath)
{
var portalController = new PortalController();
string message = string.Empty;
//check if this is the last portal
int portalCount = portalController.GetPortals().Count;
if (portalCount > 1)
{
if (portal != null)
{
//delete custom resource files
Globals.DeleteFilesRecursive(serverPath, ".Portal-" + portal.PortalID + ".resx");
//If child portal delete child folder
var arr = TestablePortalAliasController.Instance.GetPortalAliasesByPortalId(portal.PortalID).ToList();
if (arr.Count > 0)
{
var portalAliasInfo = (PortalAliasInfo)arr[0];
string portalName = Globals.GetPortalDomainName(portalAliasInfo.HTTPAlias, null, true);
if (portalAliasInfo.HTTPAlias.IndexOf("/", StringComparison.Ordinal) > -1)
{
portalName = GetPortalFolder(portalAliasInfo.HTTPAlias);
}
if (!String.IsNullOrEmpty(portalName) && Directory.Exists(serverPath + portalName))
{
DeletePortalFolder(serverPath, portalName);
}
}
//delete upload directory
Globals.DeleteFolderRecursive(serverPath + "Portals\\" + portal.PortalID);
if (!string.IsNullOrEmpty(portal.HomeDirectory))
{
string HomeDirectory = portal.HomeDirectoryMapPath;
if (Directory.Exists(HomeDirectory))
{
Globals.DeleteFolderRecursive(HomeDirectory);
}
}
//remove database references
portalController.DeletePortalInfo(portal.PortalID);
}
}
else
{
message = Localization.GetString("LastPortal");
}
return message;
}