public FingerPrint getFingerPrintById(String id) { string query = "SELECT * FROM fingerprint WHERE FINGERPRINT_ID = "+id+" "; //Create a list to store the result FingerPrint fingerPrint = new FingerPrint(); if (this.OpenConnection() == true) { //Create Command MySqlCommand cmd1 = new MySqlCommand(query, connection); //Create a data reader and Execute the command MySqlDataReader dataReader1 = cmd1.ExecuteReader(); //Read the data and store them in the list while (dataReader1.Read()) { fingerPrint.FingerPrintId = dataReader1["fingerprint_id"] + ""; fingerPrint.AudioType = getAudioTypeById(dataReader1["type_id"] + ""); } //close Data Reader dataReader1.Close(); //close Connection this.CloseConnection(); //return list to be displayed return fingerPrint; } else { return null; } }
public LogAudioDetection() { fingerprintId = new FingerPrint(); }
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; } }