示例#1
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            var selectedRow = PlaylistsDataGridView.SelectedRows[0];

            var playlist = (Playlist)selectedRow.DataBoundItem;

            var tracks = playlist.PlaylistId == 0
                ? MusicTracksRepo.GetAllOfUser(_currentUser.UserId)
                : MusicTracksRepo.GetAllInPlaylist(playlist);

            switch (searchTypeCmbBox.Text)
            {
            case "По названию":
                TracksGridView.DataSource = tracks.Where(x => x.Name.Contains(searchQueryTxtBox.Text)).ToList();
                break;

            case "По исполнителю":
                TracksGridView.DataSource = tracks.Where(x => x.AuthorName.Contains(searchQueryTxtBox.Text)).ToList();
                break;

            case "По жанру":
                TracksGridView.DataSource = tracks.Where(x => x.GenreName.Contains(searchQueryTxtBox.Text)).ToList();
                break;
            }
        }
示例#2
0
        private void FillOrRefreshTracksGridView(Playlist playlist = null)
        {
            var tracks = playlist == null?MusicTracksRepo.GetAllOfUser(_currentUser.UserId) : MusicTracksRepo
                             .GetAllInPlaylist(playlist);

            TracksGridView.DataSource            = tracks;
            TracksGridView.Columns[0].Visible    = false;
            TracksGridView.Columns[1].HeaderText = "Композиция";
            TracksGridView.Columns[2].HeaderText = "Исполнитель";
            TracksGridView.Columns[3].HeaderText = "Жанр";
        }