From 4c3eb7f334abb8129b57e86f2935d75d0b3070b4 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 03 三月 2025 18:55:31 +0800
Subject: [PATCH] 完善UI;新增TestResult;
---
HMI.ParameterManage/Model/SqlModel.cs | 32 ++++++++++++++++++++++++++++----
1 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/HMI.ParameterManage/ControlModel.cs b/HMI.ParameterManage/Model/SqlModel.cs
similarity index 72%
rename from HMI.ParameterManage/ControlModel.cs
rename to HMI.ParameterManage/Model/SqlModel.cs
index 67d0035..037a083 100644
--- a/HMI.ParameterManage/ControlModel.cs
+++ b/HMI.ParameterManage/Model/SqlModel.cs
@@ -1,16 +1,40 @@
锘縰sing System.Collections.ObjectModel;
using System.Data;
+using System.IO;
using HMI.Core.Entity;
using HMI.Core.Util;
using HMI.ParameterManage.Entity;
-namespace HMI.ParameterManage
+namespace HMI.ParameterManage.Model
{
- public class ControlModel : NotifyBase
+
+ public class SqlModel : NotifyBase
{
- public ControlModel(SqliteHelper sqliteHelper)
+ public SqlModel(string baseFolder)
{
- SqliteHelper = sqliteHelper;
+ string dbpath = Path.Combine(baseFolder, "ParameterManage.db");
+ if (!File.Exists(dbpath))
+ {
+ SqliteHelper.CreateDatabase(dbpath);
+ }
+ SqliteHelper = new SqliteHelper(dbpath);
+ SqliteHelper.ExecuteSql(@"CREATE TABLE IF NOT EXISTS product (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ name TEXT NOT NULL,
+ isMaster INTEGER,
+ parentId INTEGER,
+ UNIQUE(name)
+ );
+CREATE TABLE IF NOT EXISTS parameter (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ name TEXT NOT NULL,
+ value TEXT,
+ unit TEXT,
+ description TEXT,
+ pGroup TEXT,
+ productName TEXT,
+ UNIQUE(productName,name)
+ );");
}
public SqliteHelper SqliteHelper { get; private set; }
--
Gitblit v1.9.1