| File was renamed from HMI.ParameterManage/ControlModel.cs |
| | |
| | | using 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; } |