/[AnywhereTS-MSSQL]/trunk/TSAdminTool/ATSAmdin.Installer.cs
ViewVC logotype

Diff of /trunk/TSAdminTool/ATSAmdin.Installer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/TSAdminTool/ATSAmdin.Installer.cs	2012/07/15 13:01:23	152
+++ trunk/TSAdminTool/ATSAmdin.Installer.cs	2012/07/15 13:17:36	153
@@ -30,6 +30,43 @@
             dlg.ShowDialog();            
         }
 
+        private void InstallDatabase()
+        {
+            // install the database 
+            Thread db_installer_thread = new Thread(new ThreadStart(InstallDatabaseWaitMessage));
+            db_installer_thread.IsBackground = true;
+            db_installer_thread.Start();
+            Logging.ATSAdminInstallerLog.DebugFormat(@"Installing database: {2} to {0}\{1}", DBServer, DBInstance, ATSGlobals.strDatabaseName);
+            AnywhereTS.DatabaseSupport dbsup = new DatabaseSupport();
+            dbsup.SetupDatabase();
+            dlg.Message = string.Format(@"Successfully installed the database: {2} to {0}\{1}", DBServer, DBInstance, ATSGlobals.strDatabaseName);
+            dlg.ForeColor = Color.Green;
+            Thread.Sleep(new TimeSpan(0, 0, 15));
+            dlg.Close();
+            Logging.ATSAdminInstallerLog.DebugFormat(@"Successfully Installed database: {2} to {0}\{1}", DBServer, DBInstance, ATSGlobals.strDatabaseName);
+        }
+
+        private void ConfigureATS()
+        {
+            try
+            {
+                frmAdmin atsadmin = new frmAdmin();
+                if (!atsadmin.ConfigureATS())
+                {
+                    throw new Exception("AnywhereTS cannot be installed without configuring it first.");
+                }
+            }
+            catch (Exception ex)
+            {
+                // database install failed
+                using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
+                {
+                    Logging.ATSAdminInstallerLog.Error("ConfigureATS() failed.");
+                }
+                throw ex;
+            }
+        }
+
         public override void Install(IDictionary stateSaver)
         {
             base.Install(stateSaver);
@@ -50,18 +87,9 @@
                     ATSGlobals.SetATSRegValue(ProSupport.strRegDatabaseInstance, DBInstance);
                     ProSupport.strDatabaseServer = ATSGlobals.GetATSRegValueString(ProSupport.strRegDatabaseServer);
                     ProSupport.strDatabaseInstance = ATSGlobals.GetATSRegValueString(ProSupport.strRegDatabaseInstance);
-                    // install the database 
-                    Thread db_installer_thread = new Thread(new ThreadStart(InstallDatabaseWaitMessage));
-                    db_installer_thread.IsBackground = true;
-                    db_installer_thread.Start();
-                    Logging.ATSAdminInstallerLog.DebugFormat(@"Installing database: {2} to {0}\{1}", DBServer, DBInstance, ATSGlobals.strDatabaseName);
-                    AnywhereTS.DatabaseSupport dbsup = new DatabaseSupport();
-                    dbsup.SetupDatabase();
-                    dlg.Message = string.Format(@"Successfully installed the database: {2} to {0}\{1}", DBServer, DBInstance, ATSGlobals.strDatabaseName);
-                    dlg.ForeColor = Color.Green;
-                    Thread.Sleep(new TimeSpan(0,0,15));
-                    dlg.Close();
-                    Logging.ATSAdminInstallerLog.DebugFormat(@"Successfully Installed database: {2} to {0}\{1}", DBServer, DBInstance, ATSGlobals.strDatabaseName);
+
+                    InstallDatabase();
+                    ConfigureATS();
                 }
             }
             catch (Exception ex)

 

  ViewVC Help
Powered by ViewVC 1.1.22