123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.SelectCourse;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.SelectCourse;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.SelectCourseManage
- {
- [Authorization]
- public class ExaminationSubjectCollegeControlController : Controller
- {
- //
- // GET: /ExaminationSubjectCollegeControl/
- public IExaminationSubjectCollegeControlServices examinationSubjectCollegeControlServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var examinationTypeID = pararms.getExtraGuid("ExaminationTypeDropdown");
- var examinationSubjectID = pararms.getExtraGuid("ExaminationSubjectDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var facultymajorID = pararms.getExtraGuid("FacultymajorDropdown");
- int? schoolyearNumID = pararms.getExtraInt("SchoolyearNumDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearNumDropDown");
- return base.Json(examinationSubjectCollegeControlServices.GetExaminationSubjectCollegeControlViewGrid(configuretView, examinationTypeID, examinationSubjectID, collegeID, facultymajorID, schoolyearNumID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpGet]
- public ActionResult Add()
- {
- ExaminationSubjectCollegeControlView examinationSubjectCollegeControlView = new ExaminationSubjectCollegeControlView();
- return View(examinationSubjectCollegeControlView);
- }
- [HttpPost]
- public ActionResult Add(ExaminationSubjectCollegeControlView examinationSubjectCollegeControlView)
- {
- try
- {
- var facultymajorString = Request.Form["selectFacultymajorIDs"];
- if (facultymajorString == "" || facultymajorString == null)
- {
- throw new Exception("请选择院系专业信息");
- }
- var facultymajorIDList = facultymajorString.Split(',').Where(x => x.IndexOf("-") >= 0).Select(x => new Guid(x)).ToList();
- examinationSubjectCollegeControlServices.ExaminationSubjectCollegeControlAdd(examinationSubjectCollegeControlView, facultymajorIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="examinationSubjectCollegeControlID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? examinationSubjectCollegeControlID)
- {
- ExaminationSubjectCollegeControlView examinationSubjectCollegeControlView = new ExaminationSubjectCollegeControlView();
- if (examinationSubjectCollegeControlID.HasValue)
- {
- examinationSubjectCollegeControlView = examinationSubjectCollegeControlServices.GetExaminationSubjectCollegeControlView(examinationSubjectCollegeControlID);
- }
- return View(examinationSubjectCollegeControlView);
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="graduationApplyView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(ExaminationSubjectCollegeControlView examinationSubjectCollegeControlView)
- {
- try
- {
- examinationSubjectCollegeControlServices.ExaminationSubjectCollegeControlEdit(examinationSubjectCollegeControlView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult Delete(string examinationSubjectCollegeControlIDs)
- {
- try
- {
- List<Guid?> list = examinationSubjectCollegeControlIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- examinationSubjectCollegeControlServices.ExaminationSubjectCollegeControlDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message);
- }
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var examinationTypeID = Request.Form["ExaminationTypeDropdown"].ParseStrTo<Guid>();
- var examinationSubjectID = Request.Form["ExaminationSubjectDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var facultymajorID = Request.Form["FacultymajorDropdown"].ParseStrTo<Guid>();
- int? schoolyearNumID = Request["SchoolyearNumDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["SchoolyearNumDropDown"].ParseStrTo<int>();
- var examinationSubjectCollegeControlIDString = Request.Form["SelectedID"];
- var examinationSubjectCollegeControlIDList = examinationSubjectCollegeControlIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dt = examinationSubjectCollegeControlServices.GetExaminationSubjectCollegeControlViewList(configuretView, examinationTypeID, examinationSubjectID, collegeID, facultymajorID, schoolyearNumID, examinationSubjectCollegeControlIDList)
- .Select(x => new
- {
- x.ExaminationTypeName,
- x.ExaminationSubjectName,
- x.CollegeName,
- x.FacultymajorName,
- x.SchoolyearNum
- }).ToTable();
- string[] liststring = { "考试类型", "考试科目", @EMIS.Utility.RSL.Get("College"), "院系专业", "年级数" };
- neh.Export(dt, liststring, "专业报考限制" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|