Exemplo n.º 1
0
        /// <summary>
        /// 根据单元(讲义)id查询单元(讲义)信息
        /// </summary>
        /// <param name="unitId"></param>
        /// <returns></returns>
        public DtoLessonUnit SelectUnit(int unitId, int processId)
        {
            DtoLessonUnit unit      = new DtoLessonUnit();
            var           unitInfo  = LessonServer.SelectUnit(unitId);
            var           unitSteps = (Yw_LessonUnitStepActions)UnitStepFactory.Create(UnitServer.SelectSteps(unitId));

            if (unitInfo != null)
            {
                unit.Id         = unitInfo.Ycu_Id;
                unit.CourseId   = unitInfo.Ycu_CourseId;
                unit.LessonId   = unitInfo.Ycu_LessonId;
                unit.Index      = unitInfo.Ycu_Index;
                unit.Name       = unitInfo.Ycu_Name;
                unit.Screenshot = unitInfo.Ycu_Screenshot;
                unit.Status     = unitInfo.Ycu_Status;
                unit.Creator    = unitInfo.Ycu_Creator;
                unit.CreateTime = unitInfo.Ycu_CreateTime;
                unit.Editor     = unitInfo.Ycu_Editor;
                unit.UpdateTime = unitInfo.Ycu_UpdateTime;
                if (unitSteps != null)
                {
                    unit.Steps = unitSteps.Steps;
                }
                if (processId != 0)                                                            //如果有审批id
                {
                    var approve = ApproveServer.SelectByUnitIdAndProcessID(unitId, processId); //获取最后一个审批意见
                    if (approve != null)                                                       //如果审批意见不为空,添加审批内容
                    {
                        unit.Approve       = approve.Yup_Remark;
                        unit.ApproveStatus = approve.Yup_Status;
                    }
                }
            }
            return(unit);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 读取radis中存储的单元对象
        /// </summary>
        /// <param name="unitid"></param>
        /// <returns></returns>
        public DtoLessonUnit GetUnitFromRadis(int unitid)
        {
            DtoLessonUnit unit      = new DtoLessonUnit();
            var           data      = CacheHelper.GetCache <Yw_LessonUnitStep>(CacheKeyEnum.UnitStepEdit_Cache, unitid);
            var           unitSteps = (Yw_LessonUnitStepActions)UnitStepFactory.Create(data);

            unit.Id     = unitSteps.Yls_UnitId;
            unit.Index  = unitSteps.Yls_UnitIndex;
            unit.Coins  = unitSteps.Yls_Coins;
            unit.Steps  = unitSteps.Steps;
            unit.Status = unitSteps.Yls_Status;
            return(unit);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 修改单元讲义数据
        /// </summary>
        /// <param name="unit"></param>
        /// <returns></returns>
        public void Update(DtoLessonUnit unit)
        {
            var lessonUnit = LessonServer.SelectUnit(unit.Id);
            var unitSteps  = (Yw_LessonUnitStepActions)UnitStepFactory.Create(UnitServer.SelectSteps(unit.Id));

            lessonUnit.Ycu_Name       = unit.Name;
            lessonUnit.Ycu_Screenshot = unit.Screenshot;
            lessonUnit.Ycu_Editor     = unit.Editor;
            lessonUnit.Ycu_Index      = unit.Index;
            if (unit.Steps != null)
            {
                unitSteps.Yls_UnitId     = lessonUnit.Ycu_Id;
                unitSteps.Yls_UnitIndex  = unit.Index;
                unitSteps.Steps          = unit.Steps;
                unitSteps.Yls_Coins      = unit.Coins;
                unitSteps.Yls_SubjectIds = GetLessonQuestionIdStr(unit.Steps);
            }
            LessonServer.UpdateUnits(lessonUnit);
            UnitServer.UpdateSteps(unitSteps);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据学生id课程id及课时id,分页查询课时单元信息
        /// </summary>
        /// <param name="search"></param>
        /// <returns></returns>
        public List <DtoLessonUnit> SelectUnitByNext(DtoLessonUnitSearch search)
        {
            StudentStudyBll bll = new StudentStudyBll();

            //如果学生有这个课程进度
            if (bll.GetProgressByStudentCourse(search.StudentID, search.CourseID) != null)
            {
                //获取课时单元信息数据并转换成动作对象
                var list = UnitServer.SelectUnitsByNext(search).Select(u => (Yw_LessonUnitStepActions)UnitStepFactory.Create(u)).ToList();
                //将数据转换成为dto模型
                return(list.Select(u => new DtoLessonUnit()
                {
                    CourseId = u.Yls_CourseId,
                    LessonId = u.Yls_LessonId,
                    Id = u.Yls_UnitId,
                    Index = u.Yls_UnitIndex,
                    Coins = u.Yls_Coins,
                    Steps = u.Steps,
                    Status = u.Yls_Status,
                    CreateTime = u.Yls_CreateTime,
                    UpdateTime = u.Yls_UpdateTime
                }).ToList());
            }
            return(new List <DtoLessonUnit>());
        }