/// <summary>
        /// 设置分数
        /// </summary>
        /// <param name="iUnitType">//1阅读,2讨论
        /// <param name="IsAdd">True:新增 False:删除</param>
        /// <param name="obj">数据对象</param>
        private void ScoreSet(int iUnitType, int? iUnitContent = 0, int iClassId = 0, int iTrainingId = 0, bool IsAdd = false, Object obj = null)
        {
            var scheduleBll = new Member_ClassUnitContentScheduleBLL();
            var replyBll = new Course_UnitReplyDetailBLL();

            int iPlanId = 0, iAccountId = 0, iUnitId = 0;
            double dblScore = 0;
            var stbSqlWhere = new StringBuilder();

            if (iUnitType == 1)
            {
                iPlanId = Code.SiteCache.Instance.PlanId;
                iAccountId = Code.SiteCache.Instance.LoginInfo.UserId;

                stbSqlWhere.AppendFormat(" ClassId = {0} AND TrainingId = {1} AND AccountId = {2} AND UnitContent = {3} AND Status = 1 AND Delflag = 0",
                    iClassId, iTrainingId, iAccountId, iUnitContent);

                var List_Schedule = scheduleBll.GetList(stbSqlWhere.ToString(), string.Empty);
                if (List_Schedule != null && List_Schedule.Count > 0 && List_Schedule[0].score == null)//当存在记录,并且Score=null时记录分数
                {
                    Web.Code.ScoreSetHelper.ScoreSet(iUnitContent, iUnitType, iClassId, iPlanId, iAccountId, dblScore);
                }
            }
            else if (iUnitType == 2)//讨论  参与次数要 >=1
            {
                var model = obj as Course_UnitReplyDetail;
                iUnitContent = model.UnitContent;
                iClassId = model.ClassId;
                iPlanId = Code.SiteCache.Instance.PlanId;
                iAccountId = model.AccountId;
                stbSqlWhere.AppendFormat(" ClassId = {0} AND AccountId = {1} AND UnitContent = {2} AND Display = 1 AND Delflag = 0",
                        iClassId, iAccountId, iUnitContent);

                var List_ReplyDetail = replyBll.GetList(stbSqlWhere.ToString(), string.Empty);
                if (List_ReplyDetail != null)
                {
                    if (IsAdd)
                    {
                        if (List_ReplyDetail.Count <= 0)
                        {
                            Web.Code.ScoreSetHelper.ScoreSet(iUnitContent, iUnitType, iClassId, iPlanId, iAccountId, dblScore, true);
                        }
                    }
                    else
                    {
                        Web.Code.ScoreSetHelper.ScoreSet(iUnitContent, iUnitType, iClassId, iPlanId, iAccountId, dblScore, false);
                    }
                }

                //获取当前活动的UnitId
                var unitContentBll = new Course_UnitContentBLL();
                var Model_UnitContent = unitContentBll.GetModel(iUnitContent.Value, string.Empty);
                iUnitId = Model_UnitContent.UnitId == null ? 0 : Model_UnitContent.UnitId.Value;
                //获取TrainingId
                var unitDetailBll = new Course_UnitDetailBLL();
                var Model_UnitDetail = unitDetailBll.GetModel(iUnitId, string.Empty);
                iTrainingId = Model_UnitDetail.TrainingId == null ? 0 : Model_UnitDetail.TrainingId.Value;
                //更新总进度
                this.UpdateOverallProgress(iUnitId, iClassId, iTrainingId, iAccountId, iUnitContent.Value);//分数添加之后更新总进度
            }
        }
        public ActionResult DisplayCourseUnit(int id)
        {
            Course_UnitDetailBLL bll = new Course_UnitDetailBLL();

            Course_UnitDetail model = bll.GetModel(id,"Delflag = 0");

            //设置是否显示
            if (model.Display)
            {
                model.Display = false;
            }
            else
            {
                model.Display = true;
            }

            if (bll.Update(model))
            {
                return Json(new { Result = true,  Display= model.Display}, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { Result = false, Display = model.Display}, JsonRequestBehavior.AllowGet);
            }
        }
        /// <summary>
        /// 找到当前[活动小节]的最外层[章]
        /// </summary>
        /// <param name="iId"></param>
        /// <param name="iTrainingId"></param>
        /// <returns></returns>
        private Course_UnitDetail GetCourse_UnitDetail(int iId, int? iTrainingId)
        {
            var unitBll = new Course_UnitDetailBLL();
            var model = new Course_UnitDetail();

            model = unitBll.GetModel(iId, "TrainingId = " + iTrainingId.Value);

            if (model != null)
            {
                if (model.ParentId != 0)
                {
                    return GetCourse_UnitDetail(model.ParentId.Value, iTrainingId);
                }
                else
                {
                    return model;
                }
            }
            else
            {
                return null;
            }
        }
        public ActionResult CourseUnitEdit(int TrainingId,int CourseId)
        {
            //ViewBag.Title = "课程单元编辑";
            Course_DetailBLL bll_CourseDetail = new Course_DetailBLL();
            Course_UnitDetailBLL bll = new Course_UnitDetailBLL();

            //指定课程的课程ID
            ViewBag.TrainingId = TrainingId;
            //获取指定课程ID对应的课程单元信息
            ViewBag.TrainingInfo = bll_CourseDetail.GetTrainingInfoById(TrainingId);
            //获取课程单元Model
            ViewBag.UnitDetailModel = bll.GetModel(CourseId,"Delflag = 0");

            return View();
        }