Example #1
0
        /*
         * Ouput Blockscore Questions Score Response object to a string
         */
        private string GetblockscoreQuestionsScoreResponseoutput(BlockScoreQuestionsScoreResponse blockscoreresponse)
        {
            string strreturn = "";

            strreturn += "<br/>question_set_id = " + blockscoreresponse.question_set_id;
            strreturn += "<br/>score = " + blockscoreresponse.score;

            return(strreturn);
        }
Example #2
0
        /*
         * Verify the Answers with Blockscore
         */
        private void CheckAnswers(BlockscoreAPI blockscore, BlockScoreResponse questionSet)
        {
            if (!string.IsNullOrEmpty(questionSet.question_set_id))
            {
                try
                {
                    var random = new Random();

                    List <BlockScoreAnswer> answerlist = new List <BlockScoreAnswer>
                    {
                        new BlockScoreAnswer {
                            question_id = "1", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "2", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "3", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "4", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "5", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                    };

                    lblquestionscorerequest.Text = GetblockscoreQuestionsRequestoutput(questionSet, answerlist);

                    BlockScoreQuestionsScoreResponse blockscorequestionscoreresponse = blockscore.CheckQuestionAnswers(answerlist);

                    lblquestionscoreresponse.Text = GetblockscoreQuestionsScoreResponseoutput(blockscorequestionscoreresponse);
                }
                catch (Exception e)
                {
                    throw new Exception("Caught exception: " + e.Message + "\n");
                }
            }
        }