public ActionResult List() { PrepareTrainingCheckBLL bll = new PrepareTrainingCheckBLL(); int subjectId = Code.ExtendHelper.ToInt(Request["SubjectId"]); ViewBag.Subject = bll.GetSubject(); ViewBag.SubjectId = subjectId; int statusId = Code.ExtendHelper.ToInt(Request["StatusId"]); Dictionary<int, string> dict = new Dictionary<int, string>(); int[] dictKey = { 2, 3, 4, 5, 6 }; string[] dictValue = { "等待审核", "通过", "不通过", "已上架", "已下架" }; for (int i = 0; i < dictKey.Length; i++) { dict.Add(dictKey[i], dictValue[i]); } ViewBag.Status = dict; ViewBag.StatusId = statusId; 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("Delflag=0 and Status<>1 and PartitionId=" + cache.LoginInfo.PartitionId); if (keyWords != "") where.Append(" and Title like '%" + keyWords.Replace("'", "''") + "%'"); if (subjectId != 0) where.Append(" and " + subjectId + " in (select value from [dbo].[split](Subject,','))"); if (statusId != 0) where.Append(" and Status=" + statusId); 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 (pageCount == 0) { pageIndex = 0; } else { 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(); return View(bll.GetTrainingInfoList(pageSize, pageIndex, where.ToString(), "CreateDate desc")); }
public ActionResult Edit(int id) { PrepareTrainingCheckBLL bll = new PrepareTrainingCheckBLL(); NationalAbility_CourseBLL nationalAbility_CourseBLL = new NationalAbility_CourseBLL(); Traning_Detail model = bll.GetTrainingDetail(id, "Delflag=0 and Status<>1"); if (model == null) { return Content("<script>setTimeout(function () { window.location.href = '/Prepare/TrainingCheck/List' }, 3000);</script>操作失败,3秒后自动返回到列表!"); } ViewBag.TrainingObjectData = bll.GetTraningObject(); ViewBag.SubjectData = bll.GetSubject(); ViewBag.StudyLevelData = bll.GetStudyLevel(); ViewBag.TrainingFormData = bll.GetTrainingForm(); ViewBag.TeacherTitleData = bll.GetTeacherTitle(); ViewBag.TrainingFeildData = bll.GetTrainingField("Delflag=0 and IsSpec=0", ""); ViewBag.TrainingCategoryData = bll.GetTrainingCategory("Delflag=0 and Field=" + model.TraingField, ""); ViewBag.TrainingTopicData = bll.GetTrainingTopic("Delflag=0 and CategoryId=" + model.TraingCategory, ""); ViewBag.NationalCoursData = nationalAbility_CourseBLL.GetList2("Delflag=0 and TCategoryId=" + model.TraingCategory, ""); ViewBag.AttachData = bll.GetAttachTable("Delflag=0 and TraningId=" + id, ""); ViewBag.OutCourseTypeData = bll.GetOutCourseType("Delflag=0", ""); Organ_Detail otypeModel = new Organ_DetailBLL().GetModel(Convert.ToInt32(model.OrganId)); ViewBag.OTypeId = otypeModel == null ? 0 : Convert.ToInt32(otypeModel.OType); return View(model); }