Esempio n. 1
0
 public ViewModelListSong()
 {
     _listsong  = new ENTITIES.ListSong();
     oService   = new ReferenceServiceSong.SongServiceClient();
     _listSongs = new ObservableCollection <ENTITIES.ListSong>(oService.GetLists());
     _listSongs.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(CollectionChanged);
 }
Esempio n. 2
0
 private void AddList()
 {
     if (CurrentSong != null)
     {
         Views.ViewPlayList windowsAgregarLista = new Views.ViewPlayList(CurrentSong.IdSong);
         windowsAgregarLista.ShowDialog();
         ENTITIES.ListSong Result = windowsAgregarLista.combo.Items[windowsAgregarLista.combo.Items.Count - 1] as ENTITIES.ListSong;
         CurrentListsSongs.Add(Result);
     }
 }
Esempio n. 3
0
        public ViewModelSong()
        {
            _song     = new ENTITIES.Song();
            oServicio = new ReferenceServiceSong.SongServiceClient();
            _songs    = new ObservableCollection <ENTITIES.Song>(oServicio.GetCompleteSongs());
            _songs.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(_songs_CollectionChanged);

            SetConfigurationView();

            _listsong  = new ENTITIES.ListSong();
            _listSongs = new ObservableCollection <ENTITIES.ListSong>(oServicio.GetLists());
            _listSongs.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(CollectionChanged);
        }
Esempio n. 4
0
        private void Submit()
        {
            if (Name != string.Empty && SelectListSong != null && Name != null)
            {
                ENTITIES.ListSong oListSong = oService.AddList(new ENTITIES.ListSong()
                {
                    Create = DateTime.Now,
                    Name   = this.Name
                });
                if (oListSong.Id != 0)
                {
                    ENTITIES.PlayList oPlayList = oService.AddPlayList(new ENTITIES.PlayList()
                    {
                        DateCreation = DateTime.Now,
                        List         = oListSong,
                        Song         = new ENTITIES.Song()
                        {
                            IdSong = this.IdSong
                        }
                    });


                    CurrentListsSongs.Add(oListSong);
                    SelectListSong = oListSong;
                    MessageBox.Show("Exito");
                    CloseAction();
                }
            }
            else
            {
                ENTITIES.PlayList oPlayList = oService.AddPlayList(new ENTITIES.PlayList()
                {
                    DateCreation = DateTime.Now,
                    List         = SelectListSong,
                    Song         = new ENTITIES.Song()
                    {
                        IdSong = this.IdSong
                    }
                });
                if (oPlayList.Id != 0)
                {
                    MessageBox.Show("Exito");
                    CloseAction();
                }
            }
        }
Esempio n. 5
0
        public static List <ENTITIES.Song> GetAll(ENTITIES.ListSong oListSong)
        {
            List <ENTITIES.Song> lSongs = null;

            try
            {
                using (IDataReader sqrSource = DAL.Core.GetConnection.ExecuteReader("spTblSongsGetByIdList", oListSong.Id))
                {
                    lSongs = new List <ENTITIES.Song>();
                    while (sqrSource.Read())
                    {
                        lSongs.Add(new ENTITIES.Song()
                        {
                            IdSong   = sqrSource.GetInt32(0),
                            Source   = sqrSource.GetString(1),
                            Duration = sqrSource.GetString(2),
                            Autor    = sqrSource.GetString(3),
                            Album    = new ENTITIES.Album()
                            {
                                IdAlbum = sqrSource.GetInt32(4),
                                Name    = sqrSource.GetString(5),
                                Year    = sqrSource.GetInt32(6),
                                Genre   = new ENTITIES.GenreMusic()
                                {
                                    Id          = sqrSource.GetInt32(7),
                                    Description = sqrSource.GetString(8)
                                }
                            }
                        });
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                throw (sqlEx);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return(lSongs);
        }
Esempio n. 6
0
        public static ENTITIES.ListSong Add(ENTITIES.ListSong oList)
        {
            object oResult = null;

            try
            {
                oResult = DAL.Core.GetConnection.ExecuteScalar("spTblListAdd", oList.Name, DateTime.Now);
                if (oResult != null)
                {
                    oList.Id = int.Parse(oResult.ToString());
                }
            }
            catch (SqlException sqlEx)
            {
                throw (sqlEx);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return(oList);
        }
Esempio n. 7
0
 public List <ENTITIES.Song> GetSongsByList(ENTITIES.ListSong oListSong)
 {
     return(DAL.ListSong.GetAll(oListSong));
 }
Esempio n. 8
0
 public ENTITIES.ListSong AddList(ENTITIES.ListSong oList)
 {
     return(DAL.ListSong.Add(oList));
 }