Beispiel #1
0
        public ActionResult Take(long id)
        {
            TestProctor proctor = new TestProctor(id);

            if (proctor.EmployeeCourseAssignment.Completed || proctor.EmployeeCourseAssignment.CourseTopicID < 1)
            {
                return View("Finished", proctor);
            }

            int step;
            if (Step.HasValue)
            {
                proctor.SaveCurrentTestTakingStep(Step.Value);
            }
            else if (proctor.CompletedPresentation && proctor.EmployeeCourseAssignment.CurrentStatus.Section != Domain.StatusType.Testing)
            {
                proctor.SaveCurrentTestTakingStep(1);
            }

            if (!proctor.IsFinished &&
                proctor.Quiz.CurrentQuestion != null)
            {
                return View(proctor);
            }
            else if (proctor.IsFinished)
            {
                ViewBag.ReturnToHub = Resources.Literals.ReturnToControlCenter;

                return View("Finished", proctor);
            }

            return RedirectToAction("Start", "Access", new { EmployeeID, CCApp });
        }
Beispiel #2
0
        public ActionResult View(long id)
        {
            var proctor = new TestProctor(id);

            var step = Step ?? 0;
            var userSuppliedStep = Step.HasValue;

            if (userSuppliedStep)
            {
                proctor.SaveCurrentPresentationStep(step);
            }
            else if (proctor.EmployeeCourseAssignment.CurrentStatus != null)
            {
                if (proctor.CompletedPresentation)
                {
                    return RedirectToAction("Take", new { id = id, EmployeeID, CCApp });
                }
                step = proctor.EmployeeCourseAssignment.CurrentStatus.Sequence;
                proctor.SaveCurrentPresentationStep(step);
            }
            else
            {
                proctor.SaveCurrentPresentationStep(1);
            }

            switch (proctor.Presentation.CurrentStep.PresentationType)
            {
                case Domain.MediaType.Image:
                    return View("ImageItem", proctor);
                case Domain.MediaType.Video:
                    return View("VideoItem", proctor);
                case Domain.MediaType.Audio:
                    return View("AudioItem", proctor);
            }

            return RedirectToAction("Start", "Access", new { EmployeeID, CCApp });
        }
Beispiel #3
0
        public ActionResult Take(long id, FormCollection collection)
        {
            TestProctor proctor = new TestProctor(id);

            if (string.IsNullOrEmpty(collection["Answer-radio"]))
            {
                //This indicates no answer was chosen, the user just pressed submit.
                proctor.ShowNoChoiceMadeMessage = collection["Answer-radio"] != null && collection["Answer-radio"].Trim() == string.Empty;
                return Take(id);
            }
            int answerChosen = int.Parse(collection["Answer-radio"]);

            //Record the answer
            proctor.SaveResponse(answerChosen);

            if (!proctor.IsFinished &&
                proctor.Quiz.CurrentQuestion != null)
            {
                return View(proctor);
            }
            else if (proctor.IsFinished)
            {
                ViewBag.ReturnToHub = Resources.Literals.ReturnToControlCenter;

                return View("Finished", proctor);
            }

            return new HttpNotFoundResult();
        }