示例#1
0
        /// <summary>
        /// OnUpdate
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            if (Page.IsValid)
            {
                //Get Solutions
                PortalsDB portals = new PortalsDB();

                try {
                    PathField.Text = PathField.Text.Replace("/", string.Empty);
                    PathField.Text = PathField.Text.Replace("\\", string.Empty);
                    PathField.Text = PathField.Text.Replace(".", string.Empty);

                    if (!chkUseXMLTemplate.Checked)
                    {
                        // Create portal the "old" way
                        int NewPortalID =
                            portals.CreatePortal(this.PortalSettings.PortalID, AliasField.Text, TitleField.Text, PathField.Text);

                        // Update custom settings in the database
                        EditTable.ObjectID = NewPortalID;
                        EditTable.UpdateControls();
                    }
                    else
                    {
                        bool createdOk   = true;
                        int  newPortalID = CreatePortal(out createdOk);
                        if (!createdOk)
                        {
                            string aux = General.GetString("NEW_PORTAL_ERROR", "There was an error on creating the portal", this);

                            ErrorMessage.Visible = true;
                            ErrorMessage.Text    = aux + "<br>";
                            return;
                        }
                    }


                    // Redirect back to calling page
                    RedirectBackToReferringPage();
                } catch (Exception ex) {
                    string aux =
                        General.GetString("NEW_PORTAL_ERROR", "There was an error on creating the portal", this);
                    ErrorHandler.Publish(LogLevel.Error, aux, ex);

                    ErrorMessage.Visible = true;
                    ErrorMessage.Text    = aux + "<br>";
                }
            }
        }
示例#2
0
        /// <summary>
        /// OnUpdate
        /// </summary>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            if (Page.IsValid)
            {
                //Get Solutions
                PortalsDB portals = new PortalsDB();

                try
                {
                    PathField.Text = PathField.Text.Replace("/", string.Empty);
                    PathField.Text = PathField.Text.Replace("\\", string.Empty);
                    PathField.Text = PathField.Text.Replace(".", string.Empty);
                    if (chkUseTemplate.Checked == false)
                    {
                        // Create portal the "old" way
                        int NewPortalID = portals.CreatePortal(Convert.ToInt32(SolutionsList.SelectedItem.Value), AliasField.Text, TitleField.Text, PathField.Text);

                        // Update custom settings in the database
                        EditTable.ObjectID = NewPortalID;
                        EditTable.UpdateControls();
                    }
                    else
                    {
                        //Create portal based on the selected portal
                        int NewPortalID = CreatePortal(Convert.ToInt32(SolutionsList.SelectedItem.Value),
                                                       SolutionsList.SelectedItem.Text, AliasField.Text, TitleField.Text, PathField.Text);
                    }

                    // Redirect back to calling page
                    RedirectBackToReferringPage();
                }
                catch (Exception ex)
                {
                    Rainbow.Configuration.ErrorHandler.HandleException(Esperantus.Localize.GetString("NEW_PORTAL_ERROR", "There was an error on creating the portal", this), ex);

                    ErrorMessage.Visible = true;
                    ErrorMessage.Text    = Esperantus.Localize.GetString("NEW_PORTAL_ERROR", "There was an error on creating the portal", this) + "<br>";
                    //ErrorMessage.Text += ex.Message;
                }
            }
        }