/// <summary>
        /// 在线学习-[单元测试]提交
        /// </summary>
        /// <returns></returns>
        public ActionResult LearnOnLineQuizEdit(List<Member_CourseContentAnswerOther> listOther)
        {
            string strVerson = string.Empty;
            int iClassId = 0, iAccountId = 0, iPlanId = 0, iResultId = 0, iUnitContent = 0, iTrainingId = 0, iQuestionCnt = 0, iRightCount = 0, iWrongCount = 0;
            double dblScoreTotal = 0, dblGetScore = 0, dblResultScore = 0;
            var stbSqlWhere = new StringBuilder();
            //获取 答题总数,答题正确的个数,答题错误的个数,结果
            iQuestionCnt = listOther.Count;//总题数
            bool bolResult = false;

            var unitQuesBll = new Course_UnitQuestionBLL();
            var CourseContentAnswerBll = new Member_CourseContentAnswerBLL();
            var unitBll = new Course_UnitContentBLL();
            var Member_ClassUnitContentSchedulebll = new Member_ClassUnitContentScheduleBLL();

            iAccountId = Code.SiteCache.Instance.LoginInfo.UserId;
            iPlanId = Code.SiteCache.Instance.PlanId;

            //获取[单元测试]总得分
            foreach (var item in listOther)
            {
                //获取该题目的正确答案
                var Model_Ques = unitQuesBll.GetModel(item.Id, string.Empty);
                if (!string.IsNullOrEmpty(item.Credits))
                {
                    double dblCre = 0;
                    double.TryParse(item.Credits, out dblCre);
                    dblScoreTotal += dblCre;//获取所有题目的答案的总得分

                    if (item.Answer == Model_Ques.Answer)
                    {
                        iRightCount++;//正确答题数
                        dblResultScore += dblCre;//用户得分
                    }
                    else
                        iWrongCount++;//错误答题数

                    strVerson = item.Verson;//题目版本号,一批题目的版本号都一样
                    iUnitContent = item.UnitContentId;//一批题目的UnitContentId都一样
                    iClassId = item.ClassId;//一批题目的ClassId都一样
                    iTrainingId = item.TrainingId;//一批题目的TrainingId都一样
                }
            }

            //若课程已结束禁止操作
            if (this.GetCourseIsOver(iClassId, iTrainingId, iAccountId))
                return Json(new { Result = true, Msg = "提交失败.当前课程已结束,不能执行该操作!" }, JsonRequestBehavior.AllowGet);
            ////查看当前活动是否已打分,若已打分则禁止操作[待删除.打分操作为自动打分,不作为判断条件]
            //if (this.GetActivityScore(iClassId, iTrainingId, iAccountId, iUnitContent))
            //    return Json(new { Result = false, Msg = "提交失败.当前活动已打分,不能执行该操作!" }, JsonRequestBehavior.AllowGet);

            //提交时,判断其剩余考试次数
            stbSqlWhere.AppendFormat(@"UnitContent = {0} AND ClassId = {1} AND AccountId = {2} AND Delflag = 0", iUnitContent, iClassId, iAccountId);
            var ResultBll = new Member_ContentAnswerResultBLL();
            var List_Member_ContentAnswerResult = ResultBll.GetList(stbSqlWhere.ToString());
            int iRowsCount = List_Member_ContentAnswerResult.Tables[0].Rows.Count;//获取已考试的次数

            var model = unitBll.GetModel(iUnitContent, string.Empty);
            if (iRowsCount >= model.TestCnt && model.TestCnt != -1)
            {
                return Json(new { Result = false, Msg = "试题提交失败。你的单元测试 - [ " + model.Title + " ] 剩余答题次数不足!" }, JsonRequestBehavior.AllowGet);
            }

            var ResultModel = new Member_ContentAnswerResult();
            ResultModel.Verson = strVerson;
            ResultModel.UnitContent = iUnitContent;
            ResultModel.ClassId = iClassId;
            ResultModel.Score = decimal.Parse(dblResultScore.ToString());//用户的答题得分
            ResultModel.QuestionCnt = iQuestionCnt;
            ResultModel.RightAnswer = iRightCount;
            ResultModel.WrongAnswer = iWrongCount;
            ResultModel.Result = bolResult;
            ResultModel.AccountId = iAccountId;
            ResultModel.Delflag = false;
            ResultModel.CreateDate = DateTime.Now;

            //将数据插入到总分表
            bool bolRes = this.InsertMember_ContentAnswerResult(ResultModel, out iResultId);

            if (bolRes)
            {
                foreach (var itemQues in listOther)
                {
                    //获取该题目的正确答案
                    var Model_Ques = unitQuesBll.GetModel(itemQues.Id, string.Empty);

                    double dblGetCreTmp = 0;
                    double.TryParse(itemQues.Credits, out dblGetCreTmp);

                    //将用户的[单元测试]答案保存
                    Member_CourseContentAnswer Model_Answer = new Member_CourseContentAnswer();
                    Model_Answer.AnswerResult = iResultId;
                    Model_Answer.Question = itemQues.Id;
                    Model_Answer.Answer = itemQues.Answer;
                    Model_Answer.Result = Model_Ques.Answer == itemQues.Answer;//比对正确答案
                    dblGetScore += Model_Ques.Answer == itemQues.Answer ? dblGetCreTmp : 0;//当前学员答题得分
                    Model_Answer.AccountId = iAccountId;
                    Model_Answer.Delflag = false;
                    Model_Answer.CreateDate = DateTime.Now;

                    //将数据插入到学员答题内容表,用户的[课程评价]答案保存
                    bolRes = CourseContentAnswerBll.Add(Model_Answer);
                }
            }

            if (bolRes)
            {
                //更新总进度
                this.UpdateOverallProgress(model.UnitId.Value, iClassId, iTrainingId, iAccountId, iUnitContent);
                //查询该学员的[单元测试]的成绩中最大分数的数据对象
                var Model_ActivityMaxScore = this.GetActivityMaxScore(iClassId, iTrainingId, iAccountId, iUnitContent);
                if (Model_ActivityMaxScore != null)
                {
                    var strWhere_Activity = string.Format(@" Status = 1 AND Delflag = 0 AND ClassId = {0} AND TrainingId = {1} AND AccountId = {2} AND UnitContent IN ({3})",
                        iClassId, iTrainingId, iAccountId, iUnitContent);
                    var List_ClassUnitContentSchedule = Member_ClassUnitContentSchedulebll.GetList(strWhere_Activity, "Id");
                    if (List_ClassUnitContentSchedule != null && List_ClassUnitContentSchedule.Count == 1)
                    {
                        var Model_ClassUnitContentSchedule = List_ClassUnitContentSchedule[0];
                        ScoreSetHelper.ScoreSet(Model_ClassUnitContentSchedule.Id, 4, iClassId, iPlanId, iAccountId, Model_ActivityMaxScore.Score.ToDouble(), Model_ClassUnitContentSchedule.score == null);
                    }
                }

                return Json(new { Result = true, Msg = "单元测试提交成功!", TotalScore = dblGetScore }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { Result = false, Msg = "单元测试提交失败!" }, JsonRequestBehavior.AllowGet);
            }
        }
 private void ConvertToModel(IDataReader reader, Member_ContentAnswerResult model)
 {
     if (reader["Id"] != DBNull.Value)
         model.Id = Convert.ToInt32(reader["Id"]);
     if (reader["Verson"] != DBNull.Value)
         model.Verson = Convert.ToString(reader["Verson"]);
     if (reader["UnitContent"] != DBNull.Value)
         model.UnitContent = Convert.ToInt32(reader["UnitContent"]);
     if (reader["ClassId"] != DBNull.Value)
         model.ClassId = Convert.ToInt32(reader["ClassId"]);
     if (reader["Score"] != DBNull.Value)
         model.Score = Convert.ToDecimal(reader["Score"]);
     if (reader["QuestionCnt"] != DBNull.Value)
         model.QuestionCnt = Convert.ToInt32(reader["QuestionCnt"]);
     if (reader["RightAnswer"] != DBNull.Value)
         model.RightAnswer = Convert.ToInt32(reader["RightAnswer"]);
     if (reader["WrongAnswer"] != DBNull.Value)
         model.WrongAnswer = Convert.ToInt32(reader["WrongAnswer"]);
     if (reader["Result"] != DBNull.Value)
         model.Result = Convert.ToBoolean(reader["Result"]);
     if (reader["AccountId"] != DBNull.Value)
         model.AccountId = Convert.ToInt32(reader["AccountId"]);
     if (reader["Delflag"] != DBNull.Value)
         model.Delflag = Convert.ToBoolean(reader["Delflag"]);
     if (reader["CreateDate"] != DBNull.Value)
         model.CreateDate = Convert.ToDateTime(reader["CreateDate"]);
 }
        /// <summary>
        /// 插入数据到[单元测试]总分表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private bool InsertMember_ContentAnswerResult(Member_ContentAnswerResult model, out int iId)
        {
            var ContentAnswerResultbll = new Member_ContentAnswerResultBLL();

            return (iId = ContentAnswerResultbll.Add(model)) > 0;
        }
 /// <summary>
 /// 取得一条记录
 /// </summary>
 /// <param name="where"></param>
 /// <returns></returns>
 public Member_ContentAnswerResult GetModel(string where)
 {
     string sql = "select top 1 * from [dbo].[Member_ContentAnswerResult] Where 1 = 1";
     if (!string.IsNullOrEmpty(where))
         sql += " and " + where;
     sql += " order by Score desc";
     using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql))
     {
         if (reader.Read())
         {
             Member_ContentAnswerResult model = new Member_ContentAnswerResult();
             ConvertToModel(reader, model);
             return model;
         }
         else
         {
             return null;
         }
     }
 }