123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.MinorManage.MinorClass;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.MinorManage.MinorClass
- {
- [Authorization]
- public class MinorClassController : Controller
- {
- //
- // GET: /MinorClass/
- public IMinorClassServices minorClassServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
- var standardID = pararms.getExtraInt("MinorStandardDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("MinorStandardDropDown");
- var classminorStatus = pararms.getExtraInt("DictionaryClassminorStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryClassminorStatus");
- return base.Json(minorClassServices.GetMinorClassViewGrid(configuretView, collegeID, yearID, standardID, classminorStatus, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- var standardID = Request.Form["MinorStandardDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["MinorStandardDropDown"].ParseStrTo<int>();
- var classminorStatus = Request.Form["DictionaryClassminorStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryClassminorStatus"].ParseStrTo<int>();
- var minorClassIDString = Request.Form["SelectedID"];
- var minorClassIDList = minorClassIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dt = minorClassServices.GetMinorClassViewList(configuretView, collegeID, yearID, standardID, classminorStatus, minorClassIDList)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.GradeYearID,
- x.StandardCode,
- x.StandardName,
- x.Name,
- x.StudentNum,
- x.RecordStatus,
- }).ToTable();
- string[] liststring = { "学年学期", "年级", "专业代码", "专业名称", "辅修班级", "学生人数", "状态" };
- neh.Export(dt, liststring, "辅修班级信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- [HttpPost]
- public ActionResult Delete(string minorClassIDs)
- {
- try
- {
- List<Guid?> list = minorClassIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- minorClassServices.MinorClassDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message + "。");
- }
- }
- [HttpPost]
- public ActionResult Generate()
- {
- try
- {
- minorClassServices.GenerateMinorClass();
- return base.Json("生成成功。");
- }
- catch (Exception ex)
- {
- return base.Json("生成失败,原因:" + ex.Message + "。");
- }
- }
- [HttpGet]
- public ActionResult StudentList(Guid minorClassID)
- {
- ViewBag.MinorClassID = minorClassID;
- return View();
- }
- [HttpPost]
- public ActionResult GetStudentList()
- {
- var minorClassID = Request["minorClassID"].ParseStrTo<Guid>();
- return base.Json(minorClassServices.GetStudentsByMinorClassID(minorClassID.Value));
- }
- public ActionResult OpenClass(string minorClassIDs)
- {
- try
- {
- List<Guid?> list = minorClassIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- minorClassServices.OpenClassMinor(list);
- return base.Json("开班成功。");
- }
- catch (Exception ex)
- {
-
- return base.Json("开班失败,原因:" + ex.Message + "。");
- }
-
- }
- public ActionResult CancelOpenClass(string minorClassIDs)
- {
- try
- {
- List<Guid?> list = minorClassIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- minorClassServices.CancelOpenClassMinor(list);
- return base.Json("取消开班成功。");
- }
- catch (Exception ex)
- {
- return base.Json("取消开班失败,原因:" + ex.Message + "。");
- }
- }
- }
- }
|