Пример #1
0
        public IList <IViewUserFavoritesSongs> GetTop <IViewUserFavoritesSongsQueryParams>(int top, IViewUserFavoritesSongsQueryParams query)
        {
            _collection = new List <IViewUserFavoritesSongs>();
            string sqlCommand = "viewUserFavoritesSongsGetTop";

            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())
                    {
                        IViewUserFavoritesSongs viewUserFavoritesSongs = new ViewUserFavoritesSongs();

                        viewUserFavoritesSongs.SongId     = Convert.ToInt32(reader["songId"].ToString());
                        viewUserFavoritesSongs.UsuarioId  = Convert.ToInt32(reader["usuarioId"].ToString());
                        viewUserFavoritesSongs.ProfileId  = Convert.ToInt32(reader["profileId"].ToString());
                        viewUserFavoritesSongs.TotalSong  = Convert.ToInt32(reader["totalSong"].ToString());
                        viewUserFavoritesSongs.AlbumId    = Convert.ToInt32(reader["albumId"].ToString());
                        viewUserFavoritesSongs.ArtistId   = Convert.ToInt32(reader["artistId"].ToString());
                        viewUserFavoritesSongs.AlbumCover = reader["albumCover"].ToString();
                        viewUserFavoritesSongs.AlbumName  = reader["albumName"].ToString();
                        viewUserFavoritesSongs.ArtistName = reader["artistName"].ToString();
                        viewUserFavoritesSongs.SongName   = reader["songName"].ToString();
                        _collection.Add(viewUserFavoritesSongs);
                    }
                }
            }

            return(_collection);
        }
Пример #2
0
        public IViewUserFavoritesSongs Add(IViewUserFavoritesSongs viewUserFavoritesSongs)
        {
            IViewUserFavoritesSongs viewUserFavoritesSongsAdded = new ViewUserFavoritesSongs();
            int    id         = 0;
            string sqlCommand = "viewUserFavoritesSongsAdd";

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                _dataBase.AddInParameter(dbCmd, "@songId", DbType.Int32, viewUserFavoritesSongs.SongId);
                _dataBase.AddInParameter(dbCmd, "@usuarioId", DbType.Int32, viewUserFavoritesSongs.UsuarioId);
                _dataBase.AddInParameter(dbCmd, "@profileId", DbType.Int32, viewUserFavoritesSongs.ProfileId);
                _dataBase.AddInParameter(dbCmd, "@totalSong", DbType.Int32, viewUserFavoritesSongs.TotalSong);
                _dataBase.AddInParameter(dbCmd, "@albumId", DbType.Int32, viewUserFavoritesSongs.AlbumId);
                _dataBase.AddInParameter(dbCmd, "@artistId", DbType.Int32, viewUserFavoritesSongs.ArtistId);
                _dataBase.AddInParameter(dbCmd, "@albumCover", DbType.String, viewUserFavoritesSongs.AlbumCover);
                _dataBase.AddInParameter(dbCmd, "@albumName", DbType.String, viewUserFavoritesSongs.AlbumName);
                _dataBase.AddInParameter(dbCmd, "@artistName", DbType.String, viewUserFavoritesSongs.ArtistName);
                _dataBase.AddInParameter(dbCmd, "@songName", DbType.String, viewUserFavoritesSongs.SongName);

                id = Convert.ToInt32(_dataBase.ExecuteScalar(dbCmd));

                viewUserFavoritesSongsAdded = this.GetById(id);
            }

            return(viewUserFavoritesSongsAdded);
        }
Пример #3
0
        public IViewUserFavoritesSongs GetById(int id)
        {
            IViewUserFavoritesSongs viewUserFavoritesSongs = new ViewUserFavoritesSongs();
            string sqlCommand = "viewUserFavoritesSongsFind";

            using (DbCommand dbCmd = _dataBase.GetStoredProcCommand(sqlCommand))
            {
                IDataQuery query = new DataQuery();
                query.Where = string.Format(" viewUserFavoritesSongsId = {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())
                    {
                        viewUserFavoritesSongs.SongId     = Convert.ToInt32(reader["songId"].ToString());
                        viewUserFavoritesSongs.UsuarioId  = Convert.ToInt32(reader["usuarioId"].ToString());
                        viewUserFavoritesSongs.ProfileId  = Convert.ToInt32(reader["profileId"].ToString());
                        viewUserFavoritesSongs.TotalSong  = Convert.ToInt32(reader["totalSong"].ToString());
                        viewUserFavoritesSongs.AlbumId    = Convert.ToInt32(reader["albumId"].ToString());
                        viewUserFavoritesSongs.ArtistId   = Convert.ToInt32(reader["artistId"].ToString());
                        viewUserFavoritesSongs.AlbumCover = reader["albumCover"].ToString();
                        viewUserFavoritesSongs.AlbumName  = reader["albumName"].ToString();
                        viewUserFavoritesSongs.ArtistName = reader["artistName"].ToString();
                        viewUserFavoritesSongs.SongName   = reader["songName"].ToString();
                    }
                }
            }

            return(viewUserFavoritesSongs);
        }
Пример #4
0
        public IList <IViewUserFavoritesSongs> Find <IViewUserFavoritesSongsQueryParams>(IViewUserFavoritesSongsQueryParams query)
        {
            _collection = new List <IViewUserFavoritesSongs>();
            string sqlCommand = "viewUserFavoritesSongsFind";

            // 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())
                    {
                        IViewUserFavoritesSongs viewUserFavoritesSongs = new ViewUserFavoritesSongs();

                        viewUserFavoritesSongs.SongId     = Convert.ToInt32(reader["songId"].ToString());
                        viewUserFavoritesSongs.ProfileId  = Convert.ToInt32(reader["profileId"].ToString());
                        viewUserFavoritesSongs.TotalSong  = Convert.ToInt32(reader["totalSong"].ToString());
                        viewUserFavoritesSongs.AlbumId    = Convert.ToInt32(reader["albumId"].ToString());
                        viewUserFavoritesSongs.ArtistId   = Convert.ToInt32(reader["artistId"].ToString());
                        viewUserFavoritesSongs.AlbumCover = reader["albumCover"].ToString();
                        viewUserFavoritesSongs.AlbumName  = reader["albumName"].ToString();
                        viewUserFavoritesSongs.ArtistName = reader["artistName"].ToString();
                        viewUserFavoritesSongs.SongName   = reader["songName"].ToString();
                        _collection.Add(viewUserFavoritesSongs);
                    }
                }
            }

            return(_collection);
        }