public ActionResult CourseList() { //获取用户Id int AccountId = Code.SiteCache.Instance.LoginInfo.UserId; //ViewBag.Title = "课程制作列表"; Course_DetailBLL bll = new Course_DetailBLL(); //获取所有课程单元信息 int subjectId; int.TryParse(Request["SubjectId"], out subjectId); ViewBag.Subject = bll.GetSubjectInfoList(); ViewBag.SubjectId = subjectId; string keyWords = ""; if (!string.IsNullOrEmpty(Request["KeyWords"])) keyWords = Request["KeyWords"].Trim(); ViewBag.KeyWords = keyWords; Code.SiteCache cache = Code.SiteCache.Instance; StringBuilder where = new StringBuilder(); where.Append("A.Delflag=0 and A.Status<>1 and A.PartitionId=" + cache.LoginInfo.PartitionId); if (keyWords != "") where.Append(" and Title like '%" + keyWords + "%'"); if (subjectId != 0) where.Append(" and " + subjectId + " in (select value from [dbo].[split](Subject,','))"); where.Append(" and A.Status > 2 AND A.Status != 4 and A.OutSideType = -1 and C.AccountId=" + AccountId); //获取课程总记录数 int recordCount = bll.GetTrainingInfoCount(where.ToString()); int pageSize = 8, pageIndex; int pageCount = (int)Math.Ceiling((double)recordCount / pageSize); int.TryParse(Request["PageIndex"], out pageIndex); if (pageIndex < 1) pageIndex = 1; else if (pageIndex > pageCount) pageIndex = pageCount; ViewBag.RecordCount = recordCount; ViewBag.PageCount = pageCount; ViewBag.PageIndex = pageIndex; ViewBag.PageSize = pageSize; //获取课程单元信息 ViewBag.SubjectData = bll.GetSubject(); //获取课程列表信息 ViewBag.TrainingInfoList = bll.GetTrainingInfoList(pageSize, pageIndex, where.ToString(), "A.CreateDate"); return View(); }