public IActionResult Get(int id)
        {
            Exam exam = _examManager.GetExam(id);

            if (exam == null)
            {
                return(NotFound());
            }

            ExamResponse response = Mapper.Map <ExamResponse>(exam);

            return(Json(response));
        }
Exemplo n.º 2
0
        public ActionResult Exam(Guid examID)
        {
            if (Request.Cookies["UserId"] == null)
            {
                return(RedirectToAction("Index", "Landing"));
            }

            ExamQuestionView eqv = new ExamQuestionView();

            eqv.Exam      = examManager.GetExam(examID);
            eqv.Questions = eqv.Exam.Question.ToList();

            return(View(eqv));
        }
 private void lstStudent_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         ////Узнаем средний балл
         ExamManager examManager       = new ExamManager();
         var         MiddlleAssessment = examManager.GetExam().Where(c => c.Students_id == Convert.ToInt32(txtStudentId.Text)).Select(y => y.Assessment);
         var         result            = 0;
         if (MiddlleAssessment.Count() > 0)
         {
             result = MiddlleAssessment.Sum() / MiddlleAssessment.Count();
         }
         txMiddle.Text = result.ToString();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemplo n.º 4
0
        public void Execute(IJobExecutionContext context)
        {
            _logger.Info("===== CmrcnCrawlerJob 任务开始 =====");

            try
            {
                var config = CmrConfig.GetInstance();

                config.Subjects.Reverse();
                foreach (var subject in config.Subjects)
                {
                    var manager = new ExamManager(subject.LoginInfo);

                    if (false == subject.Enabled)
                    {
                        continue;
                    }

                    int totalExam = 0;
                    foreach (var module in subject.SubjectModules)
                    {
                        totalExam += manager.GetExam(module);
                        Thread.Sleep(1000);
                    }

                    _logger.Info(string.Format("正常完成。SubjcetId:[{0}]-Total:[{1}]", subject.Id, totalExam));
                }
            }
            catch (Exception ex)
            {
                _logger.Error("异常停止", ex);
            }

            _logger.Info(string.Format("===== 目前题库共有 {0} 道题目 =====", _examItemService.Count()));
            _logger.Info("===== CmrcnCrawlerJob 任务结束 =====");
        }
Exemplo n.º 5
0
 public EntityExamMap GetExam(int Exam_Id)
 {
     return(Ex.GetExam(Exam_Id));
 }