public void TestMethod_MoveUnit() { LessonUnitBll bll = new LessonUnitBll(); var unit = bll.SelectUnit(10000, 1); bll.MoveUnit(10000, 5); }
public JsonResult GetUnitPage(int unitid, bool isshow, string jy) { if (Encrypt.MD5Hash(unitid.ToString(), "jzxd") == jy) { DtoLessonUnit p = null; LessonUnitBll bll = new LessonUnitBll(); if (!isshow) { p = bll.SelectUnit(unitid, 0); } else { p = bll.GetUnitFromRadis(unitid); } List <int> mediaIDs = new List <int>(); List <int> textIDs = new List <int>(); var page = new Page() { pageId = p.Id, pageNum = p.Index, pageName = p.Name, coinsKey = Encrypt.EncryptQueryString($"{p.Coins}_{p.Id}_{p.LessonId}_{p.CourseId}"),//金币加密串(加密内容为"单元金币数_单元id_课时id_课程id")//Remark1 steps = p.Steps.Select(s => new Step() { stepNum = s.StepNum, actions = s.Actions.Select(a => ActionTranslator.DataToViewData(a, mediaIDs, textIDs)).ToList() }).ToList() }; //如果媒体id或文本id有值的话 if (mediaIDs.Count > 0 || textIDs.Count > 0) { ResourceBll rbll = new ResourceBll(); var medias = rbll.GetMediaObjectByIdList(mediaIDs.Distinct().ToList(), true); //获取所有的媒体对象字典 var texts = rbll.GetTextObjectByIdList(textIDs.Distinct().ToList()); //获取文本对象字典 page.steps.ForEach(s => { s.actions.ForEach(a => { ActionTranslator.SetViewDataMedia(a, medias, texts); }); }); } return(Json(new JsonResponse <Page> { State = true, ErrorCode = 0, ErrorMsg = "", Data = page })); } else { throw new Exception("GetUnitPage服务端校验失败"); } }
public JsonResult GetPage(int pageid, int processid) { LessonUnitBll bll = new LessonUnitBll(); var unit = bll.SelectUnit(pageid, processid); var page = new Page(); page.courseId = unit.CourseId; page.lessonId = unit.LessonId; page.id = unit.Id; page.name = unit.Name; page.pageNum = unit.Index; ////定义媒体资源id数组和文本资源id数组 List <int> mediaids = new List <int>(), textids = new List <int>(); page.steps = unit.Steps.Select(s => new Models.CurriculumSetViewModel.Step { id = s.id, stepNum = s.StepNum, actions = s.Actions.Select(a => ActionTranslator.DataToViewData(a, mediaids, textids)).ToList() }).ToList(); //如果媒体id或文本id有值的话 if (mediaids.Count > 0 || textids.Count > 0) { ResourceBll rbll = new ResourceBll(); var medias = rbll.GetMediaObjectByIdList(mediaids.Distinct().ToList()); //获取所有的媒体对象字典 var texts = rbll.GetTextObjectByIdList(textids.Distinct().ToList()); //获取文本对象字典 page.steps.ForEach((s) => { s.actions.ForEach((a) => { ActionTranslator.SetViewDataMedia(a, medias, texts); //设置动作的媒体属性 }); //遍历每一个动作 }); //遍历每一个步骤 } page.approveType = unit.ApproveStatus; page.approve = unit.Approve; return(Json(new JsonResponse <Page> { State = true, ErrorCode = 0, ErrorMsg = "", Data = page })); }
public void TestMethod_SelectSteps() { LessonUnitBll bll = new LessonUnitBll(); var s = bll.SelectUnit(10000, 1); }