Esempio n. 1
0
        public IWholeShowScore GetScore(IGuessWholeShow master)
        {
            double correct = 100;
            double incorrect = -100;
            double correctSpot = 500;

            IWholeShowScore score = new WholeShowScore();

            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            var masterSet = (Set)setService.GetSet(master.SetId);

            foreach (var setSong in this.Set.SetSongs.OrderBy(x => x.Order))
            {
                int count = masterSet.SetSongs.Where(x => x.SongId == setSong.SongId).Count();

                //If they are just straight up wrong then add it to here
                if (count == 0)
                    score.AddIncorrectSong(setSong.Song, incorrect);
                else
                {
                    int masterCount = masterSet.SetSongs.Where(x => x.SongId == setSong.SongId).Count();
                    int correctCount = score.Correct.Where(x => x.Key.SongId == setSong.SongId).Count();

                    if (masterCount > correctCount)
                    {
                        if (masterSet.SetSongs.Count >= setSong.Order)
                        {
                            if (setSong.Order == masterSet.SetSongs.Where(x => x.Order == setSong.Order).Single().Order)
                            {
                                //GIVE LOTS OF EXTRA POINTS CUZ THEY GOT IT IN THE SAME SLOT
                                score.AddCorrectSong(setSong.Song, correctSpot);
                            }
                            else
                            {
                                //GiVE NORMAL AMT OF POINTS CUZ THEY GOT WRONG SLOT
                                score.AddCorrectSong(setSong.Song, correct);
                            }
                        }
                        else
                        {
                            //GiVE NORMAL AMT OF POINTS CUZ THEY GOT WRONG SLOT
                            score.AddCorrectSong(setSong.Song, correct);
                        }
                    }
                    else
                    {
                        //If they guessed the song more times than is in the master setlist then they got it wrong
                        score.AddIncorrectSong(setSong.Song, incorrect);
                    }
                }
            }

            return score;
        }
Esempio n. 2
0
        private void Bind()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["gid"]))
            {
                phGuessWholeShowScore.Visible = true;
                
                Guid guessId = new Guid(Request.QueryString["gid"]);
                Guid userID = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString());

                GuessWholeShowService guessService = new GuessWholeShowService(Ioc.GetInstance<IGuessWholeShowRepository>());
                TopicService topicService = new TopicService(Ioc.GetInstance<ITopicRepository>());

                var guess = guessService.GetGuessWholeShow(guessId);

                TopicName = topicService.GetTopic(guess.TopicId).TopicName;

                if (guess.UserId == userID)
                {
                    var officialGuess = guessService.GetOfficialGuessByTopic(guess.TopicId);

                    if (officialGuess != null)
                    {
                        var score = guess.GetScore(officialGuess);

                        if (score != null)
                        {
                            lblGuessWholeShowScore.Text = score.GetScore().ToString();
                        }
                    }
                }
                else
                {
                    //Go buck f*****g wild on them
                }

                //WHEN OTHER GUESSES GET INTEGRATED INTO THIS PAGE THIS FUNCTIONALITY WILL NEED 
                // TO BE USED FOR EACH ONE SO WILL HAVE TO BE MOVED OUT
                SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

                var set = (Set)setService.GetSet(guess.SetId);

                if (set != null)
                {
                    rptSongList.DataSource = set.SetSongs.Where(x => x.Deleted == false).OrderBy(x => x.Order);
                    rptSongList.DataBind();
                }
            }

            
        }
Esempio n. 3
0
        private void Bind()
        {
            ShowService service = new ShowService(Ioc.GetInstance<IShowRepository>());
            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            var shows = service.GetAllShows();
            var sets = setService.GetAllSets();

            foreach (var show in shows)
            {
                ddlShows.Items.Add(new ListItem(show.GetShowName(), show.ShowId.ToString()));
            }

            ListItem item = new ListItem("Please select a show", "-1");

            ddlShows.Items.Insert(0, item);

            item.Selected = true;

            foreach (Set set in sets)
            {
                StringBuilder setName = new StringBuilder();
                
                setName.Append(set.Notes);

                if (set.Official)
                    setName.Append("***");

                if (set.Encore)
                    setName.Append(" (E)");

                if (set.ShowId != null)
                    setName.Append(" (S)");

                if (set.SetNumber > 0)
                    setName.Append(string.Format(" - {0}", set.SetNumber));

                ddlSets.Items.Add(new ListItem(setName.ToString(), set.SetId.ToString()));
            }
            ListItem item2 = new ListItem("Please select a set", "-1");

            ddlSets.Items.Insert(0, item2);

            item2.Selected = true;
        }
        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
            }
        }
        private void BindSet(GuessWholeShow guess)
        {
            lnkGetScore.NavigateUrl = LinkBuilder.GetScoreLink(guess.GuessWholeShowId, Request.Url.ToString());

            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            var set = (Set)setService.GetSet(guess.SetId);

            if (set != null)
            {
                rptSongList.DataSource = set.SetSongs.Where(x => x.Deleted == false).OrderBy(x => x.Order);
                rptSongList.DataBind();
            }

            lnkAddSongsToSet.NavigateUrl = LinkBuilder.AddSongsToSetControlLink(set.SetId, returnUrl);
            phAddSongs.Visible = true;
            
        }
        public void lnkAddSetToShow_Click(object sender, EventArgs e)
        {
            ResetPanels();

            Guid showId = new Guid(hdnId.Value);

            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            var show = (Show)showService.GetShow(showId);
            bool success = false;

            if(show != null)
            {
                short? setNumber = (short)show.Sets.Count;
                setNumber++;

                Guid setId = Guid.NewGuid();

                Set set = new Set()
                {
                    CreatedDate = DateTime.UtcNow,
                    Encore = chkEncore.Checked,
                    SetId = setId,
                    SetNumber = setNumber,
                    ShowId = showId,
                    Official = true
                };

                setService.SaveCommit(set, out success);
            }

            if (success)
            {
                phSuccess.Visible = true;
                phError.Visible = false;
            }
            else
            {
                phSuccess.Visible = false;
                phError.Visible = true;
            }

            Bind();
        }
        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();
                //}
            }
        }
        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);
        }
Esempio n. 9
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            ResetPanels();

            bool success = false;
            Guid? showId;
            Guid setId = Guid.NewGuid();

            SetService service = new SetService(Ioc.GetInstance<ISetRepository>());

            if (Validated())
            {
                showId = ddlShows.SelectedValue != "-1" ? new Guid(ddlShows.SelectedValue) : EmptyGuid;

                short? setNum = ddlSetNumber.SelectedValue != "0" ? short.Parse(ddlSetNumber.SelectedValue) : (short)0;

                Set set = new Set()
                {
                    SetId = setId,
                    Encore = chkEncore.Checked,
                    Notes = txtNotes.Text.Trim(),
                    Official = chkOfficial.Checked,
                    SetNumber = setNum == 0 ? null : setNum,
                    ShowId = showId == EmptyGuid ? null : showId
                };
                
                service.SaveCommit(set, out success);
            }

            if (success)
            {
                phSuccess.Visible = true;
                phError.Visible = false;
                phAddSongs.Visible = true;
                lnkAddSongsToSet.NavigateUrl = LinkBuilder.AddSongsToSetControlLink(setId, returnUrl);
                lnkAddSetToGuess.NavigateUrl = LinkBuilder.AddSetToGuessLink(setId);
            }
            else
            {
                phError.Visible = true;
                phSuccess.Visible = false;
            }
            
        }
        private void SetupSets()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                Guid setId = new Guid(Request.QueryString["id"]);

                hdnSetId.Value = setId.ToString();
            }

            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            var sets = setService.GetAllSets();

            foreach (var set in sets)
            {
                string notes = "<NO NAME>";

                if (!string.IsNullOrEmpty(set.Notes))
                {
                    if (set.Notes.Length <= 15 && set.Notes.Length > 0)
                        notes = set.Notes;
                    else if (set.Notes.Length > 15)
                        notes = set.Notes.Substring(0, 14);
                }

                string setName = string.Format("{0} - {1}", notes, set.SetNumber);

                ddlSets.Items.Add(new ListItem(setName, set.SetId.ToString()));
            }

            ListItem item = new ListItem("Please select a Set", "-1");

            ddlSets.Items.Insert(0, item);

            item.Selected = true;
        }
Esempio n. 11
0
        private void Bind()
        {
            Guid showId;
            IMyShow myShow;
            var userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString());

            if (string.IsNullOrEmpty(Request.QueryString["showId"]))
            {
                Response.Redirect(LinkBuilder.DashboardLink());
            }

            showId = new Guid(Request.QueryString["showId"]);
            ShowId = showId;
            hdnShowId.Value = showId.ToString();
            var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>());

            if (!string.IsNullOrEmpty(Request.QueryString["myShowId"]))
            {
                var myShowId = new Guid(Request.QueryString["myShowId"]);
                myShow = myShowService.GetMyShow(myShowId);
            }
            else
            {
                
                myShow = myShowService.GetMyShow(showId, userId);
            }

            if (myShow != null)
            {
                hdnMyShowId.Value = myShow.MyShowId.ToString();

                ajaxShowRating.CurrentRating = myShow.Rating == null ? 0 : int.Parse(myShow.Rating.Value.ToString());
                ajaxBustoutRating.CurrentRating = myShow.BustoutRating == null ? 0 : int.Parse(myShow.BustoutRating.Value.ToString());
                ajaxEnergyRating.CurrentRating = myShow.EnergyRating == null ? 0 : int.Parse(myShow.EnergyRating.Value.ToString());
                ajaxFlowRating.CurrentRating = myShow.FlowRating == null ? 0 : int.Parse(myShow.FlowRating.Value.ToString());
                ajaxSegueRating.CurrentRating = myShow.SegueRating == null ? 0 : int.Parse(myShow.SegueRating.Value.ToString());
                ajaxType1JamRating.CurrentRating = myShow.Type1JamRating == null ? 0 : int.Parse(myShow.Type1JamRating.Value.ToString());
                ajaxType2JamRating.CurrentRating = myShow.Type2JamRating == null ? 0 : int.Parse(myShow.Type2JamRating.Value.ToString());

                txtFree.Text = myShow.Notes;
                phMyShow.Visible = true;
                phMyShowRating.Visible = true;
                phNotMyShow.Visible = false;
            }

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

            var show = showService.GetShow(showId);

            SetPageTitle("Analyze " + show.GetShowName());

            lblShow.Text = show.GetShowName();
            //var sets = setService.GetSetsForShow(showId).ToList();  //sets NEEDS to be a list here! DO NOT CHANGE DAN!

            //var ss = (from set in sets
            //          from song in setSongService.GetSetSongsBySet(set.SetId).OrderBy(z => z.Order.Value).DefaultIfEmpty()
            //          from analysis in analysisService.GetAnalysisBySetSongAndUser(song.SetSongId, userId).DefaultIfEmpty()
            //          select new { Set = set, Song = song, Analysis = analysis }).ToList();

            //rptSongs.DataSource = ss;
            //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;
        }
        private void RemoveSet(Set set, Show show, ref SetService setService)
        {
            set.Deleted = true;
            set.DeletedDate = DateTime.Now;

            setService.Delete(set);

            short? setNumber = 1;

            var setList = show.Sets.OrderBy(x => x.SetNumber).Where(x => x.SetId != set.SetId);

            foreach (var s in setList)
            {
                s.SetNumber = setNumber;
                setNumber++;
            }
        }
        private void MoveSetUp(Set set, Show show, ref SetService setService)
        {
                if (set.SetNumber != 1)
                {
                    var setBefore = (Set)setService.GetSet(show.Sets.Where(x => x.SetNumber == set.SetNumber - 1).First().SetId);

                    set.SetNumber--;
                    setBefore.SetNumber++;
                }
        }
        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();
        }
        private Guid CreateNewSet(Guid showId, out bool success)
        {
            success = false;
            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            Guid setId = Guid.NewGuid();

            Set newSet = new Set()
            {
                SetId = setId,
                Encore = false,
                Official = false,
                SetNumber = 0,
                ShowId = showId
            };

            setService.Save(newSet, out success);

            return setId;
        }
        private void Bind()
        {
            Guid showId = new Guid(hdnId.Value);

            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            var sets = setService.GetSetsForShow(showId).ToList();

            FinalSetNumber = 1;

            if (sets != null)
            {
                if (sets.Count > 0)
                {
                    FinalSetNumber = sets.Count;
                }

                rptSets.DataSource = sets;
                rptSets.DataBind();
            }
        }
        public void rptSets_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ResetPanels();

            bool success = true;
            bool needToCommit = false;

            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

            Guid showId = new Guid(hdnId.Value);

            var show = (Show)showService.GetShow(showId);

            using (IUnitOfWork uow = TheCore.Infrastructure.UnitOfWork.Begin())
            {
                Guid setId = new Guid(e.CommandArgument.ToString());

                var set = (Set)setService.GetSet(setId);

                if (set != null)
                {
                    if (e.CommandName.ToLower() == "remove")
                    {
                        needToCommit = true;
                        RemoveSet(set, show, ref setService);
                    }
                    else if (e.CommandName.ToLower() == "up")
                    {
                        needToCommit = true;
                        MoveSetUp(set, show, ref setService);
                    }
                    else if (e.CommandName.ToLower() == "down")
                    {
                        needToCommit = true;
                        MoveSetDown(set, show, ref setService);
                    }
                    else if (e.CommandName.ToLower() == "change")
                    {
                        needToCommit = true;
                        Response.Redirect(LinkBuilder.AddSongsToSetControlLink(set.SetId, string.Format("/Admin/AddSetsToShow.aspx?id={0}", showId)));
                    }

                    try
                    {
                        if (needToCommit)
                        {
                            uow.Commit();

                            success = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        success = false;
                    }
                }
            }

            DetermineSuccess(success);

            Bind();
        }
        private void BindSet()
        {
            if (!string.IsNullOrEmpty(hdnId.Value))
            {
                SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());

                Guid g = new Guid(hdnId.Value);

                var set = (Set)setService.GetSet(g);

                if (set != null)
                {
                    if (set.SetSongs.Count > 0)
                    {
                        FinalOrder = set.SetSongs.OrderBy(x => x.Order).Last().Order;

                        rptSongList.DataSource = set.SetSongs.OrderBy(x => x.Order);
                        rptSongList.DataBind();
                    }
                }
            }
        }
        private void MoveSetDown(Set set, Show show, ref SetService setService)
        {
            if (set.SetNumber != show.Sets.OrderBy(x => x.SetNumber).Last().SetNumber)
            {
                var songAfter = (Set)setService.GetSet(show.Sets.Where(x => x.SetNumber == set.SetNumber + 1).First().SetId);

                set.SetNumber++;
                songAfter.SetNumber--;
            }
        }