public void PullingDataFromT3000BuildingDB(string databaseFileWithPath)
{
//this name databsefilewithpath contains the databse if empty the return
if (databaseFileWithPath == "")
{
return;
}
string connString = @"Data Source=" + databaseFileWithPath + ";Version=3;";
string TableName = "INPUTable";
using (SQLiteConnection connection = new SQLiteConnection(connString))
{
connection.Open();
SQLiteDataReader reader = null;
string queryString = "SELECT * from " + TableName + " WHERE InputUnit != '' AND InputRange != '@UnusedValue'";
SQLiteCommand command = new SQLiteCommand(queryString, connection);
command.Parameters.AddWithValue("@UnusedValue", "Unused");//This is the group id that is used to identify each node
int count = 0;
reader = command.ExecuteReader();
while (reader.Read())
{
//We need to filter temperature and humidity value
double tempVal = double.Parse(reader["InputValue"].ToString());
//--Filtering the value for temperature it should be between 0-50
//--and for humidity (represented by % ) should be between 0-100
if ((reader["InputUnit"].ToString() == "Deg.C" && (tempVal >= 0 && tempVal <= 50)) || (reader["InputUnit"].ToString().Contains("%") && (tempVal >= 0 && tempVal <= 100)))
{
// if (tempVal )
listForInputFromT3000.Add(new datatypeForT300InputTable
{
panelID = reader["PanelID"].ToString(),
inputIndex = reader["InputIndex"].ToString(),
inputDescription = reader["InputDescription"].ToString(),
inputAM = reader["InputAM"].ToString(),
inputValue = reader["InputValue"].ToString(),
inputUnit = reader["InputUnit"].ToString(),
inputRange = reader["InputRange"].ToString(),
inputCalibration = reader["InputCalibration"].ToString(),
inputCalSign = reader["InputCalSign"].ToString(),
inputFilter = reader["InputFilter"].ToString(),
inputDecon = reader["InputDecon"].ToString(),
inputJumper = reader["InputJumper"].ToString(),
inputLabel = reader["InputLabel"].ToString(),
});
}//--close of if
} //--close of while
} //--Close of using
} //--Min fxn close