public ActionResult Edit(int id) { PrepareTrainingApplyBLL bll = new PrepareTrainingApplyBLL(); NationalAbility_CourseBLL nationalAbility_CourseBLL = new NationalAbility_CourseBLL(); Traning_Detail model = bll.GetTrainingDetail(Convert.ToInt32(id), "Delflag=0 and (Status=1 or Status=4 or CanEdit=1)"); if (model == null) { return Content("<script>setTimeout(function () { window.location.href = '/Prepare/TrainingApply/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(Code.SiteCache.Instance.ManageOrganId); ViewBag.OTypeId = otypeModel == null ? 0 : Convert.ToInt32(otypeModel.OType); return View(model); }
//上架、下架 public ActionResult AjaxSetShelf(int trainingId, int status) { PrepareTrainingApplyBLL bll = new PrepareTrainingApplyBLL(); Traning_Detail model = bll.GetTrainingDetail(trainingId, "Delflag=0"); bool result; string msg; if (model == null) { result = false; msg = "记录不存在!"; } else { if (status == 5)//上架 { if (model.Status == 5) { result = false; msg = "课程已上架!"; } else { model.Status = 5; bll.UpdateTrainingDetail(model); result = true; msg = "上架成功!"; } } else if (status == 6)//下架 { if (model.Status == 6) { result = false; msg = "课程已下架!"; } else { model.Status = 6; bll.UpdateTrainingDetail(model); result = true; msg = "下架成功!"; } } else { result = false; msg = "操作失败!"; } } return Json(new { Result = result, Msg = msg }, JsonRequestBehavior.AllowGet); }
public ActionResult Details(int id) { PrepareTrainingApplyBLL bll = new PrepareTrainingApplyBLL(); Traning_Detail model = bll.GetTrainingDetail(id, "Delflag=0"); if (model == null) { return Content("<script>setTimeout(function () { window.location.href = '/Prepare/TrainingApply/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.AttachData = bll.GetAttachTable("Delflag=0 and TraningId=" + id, ""); ViewBag.OutCourseTypeData = bll.GetOutCourseType("Delflag=0", ""); ViewBag.NationalCoursData = new NationalAbility_CourseBLL().GetList2("Delflag=0 and TCategoryId=" + model.TraingCategory, ""); return View(model); }
//撤销提交审核 public ActionResult AjaxRevoke(int trainingId) { PrepareTrainingApplyBLL bll = new PrepareTrainingApplyBLL(); Traning_Detail model = bll.GetTrainingDetail(trainingId, "Delflag=0 and Status=2"); bool result; string msg; if (model == null) { result = false; msg = "课程不在待审核状态中,请尝试刷新页面!"; } else { if (model.Status == 1) { result = false; msg = "课程还未提交审核!"; } else { model.Status = 1; bll.UpdateTrainingDetail(model); result = true; msg = "撤销成功!"; } } return Json(new { Result = result, Msg = msg }, JsonRequestBehavior.AllowGet); }