示例#1
0
        private void TryDeleteCreatingPortal(string childPath)
        {
            try
            {
                if (HttpContext.Current != null && HttpContext.Current.Items.Contains("CreatingPortalId"))
                {
                    var creatingPortalId = Convert.ToInt32(HttpContext.Current.Items["CreatingPortalId"]);
                    var portalInfo       = PortalController.Instance.GetPortal(creatingPortalId);
                    PortalController.DeletePortal(portalInfo, Globals.GetAbsoluteServerPath(Request));
                }

                if (!string.IsNullOrEmpty(childPath))
                {
                    PortalController.DeletePortalFolder(string.Empty, childPath);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
        protected void DeleteAiasesGrid(object source, CommandEventArgs e)
        {
            //Get the index of the row to delete
            int index = Convert.ToInt32(e.CommandArgument);

            //Remove the alias from the aliases collection
            var portalAlias = Aliases[index];

            PortalAliasController.Instance.DeletePortalAlias(portalAlias);
            //should remove the portal's folder if exist
            var portalFolder = PortalController.GetPortalFolder(portalAlias.HTTPAlias);
            var serverPath   = Globals.GetAbsoluteServerPath(Request);

            if (!string.IsNullOrEmpty(portalFolder) && Directory.Exists(serverPath + portalFolder))
            {
                PortalController.DeletePortalFolder(serverPath, portalFolder);
            }

            //Rebind the collection
            _Aliases = null;
            BindAliases();
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DeleteAlias runs when a delete button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	12/12/2008  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void DeleteAlias(object source, DataGridCommandEventArgs e)
        {
            var controller = new PortalAliasController();

            //Get the index of the row to delete
            int index = e.Item.ItemIndex;

            //Remove the alias from the aliases collection
            var portalAlias = (PortalAliasInfo)Aliases[index];

            controller.DeletePortalAlias(portalAlias.PortalAliasID);
            //should remove the portal's folder if exist
            var portalFolder = PortalController.GetPortalFolder(portalAlias.HTTPAlias);
            var serverPath   = Globals.GetAbsoluteServerPath(Request);

            if (!string.IsNullOrEmpty(portalFolder) && Directory.Exists(serverPath + portalFolder))
            {
                PortalController.DeletePortalFolder(serverPath, portalFolder);
            }
            //Rebind the collection
            _Aliases = null;
            BindAliases();
        }