Beispiel #1
0
        /// <summary>
        /// OnDelete
        /// </summary>
        override protected void OnDelete()
        {
            if (portalList.SelectedIndex != -1)
            {
                try
                {
                    // must delete from database too
                    PortalItem p         = (PortalItem)portals[portalList.SelectedIndex];
                    PortalsDB  portalsdb = new PortalsDB();
                    //Response.Write("Will delete " + p.Name);
                    portalsdb.DeletePortal(p.ID);

                    // remove item from list
                    portals.RemoveAt(portalList.SelectedIndex);
                    // rebind list
                    portalList.DataBind();
                }
                catch (System.Data.SqlClient.SqlException sqlex)
                {
                    Rainbow.Configuration.ErrorHandler.HandleException(Esperantus.Localize.GetString("DELETE_PORTAL_ERROR", "There was an error on deleting the portal", this), sqlex);
                    Controls.Add(new LiteralControl("<br><span class=NormalRed>" + Esperantus.Localize.GetString("DELETE_PORTAL_ERROR", "There was an error on deleting the portal", this) + "<br>"));
                }
            }
            base.OnDelete();
        }
        /// <summary>
        /// OnDelete
        /// </summary>
        protected override void OnDelete()
        {
            if (portalList.SelectedIndex != -1)
            {
                try
                {
                    // must delete from database too
                    PortalItem p         = (PortalItem)portals[portalList.SelectedIndex];
                    PortalsDB  portalsdb = new PortalsDB();
                    //Response.Write("Will delete " + p.Name);
                    portalsdb.DeletePortal(p.ID);

                    // remove item from list
                    portals.RemoveAt(portalList.SelectedIndex);
                    // rebind list
                    portalList.DataBind();
                }
                catch (SqlException sqlex)
                {
                    string aux =
                        General.GetString("DELETE_PORTAL_ERROR", "There was an error on deleting the portal", this);
                    Rainbow.Framework.ErrorHandler.Publish(Rainbow.Framework.LogLevel.Error, aux, sqlex);
                    Controls.Add(new LiteralControl("<br><span class=NormalRed>" + aux + "<br>"));
                }
            }
            base.OnDelete();
        }