Exemplo n.º 1
0
        /// <summary>
        /// 根据课件id查找对应数据
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="System_Station_ID"></param>
        /// <returns></returns>
        public W_CourseWareModel GetCourseWareByIDforStu(W_CourseWareModel Model, string StuId, int System_Station_ID)
        {
            string            sql             = string.Empty;
            W_CourseWareModel CourseWareModel = new W_CourseWareModel();

            W_Configuration ConModel = Orm.Single <W_Configuration>(x => x.System_Station_ID == System_Station_ID);

            if (string.IsNullOrEmpty(StuId) && ConModel.OverFlowAuth == 1 && ConModel.UserSeeAuth == 1)
            {
                throw new ApiException("您当前未注册,请注册登录后再试!");
            }

            CourseWareModel = SqlMapper.QueryForObject <W_CourseWareModel>("GetCourseWareModel2", new { ID = Model.ChapterID, Course_ID = Model.Course_ID, System_Station_ID = System_Station_ID, StuId = StuId });

            if (CourseWareModel != null && CourseWareModel.Discipline_ID > 0)
            {
                //获取一级 二级 三级学科ID
                DisciplineIDModel DisciplineModel = new DisciplineMapper().GetDisciplineIDS(CourseWareModel.Discipline_ID);
                if (DisciplineModel != null)
                {
                    CourseWareModel.Discipline_OneLevelID   = DisciplineModel.Discipline_OneLevelID;   //一级学科ID
                    CourseWareModel.Discipline_TwoLevelID   = DisciplineModel.Discipline_TwoLevelID;   //二级学科ID
                    CourseWareModel.Discipline_ThreeLevelID = DisciplineModel.Discipline_ThreeLevelID; //三级学科ID
                }

                //秒转时间格式
                if (CourseWareModel.Duration > 0)
                {
                    CourseWareModel.DurationS = GetTurnSecondTime(CourseWareModel.Duration);
                }
                else
                {
                    CourseWareModel.DurationS = "00:00:00";
                }

                //字节转换KB  MB GB
                if (CourseWareModel.CourseSize > 0)
                {
                    CourseWareModel.CourseSizeS = HumanReadableFilesize(CourseWareModel.CourseSize);
                }
            }
            if (CourseWareModel == null)
            {
                throw new ApiException("操作失败,未找到对应的数据!");
            }
            return(CourseWareModel);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据网课id 查找对应数据
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="System_Station_ID"></param>
        /// <returns></returns>
        public dynamic GetCourseByID(int ID, int System_Station_ID, string StuId)
        {
            W_CourseModel model = SqlMapper.QueryForObject <W_CourseModel>("GetCourseByID", new { ID = ID, System_Station_ID = System_Station_ID, StuId = StuId });

            if (model != null && model.Discipline_ID > 0)
            {
                //获取一级 二级 三级学科ID
                DisciplineIDModel DisciplineModel = new DisciplineMapper().GetDisciplineIDS(model.Discipline_ID);
                if (DisciplineModel != null)
                {
                    model.Discipline_OneLevelID   = DisciplineModel.Discipline_OneLevelID;   //一级学科ID
                    model.Discipline_TwoLevelID   = DisciplineModel.Discipline_TwoLevelID;   //二级学科ID
                    model.Discipline_ThreeLevelID = DisciplineModel.Discipline_ThreeLevelID; //三级学科ID
                }
            }
            return(model);
        }
Exemplo n.º 3
0
        public List <T_TeacherInfo_Detail_DisciplineModel> GetTeacherDetailDiscipline(int TeacherDetail_ID, int System_Station_ID)
        {
            List <T_TeacherInfo_Detail_DisciplineModel> list = SqlMapper.QueryForList <T_TeacherInfo_Detail_DisciplineModel>("GetTeacherDetailDiscipline", new { TeacherDetail_ID = TeacherDetail_ID, System_Station_ID = System_Station_ID }).ToList();

            if (list != null && list.Count > 0)
            {
                list.ForEach(T =>
                {
                    //获取一级 二级 三级学科ID
                    DisciplineIDModel DisciplineModel = new DisciplineMapper().GetDisciplineIDS(T.Discipline_ID);
                    if (DisciplineModel != null)
                    {
                        T.Discipline_OneLevelID   = DisciplineModel.Discipline_OneLevelID;   //一级学科ID
                        T.Discipline_TwoLevelID   = DisciplineModel.Discipline_TwoLevelID;   //二级学科ID
                        T.Discipline_ThreeLevelID = DisciplineModel.Discipline_ThreeLevelID; //三级学科ID
                    }
                });
            }
            return(list);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据课件id查找对应数据
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="System_Station_ID"></param>
        /// <returns></returns>
        public W_CourseWareModel GetCourseWareByIDforPC(W_CourseWareModel Model, int System_Station_ID)
        {
            string            sql             = string.Empty;
            W_CourseWareModel CourseWareModel = new W_CourseWareModel();

            CourseWareModel = SqlMapper.QueryForObject <W_CourseWareModel>("GetCourseWareModel1", new { ID = Model.ID, System_Station_ID = System_Station_ID });

            if (CourseWareModel != null && CourseWareModel.Discipline_ID > 0)
            {
                //获取一级 二级 三级学科ID
                DisciplineIDModel DisciplineModel = new DisciplineMapper().GetDisciplineIDS(CourseWareModel.Discipline_ID);
                if (DisciplineModel != null)
                {
                    CourseWareModel.Discipline_OneLevelID   = DisciplineModel.Discipline_OneLevelID;   //一级学科ID
                    CourseWareModel.Discipline_TwoLevelID   = DisciplineModel.Discipline_TwoLevelID;   //二级学科ID
                    CourseWareModel.Discipline_ThreeLevelID = DisciplineModel.Discipline_ThreeLevelID; //三级学科ID
                }

                //秒转时间格式
                if (CourseWareModel.Duration > 0)
                {
                    CourseWareModel.DurationS = GetTurnSecondTime(CourseWareModel.Duration);
                }
                else
                {
                    CourseWareModel.DurationS = "00:00:00";
                }

                //字节转换KB  MB GB
                if (CourseWareModel.CourseSize > 0)
                {
                    CourseWareModel.CourseSizeS = HumanReadableFilesize(CourseWareModel.CourseSize);
                }
            }
            if (CourseWareModel == null)
            {
                throw new ApiException("操作失败,未找到对应的数据!");
            }
            return(CourseWareModel);
        }