Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
8e41751c70
2 files changed
+11
-31
No files matched your search
@@ -14,7 +14,7 @@
|
|||||||
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
|
||||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" InputMethod.IsInputMethodEnabled ="False"
|
||||||
RowEditEnding="Grid_RowEditEnding"
|
CellEditEnding="Grid_CellEditEnding"
|
||||||
Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting" >
|
Background="White" SelectionMode="Single" FontSize="15" Cursor="AppStarting" >
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -29,22 +31,10 @@ namespace DyeingComputer.View
|
|||||||
public ParameterSetView()
|
public ParameterSetView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
set_sql();
|
set_sql();
|
||||||
// Grid.CurrentCell = new DataGridCellInfo(Grid.Items[1], Grid.Columns[3]);
|
|
||||||
|
|
||||||
FocusManager.SetFocusedElement(Grid, Grid);
|
|
||||||
Grid.CurrentCell = new DataGridCellInfo(Grid.Items[Grid.Items.Count-1], Grid.Columns[3]);
|
|
||||||
Grid.BeginEdit();
|
|
||||||
//FocusManager.SetFocusedElement(Grid, Grid);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||||
DataSet sql; //内存数据缓存
|
DataSet sql; //内存数据缓存
|
||||||
@@ -59,36 +49,26 @@ namespace DyeingComputer.View
|
|||||||
if (sql != null) sql.Clear(); //清空缓存
|
if (sql != null) sql.Clear(); //清空缓存
|
||||||
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
||||||
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||||
|
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
//sql.Clear(); //清除缓存
|
|
||||||
//System.GC.Collect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
|
private void Grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)//数据表输入事件
|
||||||
{
|
{
|
||||||
string ID;
|
string ID;
|
||||||
string Numder;
|
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
|
||||||
|
|
||||||
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
ID = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
ID = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Grid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
|
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||||
{
|
datagrid_v.Add("Value", newValue);
|
||||||
string ID;
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
string Numder;
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
SQLiteHelpers.Update("Parameters",datagrid_v , "ParameterID ='"+ ID + "'", null);//更新
|
||||||
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
SQLiteHelpers.Close();//关闭数据库
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
|
||||||
{
|
|
||||||
ID = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
||||||
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user