Browse Source

数据库连接重置,刷新数据库连接功能

章政 6 years ago
parent
commit
c746ad0473

+ 6 - 0
UAS_AutoPass/App.config

@@ -2,6 +2,7 @@
 <configuration>
     <configSections>
         <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+            <section name="UAS_AutoPass.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
             <section name="UAS_AutoPast.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
         </sectionGroup>
     </configSections>
@@ -9,6 +10,11 @@
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
     </startup>
     <userSettings>
+        <UAS_AutoPass.Properties.Settings>
+            <setting name="MES" serializeAs="String">
+                <value>Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=yitoadt.wicp.io)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</value>
+            </setting>
+        </UAS_AutoPass.Properties.Settings>
         <UAS_AutoPast.Properties.Settings>
             <setting name="MES" serializeAs="String">
                 <value>Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</value>

+ 10 - 2
UAS_AutoPass/AutoAnalysisXml.Designer.cs

@@ -28,6 +28,7 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             this.XmlWatcher = new System.IO.FileSystemWatcher();
             this.XmlFolder = new System.Windows.Forms.FolderBrowserDialog();
             this.StartWatch = new System.Windows.Forms.Button();
@@ -46,6 +47,7 @@
             this.AutoStart = new System.Windows.Forms.CheckBox();
             this.ma_code = new System.Windows.Forms.TextBox();
             this.BatchAnalysus = new System.Windows.Forms.Button();
+            this.Timer = new System.Windows.Forms.Timer(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -188,7 +190,7 @@
             this.Master.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.Master.FormattingEnabled = true;
             this.Master.Location = new System.Drawing.Point(149, 29);
-            this.Master.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Master.Margin = new System.Windows.Forms.Padding(4);
             this.Master.Name = "Master";
             this.Master.Size = new System.Drawing.Size(292, 23);
             this.Master.TabIndex = 15;
@@ -197,7 +199,7 @@
             // 
             this.AutoStart.AutoSize = true;
             this.AutoStart.Location = new System.Drawing.Point(457, 32);
-            this.AutoStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.AutoStart.Margin = new System.Windows.Forms.Padding(4);
             this.AutoStart.Name = "AutoStart";
             this.AutoStart.Size = new System.Drawing.Size(119, 19);
             this.AutoStart.TabIndex = 16;
@@ -225,6 +227,11 @@
             this.BatchAnalysus.UseVisualStyleBackColor = true;
             this.BatchAnalysus.Click += new System.EventHandler(this.BatchAnalysus_Click);
             // 
+            // Timer
+            // 
+            this.Timer.Interval = 10000;
+            this.Timer.Tick += new System.EventHandler(this.Timer_Tick);
+            // 
             // AutoAnalysisXml
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
@@ -278,6 +285,7 @@
         private System.Windows.Forms.CheckBox AutoStart;
         private System.Windows.Forms.TextBox ma_code;
         private System.Windows.Forms.Button BatchAnalysus;
+        private System.Windows.Forms.Timer Timer;
     }
 }
 

+ 5 - 2
UAS_AutoPass/AutoAnalysisXml.cs

@@ -7,7 +7,6 @@ using System.Threading;
 using System.Windows.Forms;
 using System.Xml;
 using UAS_AutoPass.ToolClass;
-using BenQGuru.eMES.DLLService;
 using System.Text;
 
 namespace UAS_AutoPass
@@ -21,7 +20,6 @@ namespace UAS_AutoPass
 
         DataTable DB;
 
-        MESHelper helper = new MESHelper();
         /// <summary>
         /// 用户编号
         /// </summary>
@@ -696,5 +694,10 @@ namespace UAS_AutoPass
                 }
             }
         }
+
+        private void Timer_Tick(object sender, EventArgs e)
+        {
+            dh.ExecuteSql("select sysdate from dual", "select");
+        }
     }
 }

+ 3 - 0
UAS_AutoPass/AutoAnalysisXml.resx

@@ -123,4 +123,7 @@
   <metadata name="XmlFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>164, 17</value>
   </metadata>
+  <metadata name="Timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>296, 17</value>
+  </metadata>
 </root>

+ 0 - 3
UAS_AutoPass/AutoPassDataCollect.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Windows.Forms;
-using BenQGuru.eMES.DLLService;
 using System.Collections.Generic;
 using UAS_AutoPass.ToolClass;
 
@@ -8,7 +7,6 @@ namespace UAS_AutoPass
 {
     public partial class AutoPassDataCollect : Form
     {
-        MESHelper helper;
 
         List<string> Data = new List<string>();
         //Queue<string> que = new Queue<string>();
@@ -29,7 +27,6 @@ namespace UAS_AutoPass
         private void Form1_Load(object sender, EventArgs e)
         {
             //dh = new DataHelper();
-            helper = new MESHelper();
             AutoPastTimer.Interval = 1000;
             AutoPastTimer.Tick += AutoPastTimer_Tick;
         }

+ 0 - 1
UAS_AutoPass/Login.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Windows.Forms;
-using BenQGuru.eMES.DLLService;
 using UAS_AutoPass.ToolClass;
 
 namespace UAS_AutoPass

+ 2 - 2
UAS_AutoPass/Properties/Settings.Designer.cs

@@ -26,8 +26,8 @@ namespace UAS_AutoPass.Properties {
         [global::System.Configuration.UserScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
         [global::System.Configuration.DefaultSettingValueAttribute("Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES;Pooling=false" +
-            ";Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230" +
-            ".200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));")]
+            ";Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=yitoadt.wic" +
+            "p.io)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));")]
         public string MES {
             get {
                 return ((string)(this["MES"]));

+ 2 - 2
UAS_AutoPass/Properties/Settings.settings

@@ -1,9 +1,9 @@
 <?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="UAS_AutoPast.Properties" GeneratedClassName="Settings">
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="UAS_AutoPass.Properties" GeneratedClassName="Settings">
   <Profiles />
   <Settings>
     <Setting Name="MES" Type="System.String" Scope="User">
-      <Value Profile="(Default)">Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.230.200)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</Value>
+      <Value Profile="(Default)">Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=yitoadt.wicp.io)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</Value>
     </Setting>
   </Settings>
 </SettingsFile>

+ 0 - 3
UAS_AutoPass/UAS_AutoPass.csproj

@@ -70,9 +70,6 @@
     <SignManifests>false</SignManifests>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="BenQGuru.eMES.DLLService">
-      <HintPath>..\UAS_DLLTest\tool\BenQGuru.eMES.DLLService.dll</HintPath>
-    </Reference>
     <Reference Include="Oracle.ManagedDataAccess">
       <HintPath>..\UAS_DLLTest\tool\Oracle.ManagedDataAccess.dll</HintPath>
     </Reference>