示例#1
0
 protected void UpdateButton_Click(object sender, EventArgs e)
 {
     if (AckBox.Checked)
     {
         string message;
         if (ValidateConnection(ConnectionString.Text, out message))
         {
             ConfigUtility.UpdateConnectionString(ConnectionString.Text, EncryptIt.Enabled ? EncryptIt.Checked : false);
             SavedMessage.Text             = "Connection string updated at " + LocaleHelper.LocalNow.ToShortTimeString() + ".";
             SavedMessage.Visible          = true;
             ExistingConnectionString.Text = ConnectionString.Text;
             AckBox.Checked = false;
         }
         else
         {
             ErrorMessage.Text    = "A connection could not be established for the given connection string.  Connection string not updated.  (The server said: " + message + ")";
             ErrorMessage.Visible = true;
         }
     }
     else
     {
         ErrorMessage.Text    = "You did not acknowledge the warning.  Connection string not updated.";
         ErrorMessage.Visible = true;
     }
 }
示例#2
0
        protected void InstallButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (PCIAcknowledgement.Checked)
                {
                    // VALIDATE THE CONNECTION
                    string connectionString = GenerateConnectionString();
                    string connectionMessage;
                    if (ConfigUtility.ValidateConnection(connectionString, out connectionMessage))
                    {
                        if (ValidateKey())
                        {
                            // hide the configuration form
                            FormPanel.Visible = false;

                            // SETUP THE DATABASE
                            List <string> errorList = new List <string>();
                            if (IsNewInstall())
                            {
                                errorList = RunScript(connectionString, Server.MapPath("~/Install/AbleCommerce.sql"));
                            }

                            // WRITE WEB.CONFIG
                            ConfigUtility.UpdateConnectionString(connectionString, true);

                            // IF ITS EXISTING AC7 INSTALL THEN REDIRECT TO UPGRADE PAGE
                            if (!IsNewInstall())
                            {
                                // VALIDATE IF WE HAVE A VALID VERSION OF THE DATABASE TO UPGRADE
                                if (ValidateExistingDatabase(connectionString, errorList))
                                {
                                    Response.Redirect("Upgrade.aspx", true);
                                }
                                else
                                {
                                    ContinueButton2.Visible = false;
                                }
                            }

                            // update results
                            if (errorList.Count == 0)
                            {
                                ConfigurationCompletePanel.Visible = true;
                            }
                            else
                            {
                                ConfigurationErrorPanel.Visible = true;
                                ConfigurationErrorList.Text     = "<p>" + string.Join("</p><p>", errorList.ToArray()) + "</p>";
                            }
                        }
                    }
                    else
                    {
                        HandleError("<p style=\"color:#FF0000;\">The specified database connection could not be opened.</p><p style=\"color:#FF0000;\">Connection String: " + connectionString + "</p><p style=\"color:#FF0000;\">Message: " + connectionMessage + "</p>");
                    }
                }
                else
                {
                    HandleError("<p style=\"color:#FF0000;\">You must acknowledge that you have reviewed the secure implementation guide.</p>");
                }
            }
        }