private void CofresultsBTN_Click_1(object sender, RoutedEventArgs e)
        {
            int              ques1AnswerID = 0, ques2AnswerID = 0, ques3AnswerID = 0, ques4AnswerID = 0, answerTotal = 0;
            pslResults       psl = new pslResults();
            americanoResults ar  = new americanoResults();
            vanillaResults   vr  = new vanillaResults();

            TAnswer answer = new TAnswer();

            if (mornRB.IsChecked == true)
            {
                ques1AnswerID    = 1;
                answer.AnswerOne = "1";
            }
            else if (nightRB.IsChecked == true)
            {
                ques1AnswerID    = 2;
                answer.AnswerOne = "2";
            }
            if (purpRB.IsChecked == true)
            {
                ques2AnswerID    = 1;
                answer.AnswerTwo = "1";
            }
            else if (orangeRB.IsChecked == true)
            {
                ques2AnswerID    = 2;
                answer.AnswerTwo = "2";
            }
            else if (blueRB.IsChecked == true)
            {
                ques2AnswerID    = 3;
                answer.AnswerTwo = "3";
            }
            else if (BlackRB.IsChecked == true)
            {
                ques2AnswerID    = 4;
                answer.AnswerTwo = "4";
            }
            if (catRB.IsChecked == true)
            {
                ques3AnswerID      = 1;
                answer.AnswerThree = "1";
            }
            else if (dogsRB.IsChecked == true)
            {
                ques3AnswerID      = 2;
                answer.AnswerThree = "2";
            }
            if (moviesRB.IsChecked == true)
            {
                ques4AnswerID     = 1;
                answer.AnswerFour = "1";
            }
            else if (shopRB.IsChecked == true)
            {
                ques4AnswerID     = 2;
                answer.AnswerFour = "2";
            }
            else if (hikeRB.IsChecked == true)
            {
                ques4AnswerID     = 3;
                answer.AnswerFour = "3";
            }
            else if (sleepRB.IsChecked == true)
            {
                ques4AnswerID     = 4;
                answer.AnswerFour = "4";
            }
            answerTotal = ques1AnswerID + ques2AnswerID + ques3AnswerID + ques4AnswerID;
            if (answerTotal <= 5)
            {
                vr.Show();
            }
            else if (answerTotal <= 9)
            {
                psl.Show();
            }
            else if (answerTotal >= 10)
            {
                ar.Show();
            }
            answer.TQuiz = db.TQuizs.Find(13);
            db.TAnswers.Add(answer);
            db.SaveChanges();
        }
示例#2
0
        private void ResultsBTN_Click(object sender, RoutedEventArgs e)
        {
            int ques1AnswerID = 0, ques2AnswerID = 0, ques3AnswerID = 0, ques4AnswerID = 0, answerTotal = 0;
            spongebobResults sbr = new spongebobResults();
            PatrickResults   pr  = new PatrickResults();
            KrabsResults     kr  = new KrabsResults();
            SquidwardResults sqr = new SquidwardResults();

            TAnswer answer = new TAnswer();

            if (musicRB.IsChecked == true)
            {
                ques1AnswerID    = 1;
                answer.AnswerOne = "1";
            }
            else if (movieRB.IsChecked == true)
            {
                ques1AnswerID    = 2;
                answer.AnswerOne = "2";
            }
            else if (hangRB.IsChecked == true)
            {
                ques1AnswerID    = 3;
                answer.AnswerOne = "3";
            }
            else if (workRB.IsChecked == true)
            {
                ques1AnswerID    = 4;
                answer.AnswerOne = "4";
            }
            if (greenRB.IsChecked == true)
            {
                ques2AnswerID    = 1;
                answer.AnswerTwo = "1";
            }
            else if (pinkRB.IsChecked == true)
            {
                ques2AnswerID    = 2;
                answer.AnswerTwo = "2";
            }
            else if (purpRB.IsChecked == true)
            {
                ques2AnswerID    = 3;
                answer.AnswerTwo = "3";
            }
            else if (orangeRB.IsChecked == true)
            {
                ques2AnswerID    = 4;
                answer.AnswerTwo = "3";
            }
            if (crabRB.IsChecked == true)
            {
                ques3AnswerID      = 1;
                answer.AnswerThree = "1";
            }
            else if (pizzaRB.IsChecked == true)
            {
                ques3AnswerID      = 2;
                answer.AnswerThree = "2";
            }
            else if (spagRB.IsChecked == true)
            {
                ques3AnswerID      = 3;
                answer.AnswerThree = "3";
            }
            else if (friesRB.IsChecked == true)
            {
                ques3AnswerID      = 4;
                answer.AnswerThree = "4";
            }
            if (garyRB.IsChecked == true)
            {
                ques4AnswerID     = 1;
                answer.AnswerFour = "1";
            }
            else if (patRB.IsChecked == true)
            {
                ques4AnswerID     = 2;
                answer.AnswerFour = "2";
            }
            else if (plankRB.IsChecked == true)
            {
                ques4AnswerID     = 3;
                answer.AnswerFour = "3";
            }
            else if (sandRB.IsChecked == true)
            {
                ques4AnswerID     = 4;
                answer.AnswerFour = "4";
            }
            answerTotal = ques1AnswerID + ques2AnswerID + ques3AnswerID + ques4AnswerID;
            if (answerTotal <= 4)
            {
                sqr.Show();
            }
            else if (answerTotal <= 6)
            {
                pr.Show();
            }
            else if (answerTotal <= 8)
            {
                sbr.Show();
            }
            else if (answerTotal >= 10)
            {
                kr.Show();
            }
            answer.TQuiz = db.TQuizs.Find(14);
            db.TAnswers.Add(answer);
            db.SaveChanges();
        }
        private void ResultusBttn_Click(object sender, RoutedEventArgs e)
        {
            int ques1AnswerID = 0, ques2AnswerID = 0, ques3AnswerID = 0, ques4AnswerID = 0, answerTotal = 0;
            AlligatorResults ar = new AlligatorResults();
            HorseResult      hr = new HorseResult();
            LionResults      lr = new LionResults();
            CoyoteResults    cr = new CoyoteResults();

            TAnswer answer = new TAnswer();

            if (comfortRB.IsChecked == true)
            {
                ques1AnswerID    = 1;
                answer.AnswerOne = "1";
            }
            else if (comegoRB.IsChecked == true)
            {
                ques1AnswerID    = 2;
                answer.AnswerOne = "2";
            }
            else if (spendRB.IsChecked == true)
            {
                ques1AnswerID    = 3;
                answer.AnswerOne = "3";
            }
            else if (friendsRB.IsChecked == true)
            {
                ques1AnswerID    = 4;
                answer.AnswerOne = "4";
            }
            if (strikeRB.IsChecked == true)
            {
                ques2AnswerID    = 1;
                answer.AnswerTwo = "1";
            }
            else if (walkRB.IsChecked == true)
            {
                ques2AnswerID    = 2;
                answer.AnswerTwo = "2";
            }
            else if (rageRB.IsChecked == true)
            {
                ques2AnswerID    = 3;
                answer.AnswerTwo = "3";
            }
            else if (callRB.IsChecked == true)
            {
                ques2AnswerID    = 4;
                answer.AnswerTwo = "4";
            }
            if (myselfRB.IsChecked == true)
            {
                ques3AnswerID      = 1;
                answer.AnswerThree = "1";
            }
            else if (strangerRB.IsChecked == true)
            {
                ques3AnswerID      = 2;
                answer.AnswerThree = "2";
            }
            else if (familyRB.IsChecked == true)
            {
                ques3AnswerID      = 3;
                answer.AnswerThree = "3";
            }
            else if (loyalRB.IsChecked == true)
            {
                ques3AnswerID      = 4;
                answer.AnswerThree = "4";
            }
            if (secretRB.IsChecked == true)
            {
                ques4AnswerID     = 1;
                answer.AnswerFour = "1";
            }
            else if (bookRB.IsChecked == true)
            {
                ques4AnswerID     = 2;
                answer.AnswerFour = "2";
            }
            else if (lifeRB.IsChecked == true)
            {
                ques4AnswerID     = 3;
                answer.AnswerFour = "3";
            }
            else if (truthRB.IsChecked == true)
            {
                ques4AnswerID     = 4;
                answer.AnswerFour = "4";
            }
            answerTotal = ques1AnswerID + ques2AnswerID + ques3AnswerID + ques4AnswerID;
            if (answerTotal <= 6)
            {
                ar.Show();
            }
            else if (answerTotal <= 8)
            {
                hr.Show();
            }
            else if (answerTotal <= 10)
            {
                lr.Show();
            }
            else if (answerTotal >= 12)
            {
                cr.Show();
            }
            answer.TQuiz = db.TQuizs.Find(14);
            db.TAnswers.Add(answer);
            db.SaveChanges();
        }