Exemplo n.º 1
0
        public ActionResult LearnOnLineExamShowView(int TrainingId, int UnitContent, int ClassId, int UId)
        {
            var Model_Course_UnitContent = this.GetCourseUnitContentActivity(TrainingId, UnitContent, ClassId, false);

            var stbSqlWhere = new StringBuilder();
            stbSqlWhere.AppendFormat(@"AnswerResult = {0}", UId);

            var AnswerBll = new Member_CourseContentTestAnswerBLL();
            var ResultBll = new Member_CourseContentTestAnswerResultBLL();
            var List_Member_CourseContentTestAnswer = AnswerBll.GetList(stbSqlWhere.ToString(), string.Empty);
            var Model_Member_CourseContentTestAnswerResult = ResultBll.GetModel(UId, string.Empty);

            #region [结业考试]题目信息
            this.GetExamCourseUnitTest(TrainingId, Model_Member_CourseContentTestAnswerResult.Verson);//结业题目表没有UnitContent
            #endregion

            ViewBag.Model_Member_CourseContentTestAnswerResult = Model_Member_CourseContentTestAnswerResult;
            ViewBag.List_Member_CourseContentTestAnswer = List_Member_CourseContentTestAnswer;

            return View();
        }
Exemplo n.º 2
0
 public JsonResult GetExamAnswerList(int UnitContentId, int AccountId)
 {
     try
     {
         var quizList = new Member_CourseContentTestAnswerResultBLL().GetList(" Delflag=0 and  UnitContent=" + UnitContentId + " and AccountId=" + AccountId, "");
         return Json(from c in quizList select new { Id = Dianda.Common.QueryString.UrlEncrypt(c.Id), CreateDate = c.CreateDate.ToString("yyyy-MM-dd HH:mm") }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 在线学习-结业考试提交
        /// </summary>
        /// <returns></returns>
        public ActionResult LearnOnLineExamEdit(List<Member_CourseContentTestAnswerOther> listOther)
        {
            var TestAnswerResultBll = new Member_CourseContentTestAnswerResultBLL();
            var unitBll = new Course_UnitContentBLL();
            var stbSqlWhere = new StringBuilder();
            var strOrderBy = "CreateDate";

            int iTrainingId = 0, iId = 0;

            var Model_ExamAnswerResult = this.GetLearnOnLineExamResult(listOther, out iTrainingId);
            if (Model_ExamAnswerResult == null)
            {
                return Json(new { Result = true, Msg = "试题提交异常!" }, JsonRequestBehavior.AllowGet);
            }

            //若课程已结束禁止操作
            if (this.GetCourseIsOver(Model_ExamAnswerResult.ClassId, iTrainingId, Model_ExamAnswerResult.AccountId))
                return Json(new { Result = true, Msg = "提交失败.当前课程已结束,不能执行该操作!" }, JsonRequestBehavior.AllowGet);
            //查看当前活动是否已打分,若已打分则禁止操作
            if (this.GetActivityScore(Model_ExamAnswerResult.ClassId, iTrainingId, Model_ExamAnswerResult.AccountId, Model_ExamAnswerResult.UnitContent))
                return Json(new { Result = false, Msg = "提交失败.当前活动已打分,不能执行该操作!" }, JsonRequestBehavior.AllowGet);

            //提交时,判断其剩余考试次数
            var model = unitBll.GetModel(Model_ExamAnswerResult.UnitContent, string.Empty);

            stbSqlWhere.AppendFormat(@" UnitContent = {0} and AccountId = {1} and Delflag = 0", Model_ExamAnswerResult.UnitContent, Model_ExamAnswerResult.AccountId);
            var List_Result = TestAnswerResultBll.GetList(stbSqlWhere.ToString(), strOrderBy);
            if (List_Result.Count >= model.TestCnt && model.TestCnt != -1)
            {
                return Json(new { Result = true, Msg = "试题提交失败。你的结业考试 - [ " + model.Title + " ] 剩余答题次数不足!" }, JsonRequestBehavior.AllowGet);
            }

            //提交总分到表 Member_CourseContentTestAnswerResult
            bool bolResult = TestAnswerResultBll.Add(Model_ExamAnswerResult) > 0;
            iId = Model_ExamAnswerResult.Id;

            //提交数据到用户答案表 Member_CourseContentTestAnswer
            if (bolResult)
            {
                bolResult = this.SaveMember_CourseContentTestAnswer(listOther, iId);
            }

            if (bolResult)
            {
                SessionHelper sess = new SessionHelper();
                sess.Remove("LearnOnLineExam");

                int iUnitContent = Model_ExamAnswerResult.UnitContent;
                //更新总进度
                this.UpdateOverallProgress(model.UnitId.Value, Model_ExamAnswerResult.ClassId, iTrainingId, Model_ExamAnswerResult.AccountId, iUnitContent);

                return Json(new { Result = true, Msg = "试题提交成功!" }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { Result = true, Msg = "试题提交失败!" }, JsonRequestBehavior.AllowGet);
            }
        }