|
|
@ -4,6 +4,7 @@ using formula_manage.UserClass; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Data; |
|
|
|
using System.Diagnostics.Eventing.Reader; |
|
|
|
using System.Linq; |
|
|
|
using System.Net; |
|
|
|
using System.Text; |
|
|
@ -54,13 +55,12 @@ namespace DyeingComputer.View |
|
|
|
|
|
|
|
if (sql != null) sql.Clear(); //清空缓存
|
|
|
|
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
|
|
|
|
|
|
|
//sql.Tables[0].Rows.Add(datatable_t);
|
|
|
|
DataRow dr = sql.Tables[0].NewRow();//添加表数据
|
|
|
|
dr["ProgramID"] = ProgramID; |
|
|
|
dr["Program"] = ProgramNAME; |
|
|
|
sql.Tables[0].Rows.Add(dr); |
|
|
|
|
|
|
|
Dat(); |
|
|
|
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
|
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
|
|
|
|
@ -68,6 +68,18 @@ namespace DyeingComputer.View |
|
|
|
//System.GC.Collect();
|
|
|
|
} |
|
|
|
|
|
|
|
public void Dat()//行号刷新
|
|
|
|
{ |
|
|
|
int a = sql.Tables[0].Rows.Count; |
|
|
|
for(int i = 0; i <a; i++) |
|
|
|
{ |
|
|
|
DataRow dr = sql.Tables[0].Rows[i]; |
|
|
|
dr.BeginEdit(); |
|
|
|
dr["Step"] = i+1; |
|
|
|
dr.EndEdit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
string Numder = null; |
|
|
|
string ID = null; |
|
|
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
|
|
|
@ -75,8 +87,8 @@ namespace DyeingComputer.View |
|
|
|
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
|
|
|
if (rownum != -1)//判断鼠标定位是否有效
|
|
|
|
{ |
|
|
|
ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
|
|
Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
|
|
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
|
|
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -88,17 +100,41 @@ namespace DyeingComputer.View |
|
|
|
{ |
|
|
|
this.Visibility = Visibility.Collapsed;//隐藏控件
|
|
|
|
} |
|
|
|
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//
|
|
|
|
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除行
|
|
|
|
{ |
|
|
|
int d = 0; |
|
|
|
int a = sql.Tables[0].Rows.Count; |
|
|
|
|
|
|
|
if (ID != null) { d = StrToInt.To16Convert10(ID); } else { return; } |
|
|
|
if (a != d)//如果删除不是最后一行执行
|
|
|
|
{ |
|
|
|
sql.Tables[0].Rows.RemoveAt(d - 1); |
|
|
|
|
|
|
|
Dat(); |
|
|
|
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
|
|
|
} |
|
|
|
} |
|
|
|
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//
|
|
|
|
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入行
|
|
|
|
{ |
|
|
|
int d=0; |
|
|
|
if (ID != null) { d = StrToInt.To16Convert10(ID); } else { return; } |
|
|
|
DataRow dr = sql.Tables[0].NewRow();//添加表数据
|
|
|
|
dr["ProgramID"] = ProgramID; |
|
|
|
dr["Program"] = ProgramNAME; |
|
|
|
sql.Tables[0].Rows.InsertAt(dr,d-1); |
|
|
|
ID = null; |
|
|
|
|
|
|
|
Dat(); |
|
|
|
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
|
|
|
} |
|
|
|
private void ProgramgroupView_Save_Click(object sender, RoutedEventArgs e)//
|
|
|
|
{ |
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
|
|
|
|
|
SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '"+ ProgramID + "'", null); |
|
|
|
|
|
|
|
|
|
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|