/[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

revision 148 by william, Sun Jul 15 08:14:41 2012 UTC revision 149 by william, Sun Jul 15 11:21:36 2012 UTC
# Line 29  namespace AnywhereTS Line 29  namespace AnywhereTS
29          //private SqlCommand sqlCmd = new SqlCommand();          //private SqlCommand sqlCmd = new SqlCommand();
30    
31          const string SQL_BROWSER_SERVICE_NAME = "SQLBrowser";          const string SQL_BROWSER_SERVICE_NAME = "SQLBrowser";
32          public static string InstanceName { get { return AnywhereTS.DBSupport.Properties.Settings.Default.DBInstance; } }          //public static string InstanceName { get { return ProSupport.strDatabaseInstance; } }
33          public bool SetupDatabase()          public bool SetupDatabase()
34          {          {
35              Exception ErrorInfo = null;              Exception ErrorInfo = null;
# Line 580  namespace AnywhereTS Line 580  namespace AnywhereTS
580              {              {
581                  prot.Get();                  prot.Get();
582                  if ((string)prot.GetPropertyValue("ProtocolName") == "Np" &&  //Named pipes                  if ((string)prot.GetPropertyValue("ProtocolName") == "Np" &&  //Named pipes
583                      (string)prot.GetPropertyValue("InstanceName") == InstanceName)                      (string)prot.GetPropertyValue("InstanceName") == ProSupport.strDatabaseInstance)
584                  {   // We found the named pipes protocol                  {   // We found the named pipes protocol
585                      if (!(bool)prot.GetPropertyValue("Enabled"))                      if (!(bool)prot.GetPropertyValue("Enabled"))
586                      {   // Named pipes not activated                      {   // Named pipes not activated
# Line 588  namespace AnywhereTS Line 588  namespace AnywhereTS
588    
589                          // Check if user wants to restart SQL server                          // Check if user wants to restart SQL server
590                          DialogResult resultRights;                          DialogResult resultRights;
591                          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);                          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?", ProSupport.strDatabaseInstance), string.Format("AnywhereTS - Restart {0} (This operation might take up to 60 seconds!)", ProSupport.strDatabaseInstance), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
592                          if (resultRights == DialogResult.Yes)                          if (resultRights == DialogResult.Yes)
593                          {                          {
594                              // Restart the SQL server                              // Restart the SQL server
# Line 597  namespace AnywhereTS Line 597  namespace AnywhereTS
597                              foreach (ManagementObject svc in sqlServicesMan.GetInstances())                              foreach (ManagementObject svc in sqlServicesMan.GetInstances())
598                              {                              {
599                                  if ((uint)svc.GetPropertyValue("SqlServiceType") == sqlServerService &&                                  if ((uint)svc.GetPropertyValue("SqlServiceType") == sqlServerService &&
600                                      (string)svc.GetPropertyValue("ServiceName") == string.Format("MSSQL${0}", InstanceName))                                      (string)svc.GetPropertyValue("ServiceName") == string.Format("MSSQL${0}", ProSupport.strDatabaseInstance))
601                                  {                                  {
602                                      svc.Get();                                      svc.Get();
603                                      if ((uint)svc.GetPropertyValue("State") != sqlServiceStopped)                                      if ((uint)svc.GetPropertyValue("State") != sqlServiceStopped)

Legend:
Removed from v.148  
changed lines
  Added in v.149

  ViewVC Help
Powered by ViewVC 1.1.22