48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using MySql.Data.MySqlClient;
|
|
|
|
namespace ConnectPlus_SOC
|
|
{
|
|
class MySQLinsertThread
|
|
{
|
|
string connStr;
|
|
public MySQLinsertThread(string p_connectionString)
|
|
{
|
|
connStr = p_connectionString;
|
|
}
|
|
|
|
public void HandleConnection()
|
|
{
|
|
|
|
}
|
|
|
|
bool insertSMSinDB(string p_radioID, string p_message)
|
|
{
|
|
try
|
|
{
|
|
MySqlConnection connection = new MySqlConnection(connStr);
|
|
MySqlCommand command = connection.CreateCommand();
|
|
MySqlDataReader Reader;
|
|
command.CommandText = "insert into SMS_IN (message,subscriber,time) values ('" + p_message +
|
|
"','" + p_radioID +
|
|
"','" + DateTime.Now.ToUniversalTime().ToString("yyyy:MM:dd HH:mm:ss") +
|
|
"')";
|
|
connection.Open();
|
|
Reader = command.ExecuteReader();
|
|
|
|
connection.Close();
|
|
|
|
return true;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Utils.ConsWrite(DebugMSG_Type.always,"Error inserting SMS in DB");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|