Esempio n. 1
0
        void RandomQuestionArtist(ref MG_Question myQues)
        {
            int    val;
            Random rand = new Random();

            List <MG_Artist> ListArtist = db.MG_Artists.Where(x => x.Nation == ((ComboBoxItem)ComboBox.SelectedValue).Content.ToString()).ToList();

            List <int> myVal = new List <int>();

            do
            {
                val = rand.Next(0, ListArtist.Count() - 1);
            }while (IsHave(myVal, val) && ListArtist[val].NameArtist != myQues.Answer);

            myQues.A = ListArtist[val].NameArtist;
            myVal.Add(val);

            do
            {
                val = rand.Next(0, ListArtist.Count() - 1);
            }while (IsHave(myVal, val) && ListArtist[val].NameArtist != myQues.Answer);

            myQues.B = ListArtist[val].NameArtist;
            myVal.Add(val);

            do
            {
                val = rand.Next(0, ListArtist.Count() - 1);
            }while (IsHave(myVal, val) && ListArtist[val].NameArtist != myQues.Answer);
            myQues.C = ListArtist[val].NameArtist;
            myVal.Add(val);

            do
            {
                val = rand.Next(0, ListArtist.Count() - 1);
            }while (IsHave(myVal, val) && ListArtist[val].NameArtist != myQues.Answer);
            myQues.D = ListArtist[val].NameArtist;
            myVal.Add(val);

            val = rand.Next(1, 4);
            switch (val)
            {
            case 1:
                myQues.A = myQues.Answer;
                break;

            case 2:
                myQues.B = myQues.Answer;
                break;

            case 3:
                myQues.C = myQues.Answer;
                break;

            case 4:
                myQues.D = myQues.Answer;
                break;
            }
        }
Esempio n. 2
0
        void CreateQuestionSong()
        {
            MG_Question myQuestionSong = new MG_Question();

            myQuestionSong.TextQuestion = "Name Of Song?";
            myQuestionSong.Source       = "";
            myQuestionSong.Description  = "Chosen Correct Answer";
            myQuestionSong.Type         = 0;
            myQuestionSong.Genre        = ((ComboBoxItem)ComboBox.SelectedValue).Content.ToString();
            myQuestionSong.Answer       = mySong.Name_Song;
            RandomQuestion(ref myQuestionSong);
            db.MG_Questions.InsertOnSubmit(myQuestionSong);
            db.SubmitChanges();
        }
Esempio n. 3
0
 partial void DeleteMG_Question(MG_Question instance);
Esempio n. 4
0
 partial void UpdateMG_Question(MG_Question instance);
Esempio n. 5
0
 partial void InsertMG_Question(MG_Question instance);