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

Diff of /trunk/TSAdminTool/Database.cs

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

--- trunk/TSAdminTool/Database.cs	2012/07/14 13:16:38	130
+++ trunk/TSAdminTool/Database.cs	2012/07/15 02:55:20	131
@@ -14,13 +14,13 @@
 {
     class DatabaseSupport
     {
-        
+
         enum VersionCheck
         {
-            Failed = 0, 
-            Equal, 
+            Failed = 0,
+            Equal,
             DatabaseIsMoreNew,
-            DatabaseIsOlder, 
+            DatabaseIsOlder,
             //DatabaseNotFound,
             DatabaseCreated,
         };
@@ -34,10 +34,10 @@
         {
             Exception ErrorInfo = null;
             try
-            {                
+            {
                 bool bContinue = false;
                 // Create a connection to SQL Server
-                Logging.ATSAdminLog.Debug("SetupDatabase() called ");
+                Logging.DatabaseLog.Debug("SetupDatabase() called ");
                 #region comment-code
                 #region Database Creation support
                 using (MsSqlConnector conn = new MsSqlConnector(ProSupport.strDatabaseServer, ProSupport.strDatabaseInstance, ATSGlobals.strDatabaseName))
@@ -52,29 +52,28 @@
                     {
                         try
                         {
-                            conn.Dispose();
+                            conn.CloseConnection(out ErrorInfo);
                             using (MsSqlConnector conn1 = new MsSqlConnector(ProSupport.strDatabaseServer, ProSupport.strDatabaseInstance, "master"))
                             {
                                 try
                                 {
-                                   
-                                        conn1.CreateConnection(out ErrorInfo);
-                                        conn1.OpenConnection(out ErrorInfo);
+                                    conn1.CreateConnection(out ErrorInfo);
+                                    conn1.OpenConnection(out ErrorInfo);
 
-                                        // create datagbase
-                                        using (log4net.NDC.Push("SetupDatabase().CreateDatabase"))
-                                        {
-                                            Logging.ATSAdminLog.Info(string.Format("Creating Database {0}", ATSGlobals.strDatabaseName));
-                                            RunScript(SQLServerResources.CreateDatabase, conn1, out ErrorInfo);
-                                            Logging.ATSAdminLog.Info(string.Format("Created Database {0}", ATSGlobals.strDatabaseName));
-                                        }
-                                        using (log4net.NDC.Push("SetupDatabase().CreateTables"))
-                                        {
-                                            // create tables
-                                            Logging.ATSAdminLog.Info(string.Format("Creating Tables in {0} Database", ATSGlobals.strDatabaseName));
-                                            RunScript(SQLServerResources.CreateTables, conn1, out ErrorInfo);
-                                            Logging.ATSAdminLog.Info(string.Format("Created Tables in {0} Database", ATSGlobals.strDatabaseName));
-                                        }
+                                    // create datagbase
+                                    using (log4net.NDC.Push("SetupDatabase().CreateDatabase"))
+                                    {
+                                        Logging.DatabaseLog.Info(string.Format("Creating Database {0}", ATSGlobals.strDatabaseName));
+                                        RunScript(SQLServerResources.CreateDatabase, conn1, out ErrorInfo);
+                                        Logging.DatabaseLog.Info(string.Format("Created Database {0}", ATSGlobals.strDatabaseName));
+                                    }
+                                    using (log4net.NDC.Push("SetupDatabase().CreateTables"))
+                                    {
+                                        // create tables
+                                        Logging.DatabaseLog.Info(string.Format("Creating Tables in {0} Database", ATSGlobals.strDatabaseName));
+                                        RunScript(SQLServerResources.CreateTables, conn1, out ErrorInfo);
+                                        Logging.DatabaseLog.Info(string.Format("Created Tables in {0} Database", ATSGlobals.strDatabaseName));
+                                    }
                                 }
                                 catch (Exception ex1)
                                 {
@@ -90,7 +89,6 @@
                         throw ErrorInfo;
                     }
                 }
-                if (ErrorInfo != null) { throw ErrorInfo; }
                 #endregion
 
                 #region Database version check
@@ -99,7 +97,7 @@
                 int chkVer = CheckVersion(out databaseVersion);
                 VersionCheck verChk = (VersionCheck)chkVer;
                 //MessageBox.Show(string.Format("Version Check: {0} Version: {1}", verChk.ToString(), databaseVersion.ToString()));
-                Logging.ATSAdminLog.InfoFormat("Database Version Check: {0} .... Database Version: {1}", verChk.ToString(), databaseVersion.ToString());
+                Logging.DatabaseLog.InfoFormat("Database Version Check: {0} .... Database Version: {1}", verChk.ToString(), databaseVersion.ToString());
                 switch (chkVer)
                 {
                     case (int)VersionCheck.Equal:
@@ -126,30 +124,30 @@
                                         // Run the apropriate upgdrade script(s)
                                         case "1.0.0.0":
                                             {   // Current database is version 1.0.0.0, update to 1.0.0.1
-                                                Logging.ATSAdminLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.0", "1.0.0.1");
+                                                Logging.DatabaseLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.0", "1.0.0.1");
                                                 bContinue = RunScript(SQLServerResources.UpdateDatabase1, conn, out ErrorInfo);
-                                                Logging.ATSAdminLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.0", "1.0.0.1");
+                                                Logging.DatabaseLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.0", "1.0.0.1");
                                                 goto case "1.0.0.1"; // Continue and upgrade one more step
                                             }
                                         case "1.0.0.1":
                                             {   // Current database is version 1.0.0.1, update to 1.0.0.2
-                                                Logging.ATSAdminLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.1", "1.0.0.2");
+                                                Logging.DatabaseLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.1", "1.0.0.2");
                                                 bContinue = RunScript(SQLServerResources.UpdateDatabase2, conn, out ErrorInfo);
-                                                Logging.ATSAdminLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.2", "1.0.0.2");
+                                                Logging.DatabaseLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.2", "1.0.0.2");
                                                 goto case "1.0.0.2"; // Continue and upgrade one more step
                                             }
                                         case "1.0.0.2":
                                             {   // Current database is version 1.0.0.2, update to 1.0.0.3
-                                                Logging.ATSAdminLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.2", "1.0.0.3");
+                                                Logging.DatabaseLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.2", "1.0.0.3");
                                                 bContinue = RunScript(SQLServerResources.UpdateDatabase3, conn, out ErrorInfo);
-                                                Logging.ATSAdminLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.2", "1.0.0.3");
+                                                Logging.DatabaseLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.2", "1.0.0.3");
                                                 goto case "1.0.0.3"; // Continue and upgrade one more step
                                             }
                                         case "1.0.0.3":
                                             {   // Current database is version 1.0.0.3, update to 1.0.0.4
-                                                Logging.ATSAdminLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.3", "1.0.0.4");
+                                                Logging.DatabaseLog.InfoFormat("Upgrading Database from version: {0} to version: {1}", "1.0.0.3", "1.0.0.4");
                                                 bContinue = RunScript(SQLServerResources.UpdateDatabase4, conn, out ErrorInfo);
-                                                Logging.ATSAdminLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.4", "1.0.0.4");
+                                                Logging.DatabaseLog.InfoFormat("Upgraded Database from version: {0} to version: {1}", "1.0.0.4", "1.0.0.4");
                                                 break;
                                             }
                                         default:
@@ -158,13 +156,13 @@
                                                 if (databaseVersion == new Version(0, 0, 0, 0))
                                                 {
                                                     string format = string.Format("Database version is {0}, this should have been auto upgraded to {1}", databaseVersion.ToString(), ATSGlobals.strDatabaseVersion);
-                                                    Logging.ATSAdminLog.Fatal(format);
+                                                    Logging.DatabaseLog.Fatal(format);
                                                     MessageBox.Show(format);
                                                 }
                                                 else
                                                 {
                                                     string format = string.Format("Failed to upgrade Database from version: {0} to version: {1}", databaseVersion.ToString(), ATSGlobals.strDatabaseVersion);
-                                                    Logging.ATSAdminLog.Fatal(format);
+                                                    Logging.DatabaseLog.Fatal(format);
                                                     MessageBox.Show(format);
                                                 }
                                                 break;
@@ -204,7 +202,7 @@
                     ErrorInfo = ex.GetBaseException();
                     using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
                     {
-                        Logging.ATSAdminLog.Error(string.Format("Failed to setup database: {0}", ATSGlobals.strDatabaseName));
+                        Logging.DatabaseLog.Error(string.Format("SetupDatabase() failed"));
                     }
                     throw ErrorInfo;
                 }
@@ -213,14 +211,14 @@
                     ErrorInfo = ErrorInfo.GetBaseException();
                     using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ErrorInfo.GetType().Name, ErrorInfo.Message, System.Environment.NewLine, ErrorInfo.ToString())))
                     {
-                        Logging.ATSAdminLog.Error(string.Format("Failed to setup database: {0}", ATSGlobals.strDatabaseName));
+                        Logging.DatabaseLog.Error(string.Format("SetupDatabase() failed"));
                     }
                     throw ErrorInfo;
                 }
             }
         }
 
- 
+
         public bool RunScript(string strFile, MsSqlConnector con, out Exception ErrorInfo)
         {
             ErrorInfo = null;
@@ -234,7 +232,7 @@
         {
             Exception ErrorInfo = null;
             //Get Version information from application
-            Version v=new Version(ATSGlobals.strDatabaseVersion);
+            Version v = new Version(ATSGlobals.strDatabaseVersion);
             vDb = new Version("0.0.0.0"); // Assign a default value for version
             try
             {
@@ -248,15 +246,13 @@
                 {
                     try
                     {
-                        conn.CreateConnection(out ErrorInfo);
+                        SqlConnection sqlCon = conn.CreateConnection(out ErrorInfo);
                         conn.OpenConnection(out ErrorInfo);
+                        //Logging.DatabaseLog.Debug(string.Format("Getting Coount of {0} databases", ATSGlobals.strDatabaseName));
+                        SqlCommand sqlCmd = new SqlCommand(string.Format("select count(*) from master..sysdatabases where name='{0}'", ATSGlobals.strDatabaseName), sqlCon);
+                        db_count = Convert.ToInt32(sqlCmd.ExecuteScalar());
 
-                        //Logging.ATSAdminLog.Debug(string.Format("Getting Coount of {0} databases", ATSGlobals.strDatabaseName));
-
-                        SqlCommand cmd = conn.CreateCommandInstance(string.Format("select count(*) from master..sysdatabases where name='{0}'", ATSGlobals.strDatabaseName), new List<SqlParameter>(), out ErrorInfo);
-                        db_count = Convert.ToInt32(cmd.ExecuteScalar());
-
-                        Logging.ATSAdminLog.Info(string.Format("Found {0} databases named {1}", db_count, ATSGlobals.strDatabaseName));
+                        Logging.DatabaseLog.Info(string.Format("Found {0} databases named {1}", db_count, ATSGlobals.strDatabaseName));
                     }
                     catch (Exception ex)
                     {
@@ -265,7 +261,7 @@
                             ErrorInfo = ex;
                             using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
                             {
-                                Logging.ATSAdminLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
+                                Logging.DatabaseLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
                             }
                             throw ErrorInfo;
                         }
@@ -274,7 +270,7 @@
                             ErrorInfo = ex.GetBaseException();
                             using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ErrorInfo.GetType().Name, ErrorInfo.Message, System.Environment.NewLine, ErrorInfo.ToString())))
                             {
-                                Logging.ATSAdminLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
+                                Logging.DatabaseLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
                             }
                             throw ErrorInfo;
                         }
@@ -311,16 +307,16 @@
                                         // create datagbase
                                         using (log4net.NDC.Push("CheckVersion().CreateDatabase"))
                                         {
-                                            Logging.ATSAdminLog.Info(string.Format("Creating Database {0}", ATSGlobals.strDatabaseName));
+                                            Logging.DatabaseLog.Info(string.Format("Creating Database {0}", ATSGlobals.strDatabaseName));
                                             RunScript(SQLServerResources.CreateDatabase, conn1, out ErrorInfo);
-                                            Logging.ATSAdminLog.Info(string.Format("Created Database {0}", ATSGlobals.strDatabaseName));
+                                            Logging.DatabaseLog.Info(string.Format("Created Database {0}", ATSGlobals.strDatabaseName));
                                         }
                                         using (log4net.NDC.Push("CheckVersion().CreateTables"))
                                         {
                                             // create tables
-                                            Logging.ATSAdminLog.Info(string.Format("Creating Tables in {0} Database", ATSGlobals.strDatabaseName));
+                                            Logging.DatabaseLog.Info(string.Format("Creating Tables in {0} Database", ATSGlobals.strDatabaseName));
                                             RunScript(SQLServerResources.CreateTables, conn1, out ErrorInfo);
-                                            Logging.ATSAdminLog.Info(string.Format("Created Tables in {0} Database", ATSGlobals.strDatabaseName));
+                                            Logging.DatabaseLog.Info(string.Format("Created Tables in {0} Database", ATSGlobals.strDatabaseName));
                                         }
                                     }
                                     catch (Exception ex1)
@@ -342,21 +338,21 @@
                     #endregion
                 }
 
-                
+
                 #region Get Database Version
                 using (MsSqlConnector conn = new MsSqlConnector(ProSupport.strDatabaseServer, ProSupport.strDatabaseInstance, ATSGlobals.strDatabaseName))
                 {
                     try
                     {
-                        conn.CreateConnection(out ErrorInfo);
+                        SqlConnection sqlCon = conn.CreateConnection(out ErrorInfo);
                         conn.OpenConnection(out ErrorInfo);
 
-                        //Logging.ATSAdminLog.Debug(string.Format("Getting Coount of {0} databases", ATSGlobals.strDatabaseName));
+                        //Logging.DatabaseLog.Debug(string.Format("Getting Coount of {0} databases", ATSGlobals.strDatabaseName));
 
-                        SqlCommand cmd = conn.CreateCommandInstance(string.Format("SELECT value from {0}..AppInfo where property='version'", ATSGlobals.strDatabaseName), new List<SqlParameter>(), out ErrorInfo);
-                        string version = (string)cmd.ExecuteScalar();
+                        SqlCommand sqlCmd = new SqlCommand(string.Format("SELECT value from {0}..AppInfo where property='version'", ATSGlobals.strDatabaseName), sqlCon);
+                        string version = (string)sqlCmd.ExecuteScalar();
                         vDb = new Version(version);
-                        Logging.ATSAdminLog.Info(string.Format("Database {0} is at Version: {1}", ATSGlobals.strDatabaseName, version));
+                        Logging.DatabaseLog.Info(string.Format("Database {0} is at Version: {1}", ATSGlobals.strDatabaseName, version));
                     }
                     catch (Exception ex)
                     {
@@ -365,7 +361,7 @@
                             ErrorInfo = ex;
                             using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ex.GetType().Name, ex.Message, System.Environment.NewLine, ex.ToString())))
                             {
-                                Logging.ATSAdminLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
+                                Logging.DatabaseLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
                             }
                             throw ErrorInfo;
                         }
@@ -374,7 +370,7 @@
                             ErrorInfo = ex.GetBaseException();
                             using (log4net.NDC.Push(string.Format("{0}: MESSAGE={1}{2}Diagnostics:{2}{3}", ErrorInfo.GetType().Name, ErrorInfo.Message, System.Environment.NewLine, ErrorInfo.ToString())))
                             {
-                                Logging.ATSAdminLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
+                                Logging.DatabaseLog.Error(string.Format("Failed to get count of databases named: {0}{1}", System.Environment.NewLine, ATSGlobals.strDatabaseName));
                             }
                             throw ErrorInfo;
                         }
@@ -387,56 +383,56 @@
                 //{
                 //    //using (log4net.NDC.Push(string.Format("SQL Statment={0}", "SELECT value from {0}..AppInfo where property='version'", ATSGlobals.strDatabaseName)))
                 //    //{
-                //        Logging.ATSAdminLog.Debug(string.Format("Getting {0} Database Version#1", ATSGlobals.strDatabaseName));
+                //        Logging.DatabaseLog.Debug(string.Format("Getting {0} Database Version#1", ATSGlobals.strDatabaseName));
                 //        sqlCon = new SqlConnection(Properties.Settings.Default.atsConnectionString.Replace(ATSGlobals.strDatabaseName, "master"));
                 //        if (sqlCon.State != ConnectionState.Open) sqlCon.Open();
                 //        sqlCmd = new SqlCommand(string.Format("SELECT value from {0}..AppInfo where property='version'",ATSGlobals.strDatabaseName), sqlCon);
                 //        strResult = (string)sqlCmd.ExecuteScalar();
                 //        sqlCon.Close();
                 //    //}
-                //    Logging.ATSAdminLog.DebugFormat("{0} database version={1}",ATSGlobals.strDatabaseName, strResult);
+                //    Logging.DatabaseLog.DebugFormat("{0} database version={1}",ATSGlobals.strDatabaseName, strResult);
                 //}
                 //catch(SqlException ex)
                 //{
                 //    // the database exists, but one or more tables are missing
                 //    using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", ex.Number.ToString(), ex.Message, System.Environment.NewLine, ex.ToString())))
                 //    {
-                //        Logging.ATSAdminLog.Error("Failed to get database version");
+                //        Logging.DatabaseLog.Error("Failed to get database version");
                 //    }
                 //    try
                 //    {
                 //        //using (log4net.NDC.Push(string.Format("SQL Statment={0}", SQLServerResources.CreateTables)))
                 //        //{
-                //            Logging.ATSAdminLog.Debug(string.Format("Creating Tables in {0} Database in CheckVersion()", ATSGlobals.strDatabaseName));
+                //            Logging.DatabaseLog.Debug(string.Format("Creating Tables in {0} Database in CheckVersion()", ATSGlobals.strDatabaseName));
                 //            sqlCon = new SqlConnection(Properties.Settings.Default.atsConnectionString.Replace(ATSGlobals.strDatabaseName, "master"));
                 //            if (sqlCon.State != ConnectionState.Open) sqlCon.Open();
                 //            RunScript(SQLServerResources.CreateTables);
                 //            sqlCon.Close();
                 //        //}
-                //        Logging.ATSAdminLog.Debug(string.Format("Created Tables in {0} Database in CheckVersion()", ATSGlobals.strDatabaseName));
+                //        Logging.DatabaseLog.Debug(string.Format("Created Tables in {0} Database in CheckVersion()", ATSGlobals.strDatabaseName));
                 //        using (log4net.NDC.Push(string.Format("SQL Statment={0}", string.Format("SELECT value from {0}..AppInfo where property='version'", ATSGlobals.strDatabaseName))))
                 //        {
-                //            Logging.ATSAdminLog.Debug(string.Format("Getting {0} Database Version#2", ATSGlobals.strDatabaseName));
+                //            Logging.DatabaseLog.Debug(string.Format("Getting {0} Database Version#2", ATSGlobals.strDatabaseName));
                 //            sqlCon = new SqlConnection(Properties.Settings.Default.atsConnectionString.Replace(ATSGlobals.strDatabaseName, "master"));
                 //            if (sqlCon.State != ConnectionState.Open) sqlCon.Open();
                 //            sqlCmd = new SqlCommand(string.Format("SELECT value from {0}..AppInfo where property='version'", ATSGlobals.strDatabaseName), sqlCon);
                 //            strResult = (string)sqlCmd.ExecuteScalar();
                 //            sqlCon.Close();
                 //        }
-                //        Logging.ATSAdminLog.DebugFormat("{0} database version={1}",ATSGlobals.strDatabaseName, strResult);
+                //        Logging.DatabaseLog.DebugFormat("{0} database version={1}",ATSGlobals.strDatabaseName, strResult);
                 //    }
                 //    catch(SqlException ex1)
                 //    {
                 //        using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", ex1.Number.ToString(), ex1.Message, System.Environment.NewLine, ex1.ToString())))
                 //        {
-                //            Logging.ATSAdminLog.Error("Failed to get database version");
+                //            Logging.DatabaseLog.Error("Failed to get database version");
                 //        }
                 //        return (int)VersionCheck.Failed;
                 //    }
                 //}
                 #endregion
-                
-          
+
+
                 //sqlCon.Close();
 
                 if (vDb == v)
@@ -445,16 +441,16 @@
                 if (vDb > v)
                     return (int)VersionCheck.DatabaseIsMoreNew;
 
-                else 
+                else
                     return (int)VersionCheck.DatabaseIsOlder;
-                
+
             }
             catch (SqlException sql_ex)
             {
                 MessageBox.Show(sql_ex.Number.ToString() + " " + sql_ex.Message.ToString());
                 using (log4net.NDC.Push(string.Format("SqlException: ID={0} MESSAGE={1}{2}Diagnostics:{2}{3}", sql_ex.Number.ToString(), sql_ex.Message, System.Environment.NewLine, sql_ex.ToString())))
                 {
-                    Logging.ATSAdminLog.Error("Failed to check database version");
+                    Logging.DatabaseLog.Error("Failed to check database version");
                 }
                 return (int)VersionCheck.Failed;
             }
@@ -463,13 +459,13 @@
                 MessageBox.Show(system_ex.Message.ToString());
                 using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", system_ex.Message, System.Environment.NewLine, system_ex.ToString())))
                 {
-                    Logging.ATSAdminLog.Error("Failed to check database version");
+                    Logging.DatabaseLog.Error("Failed to check database version");
                 }
                 return (int)VersionCheck.Failed;
             }
         }
 
-      
+
 
 
         //[Obsolete("SetDatabaseRights() has been deperecated - user rights are assigned via SQL Server", true)]
@@ -486,7 +482,7 @@
         //        MessageBox.Show("Cannot set access rights for users to the database. Do you have the sufficient rights? Application will abort. Error: " + e.Message);
         //        using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
         //        {
-        //            Logging.ATSAdminLog.Fatal("Cannot set access rights for users to the database.");
+        //            Logging.DatabaseLog.Fatal("Cannot set access rights for users to the database.");
         //        }
         //        Application.Exit();
         //        return;
@@ -511,7 +507,7 @@
                 MessageBox.Show("Could not start the SQL Browser service (13078). Error:" + e.Message);
                 using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
                 {
-                    Logging.ATSAdminLog.Error("Could not start the SQL Browser service (13078).");
+                    Logging.DatabaseLog.Error("Could not start the SQL Browser service (13078).");
                 }
             }
         }
@@ -531,19 +527,19 @@
 
                 }
             }
-            catch(Exception e)
+            catch (Exception e)
             {
                 MessageBox.Show("Error, could not configure SQL Browser service (24888). Please check that SQL Server is intalled and that you are logged in with sufficient rights to configure services. Then retry the operation.");
                 using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
                 {
-                    Logging.ATSAdminLog.Fatal("Could not configure SQL Browser service (24888). Please check that SQL Server is intalled and that you are logged in with sufficient rights to configure services. Then retry the operation.");
+                    Logging.DatabaseLog.Fatal("Could not configure SQL Browser service (24888). Please check that SQL Server is intalled and that you are logged in with sufficient rights to configure services. Then retry the operation.");
                 }
             }
         }
 
         // Enable named pipes on the SQL Express server
         public static bool EnableNamedPipes()
-        { 
+        {
             ManagementScope manScope = new ManagementScope(@"\\.\root\Microsoft\SqlServer\ComputerManagement");
             ManagementClass sqlServicesMan = new ManagementClass(manScope, new ManagementPath("SqlService"), null);
             ManagementClass serverProtocolsMan = new ManagementClass(manScope, new ManagementPath("ServerNetworkProtocol"), null);
@@ -561,7 +557,7 @@
                     if (!(bool)prot.GetPropertyValue("Enabled"))
                     {   // Named pipes not activated
                         prot.InvokeMethod("SetEnable", null);  // Activate named pipes
-              
+
                         // Check if user wants to restart SQL server
                         DialogResult resultRights;
                         resultRights = MessageBox.Show(string.Format("In order for users to use the AnywhereTS control panel, the {0} service on this computer need to be restarted. This operation might take up to 60 seconds. Do you want restart the {0} service now?", InstanceName), string.Format("AnywhereTS - Restart {0} (This operation might take up to 60 seconds!)", InstanceName), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

 

  ViewVC Help
Powered by ViewVC 1.1.22