Exemplo n.º 1
0
        public ActionResult NextQuestion(FormCollection frm)
        {
            // get the response

            var chosenRep        = frm["chosenRep"].ToString();
            PossibleResponse res = new PossibleResponse();

            res.ID = Convert.ToInt32(chosenRep);

            //add the responses to
            mapAnswers.Add(question, res);


            IndexQuestion++;
            var model = PrepareNextQuestion(IndexQuestion);

            if (model != null)
            {
                return(View(model));
            }
            else
            {
                ViewBag.error    = "there is no other question";
                ViewData["test"] = TestToAnswer;

                return(RedirectToAction("InfosOfAnswers", "Collaborator", null));
                //return View();
            }
        }
Exemplo n.º 2
0
        public ActionResult AutoTests()
        {
            IEnumerable <t_evaluationtest> list = _sr.DisplayTests(logger, "Auto");

            RenderList = new List <TestToRender>();

            TestToRender     render;
            Question         question;
            PossibleResponse response;

            foreach (t_evaluationtest test in list)
            {
                render                  = new TestToRender();
                render.ID               = test.ET_ID;
                render.Type             = test.ET_Type;
                render.tType            = test.Et_tType;
                render.globaloNoteSoFar = test.globaloNoteSoFar;
                render.NbreQuestions    = test.t_criteria.Count();
                render.NbreParticipants = test.t_answertestaffectation.Count();


                render.questions = new List <Question>();

                //add the questions
                foreach (t_criteria c in test.t_criteria)
                {
                    question             = new Question();
                    question.ID          = c.Cr_ID;
                    question.coefficient = c.Cr_coefficient;
                    question.Content     = c.Cr_Content;

                    question.PossibleResponses = new List <PossibleResponse>();

                    //add the responses of each question
                    foreach (t_possibleresponse rep in c.t_possibleresponse)
                    {
                        response         = new PossibleResponse();
                        response.ID      = rep.Pr_ID;
                        response.Content = rep.Pr_Content;
                        response.Score   = rep.Pr_score;

                        question.PossibleResponses.Add(response);
                    }


                    render.questions.Add(question);
                }
                RenderList.Add(render);
            }
            RenderTestList model = new RenderTestList();

            model.TestsList = RenderList;

            return(View(model));
        }
Exemplo n.º 3
0
        public override IEnumerable <PossibleResponse> PossibleResponses()
        {
            //yes and no have default helpers
            yield return(PossibleResponse.NoResponse(NoResponse));

            //or build your own response
            yield return(new PossibleResponse("YesIntent", "yes", YesResponse));

            //or pull the response from elsewhere
            yield return(new PossibleResponse("ExternalResponseIntent", "external", ExternalResponse));
        }
Exemplo n.º 4
0
        public ActionResult Tests360()
        {
            IEnumerable <t_evaluationtest> list = _sr.DisplayTests(logger, "360");

            RenderList = new List <TestToRender>();


            TestToRender     render;
            Question         question;
            PossibleResponse response;

            foreach (t_evaluationtest test in list)
            {
                render                  = new TestToRender();
                render.ID               = test.ET_ID;
                render.Type             = test.ET_Type;
                render.tType            = test.Et_tType;
                render.globaloNoteSoFar = test.globaloNoteSoFar;
                render.NbreQuestions    = test.t_criteria.Count();
                render.NbreParticipants = test.t_answertestaffectation.Count();

                render.questions = new List <Question>();

                //add target list of the test

                render.targetList = new List <CollaboratorModel>();
                CollaboratorModel colab;

                foreach (t_evaluationtargetaffectation aff in test.t_evaluationtargetaffectation)
                {
                    colab = new CollaboratorModel();
                    t_collaborator target = aff.t_collaborator;
                    colab.C_Lastname = target.C_Lastname;
                    colab.C_Forname  = target.C_Forname;
                    colab.C_ID       = target.C_ID;
                    render.targetList.Add(colab);
                }


                //add the questions
                foreach (t_criteria c in test.t_criteria)
                {
                    question             = new Question();
                    question.ID          = c.Cr_ID;
                    question.coefficient = c.Cr_coefficient;
                    question.Content     = c.Cr_Content;

                    question.PossibleResponses = new List <PossibleResponse>();

                    //add the responses of each question
                    foreach (t_possibleresponse rep in c.t_possibleresponse)
                    {
                        response         = new PossibleResponse();
                        response.ID      = rep.Pr_ID;
                        response.Content = rep.Pr_Content;
                        response.Score   = rep.Pr_score;

                        question.PossibleResponses.Add(response);
                    }


                    render.questions.Add(question);
                }
                RenderList.Add(render);
            }
            RenderTestList model = new RenderTestList();

            model.TestsList = RenderList;

            return(View(model));
        }