Пример #1
0
 public Mplayer()
 {
     List<ShowMp3s> sRes = Utilities.ShowDB.MasterShowSongList.ToList();
     foreach (var item in sRes)
     {
         MplayerSong temp = new MplayerSong(item.ID,"../../shows/" + item.ShowID + "/mp3s/", item.Filename);
         if (!Songs.Any(a => a.Filename == temp.Filename))
         {
             Songs.Add(temp);
         }
     }
     List<ArtistMp3s> aRes = Utilities.ArtDB.MasterArtistMp3List.ToList();
     foreach (var item in aRes)
     {
         MplayerSong temp = new MplayerSong(item.ID, "../../artists/" + item.ArtistID + "/mp3s/", item.FileName);
         if (!Songs.Any(a => a.Filename == temp.Filename))
         {
             Songs.Add(temp);
         }
     }
 }
Пример #2
0
 public ProfileViewModel(string UserName)
 {
     var cacheres = Utilities.CacheDB.ProfileCaches.Where(s => s.Username == UserName);
     if (cacheres != null && cacheres.Count() > 0)
     {
         CurUserCache = cacheres.First(s => s.Username == UserName);
         ModelIsValid = true;
     }
     else
     {
         CurUserCache = new ProfileCache();
         needscaching = true;
     }
     List<Profiles> result = Utilities.ProfileDB.ProfileList.Where(s => s.UserName == UserName).ToList();
     CurUser = result[0];
     if (needscaching)
     {
         if (result != null && result.Count > 0)
         {
             #region
             NewsComms = Utilities.NewsDB.MasterCommentsListing.Where(s => s.UserId == CurUser.ID).ToList();
             if (NewsComms == null)
             {
                 NewsComms = new List<NewsComments>();
             }
             ShowComms = Utilities.ShowDB.MasterShowCommentList.Where(s => s.UserID == CurUser.ID).ToList();
             if (ShowComms == null)
             {
                 ShowComms = new List<ShowComment>();
             }
             ArtistComms = Utilities.ArtDB.MasterArtistCommentList.Where(s => s.UserID == CurUser.ID).ToList();
             if (ArtistComms == null)
             {
                 ArtistComms = new List<ArtistComment>();
             }
             GeneralComms = Utilities.CommDB.Comments.Where(s => s.UserID == CurUser.ID).ToList();
             if (GeneralComms == null)
             {
                 GeneralComms = new List<Comment>();
             }
             List<Genres> tempgenres = new List<Genres>();
             foreach (var item in CurUser.GenreIDs)
             {
                 var res = Utilities.GenreDB.GenreList.Where(s => s.JoomlaID == item);
                 tempgenres.AddRange(res);
             }
             Genres = tempgenres;
             List<ShowGenres> tempshows = new List<ShowGenres>();
             List<ArtistGenres> tempartist = new List<ArtistGenres>();
             foreach (var item in Genres)
             {
                 tempshows.AddRange(Utilities.ShowDB.MasterShowGenreList.Where(s => s.GenreID == item.JoomlaID));
                 tempartist.AddRange(Utilities.ArtDB.MasterArtistGenreList.Where(s => s.GenreID == item.JoomlaID));
             }
             foreach (var item in tempshows)
             {
                 SuggestedShows.AddRange(Utilities.ShowDB.MasterShowList.Where(s => s.JoomlaID == item.ShowID));
                 List<ShowMp3s> sRes = Utilities.ShowDB.MasterShowSongList.Where(s => s.ShowID == item.ShowID).ToList();
                 foreach (var song in sRes)
                 {
                     MplayerSong temp = new MplayerSong(song.ID, "../../shows/" + song.ShowID + "/mp3s/", song.Filename);
                     if (!SuggestedSongs.Songs.Any(a => a.Filename == temp.Filename))
                     {
                         SuggestedSongs.Songs.Add(temp);
                     }
                 }
             }
             foreach (var item in tempartist)
             {
                 SuggestedArtists.AddRange(Utilities.ArtDB.MasterArtistList.Where(s => s.JoomlaID == item.ArtistID));
                 List<ArtistMp3s> aRes = Utilities.ArtDB.MasterArtistMp3List.Where(s => s.ArtistID == item.ArtistID).ToList();
                 foreach (var song in aRes)
                 {
                     MplayerSong temp = new MplayerSong(song.ID, "../../artists/" + song.ArtistID + "/mp3s/", song.FileName);
                     if (!SuggestedSongs.Songs.Any(a => a.Filename == temp.Filename))
                     {
                         SuggestedSongs.Songs.Add(temp);
                     }
                 }
             }
             ModelIsValid = true;
             #endregion
         }
         else
         {
             ModelIsValid = false;
         }
     }
 }