123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.JSON;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.CultureplanManage.CourseMaterial;
- using EMIS.ViewModel.Cultureplan;
- using EMIS.ViewModel.CultureplanManage.CourseMaterial;
- namespace EMIS.Web.Controllers.CultureplanManage.CourseMaterial
- {
- [Authorization]
- public class ClubCourseController : Controller
- {
- public IClubCourseServices ClubCourseServices { get; set; }
- /// <summary>
- /// 俱乐部页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 俱乐部页面列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- //课程级别
- var courseLevelID = pararms.getExtraInt("DictionaryCourseLevel") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseLevel");
- //课程科类
- var courseScienceID = pararms.getExtraInt("DictionaryCourseScience") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseScience");
- //上课类型
- var classGroupingID = pararms.getExtraGuid("TeachTypeDropdown");
- //是否启用
- var isEnable = pararms.getExtraInt("DictionaryIsEnable") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsEnable");
- return base.Json(ClubCourseServices.GetClubCourseViewGrid(configuretView, courseLevelID, courseScienceID, classGroupingID,
- isEnable, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 批量新增
- /// </summary>
- /// <returns></returns>
- public ActionResult BatchAdd()
- {
- ClubCourseView clubCourseView = new ClubCourseView();
- return View(clubCourseView);
- }
-
- /// <summary>
- /// 批量新增
- /// </summary>
- /// <param name="clubCourseView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult BatchAdd(ClubCourseView clubCourseView)
- {
- try
- {
- var courseNoClubViewList = Request["CourseNoClubList"].JsonToObject<List<CoursematerialView>>();
- string result = ClubCourseServices.ClubCourseBatchAdd(clubCourseView, courseNoClubViewList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 查询对应的课程信息View(课程信息表左连俱乐部课程表,排除对应的俱乐部课程信息)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CourseNoClubList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- //课程级别
- var courseLevelID = pararms.getExtraInt("DictionaryCourseLevel") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseLevel");
- //课程科类
- var courseScienceID = pararms.getExtraInt("DictionaryCourseScience") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseScience");
- //是否启用
- var isEnable = pararms.getExtraInt("DictionaryIsEnable") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsEnable");
- return base.Json(ClubCourseServices.GetCourseNoClubViewGrid(configuretView, courseLevelID, courseScienceID, isEnable, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑(新增、修改--暂时无效)
- /// </summary>
- /// <param name="clubCourseID"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? clubCourseID)
- {
- return null;
- }
-
- /// <summary>
- /// 编辑(新增、修改--暂时无效)
- /// </summary>
- /// <param name="clubCourseView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(ClubCourseView clubCourseView)
- {
- return null;
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="clubCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string clubCourseIDs)
- {
- try
- {
- List<Guid?> list = clubCourseIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- ClubCourseServices.ClubCourseDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message);
- }
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- //课程级别
- var courseLevelID = Request.Form["DictionaryCourseLevel"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseLevel"].ParseStrTo<int>();
- //课程科类
- var courseScienceID = Request.Form["DictionaryCourseScience"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseScience"].ParseStrTo<int>();
- //上课类型
- var classGroupingID = Request.Form["TeachTypeDropdown"].ParseStrTo<Guid>();
- //是否启用
- var isEnable = Request.Form["DictionaryIsEnable"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsEnable"].ParseStrTo<int>();
- var dt = ClubCourseServices.GetClubCourseViewList(configuretView, courseLevelID, courseScienceID, classGroupingID,isEnable)
- .Select(x => new
- {
- x.CourseCode,
- x.CourseName,
- x.Abbreviation,
- x.CourseLevelName,
- x.CourseScienceName,
- x.ClassName,
- x.IsEnableName
- }).ToTable();
- string[] liststring = {
- "课程代码", "课程名称", "课程简称", "课程级别", "课程科类", "上课类型", "是否启用"
- };
- neh.Export(dt, liststring, "俱乐部课程信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|