Exemple #1
0
        private Boolean CreateSDEDatabase()
        {
            Boolean finished = false;

            try
            {
                if ((m_type == NavServerType.Base) && (m_sdeSetupFileName != String.Empty))
                {
                    StringBuilder m_shortPath = new StringBuilder(1000);
                    InstallUtility.GetShortPathName(m_ecpLocation, m_shortPath, m_shortPath.Capacity);

                    String arguments = String.Format("{0} {1} {2} {3} {4}", m_serverName, m_databaseName, m_instanceName, m_instance, m_shortPath.ToString());

                    BatchProgressForm dbFrm = new BatchProgressForm(m_dbScriptPath, m_sdeSetupFileName, arguments);
                    if (dbFrm.ShowDialog() == DialogResult.OK)
                    {
                        finished = true;
                    }
                }
            }
            catch (Exception exc)
            {
                InstallUtility.ExceptionHandler(exc, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
            return(finished);
        }
Exemple #2
0
        private Boolean CreateSQLDatabase()
        {
            Boolean finished = false;

            try
            {
                StringBuilder m_shortPath = new StringBuilder(1000);
                InstallUtility.GetShortPathName(m_dbLocation, m_shortPath, m_shortPath.Capacity);

                StringBuilder m_shortBackupPath = new StringBuilder(1000);
                InstallUtility.GetShortPathName(m_backupLocation, m_shortBackupPath, m_shortBackupPath.Capacity);

                String arguments;
                String typeStr = (m_type == NavServerType.Central) ? "CNS" : "BNS";

                if (rdoUseSQLServerAuthentication.Checked)
                {
                    arguments = String.Format("{0} {1} SQL {2} {3} {4} {5} {6}", m_serverName, m_databaseName, typeStr, m_shortPath.ToString(), m_shortBackupPath.ToString(), m_userName, m_password);
                }
                else
                {
                    arguments = String.Format("{0} {1} WIN {2} {3} {4}", m_serverName, m_databaseName, typeStr, m_shortPath.ToString(), m_shortBackupPath.ToString());
                }
                BatchProgressForm dbFrm = new BatchProgressForm(m_dbScriptPath, m_dbSetupFileName, arguments);
                if (dbFrm.ShowDialog() == DialogResult.OK)
                {
                    finished = true;
                }
            }
            catch (Exception exc)
            {
                InstallUtility.ExceptionHandler(exc, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
            return(finished);
        }
Exemple #3
0
        public void ServiceInstaller()
        {
            // Arrange

            // Act
            bool   ok      = true;
            string message = string.Empty;

            //make sure the service isn't there
            ok = InstallUtility.InstallService(install: false, message: out message);


            //in each test/assert below, the service shoud succeed, then fail due to duplicate action

            //install
            ok = InstallUtility.InstallService(install: true, message: out message);
            Assert.IsTrue(ok);
            //repeat install (should fail)
            ok = InstallUtility.InstallService(install: true, message: out message);
            Assert.IsFalse(ok);

            //uninstall
            ok = InstallUtility.InstallService(install: false, message: out message);
            Assert.IsTrue(ok);
            //repeat uninstall (should fail)
            ok = InstallUtility.InstallService(install: false, message: out message);
            Assert.IsFalse(ok);
        }
Exemple #4
0
 private void rdoAuthentication_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         ManageControls();
     }
     catch (Exception exc)
     {
         InstallUtility.ExceptionHandler(exc, System.Reflection.MethodInfo.GetCurrentMethod().Name);
     }
 }
Exemple #5
0
 private void DatabaseSetupForm_Load(object sender, EventArgs e)
 {
     try
     {
         SetupControls();
         ManageControls();
     }
     catch (Exception exc)
     {
         InstallUtility.ExceptionHandler(exc, System.Reflection.MethodInfo.GetCurrentMethod().Name);
     }
 }
Exemple #6
0
 // 170507 EDS #892 Only lookup setup files in CreateNewProject
 private void CreateNewProject()
 {
     try
     {
         String scriptLocation = FileLocator.FindFile(m_dbSetupFileName, Path.GetDirectoryName(Application.ExecutablePath), false);
         m_dbScriptPath = Path.GetDirectoryName(scriptLocation);
         if (CreateSQLDatabase())
         {
             if (CreateSDEDatabase())
             {
                 String finishedString = String.Format(Strings.Value((m_task == NavServerSetupTask.Create) ? "strDBCreationComplete" : "strDBUpgradeComplete"),
                                                       m_databaseName, m_serverName);
                 MessageBox.Show(Strings.Value(finishedString, Assembly.GetExecutingAssembly()));
             }
         }
     }
     catch (Exception exc)
     {
         InstallUtility.ExceptionHandler(exc, System.Reflection.MethodInfo.GetCurrentMethod().Name);
     }
     DialogResult = DialogResult.OK;
     this.Close();
 }
Exemple #7
0
        // 170507 EDS #892 Only lookup setup files in CreateNewProject. Removed redundant code
        private void cmdContinue_Click(object sender, EventArgs e)
        {
            m_serverName     = txtServerName.Text;
            m_databaseName   = txtDatabaseName.Text;
            m_instanceName   = txtInstanceName.Text;
            m_instance       = txtInstance.Text;
            m_ecpLocation    = txtLicenseFile.Text;
            m_dbLocation     = txtLocation.Text;
            m_backupLocation = txtLocationBackup.Text;

            m_userName = txtUsername.Text;
            m_password = txtPassword.Text;


            try
            {
                switch (m_task)
                {
                case NavServerSetupTask.Create:
                    CreateNewProject();
                    break;

                case NavServerSetupTask.Upgrade:
                    StatusCheck.Perform(m_serverName, m_databaseName, rdoUseSQLServerAuthentication.Checked, m_userName, m_password, m_dbLocation, m_backupLocation, m_instance, m_instanceName, m_sdeSetupFileName);
                    break;

                default:
                    break;
                }
            }
            catch (Exception exc)
            {
                InstallUtility.ExceptionHandler(exc, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
            DialogResult = DialogResult.OK;
            this.Close();
        }
Exemple #8
0
        /// <summary>
        /// SetupControls : hides controls and resizes display depending on nav server type and installation task
        /// </summary>
        // 271006 EDS #416 Initialise the server name text box to the machine name
        private void SetupControls()
        {
            try
            {
                txtServerName.Text = System.Environment.MachineName;
                rdoUseWindowsAuthentication.Checked = true;

                grpSDESettings.Visible = ((m_task == NavServerSetupTask.Create) && (m_type == NavServerType.Base));
                grpLocations.Visible   = (m_task == NavServerSetupTask.Create);

                if (grpSDESettings.Visible == false)
                {
                    this.Height -= grpSDESettings.Height;
                }
                if (grpLocations.Visible == false)
                {
                    this.Height -= grpLocations.Height;
                }
            }
            catch (Exception exc)
            {
                InstallUtility.ExceptionHandler(exc, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
        }
Exemple #9
0
 /// <summary>
 /// Handles the Click event of the btnNext control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected override void btnNext_Click(object sender, EventArgs e)
 {
     try {
         if (rdoNewOrExistingDatabase.SelectedItem != null)
         {
             if (rdoNewOrExistingDatabase.SelectedItem.Text.Equals("Create a New Database"))
             {
                 InstallUtility.CreateDatabase(txtDatabaseName.Text.Trim(), GetMasterConnectionString());
             }
         }
         if (!chkUseConnectionStringConfig.Checked)
         {
             string connectionString = GetConnectionString();
             InstallUtility.SetConnectionString("dashCommerce", connectionString);
         }
         //else {
         //  base.Step++;
         //}
         Response.Redirect(string.Format("~/install/install.aspx?step={0}&selected_language={1}", this.Step + 1, ddlLanguage.SelectedValue), true);
     }
     catch (Exception ex) {
         MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
     }
 }
        protected virtual void RunServiceAction(string[] args)
        {
            if (args.Length < 2)
            {
                WriteHelpAndExit("Not enough arguments specified.");
            }

            string option = args[1].ToLower();

            switch (option)
            {
            case "run":
            {
                string[] arguments = new string[] { };
                if (args.Length > 2)
                {
                    arguments = new string[args.Length - 2];
                    for (int i = 2; i < args.Length; i++)
                    {
                        arguments[i - 2] = args[i];
                    }
                }
                SynapseServer.RunConsole(arguments);
                break;
            }

            case "install":
            {
                string message = string.Empty;
                bool   error   = false;
                Dictionary <string, string> values = ParseCmdLine(args, 2, ref error, true);
                if (!InstallUtility.InstallAndStartService(serverRole: ServerRole.Node, installOptions: values, message: out message))
                {
                    Console.WriteLine(message);
                    Environment.Exit(1);
                }

                break;
            }

            case "uninstall":
            {
                string message = string.Empty;
                bool   error   = false;
                Dictionary <string, string> values = ParseCmdLine(args, 2, ref error, true);
                if (!InstallUtility.StopAndUninstallService(installOptions: values, message: out message))
                {
                    Console.WriteLine(message);
                    Environment.Exit(1);
                }

                break;
            }

            default:
            {
                WriteHelpAndExit("Unknown service action.");
                Environment.Exit(1);

                break;
            }
            }
        }