用户信息和数据库的增删改查修改
This commit is contained in:
1 parent
10611241d1
commit
5d9ab90ed3
16 files changed
+511
-23
No files matched your search
@@ -84,8 +84,10 @@ namespace SunlightAggregationManager.ViewModel
|
||||
row["State"] = 0;
|
||||
row["LinkID"] = 0;
|
||||
}
|
||||
|
||||
Machines.RowChanged += Machines_Updata;
|
||||
UserData.RowChanged += UserData_Updata;//注册userdata表更新事件
|
||||
UserData.RowDeleting += UserData_Updata;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -210,7 +212,45 @@ namespace SunlightAggregationManager.ViewModel
|
||||
SQLiteHelpers.InsertData("ActionLog", userlog);
|
||||
}
|
||||
}
|
||||
public static void Insert_Memory(DataTable DB, Dictionary<string, object> Value)//插入数据
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (DB)
|
||||
{
|
||||
DataRow drEmployee = DB.NewRow();
|
||||
drEmployee.BeginEdit();
|
||||
|
||||
foreach (KeyValuePair<string, object> kvp in Value)
|
||||
{
|
||||
drEmployee[kvp.Key] = kvp.Value;
|
||||
}
|
||||
drEmployee.EndEdit();
|
||||
DB.Rows.Add(drEmployee);
|
||||
drEmployee.AcceptChanges();
|
||||
// drEmployee.ClearErrors();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Insert_Row:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
public static void Delete_Memory(DataTable DB, string? key)//删除数据
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (DB)
|
||||
{
|
||||
DataRow drEmployee = DB.Select(key).First();
|
||||
drEmployee.Delete();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Delete_Row:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
public static DataRow? Selet_Row(DataTable DB, string? key)//查询
|
||||
{
|
||||
try
|
||||
@@ -294,5 +334,6 @@ namespace SunlightAggregationManager.ViewModel
|
||||
Console.WriteLine("SDTD:" + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user