ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/TSAdminTool/Globals.cs
(Generate patch)

Comparing trunk/TSAdminTool/Globals.cs (file contents):
Revision 46 by william, Thu Jul 12 14:17:14 2012 UTC vs.
Revision 47 by william, Thu Jul 12 14:29:34 2012 UTC

--- trunk/TSAdminTool/Globals.cs	2012/07/12 14:17:14	46
+++ trunk/TSAdminTool/Globals.cs	2012/07/12 14:29:34	47
@@ -6,6 +6,7 @@ using System.IO; // For Path
 using System.Security; // Security Exception
 using System.Windows.Forms; // Message Box
 using System.Text.RegularExpressions; // For validate MAC address
+using log4net;
 
 namespace AnywhereTS
 {
@@ -322,8 +323,7 @@ namespace AnywhereTS
                 else
                 {
                     MessageBox.Show("Error when reading from registry (55222). Value missing. Key: " + regKey + " Value: " + regValue);
-                    using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
-                    {
+                 
                         using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
                         {
                             using (log4net.NDC.Push("Value is missing"))
@@ -331,7 +331,7 @@ namespace AnywhereTS
                                 Logging.ATSAdminLog.Error("Error when reading from registry.");
                             }
                         }
-                    }
+                    
                     Application.Exit();
                     return 0;
                 }
@@ -339,8 +339,7 @@ namespace AnywhereTS
             else
             {
                 MessageBox.Show("Error when reading from registry (55221). Key missing. Key: " + regKey + " Value: " + regValue);
-                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
-                {
+               
                     using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
                     {
                         using (log4net.NDC.Push("Key is missing"))
@@ -348,7 +347,7 @@ namespace AnywhereTS
                             Logging.ATSAdminLog.Error("Error when reading from registry.");
                         }
                     }
-                }
+                
                 Application.Exit();
             }
             return 0; // No value could be retrieved from registry
@@ -515,16 +514,14 @@ namespace AnywhereTS
             else
             {
                 MessageBox.Show("Error when writing to registry (65222). Key missing. Key: " + regKey + " Value: " + regValue);
-                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
-                {
-                    using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
+            using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
                     {
                         using (log4net.NDC.Push("Key is missing"))
                         {
                             Logging.ATSAdminLog.Error("Error when writing to registry.");
                         }
                     }
-                }
+                
                 Application.Exit();
             }
         }
@@ -538,7 +535,7 @@ namespace AnywhereTS
             {
                 objRegkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(regKey);
             }
-            catch (ArgumentNullException)
+            catch (ArgumentNullException e)
             {
                 MessageBox.Show("Error when reading from registry. Installation info missing, please run the " + ATSGlobals.ApplicationName + " installation program. (29411)");
                 using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
@@ -598,8 +595,7 @@ namespace AnywhereTS
             else
             {
                 MessageBox.Show("Error when reading from registry (59221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root);
-                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
-                {
+           
                     using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
                     {
                         using (log4net.NDC.Push("Key is missing"))
@@ -607,7 +603,7 @@ namespace AnywhereTS
                             Logging.ATSAdminLog.Error("Error when reading from registry.");
                         }
                     }
-                }
+                
                 Application.Exit();
             }
             return false; // No value could be retrieved from registry
@@ -779,13 +775,12 @@ namespace AnywhereTS
             else
             {
                 MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root);
-                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
-                {
+          
                     using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
                     {
                             Logging.ATSAdminLog.Error("Error when reading from registry.");                        
                     }
-                }
+                
                 Application.Exit();
             }
         }
@@ -857,13 +852,12 @@ namespace AnywhereTS
             else
             {
                 MessageBox.Show("Error when reading from registry (95221). Key missing. Key: " + regKey + " Value: " + strRegTFTP_root);
-                using (log4net.NDC.Push(string.Format("SqlException: MESSAGE={0}{1}Diagnostics:{1}{2}", e.Message, System.Environment.NewLine, e.ToString())))
-                {
+            
                     using (log4net.NDC.Push(string.Format("key={0} value={1}", regKey, regValue)))
                     {
                             Logging.ATSAdminLog.Error("Error when reading from registry.");                       
                     }
-                }
+                
                 Application.Exit();
             }
         }