From fd4caf028b76e4447a628f757938d1c5eb35795e Mon Sep 17 00:00:00 2001 From: stephaniegl Date: Thu, 28 Nov 2024 17:12:54 +0700 Subject: [PATCH] Add FMS Condition Table, and half way create database --- Database.cs | 24 +++++- MainWindow.xaml | 186 ++++++++++++++++++++++++++------------------- MainWindow.xaml.cs | 33 +++++++- 3 files changed, 160 insertions(+), 83 deletions(-) diff --git a/Database.cs b/Database.cs index 954761c..47722dc 100644 --- a/Database.cs +++ b/Database.cs @@ -22,6 +22,7 @@ namespace FAtoPA CreateFSMTable(); CreateModbusTable(); CreateVXTable(); + CreateConditionTable(); } private bool CreateFSMTable() @@ -169,7 +170,7 @@ namespace FAtoPA } } - private bool CreateModbusTable() + private bool CreateModbusTable() { //Debug.WriteLine("About to execute CreateModbusTable"); using (var connection = new SQLiteConnection(connectionString)) @@ -312,6 +313,27 @@ namespace FAtoPA } } + private bool CreateConditionTable() + { + using (var connection = new SQLiteConnection(connectionString)) + { + try + { + connection.Open(); + var conFMSCmd = connection.CreateCommand(); + conFMSCmd.CommandText = "CREATE TABLE IF NOT EXISTS ConditionTable (No INTEGER AUTO INCREMENT, Condition TEXT, PASStatus TEXT)"; + conFMSCmd.ExecuteNonQuery(); + Debug.WriteLine("CreateConditionTable success"); + return true; + } + catch (Exception ex) + { + Debug.WriteLine("Error CreateConditionTable, Exception : " + ex.Message); + return false; + } + } + } + private bool CreateVXTable() { //Debug.WriteLine("About to execute CreateVXTable"); diff --git a/MainWindow.xaml b/MainWindow.xaml index 48d0948..141636b 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -61,11 +61,11 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1 1 1 0" - CornerRadius="10,10,0,0" - + CornerRadius="10,10,0,0" Padding="8" Margin="2 2 0 0"> @@ -187,7 +187,7 @@ - -