Esempio n. 1
0
        public void AddTriggerLog(Trigger t, string text)
        {
            if (connection.State != System.Data.ConnectionState.Open)
                connection.Open();

            SqlCommand cmd = new SqlCommand("INSERT INTO [hornon].[dbo].[TriggerLog] ([triggerId], [logText]) VALUES (" + t.triggerId + ", '" + text.Replace("'", "''") + "')", connection);
            cmd.ExecuteNonQuery();

            connection.Close();
        }
Esempio n. 2
0
        public void UpdateTrigger(Trigger t)
        {
            if (connection.State != System.Data.ConnectionState.Open)
                connection.Open();

            string dateTime = "NULL";
            if (t.lastTriggered.HasValue)
                dateTime = "'" + t.lastTriggered.Value.ToString("yyyyMMdd HH:mm:ss") + "'";

            SqlCommand cmd = new SqlCommand("UPDATE [hornon].[dbo].[Triggers] SET lastTriggered = " + dateTime + ", canTrigger = '" + (t.canTrigger ? "1" : "0") + "' WHERE triggerId = " + t.triggerId, connection);
            cmd.ExecuteNonQuery();

            connection.Close();
        }