mvvm模式升级从 packages.config 迁移到 PackageReference

This commit is contained in:
sc committed 2024-06-29 23:20:36 +08:00
commit 83a38deaa6
56 files changed
+612 -1158

No files matched your search

+23 -32
View File
@@ -1,24 +1,11 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Runtime.InteropServices;
using System.Data.SqlClient;
using System.Data;
using System.Security.Policy;
using System.IO;
using formula_manage.Windows;
namespace formula_manage
{
@@ -31,7 +18,7 @@ namespace formula_manage
DataTable logindataTable = new DataTable(); //建立login缓存
public Login()
public Login()
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
@@ -68,12 +55,12 @@ namespace formula_manage
UserClass.LogGing.LogGingDATA("LOGon = ENGINEER");
Main.ShowDialog();//实例化并置顶打开窗口
}
}
else
{
string var_sql;
string var_sql;
if (pasword =="") var_sql = "[UserCode]='" + user + "' and [PassWord] is null"; //查询字符
if (pasword == "") var_sql = "[UserCode]='" + user + "' and [PassWord] is null"; //查询字符
else var_sql = "[UserCode]='" + user + "' and [PassWord]='" + pasword + "'";
var loginOK = this.logindataTable.Select(var_sql).FirstOrDefault(); //查询账号信息是否正确,不正确返回null
@@ -91,7 +78,7 @@ namespace formula_manage
Main.ShowDialog();//实例化并置顶打开窗口
}
else
System.Windows.MessageBox.Show("账号或密码错误");
System.Windows.MessageBox.Show("账号或密码错误");
}
}
@@ -126,15 +113,16 @@ namespace formula_manage
DBCLINK.Visibility = Visibility.Hidden;
EXLINK.Visibility = Visibility.Hidden;
USERLINK.Visibility = Visibility.Hidden;
DISPENLINK.Background = Brushes.Red;
DISPENLINK.Background = Brushes.Red;
}
if (Boolean.Parse(Configini.IniReadvalue("SOFTWARE_SET", "L6")))
{
try
{
EXLINK.Background = Brushes.Green;
}catch(Exception)
EXLINK.Background = Brushes.Green;
}
catch (Exception)
{
EXLINK.Background = Brushes.Red;
System.Windows.MessageBox.Show("扩展程序未启动");
@@ -149,16 +137,17 @@ namespace formula_manage
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
SQL2 = Boolean.Parse(Configini.IniReadvalue("SQL_SERVER", "SQL6")); //数据库对象2是否生效
}catch(Exception)
{
System.Windows.MessageBox.Show("配置信息丢失");
}
catch (Exception)
{
System.Windows.MessageBox.Show("配置信息丢失");
}
if (TEXT_SQMOD == "0") //判断连接方式
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
}
else
else
{
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
}
@@ -167,8 +156,9 @@ namespace formula_manage
try
{
await conn_SC.OpenAsync();
}catch (Exception)
await conn_SC.OpenAsync();
}
catch (Exception)
{
DISPENLINK.Background = Brushes.Red; //连接失败红色
DBCLINK.Background = Brushes.Red;
@@ -179,7 +169,7 @@ namespace formula_manage
UserClass.LogGing.LogGingDATA("DISPENLINK = ConnectFailed");
return;
}
}
conn_SC.Close(); //关闭连接
DISPENLINK.Background = Brushes.Green; //连接成功绿色
@@ -200,10 +190,11 @@ namespace formula_manage
}
SqlConnection conn_DBC = new SqlConnection(Connstr_DBC);
try
try
{
await conn_DBC.OpenAsync();
}catch (Exception)
}
catch (Exception)
{
DBCLINK.Background = Brushes.Red; //连接失败红色
System.Windows.MessageBox.Show("连接数据库失败");