public IList <IViewAlbumArtistSongTotalVotes> GetTop <IViewAlbumArtistSongTotalVotesQueryParams>(int top, IViewAlbumArtistSongTotalVotesQueryParams query)
        {
            _collection = new List <IViewAlbumArtistSongTotalVotes>();
            string sqlCommand = "viewAlbumArtistSongTotalVotesGetTop";

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                _dataBase.AddInParameter(dbCmd, "@topParam", DbType.Int32, top);
                _dataBase.AddInParameter(dbCmd, "@fromParam", DbType.String, ((IDataQuery)query).From);
                _dataBase.AddInParameter(dbCmd, "@whereParam", DbType.String, ((IDataQuery)query).Where);
                _dataBase.AddInParameter(dbCmd, "@orderByParam", DbType.String, ((IDataQuery)query).OrderBy);

                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        IViewAlbumArtistSongTotalVotes viewAlbumArtistSongTotalVotes = new ViewAlbumArtistSongTotalVotes();

                        viewAlbumArtistSongTotalVotes.SongId     = Convert.ToInt32(reader["songId"].ToString());
                        viewAlbumArtistSongTotalVotes.Total      = Convert.ToInt32(reader["total"].ToString());
                        viewAlbumArtistSongTotalVotes.SongName   = reader["songName"].ToString();
                        viewAlbumArtistSongTotalVotes.AlbumName  = reader["albumName"].ToString();
                        viewAlbumArtistSongTotalVotes.ArtistName = reader["artistName"].ToString();
                        viewAlbumArtistSongTotalVotes.ArtistId   = Convert.ToInt32(reader["artistId"].ToString());
                        viewAlbumArtistSongTotalVotes.AlbumCover = reader["albumCover"].ToString();
                        viewAlbumArtistSongTotalVotes.BattlDate  = (DateTime)reader["battlDate"];
                        _collection.Add(viewAlbumArtistSongTotalVotes);
                    }
                }
            }

            return(_collection);
        }
        public IList <IViewAlbumArtistSongTotalVotes> Find <IViewAlbumArtistSongTotalVotesQueryParams>(IViewAlbumArtistSongTotalVotesQueryParams query)
        {
            _collection = new List <IViewAlbumArtistSongTotalVotes>();
            string sqlCommand = "viewAlbumArtistSongTotalVotesGroupedBySong";

            // Create a suitable command type and add the required parameter.
            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                _dataBase.AddInParameter(dbCmd, "@fromParam", DbType.String, ((IDataQuery)query).From);
                _dataBase.AddInParameter(dbCmd, "@whereParam", DbType.String, ((IDataQuery)query).Where);
                _dataBase.AddInParameter(dbCmd, "@orderByParam", DbType.String, ((IDataQuery)query).OrderBy);
                _dataBase.AddInParameter(dbCmd, "@pageNumber", DbType.String, ((IDataQuery)query).Page);
                _dataBase.AddInParameter(dbCmd, "@rowCount", DbType.String, ((IDataQuery)query).RowCount);

                // Call the ExecuteReader method with the command.
                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        IViewAlbumArtistSongTotalVotes viewAlbumArtistSongTotalVotes = new ViewAlbumArtistSongTotalVotes();

                        viewAlbumArtistSongTotalVotes.SongId     = Convert.ToInt32(reader["songId"].ToString());
                        viewAlbumArtistSongTotalVotes.SongName   = reader["songName"].ToString();
                        viewAlbumArtistSongTotalVotes.Total      = Convert.ToInt32(reader["total"].ToString());
                        viewAlbumArtistSongTotalVotes.AlbumName  = reader["albumName"].ToString();
                        viewAlbumArtistSongTotalVotes.ArtistName = reader["artistName"].ToString();
                        viewAlbumArtistSongTotalVotes.ArtistId   = Convert.ToInt32(reader["total"].ToString());
                        viewAlbumArtistSongTotalVotes.AlbumCover = reader["albumCover"].ToString();
                        _collection.Add(viewAlbumArtistSongTotalVotes);
                    }
                }
            }

            return(_collection);
        }
        public IViewAlbumArtistSongTotalVotes GetById(int id)
        {
            IViewAlbumArtistSongTotalVotes viewAlbumArtistSongTotalVotes = new ViewAlbumArtistSongTotalVotes();
            string sqlCommand = "viewAlbumArtistSongTotalVotesFind";

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                IDataQuery query = new DataQuery();
                query.Where = string.Format(" songId={0} ", id);

                _dataBase.AddInParameter(dbCmd, "@fromParam", DbType.String, query.From);
                _dataBase.AddInParameter(dbCmd, "@whereParam", DbType.String, query.Where);
                _dataBase.AddInParameter(dbCmd, "@orderByParam", DbType.String, query.OrderBy);

                // Call the ExecuteReader method with the command.
                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        viewAlbumArtistSongTotalVotes.SongId     = Convert.ToInt32(reader["songId"].ToString());
                        viewAlbumArtistSongTotalVotes.Total      = Convert.ToInt32(reader["total"].ToString());
                        viewAlbumArtistSongTotalVotes.SongName   = reader["songName"].ToString();
                        viewAlbumArtistSongTotalVotes.AlbumName  = reader["albumName"].ToString();
                        viewAlbumArtistSongTotalVotes.ArtistName = reader["artistName"].ToString();
                        viewAlbumArtistSongTotalVotes.ArtistId   = Convert.ToInt32(reader["artistId"].ToString());
                        viewAlbumArtistSongTotalVotes.AlbumCover = reader["albumCover"].ToString();
                        viewAlbumArtistSongTotalVotes.BattlDate  = (DateTime)reader["battlDate"];
                    }
                }
            }

            return(viewAlbumArtistSongTotalVotes);
        }
        public IList <IViewAlbumArtistSongTotalVotes> ExecuteProcedure <IViewTopAlbumsQueryParams>(string procedureName, IViewTopAlbumsQueryParams query, int top = 0)
        {
            _collection = new List <IViewAlbumArtistSongTotalVotes>();

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(procedureName))
            {
                if (top > 0)
                {
                    _dataBase.AddInParameter(dbCmd, "@topParam", DbType.Int32, top);
                }

                _dataBase.AddInParameter(dbCmd, "@whereParam", DbType.String, ((IDataQuery)query).Where);

                using (IDataReader reader = _dataBase.ExecuteReader(dbCmd))
                {
                    while (reader.Read())
                    {
                        IViewAlbumArtistSongTotalVotes viewAlbumArtistSongTotalVotes = new ViewAlbumArtistSongTotalVotes();

                        viewAlbumArtistSongTotalVotes.ArtistId   = Convert.ToInt32(reader["artistId"].ToString());
                        viewAlbumArtistSongTotalVotes.Total      = Convert.ToInt32(reader["totalVotes"].ToString());
                        viewAlbumArtistSongTotalVotes.AlbumName  = reader["albumName"].ToString();
                        viewAlbumArtistSongTotalVotes.ArtistName = reader["artistName"].ToString();
                        viewAlbumArtistSongTotalVotes.AlbumCover = reader["albumCover"].ToString();
                        viewAlbumArtistSongTotalVotes.Picture    = reader["picture"].ToString();

                        _collection.Add(viewAlbumArtistSongTotalVotes);
                    }
                }
            }

            return(_collection);
        }