示例#1
0
        public List<AudioType> getAllAudioType()
        {
            string query = "SELECT * FROM audio_type";

            //Create a list to store the result
            List<AudioType> Audios = new List<AudioType>();

            //Open connection
            if (this.OpenConnection() == true)
            {
                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection);
                //Create a data reader and Execute the command
                MySqlDataReader dataReader = cmd.ExecuteReader();

                //Read the data and store them in the list
                while (dataReader.Read())
                {
                    AudioType audioType = new AudioType();
                    audioType.Type_id = dataReader["type_id"] + "";
                    audioType.Type_name = dataReader["type_name"] + "";
                    Audios.Add(audioType);
                }

                //close Data Reader
                dataReader.Close();

                //close Connection
                this.CloseConnection();

                //return list to be displayed
                return Audios;
            }
            else
            {
                return null;
            }
        }
示例#2
0
        private AudioType getAudioTypeById(String id )
        {
            string query = "SELECT * FROM audio_type WHERE TYPE_ID = "+id+" ";

            //Create a list to store the result
            AudioType audioType = new AudioType();

            if (this.OpenConnection() == true)
            {
                //Create Command
                MySqlCommand cmd2 = new MySqlCommand(query, connection);
                //Create a data reader and Execute the command
                MySqlDataReader dataReader2 = cmd2.ExecuteReader();

                //Read the data and store them in the list
                while (dataReader2.Read())
                {
                    audioType.Type_id = dataReader2["type_id"] + "";
                    audioType.Type_name = dataReader2["type_name"] + "";
                }

                //close Data Reader
                dataReader2.Close();

                //close Connection
                this.CloseConnection();

                //return list to be displayed
                return audioType;
            }
            else
            {
                return null;
            }
        }
示例#3
0
        public List<LogAudioDetection> getAllLogAudioDetectionShortByDateForDataGrid()
        {
            string query = "SELECT log_audio_detected.log_id, audio_type.type_name,log_audio_detected.log_detected_time,log_audio_detected.log_message,log_audio_detected.log_seen_status from log_audio_detected,audio_type,fingerprint where log_audio_detected.fingerprint_id = fingerprint.fingerprint_id AND fingerprint.type_id = audio_type.type_id ORDER BY log_audio_detected.log_detected_time DESC ";
            List<LogAudioDetection> LogAudios = new List<LogAudioDetection>();

            if (this.OpenConnection() == true)
            {
                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection);
                //Create a data reader and Execute the command
                MySqlDataReader dataReader = cmd.ExecuteReader();

                //Read the data and store them in the list
                while (dataReader.Read())
                {
                    LogAudioDetection logAudioDetection = new LogAudioDetection();
                    FingerPrint fingerPrint = new FingerPrint();
                    AudioType audioType = new AudioType();

                    //audioType.Type_ = dataReader["type_id"] + "";
                    //audioType.Type_name = dataReader["type_name"] + "";
                    logAudioDetection.LogId = dataReader["log_id"] + "";
                    audioType.Type_name = dataReader["type_name"] + "";
                    fingerPrint.AudioType = audioType;
                    logAudioDetection.FingerprintId = fingerPrint;
                    logAudioDetection.LogDetectionTime = dataReader["log_detected_time"] + "";
                    logAudioDetection.LogSeenStatus = dataReader["log_seen_status"] + "";
                    logAudioDetection.LogMessage = dataReader["log_message"] + "";

                    LogAudios.Add(logAudioDetection);
                }

                //close Data Reader
                dataReader.Close();

                //close Connection
                this.CloseConnection();

                //return list to be displayed
                return LogAudios;
            }
            else
            {
                return null;
            }
        }