Esempio n. 1
0
        public static mysql_results pre_program(string id)
        {
            cmd.CommandText = "SELECT * FROM `pre_program` WHERE `masterID` = " + id;
            cmd.CommandType = CommandType.Text;
            MySqlDataReader reader = cmd.ExecuteReader();

            mysql_todo[]  list = new mysql_todo[50];
            mysql_results res = new mysql_results();
            TimeSpan      ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
            double        unixTime = ts.TotalSeconds;
            int           i = 0, j = 0;

            res.result = false;
            while (reader.Read())
            {
                if (reader.GetString(2).Length > 2)
                {
                    list[i]     = new mysql_todo();
                    list[i].sql = "INSERT `log_current_session` SET `type`='cmd', `message`='" + reader.GetString(2) + "',`when`=" + (reader.GetInt32(1) + unixTime).ToString().Replace(',', '.') + ",`who_ID`=" + reader.GetUInt32(5);
                    res.result  = true;
                    i++;
                }
            }

            reader.Close();
            for (j = 0; j < i; j++)
            {
                QueryCommand(list[j].sql);
            }
            return(res);
        }
Esempio n. 2
0
        public static mysql_results pre_program(string id)
        {
            cmd.CommandText = "SELECT * FROM `pre_program` WHERE `masterID` = " + id;
            cmd.CommandType = CommandType.Text;
            MySqlDataReader reader = cmd.ExecuteReader();
            mysql_todo[] list = new mysql_todo[50];
            mysql_results res = new mysql_results();
            TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
            double unixTime = ts.TotalSeconds;
            int i=0,j=0;
            res.result = false;
            while (reader.Read())
            {
                if (reader.GetString(2).Length > 2)
                {
                    list[i] = new mysql_todo();
                    list[i].sql = "INSERT `log_current_session` SET `type`='cmd', `message`='" + reader.GetString(2) + "',`when`=" + (reader.GetInt32(1) + unixTime).ToString().Replace(',', '.') + ",`who_ID`=" + reader.GetUInt32(5);
                    res.result = true;
                    i++;
                }

            }

            reader.Close();
            for (j = 0; j < i; j++)
            {
                QueryCommand(list[j].sql);

            }
            return res;
        }