Beispiel #1
0
        protected bool LogMessageOnDatabase(OdbcDataReader toSend)
        {
            try
             {
            string query = "INSERT INTO SMS_Log (MobilePhone, SMS_Day, SMS_Hour, SMS_Text, DateTimeSent, ID_Group, SMS_Sent) VALUES ('" +
                           toSend["MobilePhone"].ToString() + "', '" + toSend["SMS_Day"].ToString() + "', '" + ((DateTime)toSend.GetDateTime(toSend.GetOrdinal("SMS_Hour"))).ToString("hh:mm:ss") + "', '" +
                           toSend["SMS_Text"].ToString() + "', '" + DateTime.Now + "', '" + toSend["ID_Group"].ToString() + "', '" +
                           DateTime.Now + "')";

            int r = database.ExecuteCommand(query);

            if (r < 1)
               return false;

            return true;
             }
             catch (Exception ex)
             {
            if (Debug)
               Console.WriteLine("Engine.LogMessageOnDatabase Exception: {0}", ex.Message);

            return false;
             }
        }
Beispiel #2
0
 public static DateTime? GetNullableDatetime(OdbcDataReader reader, string columnName)
 {
     int x = reader.GetOrdinal(columnName);
     return reader.IsDBNull(x) ? (DateTime?)null : reader.GetDateTime(x);
 }