示例#1
0
        /// <summary>
        /// cmdDelete_Click runs when the Delete LinkButton is clicked.
        /// It deletes the current portal form the Database.  It can only run in Host
        /// (SuperUser) mode
        /// </summary>
        /// <history>
        ///     [cnurse]	9/9/2004	Modified
        ///     [VMasanas]  9/12/2004   Move skin deassignment to DeletePortalInfo.
        /// </history>
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                PortalController objPortalController = new PortalController();
                PortalInfo       objPortalInfo       = objPortalController.GetPortal(intPortalId);

                if (objPortalInfo != null)
                {
                    string strMessage = PortalController.DeletePortal(objPortalInfo, Globals.GetAbsoluteServerPath(Request));
                    objPortalController.DeletePortalMail(intPortalId);
                    if (string.IsNullOrEmpty(strMessage))
                    {
                        EventLogController objEventLog = new EventLogController();
                        objEventLog.AddLog("PortalName", objPortalInfo.PortalName, PortalSettings, UserId, EventLogController.EventLogType.PORTAL_DELETED);

                        // Redirect to another site
                        if (intPortalId == PortalId)
                        {
                            if (PortalSettings.HostSettings["HostURL"].ToString() != "")
                            {
                                Response.Redirect(Globals.AddHTTP(PortalSettings.HostSettings["HostURL"].ToString()));
                            }
                            else
                            {
                                Response.End();
                            }
                        }
                        else
                        {
                            Response.Redirect(Convert.ToString(ViewState["UrlReferrer"]), true);
                        }
                    }
                    else
                    {
                        UI.Skins.Skin.AddModuleMessage(this, strMessage, ModuleMessageType.RedError);
                    }
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }