You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.5 KiB
69 lines
2.5 KiB
using SunlightCentralizedControlManagement_SCCM_.UserClass;
|
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.EX
|
|
{
|
|
/// <summary>
|
|
/// DispenseState.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class DispenseState : UserControl
|
|
{
|
|
public DispenseState()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public async void State(object dat,string mac)
|
|
{
|
|
string Connstr_SC;
|
|
string WaitChemical_WaitDispenseDyestuff;
|
|
string DAT = mac.Substring(0,3);
|
|
if (DAT == "252")
|
|
{
|
|
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitDispenseDyestuff] WHERE DispenseMachine = '" + dat + "'";
|
|
}
|
|
else
|
|
{
|
|
WaitChemical_WaitDispenseDyestuff = "SELECT * FROM [dbo].[WaitChemical] WHERE DispenseMachine = '" + dat + "'";
|
|
}
|
|
try
|
|
{
|
|
if (MainWindowViewModel.SQMOD == "Windows Authentication")
|
|
{
|
|
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";Trusted_Connection=SSPI";
|
|
}
|
|
else
|
|
{
|
|
Connstr_SC = "server=" + MainWindowViewModel.SQLIP + ";database=" + MainWindowViewModel.SQLNAME + ";User ID=" + MainWindowViewModel.SQLUSER + ";Password=" + MainWindowViewModel.SQLPASWORD;
|
|
}
|
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
|
|
await conn_SC.OpenAsync(); //连接数据库
|
|
SqlDataAdapter WaitChemical_data = new SqlDataAdapter(WaitChemical_WaitDispenseDyestuff, Connstr_SC); //查询
|
|
conn_SC.Close();
|
|
|
|
DataTable ds = new DataTable();//载入信息
|
|
WaitChemical_data.Fill(ds);
|
|
Grid_data.ItemsSource = ds.DefaultView;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogGing.ERRDATA(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|