Пример #1
0
        /// <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);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <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);

            //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();
        }