/// <summary>
        /// 获取培训内容
        /// </summary>
        /// <param name="classId"></param>
        /// <returns></returns>
        public JsonResult GetContentByClassId(int classId, int type = 0)
        {
            try
            {
                var courseList    = _trainLearningManager.GetClassShowList(classId);
                var examList      = _trainLearningManager.GetClassExamShow(classId);
                var practicalList = _classManager.GetTrainClassToPracticals(classId);
                if (type == 1)
                {
                    var couseContentList = _trainLearningManager.GetTrainClassToCourseContents();
                    var resourceList     = _trainLearningManager.GetTrainClassToResource();
                    foreach (var course in courseList)
                    {
                        var rList = resourceList.Where(p => p.ClassCourseId == course.ID);
                        var cList = couseContentList.Where(p => p.CourseId == course.ID);
                        course.resourceList      = rList.Any() ? rList.ToList() : new List <Tr_TrainClassToCourseResource>();
                        course.coursecontentList = cList.Any() ? cList.ToList() : new List <Tr_TrainClassToCouseContent>();
                    }
                }

                return(Json(new { result = 1, courseList = courseList, examList = examList, practicalList = practicalList }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { result = 0, error = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 培训班课程
        /// </summary>
        /// <returns></returns>
        public ActionResult AddClassCourse(int classId)
        {
            var classmodel = _classManager.GetTrTrainClassById(classId);
            List <Tr_TrainClassToCourse> courseList = _classManager.GetTrainClassToCourses(classId);

            if (courseList.Count > 0)
            {
                foreach (var course in courseList)
                {
                    course.resourceLsit = _classManager.GetTrainClassToCourseResources(course.ID);
                    course.contentLsit  = _classManager.GetTrainClassToCourseContents(course.ID);
                    course.checkLsit    = _classManager.GetTrainClassToCourseChecks(course.ID);
                    if (!course.resourceLsit.Any())
                    {
                        course.resourceLsit = new List <Tr_TrainClassToCourseResource>();
                    }
                    if (!course.contentLsit.Any())
                    {
                        course.contentLsit = new List <Tr_TrainClassToCouseContent>();
                    }
                    if (!course.checkLsit.Any())
                    {
                        course.checkLsit = new List <Tr_TrainClassToCouseCheck>();
                    }
                }
            }
            else
            {
                courseList = new List <Tr_TrainClassToCourse>();
            }

            ViewBag.classId     = classId;
            ViewBag.weightType  = classmodel.WeightType;
            ViewBag.CourseModel = courseList;

            //return View(courseList);


            /*
             *
             * return View(examList);
             */

            List <Tr_TrainClassToExam> examList = _classManager.GetTrainClassToExams(classId);

            if (!examList.Any())
            {
                examList = new List <Tr_TrainClassToExam>();
            }
            else
            {
                foreach (var exam in examList)
                {
                    if (exam.ExamID > 0)
                    {
                        tbExamination model = _examinationBL.GetExamination(exam.ExamID);
                        tbExampaper   paper = _exampaperBL.GetExampaper(model.PaperID);
                        exam.PaperID         = model.PaperID;
                        exam.Papername       = paper != null ? paper.ExampaperTitle : "";
                        exam.TestTimes       = model.TestTimes;
                        exam.RadomOrderFlag  = model.RadomOrderFlag;
                        exam.PassScore       = model.PassScore;
                        exam.ApprovalUserIds = model.ApprovalUser == null
                            ? ""
                            : model.ApprovalUser.GetString(defaultValue: "");
                    }
                }
            }
            ViewBag.ExamModel = examList;


            List <Tr_TrainClassToPractical> practList = _classManager.GetTrainClassToPracticals(classId);

            if (!practList.Any())
            {
                practList = new List <Tr_TrainClassToPractical>();
            }
            //return View(practList);
            ViewBag.PractModel = practList;

            return(View());
        }
Esempio n. 3
0
        /// <summary>
        /// 培训班调整详情(报表)
        /// </summary>
        /// <param name="classId"></param>
        /// <returns></returns>
        public ActionResult TrainAdjustReportDetail(int classId)
        {
            Tr_TrainClass model = _classManager.GetTrTrainClassById(classId);

            //课程
            List <Tr_TrainClassToCourse> courseList = _classManager.GetTrainClassToCourses(classId);

            if (courseList.Count > 0)
            {
                foreach (var course in courseList)
                {
                    course.resourceLsit = _classManager.GetTrainClassToCourseResources(course.ID);
                    course.contentLsit  = _classManager.GetTrainClassToCourseContents(course.ID);
                    course.checkLsit    = _classManager.GetTrainClassToCourseChecks(course.ID);
                    if (!course.resourceLsit.Any())
                    {
                        course.resourceLsit = new List <Tr_TrainClassToCourseResource>();
                    }
                    if (!course.contentLsit.Any())
                    {
                        course.contentLsit = new List <Tr_TrainClassToCouseContent>();
                    }
                    if (!course.checkLsit.Any())
                    {
                        course.checkLsit = new List <Tr_TrainClassToCouseCheck>();
                    }
                }
            }
            else
            {
                courseList = new List <Tr_TrainClassToCourse>();
            }
            //考试
            List <Tr_TrainClassToExam> examList = _classManager.GetTrainClassToExams(classId);

            if (!examList.Any())
            {
                examList = new List <Tr_TrainClassToExam>();
            }
            else
            {
                foreach (var exam in examList)
                {
                    if (exam.ExamID > 0)
                    {
                        tbExamination emodel = _examinationBL.GetExamination(exam.ExamID);
                        tbExampaper   paper  = _exampaperBL.GetExampaper(emodel.PaperID);
                        exam.PaperID         = emodel.PaperID;
                        exam.Papername       = paper != null ? paper.ExampaperTitle : "";
                        exam.TestTimes       = emodel.TestTimes;
                        exam.RadomOrderFlag  = emodel.RadomOrderFlag;
                        exam.PassScore       = emodel.PassScore;
                        exam.ApprovalUserIds = emodel.ApprovalUser == null
                            ? ""
                            : emodel.ApprovalUser.GetString(defaultValue: "");
                    }
                }
            }
            //考评
            List <Tr_TrainClassToPractical> practList = _classManager.GetTrainClassToPracticals(classId);

            if (!practList.Any())
            {
                practList = new List <Tr_TrainClassToPractical>();
            }
            var maxbatch       = _planManager.GetMaxBatch(classId, 1);
            var approvelist    = _planManager.GeTrPlanApproveList(classId, 1, maxbatch).OrderBy(p => p.Step);
            var newApprovelist = new List <Tr_PlanApproveList>();
            var flag           = false;

            foreach (var approve in approvelist)
            {
                if (!flag)
                {
                    if (approve.ApproveStatus == 0)
                    {
                        flag = true;
                        newApprovelist.Add(approve);
                    }
                    else
                    {
                        newApprovelist.Add(approve);
                    }
                }
            }
            ViewBag.approvelist = newApprovelist;

            List <Tr_TrainClassToUser> userlist = _classManager.GetClassToUsers(classId);

            ViewBag.UserIds = userlist.Select(p => p.UserId).GetString();

            ViewBag.Courses    = courseList;
            ViewBag.Exams      = examList;
            ViewBag.Practicals = practList;
            return(View(model));
        }