Ejemplo n.º 1
0
        public string buildQuestionToLevel(double popularFrom, double popularTo, string locationInTable)
        {
albumIsNull:
            Album album;
            Song songForQuestion;

            if ((album = BuildQuestionByArtistSkills()) != null)
            {
                this.albumForQuestion = album;
            }
            else if ((album = BuildQuestionByYearsSkills()) != null)
            {
                this.albumForQuestion = album;
            }
            else
            {
                Random rnd          = new Random();
                int    chooseMethod = rnd.Next(0, 2);
                if (chooseMethod == 1)
                {
                    songForQuestion = db.GetSongOfArtistByPopularity(popularFrom, popularTo);
                }
                else
                {
                    songForQuestion = db.GetOthersYearSkillsSong(locationInTable);
                }
                if (songForQuestion == null)
                {
                    goto albumIsNull;
                }
                album = db.GetSpecificAlbumOfArtist(songForQuestion.Artist_id, songForQuestion.Album_name);
            }
            if (album == null)
            {
                goto albumIsNull;
            }
            this.albumForQuestion = album;
            this.Question         = this.Question.Replace("<artist_name>", album.Artist_name);
            this.Question         = this.Question.Replace("<album_name>", album.Album_name);
            return(this.Question);
        }