Exemplo n.º 1
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            if (TrackNameTxtBox.Text == string.Empty)
            {
                TrackNameTxtBox.BackColor = Color.IndianRed;
                return;
            }

            if (TrackAuthorTxtBox.Text == string.Empty)
            {
                TrackAuthorTxtBox.BackColor = Color.IndianRed;
                return;
            }

            if (GenreCmbBox.Text == string.Empty)
            {
                GenreCmbBox.BackColor = Color.IndianRed;
                return;
            }

            _musicTrack.TrackName   = TrackNameTxtBox.Text;
            _musicTrack.TrackAuthor = TrackAuthorTxtBox.Text;
            _musicTrack.GenreId     = GenresRepo.GetByName(GenreCmbBox.Text).GenreId;
            if (PlaylistCmbBox.Text != string.Empty)
            {
                var playlist = PlaylistsRepo.GetById((int)PlaylistCmbBox.SelectedValue);
                playlist.MusicTracks.Add(_musicTrack);
                PlaylistsRepo.AddOrUpdate(playlist);
            }

            MusicTracksRepo.AddOrUpdate(_musicTrack);

            Close();
        }
Exemplo n.º 2
0
        private void DeletePlaylist_Click(object sender, EventArgs e)
        {
            var selectedRow = PlaylistsDataGridView.SelectedRows[0];

            var playlist = (Playlist)selectedRow.DataBoundItem;

            PlaylistsRepo.Delete(playlist);
        }
Exemplo n.º 3
0
        public void Verify_PlayListName_Is_Not_Empty()
        {
            //Arrange
            PlaylistsRepo pr        = new PlaylistsRepo();
            string        exp_pname = "";

            //Act
            PlaylistsModel pmd   = pr.GetPlayList(13);
            string         pname = pmd.P_name;

            //Assert
            Assert.AreNotEqual(exp_pname, pname);
        }
Exemplo n.º 4
0
        public void Verify_PlayList()
        {
            //Arrange
            PlaylistsRepo pr        = new PlaylistsRepo();
            string        exp_pname = "EZY";

            //Act
            PlaylistsModel pmd   = pr.GetPlayList(3);
            string         pname = pmd.P_name;

            //Assert
            Assert.AreEqual(exp_pname, pname);
        }
Exemplo n.º 5
0
 private void AddPlaylistBtn_Click(object sender, EventArgs e)
 {
     if (PlaylistNameTxtBox.Text != string.Empty)
     {
         _playlist.PlaylistName = PlaylistNameTxtBox.Text;
         PlaylistsRepo.AddOrUpdate(_playlist);
         DialogResult = DialogResult.OK;
         Close();
     }
     else
     {
         PlaylistNameTxtBox.BackColor = Color.IndianRed;
     }
 }
Exemplo n.º 6
0
        private void FillOrRefreshPlaylistsGridView()
        {
            var playlists = PlaylistsRepo.GetAll(_currentUser.UserId).ToList();

            playlists.Add(new Playlist
            {
                PlaylistName = "Загруженные мною"
            });
            playlists = playlists.OrderBy(x => x.PlaylistId).ToList();
            PlaylistsDataGridView.DataSource            = playlists;
            PlaylistsDataGridView.Columns[0].Visible    = false;
            PlaylistsDataGridView.Columns[1].HeaderText = "Плейлисты";
            PlaylistsDataGridView.Columns[2].Visible    = false;
            PlaylistsDataGridView.Columns[3].Visible    = false;
            PlaylistsDataGridView.Columns[4].Visible    = false;
        }
Exemplo n.º 7
0
        public MusicTrackForm(MusicTrack musicTrack)
        {
            InitializeComponent();

            _musicTrack = musicTrack;

            TrackNameTxtBox.TextChanged   += ResetBackground;
            TrackAuthorTxtBox.TextChanged += ResetBackground;
            GenreCmbBox.TextChanged       += ResetBackground;
            PlaylistCmbBox.TextChanged    += ResetBackground;

            TrackNameTxtBox.Text      = _musicTrack.TrackName;
            TrackAuthorTxtBox.Text    = _musicTrack.TrackAuthor;
            GenreCmbBox.DataSource    = GenresRepo.GetAll();
            PlaylistCmbBox.DataSource = PlaylistsRepo.GetAll(_musicTrack.UploadUserId);

            GenreCmbBox.DisplayMember = "GenreName";
            GenreCmbBox.ValueMember   = "GenreId";

            PlaylistCmbBox.DisplayMember = "PlaylistName";
            PlaylistCmbBox.ValueMember   = "PlaylistId";
        }
Exemplo n.º 8
0
        public ActionResult PlaylistInfo(int id)
        {
            PlaylistsRepo pr = new PlaylistsRepo();

            return(View(pr.GetPlayList(id)));
        }