示例#1
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>");
                }
            }
        }