Browse Source

添加原料工艺信息保存

master
sc 3 months ago
parent
commit
0203a9c6ba
  1. 2
      ProcessManageUI/MainWindow.xaml
  2. 33
      ProcessManageUI/MainWindow.xaml.cs

2
ProcessManageUI/MainWindow.xaml

@ -24,7 +24,7 @@
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,10,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" <TextBox HorizontalAlignment="Right" Height="20" Margin="0,10,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
FontSize="14" x:Name="IP"/> FontSize="14" x:Name="IP"/>
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,40,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" <TextBox HorizontalAlignment="Right" Height="20" Margin="0,40,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
FontSize="14" x:Name="MOD" IsEnabled="False"/> FontSize="14" x:Name="MOD" IsReadOnly="True"/>
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,70,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" <TextBox HorizontalAlignment="Right" Height="20" Margin="0,70,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"
FontSize="14" x:Name="NAME"/> FontSize="14" x:Name="NAME"/>
<TextBox HorizontalAlignment="Right" Height="20" Margin="0,100,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" <TextBox HorizontalAlignment="Right" Height="20" Margin="0,100,20,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200"

33
ProcessManageUI/MainWindow.xaml.cs

@ -13,6 +13,7 @@ using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
@ -192,10 +193,42 @@ namespace ProcessManageUI
{ {
if (DATAGRID_TABLE == 1) if (DATAGRID_TABLE == 1)
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.Delete("ProcessManage", null, null);
DataTable data_t = Product.Clone();
Product.AcceptChanges();
for (int i = 0; i < Product.Rows.Count; i++)
{
data_t.Clear();//清空
DataRow dt = Product.Rows[i];//行转换
DataRow drT = data_t.NewRow();
drT.ItemArray = dt.ItemArray;
data_t.Rows.InsertAt(drT, 0);
SQLiteHelpers.InsertData("ProcessManage", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
}
SQLiteHelpers.Close(); //关闭连接
inf.Text = "染料信息已储存"; inf.Text = "染料信息已储存";
} }
else if (DATAGRID_TABLE == 2) else if (DATAGRID_TABLE == 2)
{ {
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.Delete("Gram", null, null);
DataTable data_t = Gram.Clone();
Product.AcceptChanges();
for (int i = 0; i < Gram.Rows.Count; i++)
{
data_t.Clear();//清空
DataRow dt = Gram.Rows[i];//行转换
DataRow drT = data_t.NewRow();
drT.ItemArray = dt.ItemArray;
data_t.Rows.InsertAt(drT, 0);
SQLiteHelpers.InsertData("Gram", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
}
SQLiteHelpers.Close(); //关闭连接
inf.Text = "流程信息已储存"; inf.Text = "流程信息已储存";
} }

Loading…
Cancel
Save