Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
c475d5c970
3 files changed
+53
-2
No files matched your search
@@ -927,4 +927,16 @@
|
||||
<data name="Test" xml:space="preserve">
|
||||
<value>測試</value>
|
||||
</data>
|
||||
<data name="Mode" xml:space="preserve">
|
||||
<value>模式</value>
|
||||
</data>
|
||||
<data name="Password" xml:space="preserve">
|
||||
<value>密碼</value>
|
||||
</data>
|
||||
<data name="SQL" xml:space="preserve">
|
||||
<value>資料庫</value>
|
||||
</data>
|
||||
<data name="SERVER" xml:space="preserve">
|
||||
<value>伺服器</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
@@ -71,7 +72,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
if (TEXT_SQMOD.Text == "Windows Authentication") //连接数据库测试
|
||||
{
|
||||
Connstr_SC = "server=" + TEXT_SQLIP.Text + ";database=" + TEXT_SQLNAME.Text + ";Trusted_Connection=SSPI";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -97,6 +97,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL3", TEXT_SQMOD.SelectedValue.ToString());
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL4", TEXT_SQLUSER.Text);
|
||||
Configini.IniWritevalue("SQL_SERVER", "SQL5", TEXT_SQLPASWORD.Text);
|
||||
|
||||
MainWindowViewModel.SQLIP = TEXT_SQLIP.Text;
|
||||
MainWindowViewModel.SQLNAME = TEXT_SQLNAME.Text;
|
||||
MainWindowViewModel.SQMOD = TEXT_SQMOD.Text;
|
||||
MainWindowViewModel.SQLUSER = TEXT_SQLUSER.Text;
|
||||
MainWindowViewModel.SQLNAME = TEXT_SQLNAME.Text;
|
||||
MainWindowViewModel.SQL_LINK();//更新设定
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
@@ -42,6 +44,35 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
}
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
//调用配置文件
|
||||
private static UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
public static string SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||
public static string SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||
public static string SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||
public static string SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||
public static string SQLPASWORD = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||
public static SqlConnection conn_SC =new SqlConnection();//数据库
|
||||
|
||||
public static async void SQL_LINK()//连接dbc数据库
|
||||
{
|
||||
if (conn_SC.State == ConnectionState.Open) conn_SC.Close();
|
||||
try
|
||||
{
|
||||
if (SQMOD == "Windows Authentication") //连接数据库测试
|
||||
{
|
||||
conn_SC = new SqlConnection("server=" + SQLIP + ";database=" + SQLNAME + ";Trusted_Connection=SSPI");
|
||||
}
|
||||
else
|
||||
{
|
||||
conn_SC = new SqlConnection("server=" + SQLIP + ";database=" + SQLNAME + ";User ID=" + SQLUSER + ";Password=" + SQLPASWORD);
|
||||
}
|
||||
await conn_SC.OpenAsync(); //连接数据库
|
||||
//conn_SC.Close();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
public string sys_Time; //显示系统时间
|
||||
public string Sys_Time //通知UI控件参数改变
|
||||
{
|
||||
@@ -125,6 +156,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
|
||||
CountDown();
|
||||
TcpClientNEW();
|
||||
SQL_LINK();
|
||||
}
|
||||
|
||||
public static TcpClient[] MachiensTcpClient = new TcpClient[999];
|
||||
|
||||
Reference in new issue
Block a user