/// <summary> /// Selects the content of the archive. /// </summary> /// <returns>The archive content.</returns> /// <param name="contentId">Content identifier.</param> public ArchiveContent SelectArchiveContent (string contentId) { var sbQuery = new StringBuilder (); sbQuery.Append ("SELECT * "); sbQuery.Append ("FROM archivecontent "); sbQuery.AppendFormat ("WHERE Id = {0}", contentId); string query = sbQuery.ToString(); this.ContentList = new List<ArchiveContent> (); if (connection.State != ConnectionState.Open) { this.OpenConnection (); } MySqlCommand cmd = new MySqlCommand (query, connection); MySqlDataReader dataReader = cmd.ExecuteReader (); var content = new ArchiveContent (); if (dataReader.HasRows) { while (dataReader.Read ()) { content.GetArchiveContent (dataReader); } } dataReader.Close (); this.CloseConnection (); return content; }
/// <summary> /// Selects the content of the archive. /// </summary> /// <returns>The archive content.</returns> /// <param name="paramTop">Parameter top.</param> /// <param name="paramOrder">Parameter order.</param> public IList <ArchiveContent> SelectArchiveContentList (string paramSelect, string paramOrder) { var sbQuery = new StringBuilder (); sbQuery.AppendFormat ("SELECT {0} ", paramSelect); sbQuery.Append ("FROM archivecontent "); sbQuery.AppendFormat ("{0}", paramOrder); string query = sbQuery.ToString(); this.ContentList = new List<ArchiveContent> (); if (connection.State != ConnectionState.Open) { this.OpenConnection (); } MySqlCommand cmd = new MySqlCommand (query, connection); MySqlDataReader dataReader = cmd.ExecuteReader (); if (dataReader.HasRows) { while (dataReader.Read ()) { var content = new ArchiveContent (); content.GetArchiveContent (dataReader); this.ContentList.Add (content); } } dataReader.Close (); this.CloseConnection (); return this.ContentList; }