123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.MinorManage.MinorPlanManage;
- using EMIS.ViewModel.MinorManage.MinorPlanManage;
- using Bowin.Common.Utility;
- using EMIS.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.MinorManage.MinorPlanManage
- {
- [Authorization]
- public class MinorSpecialtyController : Controller
- {
- //
- // GET: /MinorSpecialty/
- public IMinorSpecialtyServices MinorSpecialtyServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var grademinorStatus = pararms.getExtraInt("GrademinorStatusDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("GrademinorStatusDictionaryDropDown");
- return this.Json(MinorSpecialtyServices.GetMinorSpecialtyViewGrid(configuretView, yearID, standardID, collegeID, grademinorStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 修改辅修计划的课程
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? GrademinorID)
- {
- MinorSpecialtyView minorSpecialtyView = new MinorSpecialtyView();
- minorSpecialtyView = MinorSpecialtyServices.GetMinorSpecialtyView(GrademinorID);
- return View(minorSpecialtyView);
- }
- /// <summary>
- /// 开放
- /// </summary>
- /// <param name="MinorCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult OpenMinorSpecialty(string GrademinorIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < GrademinorIDs.Split(',').Length; i++)
- {
- string id = GrademinorIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid GrademinorID = new Guid(id);
- list.Add(GrademinorID);
- }
- }
- MinorSpecialtyServices.MinorSpecialtyOpen(list);
- return base.Json("开放成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return base.Json("开放失败,原因:" + ex);
- }
- }
- /// <summary>
- /// 取消开放
- /// </summary>
- /// <param name="MinorCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CancelMinorSpecialty(string GrademinorIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < GrademinorIDs.Split(',').Length; i++)
- {
- string id = GrademinorIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid GrademinorID = new Guid(id);
- list.Add(GrademinorID);
- }
- }
- MinorSpecialtyServices.MinorSpecialtyCancel(list);
- return base.Json("取消开放成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return base.Json("取消开放失败,原因:" + ex);
- }
- }
- [HttpPost]
- public ActionResult OpenClass(string grademinorIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < grademinorIDs.Split(',').Length; i++)
- {
- string id = grademinorIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid grademinorID = new Guid(id);
- list.Add(grademinorID);
- }
- }
- MinorSpecialtyServices.OpenClass(list);
- return base.Json("开班成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return base.Json("开班失败,原因:" + mge);
- }
- }
- [HttpPost]
- public ActionResult OpenCancel(string grademinorIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < grademinorIDs.Split(',').Length; i++)
- {
- string id = grademinorIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid grademinorID = new Guid(id);
- list.Add(grademinorID);
- }
- }
- MinorSpecialtyServices.CancelClass(list);
- return base.Json("取消开班成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return base.Json("取消开班失败,原因:" + mge);
- }
- }
- [HttpGet]
- public ActionResult StudentList(Guid grademinorID)
- {
- ViewBag.GrademinorID = grademinorID;
- return View();
- }
- [HttpPost]
- public ActionResult GetStudentList()
- {
- var grademinorID = Request["grademinorID"].ParseStrTo<Guid>();
- return base.Json(MinorSpecialtyServices.GetStudentsByGrademinorID(grademinorID.Value));
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var GrademinorID = Request.Form["GrademinorID"];
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var grademinorStatus =Request.Form["GrademinorStatusDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["GrademinorStatusDictionaryDropDown"].ParseStrTo<int>();
- List<Guid?> GrademinorIDList = new List<Guid?>();
- if (GrademinorID != "")
- {
- GrademinorIDList = GrademinorID.SplitIDString();
- }
- else
- {
- GrademinorIDList = null;
- }
- var dt = MinorSpecialtyServices.GetMinorSpecialtyViewList(configuretView, yearID, standardID, collegeID, grademinorStatus, GrademinorIDList).Select(x => new
- {
- x.YearID,
- x.StandardCode,
- x.StandardName,
- x.CollegeName,
- x.StudentLimit,
- x.CreateTime,
- x.CreateUserName,
- x.OpenStatusStr
- }).ToTable();
- string[] liststring = { "年级", "专业代码", "专业名称", RSL.Get("College"), "人数上限","申请时间",
- "申请人","状态"};
- neh.Export(dt, liststring, "辅修专业信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|