Ejemplo n.º 1
0
        public void rptSongs_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

            var setSong = setSongService.GetSetSong(new Guid(e.CommandArgument.ToString()));

            if (e.CommandName.ToLower() == "fix")
            {
                txtSongName.Text = setSong.SongName;
                hdnSetSongIdToFix.Value = setSong.SetSongId.ToString();
            }
            else if (e.CommandName.ToLower() == "delete")
            {
                ///TEST THIS SECTION
                var songService = new SongService(Ioc.GetInstance<ISongRepository>());
                var song = songService.GetSong(setSong.SongId.Value);

                using (IUnitOfWork uow = UnitOfWork.Begin())
                {
                    setSongService.Delete(setSong);

                    if (song != null)
                        songService.Delete(song);

                    uow.Commit();
                }

                var setsongs = setSongService.GetAllSetSongs().Where(x => x.SongName.Contains(txtSearchSongName.Text));

                rptSongs.DataSource = setsongs;
                rptSongs.DataBind();
            }
        }
Ejemplo n.º 2
0
        public IQueryable<IAnalysis> GetAnalysisBySong(Guid songId)
        {
            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());
            var setSongs = setSongService.GetSetSongBySong(songId);

            var setSongIds = (from s in setSongs
                              select s.SetSongId);

            return _repo.FindAll().Where(x => setSongIds.Contains(x.SetSongId));
        }
Ejemplo n.º 3
0
        public IQueryable <IAnalysis> GetAnalysisBySong(Guid songId)
        {
            var setSongService = new SetSongService(Ioc.GetInstance <ISetSongRepository>());
            var setSongs       = setSongService.GetSetSongBySong(songId);

            var setSongIds = (from s in setSongs
                              select s.SetSongId);

            return(_repo.FindAll().Where(x => setSongIds.Contains(x.SetSongId)));
        }
Ejemplo n.º 4
0
        public void Process(IQueryable<IWantedList> activeWantedLists)
        {
            var showService = new ShowService(Ioc.GetInstance<IShowRepository>());
            var setService = new SetService(Ioc.GetInstance<ISetRepository>());
            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

            var liveSongManglers = (from show in showService.GetAllShows().OrderByDescending(x => x.ShowDate).Take(10)
                          from set in setService.GetSetsForShow(show.ShowId)
                          from setsong in setSongService.GetSetSongsBySet(set.SetId)
                          select new LiveSongDateMangler { LiveSong = (SetSong)setsong, ShowDate = show.ShowDate.Value });

            foreach (var wanted in activeWantedLists)
            {

                //bust it raw dawg
                ///LEFT OFF HERE
            }
        }
Ejemplo n.º 5
0
        public void btnFixSetSong_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSongName.Text))
                return;

            if (string.IsNullOrEmpty(hdnSetSongIdToFix.Value))
                return;

            var changeSongNameToo = false;

            if (chkSongToo.Checked)
                changeSongNameToo = true;

            var newSongName = txtSongName.Text.Trim();
            var setSongId = new Guid(hdnSetSongIdToFix.Value);
                        
            using (IUnitOfWork uow = UnitOfWork.Begin())
            {
                var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

                var setSong = setSongService.GetSetSong(setSongId);

                setSong.SongName = newSongName;
                var setsongs = setSongService.GetAllSetSongs().Where(x => x.SongName.Contains(txtSearchSongName.Text));

                if (changeSongNameToo)
                {
                    var songService = new SongService(Ioc.GetInstance<ISongRepository>());
                    var song = songService.GetSong(setSong.SongId.Value);
                    song.SongName = newSongName;
                }

                uow.Commit();

                rptSongs.DataSource = setsongs;
                rptSongs.DataBind();
            }
        }
Ejemplo n.º 6
0
        public void btnBrih_Click(object sender, EventArgs e)
        {
            var setService = new SetService(Ioc.GetInstance<ISetRepository>());
            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

            using (IUnitOfWork uow = UnitOfWork.Begin())
            {
                //bool success = false;
                //bool success2 = false;
                //bool success3 = false;

                //setService.Save(newSet, out success);

                //setSongService.Save(davidbowie, out success2);

                ////setSongService.Save(highway, out success3);

                //if (success && success2)
                //{
                //    uow.Commit();
                //}
            }
        }
Ejemplo n.º 7
0
        private void Bind()
        {
            if (string.IsNullOrEmpty(Request.QueryString["setSongId"]))
                Response.Redirect(LinkBuilder.DashboardLink());

            var setSongId = new Guid(Request.QueryString["setSongId"]);

            var showService = new ShowService(Ioc.GetInstance<IShowRepository>());
            var setService = new SetService(Ioc.GetInstance<ISetRepository>());
            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

            var setSong = setSongService.GetSetSong(setSongId);
            var set = setService.GetSet(setSong.SetId.Value);
            var show = showService.GetShow(set.ShowId.Value);

            ShowName = show.GetShowName();
            SongName = setSong.SongName;
            lnkReviewShow.NavigateUrl = LinkBuilder.AnalysisLink(show.ShowId);
            lnkNoReviews.NavigateUrl = LinkBuilder.AnalysisLink(show.ShowId);

            SetPageTitle("Review of " + SongName + " from " + ShowName);

            BindReviews(setSongId);
        }
        private FavoriteLiveSongList GetAnalysisPart(Song song)
        {
            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());
            var analysisService = new AnalysisService(Ioc.GetInstance<IAnalysisRepository>());
            var songService = new SongService(Ioc.GetInstance<ISongRepository>());

            //Get all Analysis for that Song but in groups of SetSong
            var analysis = analysisService.GetAnalysisBySong(song.SongId).GroupBy(x => x.SetSongId);

            double highestRating = 0;
            double? rating = 0;
            List<Guid> setSongIds = new List<Guid>();

            //If there are no analysis then there is nothing to see here
            if (analysis.Count() == 0)
                return null;

            var fave = new FavoriteLiveSongList(SetSong.FromSong(song));

            //If there are 1 or more analysis then we need to find out which is the highest ranked
            foreach (var a in analysis)
            {
                rating = a.Average(x => x.Rating);
                var setSongId = a.First().SetSongId;

                if (rating.HasValue && rating.Value > highestRating)
                {
                    highestRating = rating.Value;
                    fave.HighestRatedShows = new List<Show>();

                    var setSong = (SetSong)setSongService.GetSetSong(setSongId);
                    var show = GetShowFromSetSong(setSongId);
                    fave.HighestRatedShows.Add(show);
                }
                else if (rating.HasValue && rating.Value == highestRating)
                {
                    var setSong = (SetSong)setSongService.GetSetSong(setSongId);
                    var show = GetShowFromSetSong(setSongId);

                    fave.HighestRatedShows.Add(show);
                }
            }

            fave.HighestRating = highestRating;

            return fave;
        }
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            ResetPanels();

            TopicService tourService = new TopicService(Ioc.GetInstance<ITopicRepository>());
            SongService songService = new SongService(Ioc.GetInstance<ISongRepository>());
            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());
            SetSongService setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

            bool success = false;
            bool compiledSuccess = true;

            if (string.IsNullOrEmpty(hdnId.Value))
            {
                Bind();
                return;
            }

            var set = (Set)setService.GetSet(new Guid(hdnId.Value));

            if (set == null)
            {
                Bind();
                return;
            }

            if (lstSongs.Items.Count <= 0)
            {
                Bind();
                return;
            }

            using (IUnitOfWork uow = TheCore.Infrastructure.UnitOfWork.Begin())
            {

                foreach (ListItem item in lstSongs.Items)
                {
                    if (!item.Selected) { continue; }

                    var song = songService.GetSong(new Guid(item.Value));

                    if (song == null) { continue; }

                    short? order = 1;

                    if (set.SetSongs.Count > 0)
                    {
                        order = set.SetSongs.OrderBy(x => x.Order).Last().Order;
                        order++;
                    }

                    SetSong setSong = new SetSong()
                        {
                            Album = song.Album,
                            CreatedDate = DateTime.UtcNow,
                            SetSongId = Guid.NewGuid(),
                            SongId = song.SongId,
                            SongName = song.SongName,
                            Order = order,
                            Set = set,
                            SetId = set.SetId,
                            Segue = chkSegue.Checked
                        };

                    setSongService.Save(setSong, out success);

                    compiledSuccess = compiledSuccess && success;
                }

                if (compiledSuccess)
                {
                    uow.Commit();
                    phSuccess.Visible = true;
                    phError.Visible = false;
                }
                else
                {
                    phError.Visible = true;
                    phSuccess.Visible = false;
                }
            }
            
            Bind();
        }
Ejemplo n.º 10
0
        public void btnSearchSongName_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSearchSongName.Text))
                return;

            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

            var setsongs = setSongService.GetAllSetSongs().Where(x => x.SongName.Contains(txtSearchSongName.Text));

            rptSongs.DataSource = setsongs;
            rptSongs.DataBind();
        }
        public static List<FavoriteSetSong> GenerateFavoriteVersionListByAlbum(string album)
        {
            var songService = new SongService(Ioc.GetInstance<ISongRepository>());
            var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());
            var favoriteVersionService = new FavoriteVersionService(Ioc.GetInstance<IFavoriteVersionRepository>());
            var showService = new ShowService(Ioc.GetInstance<IShowRepository>());
            var setService = new SetService(Ioc.GetInstance<ISetRepository>());

            FavoriteVersionSongList songList = new FavoriteVersionSongList();

            foreach (var song in songService.GetSongsByAlbum(album))
            {
                
                var versions = favoriteVersionService.GetAllFavoriteVersions().Where(s => s.SongId == song.SongId).GroupBy(g => g.SetSongId).ToList();

                if (versions == null || versions.Count() <= 0)
                {
                    songList.AddFavoriteSongPair(null, SetSong.FromSong((Song)song), null);
                    continue;
                }

                if (versions.Count() == 1)
                {
                    var version = versions[0].First();

                    var setSong = setSongService.GetSetSong(version.SetSongId.Value);
                    var set = setService.GetSet(setSong.SetId.Value);
                    var show = showService.GetShow(set.ShowId.Value);

                    songList.AddFavoriteSongPair((FavoriteVersion)version, (SetSong)setSong, (Show)show);
                }
                else
                {
                    int count = 0;

                    Guid? setSongId = null;
                    FavoriteVersion fave = null;
                    SetSong setSong = null;
                    IShow show = null;

                    foreach (var version in versions)
                    {
                        if (version.Count() > count)
                        {
                            fave = (FavoriteVersion)version.First();
                            setSongId = version.First().SetSongId;
                        }
                    }

                    if(setSongId != null)
                    {
                        setSong = (SetSong)setSongService.GetSetSong(setSongId.Value);
                        var set = setService.GetSet(setSong.SetId.Value);
                        show = showService.GetShow(set.ShowId.Value);
                        
                    }

                    songList.AddFavoriteSongPair(fave, setSong ?? SetSong.FromSong((Song)song) , (Show)show);
                }
            }

            return songList.SongList;
        }