コード例 #1
0
        public dynamic SetWConfiguration1(W_Configuration model)
        {
            W_Configuration ret = mapper.GetWConfiguration(this.System_Station_ID);

            ret.ValidPeriod = model.ValidPeriod;
            if (model.ComDay != 0)
            {
                ret.ComDay = model.ComDay;
            }
            if (model.ComVideo != 0)
            {
                ret.ComVideo = model.ComVideo;
            }
            if (model.ComLive != 0)
            {
                ret.ComLive = model.ComLive;
            }
            if (ret == null)  //添加
            {
                return(Success(mapper.InsertWConfiguration(model, this.System_Station_ID)));
            }
            else  //修改
            {
                return(Success(mapper.UpdateWConfiguration(ret, this.System_Station_ID)));
            }
        }
コード例 #2
0
 /// <summary>
 /// 添加课程设置
 /// </summary>
 /// <param name="Model"></param>
 /// <returns></returns>
 public bool InsertWConfiguration(W_Configuration Model, int System_Station_ID)
 {
     Model.System_Station_ID = System_Station_ID;
     if (Orm.Insert(Model) <= 0)
     {
         throw new ApiException("添加失败");
     }
     return(true);
 }
コード例 #3
0
        /// <summary>
        /// 修改课程设置
        /// </summary>
        /// <param name="Model"></param>
        /// <returns></returns>
        public bool UpdateWConfiguration(W_Configuration Model, int System_Station_ID)
        {
            W_Configuration model = Orm.Single <W_Configuration>(x => x.System_Station_ID == System_Station_ID);

            if (model == null)
            {
                throw new ApiException("未找到要修改的数据");
            }
            if (Orm.Update(Model) <= 0)
            {
                throw new ApiException("修改失败");
            }
            return(true);
        }
コード例 #4
0
        public dynamic SetWConfiguration2(W_Configuration model)
        {
            W_Configuration ret = mapper.GetWConfiguration(this.System_Station_ID);

            ret.CommentValid = model.CommentValid;

            if (ret == null)  //添加
            {
                return(Success(mapper.InsertWConfiguration(model, this.System_Station_ID)));
            }
            else  //修改
            {
                return(Success(mapper.UpdateWConfiguration(ret, this.System_Station_ID)));
            }
        }
コード例 #5
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);
        }
コード例 #6
0
        public dynamic SetWConfiguration3(W_Configuration model)
        {
            W_Configuration ret = mapper.GetWConfiguration(this.System_Station_ID);

            ret.QuestionValid     = model.QuestionValid;
            ret.QuestionReplyType = model.QuestionReplyType;
            ret.QuestionLookType  = model.QuestionLookType;

            if (ret == null)  //添加
            {
                return(Success(mapper.InsertWConfiguration(model, this.System_Station_ID)));
            }
            else  //修改
            {
                return(Success(mapper.UpdateWConfiguration(ret, this.System_Station_ID)));
            }
        }
コード例 #7
0
        public dynamic SetWConfiguration4(W_Configuration model)
        {
            W_Configuration ret = mapper.GetWConfiguration(this.System_Station_ID);

            ret.OverFlowTime = model.OverFlowTime;
            ret.OverFlowInfo = model.OverFlowInfo;
            ret.OverFlowAuth = model.OverFlowAuth;
            ret.UserSeeAuth  = model.UserSeeAuth;

            if (ret == null)  //添加
            {
                return(Success(mapper.InsertWConfiguration(model, this.System_Station_ID)));
            }
            else  //修改
            {
                return(Success(mapper.UpdateWConfiguration(ret, this.System_Station_ID)));
            }
        }