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

Diff of /trunk/TSAdminTool/frmAdmin.cs

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

revision 57 by william, Thu Jul 12 16:47:17 2012 UTC revision 63 by william, Thu Jul 12 18:17:31 2012 UTC
# Line 9  namespace AnywhereTS Line 9  namespace AnywhereTS
9      using System.Windows.Forms;      using System.Windows.Forms;
10      using System.Runtime.InteropServices;      using System.Runtime.InteropServices;
11      using System.IO;      using System.IO;
12      using System.Data.SqlClient; // For File operations      using System.Data.SqlClient;
13        using System.Security.Permissions; // For File operations
14            
15    
16      public partial class frmAdmin : Form      public partial class frmAdmin : Form
# Line 23  namespace AnywhereTS Line 24  namespace AnywhereTS
24          private string selectedClientMacAddress; // The MAC address of the currently selected client.          private string selectedClientMacAddress; // The MAC address of the currently selected client.
25          public frmAdmin()          public frmAdmin()
26          {          {
27              InitializeComponent();              InitializeComponent();            
28              AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);          }  
         }  
   
         static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)  
         {  
             Exception ex = (e.ExceptionObject as Exception);  
             if (ex == null)  
             {  
                 Logging.ATSAdminLog.Error("Encountered unhandled Exception, but the exception was null");  
                 return;  
             }  
             if (ex.GetType() == typeof(SqlException))  
             {  
                 SqlException sql_ex = (ex as SqlException);  
                 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("Encountered unhandled SqlException");  
                 }  
             }  
             else  
             {  
                 using (log4net.NDC.Push(string.Format("Exception: MESSAGE={0}{1}Diagnostics:{1}{2}", ex.Message, System.Environment.NewLine, ex.ToString())))  
                 {  
                     Logging.ATSAdminLog.Error("Encountered unhandled Exception");  
                 }  
             }  
         }  
29    
30          private void frmAdmin_Load(object sender, EventArgs e)          private void frmAdmin_Load(object sender, EventArgs e)
31          {          {            
32              this.Cursor = Cursors.WaitCursor;              //this.Cursor = Cursors.WaitCursor;
33    
34              UpdateControlsToReflectProgramVersion();              UpdateControlsToReflectProgramVersion();
35    
# Line 634  namespace AnywhereTS Line 609  namespace AnywhereTS
609                  }                  }
610                  else                  else
611                  {                  {
612                      throw new Exception("Error: Cannot find record to delete (43556)");                      //throw new Exception(string.Format("Error: Cannot find record to delete (43556) for mac address: "));
613                        string error = string.Format("Error: Cannot find record to delete (43556) for mac address: {0}", selectedClientMacAddress);
614                        Logging.ATSAdminLog.Error(error);
615                        MessageBox.Show(error);                    
616                  }                  }
617              }              }
618          }          }
# Line 763  namespace AnywhereTS Line 741  namespace AnywhereTS
741    
742    
743          // Configure AnywhereTS          // Configure AnywhereTS
744          // Run first time starting ATS and can also be invoked from the Tools menu.          // Run first time starting ATS and can also be invoked from the Tools menu.        
745          private bool ConfigureATS()          private bool ConfigureATS()
746          {          {
747    
748              DialogResult result;              DialogResult result;
749    
750              if (!ProSupport.IsAnAdministrator())              if (!ProSupport.IsAnAdministrator())

Legend:
Removed from v.57  
changed lines
  Added in v.63

  ViewVC Help
Powered by ViewVC 1.1.22