public ActionResult LearnOnLineEvaluatePreviewView()
        {
            #region 获取[课程评价]题目信息

            var List_Class_TraningCommentQuestion = new List<Class_TraningCommentQuestion>();
            var TraningCommentBll = new Class_TraningCommentQuestionBLL();
            var stbSqlWhere = new StringBuilder();
            stbSqlWhere.Append("Display = 1 AND Delflag = 0");

            List_Class_TraningCommentQuestion = TraningCommentBll.GetListModel(stbSqlWhere.ToString());

            ViewBag.List_Class_TraningCommentQuestion = List_Class_TraningCommentQuestion;

            #endregion

            #region 获取 Traning_Detail Title
            //根据 TrainingId 获取 Title
            int iTrainingId = 0, iClassId = 0;
            var DetailBll = new Traning_DetailBLL();
            int.TryParse(Convert.ToString(Request["TrainingId"]) == "" ? "0" : QueryString.Decrypt(Request["TrainingId"]), out iTrainingId);
            int.TryParse(Convert.ToString(Request["ClassId"]) == "" ? "0" : QueryString.Decrypt(Request["ClassId"]), out iClassId);//获取 ClassId

            var Model_Traning_Detail = DetailBll.GetModel(iTrainingId, string.Empty);

            ViewBag.ClassId = iClassId;
            ViewBag.TrainingId = iTrainingId;
            ViewBag.TraningDetailTitle = Model_Traning_Detail.Title;
            #endregion

            return View();
        }
        public ActionResult ClassAuditDetail(string id, string doaction)
        {
            var param_id = Dianda.Common.QueryString.Decrypt(id);
            string param_doaction = "";
            if (doaction != null)
                param_doaction = Dianda.Common.QueryString.Decrypt(doaction);

            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            var traningDBll = new Traning_DetailBLL();
            var bll = new Class_DetailBLL();
            var model = bll.GetModel(param_id.ToInt());
            var organ = new Organ_DetailBLL().GetModel(SiteCache.Instance.ManageOrganId);
            if (organ.OType == 1)//培训机构职能选择自己机构开设的课程
            {
                ViewBag.CourseList = traningDBll.GetList(" OrganId =" + organ.Id + " and Delflag=0 and Display=1 ", "");
            }
            else//进修学院则可以选择自己机构开设的课程,也可以选择自己机构所属的区县下的所有课程。通过Traning_Detail.ParentOrganId。如果Range=2,则表面是市级共享课程。则可以无条件选择。
            {
                ViewBag.CourseList = traningDBll.GetList(" ((OrganId =" + organ.Id + " or ParentOrganId=" + organ.Id + ") or Range=2 ) and Delflag=0 and Display=1 ", "");
            }
            ViewBag.OrganId = SiteCache.Instance.ManageOrganId;
            ViewBag.PartitionId = organ.PartitionId;
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList("  Delflag=0 and Display=1 and IsOpen=1").Tables[0]);
            ViewBag.ClassesList = fkBll.GetList(" CategoryType=5 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.Subject = model.Subject;
            ViewBag.existSubjectList = new Class_TeachSubjectBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");
            ViewBag.StudyLevelList = fkBll.GetList(" CategoryType=4 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.StudyLevel = model.StudyLevel;
            ViewBag.existStudyLevel = new Class_StudySectionBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");
            ViewBag.TeachGradeList = fkBll.GetList(" CategoryType=7 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachGrade = model.TeachGrade;
            ViewBag.existTeachGrade = new Class_TeachGradeBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");
            ViewBag.TeachRankList = fkBll.GetList(" CategoryType=8 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachRank = model.TeachRank;
            ViewBag.existTeachRank = new Class_TeachRankBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");

            var course = new Traning_DetailBLL().GetModel(model.TraningId, "");
            var organBll = new Organ_DetailBLL();
            var list = new List<Organ_Detail>();
            //if (course.Range == 1) //区级
            //{
            //    list = organBll.GetListModel("  OType IN ( 1, 2, 3 ) and PartitionId=" + course.PartitionId + " and ParentId=" + (course.OrganId.HasValue ? course.OrganId.Value : 0));
            //}
            //else//市级
            //{
            //    list = organBll.GetShiOrganDetailList();
            //}
            list = organBll.GetListModel(" id in ( " + model.OrganRange + ")");

            ViewBag.schoolList = list;
            ViewBag.classId = param_id;
            ViewBag.OrangRange = model.OrganRange.Split(',');
            ViewBag.doaction = param_doaction;
            return View(model);
        }
        //班级操作
        public ActionResult ClassAction(string strAction, int Id, int? Instructor)
        {
            try
            {
                var bll = new Class_DetailBLL();
                var model = bll.GetModel(Id.ToInt());
                switch (strAction)
                {
                    case "clear"://清除
                        model.Delflag = true;
                        break;
                    case "complete"://结业
                        model.Status = 6;
                        break;
                    case "cancel"://撤销
                        model.Status = 1;
                        break;
                    case "setInstructor"://设置辅导员
                        model.Instructor = Instructor.Value;
                        break;
                    case "start"://开班
                        var traingModel=new Traning_DetailBLL().GetModel(model.TraningId,"");
                        if (traingModel.OutSideType == -1)//内部课程要有课程信息及比例
                        {
                            var list = new Course_DetailBLL().GetList(" Delflag=0 and TrainingId=" + model.TraningId, "");
                            if (list == null || list.Count == 0)
                                return Json(new { Code = -1, Msg = "请设置课程信息!" }, JsonRequestBehavior.AllowGet);
                            var courseDetail = list.First();
                            if (courseDetail.ReadingRate + courseDetail.DisscusRate + courseDetail.HomeWorkRate
                                + courseDetail.QuestionRate + courseDetail.TestingRate + courseDetail.CommentRate != 100)
                            {
                                return Json(new { Code = -1, Msg = "请设置课程考核比例!" }, JsonRequestBehavior.AllowGet);
                            }
                        }
                        model.Status = 5;
                        break;

                }

                bll.Update(model);

                return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 重新打分
        /// </summary>
        /// <param name="classId"></param>
        /// <param name="planId"></param>
        /// <param name="accountId"></param>
        public static void resetScore(int classId, int planId)
        {
            var member_classBll = new Member_ClassRegisterBLL();

            var classDetail = new Class_DetailBLL().GetModel(classId);

            var traningBll = new Traning_DetailBLL();
            var traning_detail = traningBll.GetModel(classDetail.TraningId, "");
            if (traning_detail == null) return;

            var courseBll = new Course_DetailBLL();
            var cousre_detail = courseBll.GetList(" TrainingId=" + traning_detail.Id, "");
            if (cousre_detail == null || cousre_detail.Count == 0) return;

            var unitContentBll = new Course_UnitContentBLL();
            var memberList = member_classBll.GetList("Delflag=0 and ClassId=" + classId + " and PlanId=" + planId, "");
            foreach (var memberModel in memberList)
            {
                var accountId = memberModel.AccountId;
                int total = 1;

                IList<Course_UnitContent> contentList = new List<Course_UnitContent>();

                #region
                //重新计算阅读分数

                total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "1,2");
                contentList = DataTableToListHelper<Course_UnitContent>.ConvertToModel(unitContentBll.GetUnitByClassAndUnitType(classId, "1,2"));
                if (contentList != null)
                {
                    var scheduleBll = new Member_ClassUnitContentScheduleBLL();
                    int scoreCount = 0;
                    foreach (var item in contentList)
                    {
                        var scheduleModel = scheduleBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " and UnitContent=" + item.Id, "");
                        if (scheduleModel != null && scheduleModel.Count > 0)
                        {
                            if (scheduleModel.First().score.HasValue)//如果有值说明打过分
                            {
                                scoreCount++;
                            }
                        }
                    }
                    if (scoreCount == total)//全部阅读过,给满分
                    {
                        memberModel.ReadingScore = cousre_detail[0].ReadingRate;
                    }
                    else
                    {
                        memberModel.ReadingScore = cousre_detail[0].ReadingRate * scoreCount / total;//阅读数与总数折算
                    }
                }

                //重新计算讨论分数

                total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "3");
                contentList = DataTableToListHelper<Course_UnitContent>.ConvertToModel(unitContentBll.GetUnitByClassAndUnitType(classId, "3"));
                if (contentList != null)
                {
                    var scheduleBll = new Member_ClassUnitContentScheduleBLL();
                    int scoreCount = 0;
                    foreach (var item in contentList)
                    {
                        var scheduleModel = scheduleBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " and UnitContent=" + item.Id, "");
                        if (scheduleModel != null && scheduleModel.Count > 0)
                        {
                            if (scheduleModel.First().score.HasValue)//如果有值说明打过分
                            {
                                scoreCount++;
                            }
                        }
                    }
                    if (scoreCount == total)//全部讨论过,给满分
                    {
                        memberModel.DiscussScore = cousre_detail[0].DisscusRate;
                    }
                    else
                    {
                        memberModel.DiscussScore = cousre_detail[0].DisscusRate * scoreCount / total;//讨论数与总数折算
                    }
                }

                //如有分值,重新计算作业分数

                total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "4");
                contentList = DataTableToListHelper<Course_UnitContent>.ConvertToModel(unitContentBll.GetUnitByClassAndUnitType(classId, "4"));
                if (contentList != null)
                {
                    var homeworkBll = new Course_UnitHomeWorkBLL();
                    double homeworkscore = 0;
                    foreach (var item in contentList)
                    {
                        var scheduleModel = homeworkBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " and UnitContent=" + item.Id, "");
                        if (scheduleModel != null && scheduleModel.Count > 0)
                        {
                            if (scheduleModel.First().Score.HasValue)//如果有值说明打过分
                            {
                                homeworkscore += (scheduleModel.First().Score.Value * (cousre_detail[0].HomeWorkRate) / (total * 100)).ToDouble();//已打分数与总数折算
                            }
                        }
                    }

                    memberModel.HomeWorkScore = homeworkscore;
                }

                //重新计算测试分数

                total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "5");
                contentList = DataTableToListHelper<Course_UnitContent>.ConvertToModel(unitContentBll.GetUnitByClassAndUnitType(classId, "5"));
                if (contentList != null)
                {
                    var scheduleBll = new Member_ClassUnitContentScheduleBLL();
                    double testscore = 0;
                    foreach (var item in contentList)
                    {
                        var scheduleModel = scheduleBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " and UnitContent=" + item.Id, "");
                        if (scheduleModel != null && scheduleModel.Count > 0)
                        {
                            if (scheduleModel.First().score.HasValue)
                            {
                                testscore += (scheduleModel.First().score.Value * (cousre_detail[0].QuestionRate) / (total * 100)).ToDouble();
                            }
                        }
                    }
                    memberModel.TestingScore = testscore;
                }

                //重新计算考试分数

                total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "6");
                contentList = DataTableToListHelper<Course_UnitContent>.ConvertToModel(unitContentBll.GetUnitByClassAndUnitType(classId, "6"));
                if (contentList != null)
                {
                    var scheduleBll = new Member_ClassUnitContentScheduleBLL();
                    double examcore = 0;
                    foreach (var item in contentList)
                    {
                        var scheduleModel = scheduleBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " and UnitContent=" + item.Id, "");
                        if (scheduleModel != null && scheduleModel.Count > 0)
                        {
                            if (scheduleModel.First().score.HasValue)
                            {
                                examcore += (scheduleModel.First().score.Value * (cousre_detail[0].TestingRate) / (total * 100)).ToDouble();
                            }
                        }
                    }
                    memberModel.ExaminationScore = examcore;
                }
                #endregion

                member_classBll.Update(memberModel);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="objectId">单元ID</param>
        /// <param name="objectType">单元类型</param>
        /// <param name="classId">班级ID</param>
        /// <param name="planId">计划ID</param>
        /// <param name="accountId">成员ID</param>
        /// <param name="score">分值</param>
        public static void ScoreSet(int? objectId, int objectType, int classId, int planId, int accountId, double score, bool add = true)
        {
            dynamic objectBll;
            dynamic model;
            Member_ClassRegister memberModel;
            int total = 1;
            var member_classBll = new Member_ClassRegisterBLL();
            var member_class = member_classBll.GetList(" Delflag=0 and ClassId=" + classId + " and PlanId=" + planId + " and AccountId=" + accountId, "");
            if (member_class == null || member_class.Count == 0) return;
            memberModel = member_class.FirstOrDefault();

            var traningBll = new Traning_DetailBLL();
            var traning_detail = traningBll.GetModel(memberModel.TrainingId.Value, "");
            if (traning_detail == null) return;

            var courseBll = new Course_DetailBLL();
            var cousre_detail = courseBll.GetList(" Delflag=0 and TrainingId=" + traning_detail.Id, "");
            if (cousre_detail == null || cousre_detail.Count == 0) return;

            var unitContentBll = new Course_UnitContentBLL();
            var oldScore = 0.0;
            switch (objectType)
            {
                case 1://read

                    objectBll = new Member_ClassUnitContentScheduleBLL();
                    model = objectBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " and UnitContent=" + objectId, "");
                    if (model.Count > 0)
                    {
                        if (add)
                            model[0].score = 1;
                        else
                            model[0].score = 0;
                        objectBll.Update(model[0]);//
                    }
                    total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "1,2");//阅读视频类的单元活动数
                    if (total > 1)
                    {
                        if (add)
                            memberModel.ReadingScore = (memberModel.ReadingScore.HasValue ? memberModel.ReadingScore.Value : 0)
                                + (cousre_detail[0].ReadingRate / (total)).ToDouble();
                        else
                        {
                            if (memberModel.ReadingScore.HasValue && memberModel.ReadingScore.Value.ToInt() > 0)
                                memberModel.ReadingScore = memberModel.ReadingScore.Value
                                    - (cousre_detail[0].ReadingRate / (total)).ToDouble();
                        }
                    }
                    else
                    {
                        if (add)
                            memberModel.ReadingScore = cousre_detail[0].ReadingRate;
                        else
                            memberModel.ReadingScore = 0.0;
                    }

                    if (memberModel.ReadingScore > cousre_detail[0].ReadingRate)
                    {
                        memberModel.ReadingScore = cousre_detail[0].ReadingRate;
                    }
                    if (memberModel.ReadingScore < 0)
                    {
                        memberModel.ReadingScore = 0;
                    }
                    member_classBll.Update(memberModel);//更新班级成员考试分数总值
                    break;
                case 2://discuss
                    objectBll = new Member_ClassUnitContentScheduleBLL();
                    model = objectBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " and UnitContent=" + objectId, "");
                    if (model.Count > 0)
                    {
                        if (add)
                            model[0].score = 1;
                        else
                            model[0].score = 0;
                        objectBll.Update(model[0]);//
                    }
                    total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "3");//讨论类的单元活动数
                    if (total > 1)
                    {
                        if (add)
                            memberModel.DiscussScore = (memberModel.DiscussScore.HasValue ? memberModel.DiscussScore.Value : 0)
                                + (cousre_detail[0].DisscusRate / (total)).ToDouble();
                        else
                        {
                            if (memberModel.ReadingScore.HasValue && memberModel.ReadingScore.Value.ToInt() > 0)
                                memberModel.DiscussScore = memberModel.DiscussScore.Value
                                    - (cousre_detail[0].DisscusRate / (total)).ToDouble();
                        }
                    }
                    else
                    {
                        if (add)
                            memberModel.DiscussScore = cousre_detail[0].DisscusRate;
                        else
                            memberModel.DiscussScore = 0.0;
                    }

                    if (memberModel.DiscussScore > cousre_detail[0].DisscusRate)
                    {
                        memberModel.DiscussScore = cousre_detail[0].DisscusRate;
                    }
                    if (memberModel.DiscussScore < 0)
                    {
                        memberModel.DiscussScore = 0;
                    }
                    member_classBll.Update(memberModel);//更新班级成员考试分数总值
                    break;
                case 3://homework
                    #region

                    objectBll = new Course_UnitHomeWorkBLL();
                    model = objectBll.GetModel(objectId.Value, "");
                    model.Score = score;
                    model.ScoreCreater = SiteCache.Instance.ManagerId;
                    objectBll.Update(model);//更新结果表
                    total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "4");//作业类的单元活动数
                    if (total > 1)
                    {
                        memberModel.HomeWorkScore = (memberModel.HomeWorkScore.HasValue ? memberModel.HomeWorkScore.Value : 0)
                           + (score * (cousre_detail[0].HomeWorkRate) / (total * 100)).ToDouble();
                    }
                    else
                    {
                        memberModel.HomeWorkScore = (score * (cousre_detail[0].HomeWorkRate) / (100)).ToDouble();
                    }

                    if (memberModel.HomeWorkScore > cousre_detail[0].HomeWorkRate)
                    {
                        memberModel.HomeWorkScore = cousre_detail[0].HomeWorkRate;
                    }
                    member_classBll.Update(memberModel);//更新班级成员作业分数总值
                    #endregion
                    break;
                case 4://question
                    #region

                    objectBll = new Member_ClassUnitContentScheduleBLL();
                    model = objectBll.GetModel(objectId.Value, "");
                    oldScore = model.score == null ? 0 : model.score;
                    model.score = score;
                    objectBll.Update(model);//更新班级成员测试分数总值
                    total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "5");//测试类的单元活动数
                    if (add)//第一次打分
                    {
                        if (total > 1)
                        {
                            memberModel.TestingScore = (memberModel.TestingScore.HasValue ? memberModel.TestingScore.Value : 0)
                               + (score * (cousre_detail[0].QuestionRate) / (total * 100)).ToDouble();
                        }
                        else
                        {
                            memberModel.TestingScore = (score * (cousre_detail[0].QuestionRate) / (100)).ToDouble();
                        }
                    }
                    else//多次打分,重新计算
                    {
                        var contentList = DataTableToListHelper<Course_UnitContent>.ConvertToModel(unitContentBll.GetUnitByClassAndUnitType(classId, "5"));
                        if (contentList != null)
                        {
                            var scheduleBll = new Member_ClassUnitContentScheduleBLL();
                            double testscore = 0;
                            foreach (var item in contentList)
                            {
                                var scheduleModel = scheduleBll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId + " AND UnitContent=" + item.Id, "");
                                if (scheduleModel != null && scheduleModel.Count > 0)
                                {
                                    if (scheduleModel.First().score.HasValue)
                                    {
                                        testscore += (scheduleModel.First().score.Value * (cousre_detail[0].QuestionRate) / (total * 100)).ToDouble();
                                    }
                                }
                            }
                            memberModel.TestingScore = testscore;
                        }
                    }
                    if (memberModel.TestingScore > cousre_detail[0].QuestionRate)
                    {
                        memberModel.TestingScore = cousre_detail[0].QuestionRate;
                    }
                    member_classBll.Update(memberModel);//更新班级成员测试分数总值
                    #endregion
                    break;
                case 5://examnation
                    #region

                    objectBll = new Member_ClassUnitContentScheduleBLL();
                    model = objectBll.GetModel(objectId.Value, "");
                    oldScore = model.score == null ? 0 : model.score;
                    model.score = score;
                    if (score >= 60)//考试大于等于60分算通过
                        memberModel.IsPass = true;
                    objectBll.Update(model);//更新班级成员考试分数总值
                    total = unitContentBll.GetUnitCountByClassAndUnitType(classId, "6");//考试类的单元活动数
                    if (total > 1)
                    {
                        memberModel.ExaminationScore = (memberModel.ExaminationScore.HasValue ? memberModel.ExaminationScore.Value : 0)
                            + (score * (cousre_detail[0].TestingRate) / (total * 100)).ToDouble();
                    }
                    else
                    {
                        memberModel.ExaminationScore = (score * (cousre_detail[0].TestingRate) / (100)).ToDouble();
                    }

                    if (memberModel.ExaminationScore > cousre_detail[0].TestingRate)
                    {
                        memberModel.ExaminationScore = cousre_detail[0].TestingRate;
                    }
                    member_classBll.Update(memberModel);//更新班级成员考试分数总值
                    #endregion
                    break;
                case 6://comment
                    #region
                    objectBll = new Member_ClassRegisterBLL();
                    model = objectBll.GetList(" Delflag=0 and ClassId=" + classId + " and PlanId=" + planId + " and AccountId=" + accountId, "")[0];
                    model.CommentScore = (score * (cousre_detail[0].CommentRate) / (total * 100)).ToDouble();
                    objectBll.Update(model);//更新班级成员评价分数总值
                    #endregion
                    break;
                default: break;
            }
        }
 private int ConvertTrainingId(int input)
 {
     //20509 教育用户体验评估方法
     //20508 学习分析技术
     //20496 不同形式微课的设计与应用
     //20495 游戏化学习在教学中的应用
     //20493 虚拟现实在教学中的应用
     //20492 翻转课堂的设计及其应用
     //20491 移动学习的设计及其应用
     //20490 新技术在教学中的应用
     //20487 活动为导向的在线课程设计
     //20470 微信在教学中的应用
     //return input;
     //Traning_Detail model = new Traning_DetailBLL().GetModel("Delflag=0 and OutSideType=2 and OutSideLink='" + input + "'");
     Traning_Detail model = new Traning_DetailBLL().GetModel("Delflag=0 and OutSideType=2");
     if (model == null)
     {
         return 0;
     }
     else
     {
         return model.Id;
     }
 }
Esempio n. 7
0
        /// <summary>
        /// 课程评价,如果已合格,加上学时
        /// </summary>
        public static void commentTraningOper(int classId,int accountId)
        {
            var classDetail = new Dianda.AP.BLL.Class_DetailBLL().GetModel(classId);
            var tranFieldModel = new Traning_DetailBLL().GetModel(classDetail.TraningId, "");

            var model = new Dianda.AP.BLL.Member_ClassRegisterBLL().GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + accountId, "").First();

            var comment = new Dianda.AP.BLL.Class_TraningCommentResultBLL().GetListModel(" ClassId=" + classId + " and AccountId=" + accountId + " and Delflag=0");
            if (model.Result == 1 && comment != null && comment.Count > 0)//如果结论是合格,,并且评论过课程,则要更新用户学分
            {
                var tranEditModel = new Member_TrainingReditBLL().GetList("Delflag=0 and TrainingField=" + tranFieldModel.TraingField
                    + " and PlanId=" + model.PlanId + " and AccountId=" + model.AccountId, "");
                Member_TrainingRedit tranEdit = null;
                if (tranEditModel == null || tranEditModel.Count == 0)//创建
                {
                    tranEdit = new Member_TrainingRedit();
                    tranEdit.AccountId = model.AccountId;
                    tranEdit.CreateDate = DateTime.Now;
                    tranEdit.Credits = tranFieldModel.TotalTime.Value;
                    tranEdit.Delflag = false;
                    tranEdit.PlanId = model.PlanId;
                    tranEdit.TrainingField = tranFieldModel.TraingField;
                    new Member_TrainingReditBLL().Add(tranEdit);
                }
                else//更新
                {
                    tranEdit = tranEditModel.First();
                    tranEdit.Credits += tranFieldModel.TotalTime.Value;
                    new Member_TrainingReditBLL().Update(tranEdit);
                }
                var traningCredit = DataTableToListHelper<Training_Credits>.ConvertToModel(
                    new Training_CreditsBLL().GetList(" and PlanId=" + model.PlanId + " and OrganId=" + classDetail.OrganId, "")
                    );//查找学时学分
                if (traningCredit != null && traningCredit.Count > 0) //轮循所有大类
                {
                    bool graduateFlag = true;
                    var member_traningBll = new Member_TrainingReditBLL();
                    foreach (var item in traningCredit)
                    {
                        var traning_credit = member_traningBll.GetList
                            (" Delflag=0 and PlanId=" + model.PlanId + " and AccountId=" + model.AccountId + " and TrainingField=" + item.TraningField
                            , "");
                        if (traningCredit != null && traningCredit.Count > 0)
                        {
                            if (traningCredit.First().MinValue > tranEdit.Credits)
                            {
                                graduateFlag = false;
                                break;
                            }
                        }
                    }
                    if (graduateFlag)//所有大类学分均合格,更新Member_PlanOverall表的用户合格状态。
                    {
                        var Member_PlanOverallBll = new Member_PlanOverallBLL();
                        var Member_PlanOverall = Member_PlanOverallBll.GetListModel(" Delflag=0 and  PlanId=" + model.PlanId + " and AccountId=" + model.AccountId);
                        if (Member_PlanOverall != null && Member_PlanOverall.Count > 0)
                        {
                            var item = Member_PlanOverall.First();
                            item.Result = 1;
                            Member_PlanOverallBll.Update(item);
                        }
                        else
                        {
                            var item = new Member_PlanOverall();
                            item.Result = 1;
                            item.PlanId = model.PlanId;

                            item.AccountId = model.AccountId;
                            item.CreateDate = DateTime.Now;
                            item.Delflag = false;

                            Member_PlanOverallBll.Add(item);
                        }
                    }
                }

            }
        }
        //批量审核
        public ActionResult AjaxTrainingCheckBatch(string ids, string value, string remark)
        {
            StringBuilder where = new StringBuilder();
            where.Append("Delflag=0 and Status in (2,4) and PartitionId=" + Code.SiteCache.Instance.LoginInfo.PartitionId
                + " and Id in (" + ids + ")");
            int status = value == "1" ? 3 : 4;
            remark = value == "1" ? "" : remark;
            int managerId = Code.SiteCache.Instance.ManagerId;
            List<Traning_ApplyApplication> applies = new List<Traning_ApplyApplication>();
            foreach (string id in ids.Split(','))
            {
                Traning_ApplyApplication apply = new Traning_ApplyApplication();
                apply.TraningId = Convert.ToInt32(id);
                apply.Status = Convert.ToInt32(value);
                apply.Remark = remark;
                apply.Creater = managerId;
                apply.OrganId = Code.SiteCache.Instance.ManageOrganId;
                apply.Delflag = false;
                apply.CreateDate = DateTime.Now;
                applies.Add(apply);
            }

            List<Traning_Detail> trainings = new Traning_DetailBLL().GetList("Id in (" + ids + ")", "");

            using (TransactionScope trans = new TransactionScope())
            {
                try
                {
                    int partitionId = Code.SiteCache.Instance.LoginInfo.PartitionId;
                    string msg;
                    foreach (Traning_Detail training in trainings)
                    {
                        if (status == 3)
                        {
                            msg = string.Format("课程:{0} 审核通过!", training.Title);
                        }
                        else
                        {
                            msg = string.Format("课程:{0} 审核不通过,原因:{1}", training.Title, remark);
                        }
                        Code.MsgHelper.sendMsg(training.Creater, managerId, partitionId, "审核信息", msg);
                    }

                    new PrepareTrainingCheckBLL().BatchTrainingApply(where.ToString(), status, remark, applies);
                    trans.Complete();
                    return Json(new { Result = true, Msg = "操作成功!" }, JsonRequestBehavior.AllowGet);
                }
                catch
                {
                    return Json(new { Result = false, Msg = "操作失败!" }, JsonRequestBehavior.AllowGet);
                }
            }
        }
        //班级首页
        public ActionResult Index()
        {
            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            var traningDBll = new Traning_DetailBLL();

            var organ = new Organ_DetailBLL().GetModel(SiteCache.Instance.ManageOrganId);
            if (organ.OType == 1)//培训机构职能选择自己机构开设的课程
            {
                ViewBag.CourseList = traningDBll.GetList(" OrganId =" + organ.Id + " and Delflag=0 and Display=1 and status=5", "");
                    //(, "");" Range=2"
            }
            else//进修学院则可以选择自己机构开设的课程,也可以选择自己机构所属的区县下的所有课程。通过Traning_Detail.ParentOrganId。如果Range=2,则表面是市级共享课程。则可以无条件选择。
            {
                ViewBag.CourseList = traningDBll.GetList(" ((OrganId =" + organ.Id + " or ParentOrganId=" + organ.Id + ")  ) and Delflag=0 and Display=1 and status=5", "");
            }//or Range=2
            ViewBag.OrganId = SiteCache.Instance.ManageOrganId;
            ViewBag.PartitionId = organ.PartitionId;
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList("  Delflag=0 and Display=1 ").Tables[0]);
            ViewBag.ClassesList = fkBll.GetList(" CategoryType=5 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.StudyLevelList = fkBll.GetList(" CategoryType=4 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachGradeList = fkBll.GetList(" CategoryType=7 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachRankList = fkBll.GetList(" CategoryType=8 and Delflag=0 and Display=1 ", "Sort desc");

            return View();
        }
        /// <summary>
        /// 获取页面活动的公共方法
        /// </summary>
        /// <returns></returns>
        private Course_UnitContent GetCourseUnitContentActivity()
        {
            //获取所有的阅读信息
            var courseBll = new Course_UnitContentBLL();
            var DetailBll = new Traning_DetailBLL();
            var List_Course_UnitContent = new List<Course_UnitContent>();
            var Model_Course_UnitContent = new Course_UnitContent();
            var stbSqlWhere = new StringBuilder();
            var strOrderBy = "Sort";

            int iClassId = 0, iTrainingId = 0, iAccountId = 0, iUnitContent = 0, iUnitId = 0;
            int.TryParse(Convert.ToString(Request["TrainingId"]) == "" ? "0" : QueryString.Decrypt(Request["TrainingId"]), out iTrainingId);
            int.TryParse(Convert.ToString(Request["UnitContent"]) == "" ? "0" : QueryString.Decrypt(Request["UnitContent"]), out iUnitContent);

            stbSqlWhere.Append(" 1 = 1 ");
            if (iTrainingId > 0)
                stbSqlWhere.AppendFormat("AND Course_UnitDetail.TrainingId = {0}", iTrainingId);
            if (iTrainingId > 0)
                stbSqlWhere.AppendFormat("AND Course_UnitContent.Id = {0}", iUnitContent);

            List_Course_UnitContent = courseBll.GetListOther(stbSqlWhere.ToString(), strOrderBy);
            if (List_Course_UnitContent != null && List_Course_UnitContent.Count == 1)
                Model_Course_UnitContent = List_Course_UnitContent[0];
            //获取当前登录用户的班级和ID

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

            //根据 TrainingId 获取 Title
            var Model_Traning_Detail = DetailBll.GetModel(iTrainingId, string.Empty);

            ViewBag.TraningDetailTitle = Model_Traning_Detail.Title;
            ViewBag.AccountId = iAccountId;
            ViewBag.TrainingId = iTrainingId;
            ViewBag.UnitContent = iUnitContent = Model_Course_UnitContent.Id;
            ViewBag.Model_Course_UnitContent = Model_Course_UnitContent;

            return Model_Course_UnitContent;
        }
Esempio n. 11
0
        //根据选择的课程返回学校范围
        public JsonResult GetTrainingForm(string courseid)
        {
            try
            {
                var course = new Traning_DetailBLL().GetModel(courseid.ToInt(), "");

                return Json(new { Code = course.TrainingForm }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
        public bool IsCanRegister(int ClassId, bool Issingle, int MemberId, int Type)
        {
            int ParentOrganId = 1;
            int oType = 1;
            int partitionId = Code.SiteCache.Instance.LoginInfo.PartitionId;
            int UserId = MemberId;
            Member_AccountBLL member_AccountBLL = new Member_AccountBLL();
            Member_Account ma = member_AccountBLL.GetModel(UserId, "");
            int OrganId = 1;
            if (Issingle)
            {
                ParentOrganId = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.OrganId).ParentId;
                oType = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.OrganId).OType;
                OrganId = Code.SiteCache.Instance.OrganId;
            }
            else
            {
                ParentOrganId = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.ManageOrganId).ParentId;
                oType = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.ManageOrganId).OType;
                OrganId = Code.SiteCache.Instance.ManageOrganId;
            }

            Member_BaseInfoBLL member_BaseInfoBLL = new Member_BaseInfoBLL();
            Member_BaseInfo m = member_BaseInfoBLL.GetModelByAccountId(UserId);
            string where = " and td.PartitionId='" + partitionId + "'and cd.PlanId='" + Code.SiteCache.Instance.PlanId + "' and cd.PartitionId='" + partitionId + "' and cd.Id='" + ClassId + "'";

            if (oType == 1)
            {
                where += " and td.OrganId='" + OrganId + "'";
            }
            else if (oType == 2)
            {
                if (m != null)
                {
                    switch (Type)
                    {
                        case 1:
                            where += " and ((css.StudySection in(select StudySection from Member_StudySection where AccountId='" + UserId + "' and Delflag='false')and css.delflag='false' )or cd.StudyLevel=1)";
                            break;
                        case 2:
                            where += " and ((cts.TeachSubject in(select TeachSubject from Member_TeachSubject where AccountId='" + UserId + "' and Delflag='false')and cts.delflag='false' )or cd.Subject=1)";
                            break;
                        case 3:
                            where += " and ((ctg.TeachGrade in(select TeachGrade from Member_TeachGrade where AccountId='" + UserId + "' and Delflag='false')and ctg.delflag='false' )or cd.TeachGrade=1)";
                            break;
                        case 4:
                            where += " and ((ctr.TeachRank in(select WorkRank from Member_WorkRank where AccountId='" + UserId + "' and Delflag='false')and ctr.delflag='false' )or cd.TeachRank=1)";
                            break;
                        case 5:
                            where += " and (CHARINDEX('," + OrganId + ",',','+cd.OrganRange+',')>0 or cd.OrganRange='0')";
                            break;
                    }
                    where += " and (td.OrganId='" + ParentOrganId + "' or td.Range=2)";

                }
                else
                {
                    where += "and 1=2";
                }
            }
            else if (oType == 5)
            {
                if (m != null)
                {
                    switch (Type)
                    {
                        case 1:
                            where += " and ((css.StudySection in(select StudySection from Member_StudySection where AccountId='" + UserId + "' and Delflag='false')and css.delflag='false' )or cd.StudyLevel=1)";
                            break;
                        case 2:
                            where += " and ((cts.TeachSubject in(select TeachSubject from Member_TeachSubject where AccountId='" + UserId + "' and Delflag='false')and cts.delflag='false' )or cd.Subject=1)";
                            break;
                        case 3:
                            where += " and ((ctg.TeachGrade in(select TeachGrade from Member_TeachGrade where AccountId='" + UserId + "' and Delflag='false')and ctg.delflag='false' )or cd.TeachGrade=1)";
                            break;
                        case 4:
                            where += " and ((ctr.TeachRank in(select WorkRank from Member_WorkRank where AccountId='" + UserId + "' and Delflag='false')and ctr.delflag='false' )or cd.TeachRank=1)";
                            break;
                        case 5:
                            where += " and (CHARINDEX('," + ma.OrganId + ",',','+cd.OrganRange+',')>0 or cd.OrganRange='0')";
                            break;
                    }
                    where += " and (td.OrganId='" + OrganId + "' or td.Range=2)";
                }
                else
                {
                    where += "and 1=2";
                }
            }
            else
            {
                where += " and 1=2";
            }
            Traning_DetailBLL traning_DetailBLL = new Traning_DetailBLL();
            int total = 0;
            List<Traning_Detail> tdlist = traning_DetailBLL.GetListHasClass(10, 1, where, "CreateDate desc", out total);
            return total > 0;
        }
        /// <summary>
        /// 学校--审核列表
        /// </summary>
        /// <returns></returns>
        public ActionResult CoursemarketVerify(int? pageIndex, int? planId, int? status, int? trainingId, int? myclassId, string searchTitle)
        {
            ViewBag.Title = "教师报名管理";
            int i = TypeConverter.ObjectToInt(pageIndex, 1);
            int groupId = Code.SiteCache.Instance.GroupId;//4,学校管理7,普通教师
            //int groupId = 4;
            Organ_DetailBLL organ_DetailBLL = new Organ_DetailBLL();
            int OrganId = 0;
            string where = "";
            if (groupId == 4)
            {
                OrganId = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.ManageOrganId).ParentId;
                ViewBag.Yes = 2;
                ViewBag.No = 3;
                where += " and ma.OrganId='" + Code.SiteCache.Instance.ManageOrganId + "'";
                //where += " and mcr.Status<=3";
            }
            else if (groupId == 2)
            {
                OrganId = Code.SiteCache.Instance.ManageOrganId;
                ViewBag.Yes = 4;
                ViewBag.No = 5;
                where += " and cd.OrganId='" + Code.SiteCache.Instance.ManageOrganId + "'";
                where += " and mcr.Status in(2,4,5)";
            }
            else if (groupId == 3)
            {
                OrganId = Code.SiteCache.Instance.ManageOrganId;
                ViewBag.Yes = 4;
                ViewBag.No = 5;
                where += " and cd.OrganId='" + Code.SiteCache.Instance.ManageOrganId + "'";
                where += " and mcr.Status in(2,4,5)";
            }
            else
            {
                where += " and 1=2";
            }
            if (planId != null && planId > 0)
            {
                where += " and mcr.PlanId='" + planId + "' ";
            }
            else { planId = -1; }
            if (status != null && status > 0)
            {
                where += " and mcr.Status='" + status + "' ";
            }
            else { status = -1; }
            if (trainingId != null && trainingId > 0)
            {
                where += " and mcr.TrainingId='" + trainingId + "' ";
            }
            else { trainingId = -1; }
            if (myclassId != null && myclassId > 0)
            {
                where += " and mcr.ClassId='" + myclassId + "' ";
            }
            else { myclassId = -1; }

            if (!string.IsNullOrEmpty(searchTitle))
            { where += " and (mbi.RealName like'%" + searchTitle.Replace("'", "''") + "%' or ma.Nickname like '%" + searchTitle.Replace("'", "''") + "%' or ma.UserName like '%" + searchTitle.Replace("'", "''") + "%' or mbi.TeacherNo like '%" + searchTitle.Replace("'", "''") + "%' or mbi.CredentialsNumber like '%" + searchTitle.Replace("'", "''") + "%' or td.Title like '%" + searchTitle.Replace("'", "''") + "%' or cd.Title like '%" + searchTitle.Replace("'", "''") + "%')"; }

            int total = 0;
            Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
            List<ClassRegisterManage> tdlist = member_ClassRegisterBLL.GetListManage(10, i, where, "CreateDate desc", out total);

            ViewData["searchTitle"] = string.IsNullOrEmpty(searchTitle) ? "" : searchTitle;
            ViewData["planId"] = planId;
            ViewData["status"] = status;
            ViewData["trainingId"] = trainingId;
            ViewData["myclassId"] = myclassId;
            ViewData["groupId"] = groupId;
            ViewBag.pageIndex = i;
            ViewBag.totalPage = total;

            Training_PlanBLL training_PlanBLL = new Training_PlanBLL();
            ViewBag.PlanList = training_PlanBLL.GetListModel(" Display=1 and Delflag='false'");

            Traning_FieldBLL traning_FieldBLL = new Traning_FieldBLL();
            ViewBag.FieldList = traning_FieldBLL.GetList(" Display=1 and Delflag='false' and IsSpec=0", " Sort");

            Traning_DetailBLL traning_DetailBLL = new Traning_DetailBLL();
            ViewBag.TraningList = traning_DetailBLL.GetList(" Display=1 and Delflag='false' and PartitionId='" + Code.SiteCache.Instance.LoginInfo.PartitionId + "' and Status=5 and (OrganId='" + OrganId + "' or Range=2)", " Id");

            Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
            ViewBag.ClassList = class_DetailBLL.GetListModel(" Display=1 and Delflag='false' ");

            return View(tdlist);
        }
        /// <summary>
        /// 教师--课程超市列表
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="organId"></param>
        /// <param name="field"></param>
        /// <param name="searchTitle"></param>
        /// <returns></returns>
        //[UrlDecrypt]
        public ActionResult CoursemarketSingleList(int? pageIndex, int? organId, int? field, string searchTitle)
        {
            ViewBag.Title = "课程超市";

            int i = TypeConverter.ObjectToInt(pageIndex, 1);
            int groupId = Code.SiteCache.Instance.GroupId;//4,学校管理7,普通教师
            Organ_DetailBLL organ_DetailBLL = new Organ_DetailBLL();
            int CountyOrganId = 0;

            int oType = 1;
            if (groupId == 7)
            {
                oType = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.OrganId).OType;
                CountyOrganId = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.OrganId).ParentId;
            }
            else if (groupId == 2 || groupId == 3 || groupId == 4)
            {
                oType = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.ManageOrganId).OType;
                if (groupId == 4)
                    CountyOrganId = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.ManageOrganId).ParentId;
                else
                    CountyOrganId = Code.SiteCache.Instance.ManageOrganId;
            }
            ViewBag.OType = oType;
            int partitionId = Code.SiteCache.Instance.LoginInfo.PartitionId;
            Member_BaseInfoBLL member_BaseInfoBLL = new Member_BaseInfoBLL();
            Member_BaseInfo m = member_BaseInfoBLL.GetModelByAccountId(Code.SiteCache.Instance.LoginInfo.UserId);
            string where = " and td.PartitionId='" + partitionId + "'and cd.PlanId='" + Code.SiteCache.Instance.PlanId + "' and cd.PartitionId='" + partitionId + "'";

            if (oType == 1)
            {
                ViewBag.OrganList = organ_DetailBLL.GetListModel(" OType=1 and Delflag='false'");
            }
            else if (oType == 2 || oType == 5)
            {
                ViewBag.OrganList = organ_DetailBLL.GetListModel(" OType=5 and Delflag='false'");
            }
            else
            {
                where += " and 1=2";
            }

            if (m != null)
            {
                where += " and (td.OrganId='" + CountyOrganId + "' or td.Range=2)";
            }
            else
            {
                where += " and 1=2";
            }

            if (organId != null && organId > 0)
            {
                where += " and td.OrganId='" + organId + "' ";
            }
            else { organId = -1; }
            if (!string.IsNullOrEmpty(searchTitle))
            { where += " and td.Title like'%" + searchTitle.Replace("'", "''") + "%' "; }
            string where2 = where;
            if (field != null && field > 0)
            { where += " and td.TraingField='" + field + "' "; }
            Traning_DetailBLL traning_DetailBLL = new Traning_DetailBLL();
            int total = 0;
            List<Traning_Detail> tdlist = traning_DetailBLL.GetListHasClass(10, i, where, "CreateDate desc", out total);

            ViewData["searchTitle"] = string.IsNullOrEmpty(searchTitle) ? "" : searchTitle;
            ViewData["organId"] = organId;
            ViewData["field"] = field;
            ViewData["partitionId"] = partitionId;
            ViewData["groupId"] = groupId;
            ViewBag.pageIndex = i;
            ViewBag.totalPage = total;

            Traning_FieldBLL traning_FieldBLL = new Traning_FieldBLL();

            List<Traning_Field> traning_FieldList = traning_FieldBLL.GetList(" Delflag='false' and display='1' and Id<>3", " Sort");
            ViewBag.FieldList = traning_FieldList;
            List<Traning_Detail> tdlistall = traning_DetailBLL.GetListHasClass(-1, -1, where2, "CreateDate desc", out total);
            List<int> list = new List<int>(traning_FieldList.Count);
            int sum = 0;
            foreach (Traning_Field tf in traning_FieldList)
            {
                int c = tdlistall.Where(a => a.TraingField == tf.Id).Count();
                list.Add(c);
                sum += c;
            }

            ViewBag.Sum = sum;
            ViewBag.FCount = list;
            return View(tdlist);
        }
 public ActionResult CoursemarketSingleEnrollC(int Id)
 {
     ViewBag.Title = "课程详细";
     int groupId = Code.SiteCache.Instance.GroupId;//4,学校管理7,普通教师
     ViewData["groupId"] = groupId;
     Traning_DetailBLL traning_DetailBLL = new Traning_DetailBLL();
     Traning_Detail traning_Detail = new Traning_Detail();
     traning_Detail = traning_DetailBLL.GetModel(Id, "");
     return View(traning_Detail);
 }
Esempio n. 16
0
        /// <summary>
        /// 获取页面活动的公共方法
        /// </summary>
        /// <param name="bolNeedUpdateProgress">是否需要更新总进度</param>
        /// <returns></returns>
        private Course_UnitContent GetCourseUnitContentActivity(int TrainingId, int UnitContent, int ClassId, bool bolNeedUpdateProgress = true)
        {
            //获取所有的阅读信息
            var courseBll = new Course_UnitContentBLL();
            var DetailBll = new Traning_DetailBLL();
            var List_Course_UnitContent = new List<Course_UnitContent>();
            var Model_Course_UnitContent = new Course_UnitContent();
            var stbSqlWhere = new StringBuilder();
            var strOrderBy = "Sort";

            int iAccountId = 0, iUnitId = 0;
            iAccountId = Code.SiteCache.Instance.LoginInfo.UserId;

            stbSqlWhere.Append(" 1 = 1");
            if (TrainingId > 0)
                stbSqlWhere.AppendFormat(" AND Course_UnitDetail.TrainingId = {0}", TrainingId);
            if (UnitContent > 0)
                stbSqlWhere.AppendFormat(" AND Course_UnitContent.Id = {0}", UnitContent);

            List_Course_UnitContent = courseBll.GetListOther(stbSqlWhere.ToString(), strOrderBy);
            if (List_Course_UnitContent != null && List_Course_UnitContent.Count == 1)
                Model_Course_UnitContent = List_Course_UnitContent[0];

            //根据 TrainingId 获取 Title
            var Model_Traning_Detail = DetailBll.GetModel(TrainingId, string.Empty);

            ViewBag.TraningDetailTitle = Model_Traning_Detail.Title;
            ViewBag.UnitId = iUnitId = Model_Course_UnitContent.UnitId.Value;
            ViewBag.AccountId = iAccountId;
            ViewBag.ClassId = ClassId;
            ViewBag.TrainingId = TrainingId;
            ViewBag.UnitContent = UnitContent = Model_Course_UnitContent.Id;
            ViewBag.Model_Course_UnitContent = Model_Course_UnitContent;

            if (bolNeedUpdateProgress && List_Course_UnitContent != null && List_Course_UnitContent.Count > 0)
            {
                //更新总体进度
                this.UpdateOverallProgress(iUnitId, ClassId, TrainingId, iAccountId, UnitContent);
            }

            return Model_Course_UnitContent;
        }
        public ActionResult BatchAuditGraduate(int classId, string Ids, string Remark)
        {
            try
            {
                var bll = new Member_ClassRegisterBLL();
                var ids = Ids.Split(',');
                var classDetail = new Dianda.AP.BLL.Class_DetailBLL().GetModel(classId);
                var tranFieldModel = new Traning_DetailBLL().GetModel(classDetail.TraningId, "");

                foreach (var id in ids)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        var Val = id.Split('|')[1].ToInt();
                        if (Val == 0) continue;//不操作

                        var model = bll.GetList("Delflag=0 and ClassId=" + classId + " and AccountId=" + id.Split('|')[0].ToInt(), "").First();

                        model.Result = Val;

                        var totalScore = (model.ReadingScore.HasValue ? model.ReadingScore.Value : 0)
                            + (model.DiscussScore.HasValue ? model.DiscussScore.Value : 0)
                            + (model.HomeWorkScore.HasValue ? model.HomeWorkScore.Value : 0)
                            + (model.TestingScore.HasValue ? model.TestingScore.Value : 0)
                            + (model.ExaminationScore.HasValue ? model.ExaminationScore.Value : 0)
                            + (model.CommentScore.HasValue ? model.CommentScore.Value : 0);

                        if (Math.Ceiling(totalScore) < 60 && Val == 1 && tranFieldModel.OutSideType == -1)//分数小于60,不操作
                            continue;

                        model.ApplyRemark = Remark;
                        model.ResultCreater = SiteCache.Instance.LoginInfo.UserId;
                        model.TotalScore = totalScore;
                        bll.Update(model);

                        var comment = new Dianda.AP.BLL.Class_TraningCommentResultBLL().GetListModel(" ClassId=" + classId + " and AccountId=" + id.Split('|')[0].ToInt() + " and Delflag=0");
                        if (Val == 1 && comment != null && comment.Count>0)//如果结论是合格,,并且评论过课程,则要更新用户学分
                        {
                            var tranEditModel = new Member_TrainingReditBLL().GetList("Delflag=0 and TrainingField=" + tranFieldModel.TraingField
                                + " and PlanId=" + model.PlanId + " and AccountId=" + model.AccountId, "");
                            Member_TrainingRedit tranEdit = null;
                            if (tranEditModel == null || tranEditModel.Count == 0)//创建
                            {
                                tranEdit = new Member_TrainingRedit();
                                tranEdit.AccountId = model.AccountId;
                                tranEdit.CreateDate = DateTime.Now;
                                tranEdit.Credits = tranFieldModel.TotalTime.Value;
                                tranEdit.Delflag = false;
                                tranEdit.PlanId = model.PlanId;
                                tranEdit.TrainingField = tranFieldModel.TraingField;
                                new Member_TrainingReditBLL().Add(tranEdit);
                            }
                            else//更新
                            {
                                tranEdit = tranEditModel.First();
                                tranEdit.Credits += tranFieldModel.TotalTime.Value;
                                new Member_TrainingReditBLL().Update(tranEdit);
                            }
                            var traningCredit = DataTableToListHelper<Training_Credits>.ConvertToModel(
                                new Training_CreditsBLL().GetList(" and PlanId=" + model.PlanId + " and OrganId=" + classDetail.OrganId, "")
                                );//查找学时学分
                            if (traningCredit != null && traningCredit.Count > 0) //轮循所有大类
                            {
                                bool graduateFlag = true;
                                var member_traningBll = new Member_TrainingReditBLL();
                                foreach (var item in traningCredit)
                                {
                                    var traning_credit = member_traningBll.GetList
                                        (" Delflag=0 and PlanId=" + model.PlanId + " and AccountId=" + model.AccountId + " and TrainingField=" + item.TraningField
                                        , "");
                                    if (traningCredit != null && traningCredit.Count > 0)
                                    {
                                        if (traningCredit.First().MinValue > tranEdit.Credits)
                                        {
                                            graduateFlag = false;
                                            break;
                                        }
                                    }
                                }
                                if (graduateFlag)//所有大类学分均合格,更新Member_PlanOverall表的用户合格状态。
                                {
                                    var Member_PlanOverallBll = new Member_PlanOverallBLL();
                                    var Member_PlanOverall = Member_PlanOverallBll.GetListModel(" Delflag=0 and  PlanId=" + model.PlanId + " and AccountId=" + model.AccountId);
                                    if (Member_PlanOverall != null && Member_PlanOverall.Count > 0)
                                    {
                                        var item = Member_PlanOverall.First();
                                        item.Result = 1;
                                        Member_PlanOverallBll.Update(item);
                                    }
                                    else
                                    {
                                        var item = new Member_PlanOverall();
                                        item.Result = 1;
                                        item.PlanId = model.PlanId;

                                        item.AccountId = model.AccountId;
                                        item.CreateDate = DateTime.Now;
                                        item.Delflag = false;

                                        Member_PlanOverallBll.Add(item);
                                    }
                                }
                            }

                        }
                    }
                }

                return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message + ex.StackTrace }, JsonRequestBehavior.AllowGet);
            }
        }
Esempio n. 18
0
 //根据选择的课程返回学校范围
 public JsonResult GetSchoolByCourse(string courseid)
 {
     try
     {
         var course = new Traning_DetailBLL().GetModel(courseid.ToInt(), "");
         var organBll = new Organ_DetailBLL();
         var list = new List<Organ_Detail>();
         if (course.Range == 1) //区级
         {
             list = organBll.GetListModel(" Delflag=0 and  OType IN ( 1, 2, 3 ) and PartitionId=" + SiteCache.Instance.LoginInfo.PartitionId + " and ParentId=" + SiteCache.Instance.ManageOrganId);
         }
         else//市级
         {
             list = organBll.GetShiOrganDetailList();
         }
         return Json(list, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }