123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.MinorManage.MinorSetting;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.MinorManage.MinorSetting;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.MinorManage.MinorSetting
- {
- [Authorization]
- public class MinorStandardSettingController : Controller
- {
- //
- // GET: /MinorStandardSetting/
- public IMinorStandardSettingServices minorStandardSettingServices { get; set; }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 辅修专业设置列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- int? minorStandardID = pararms.getExtraInt("MinorStandardDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("MinorStandardDropDown");
- int? standardID = pararms.getExtraInt("StandardDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDropDown");
- return base.Json(minorStandardSettingServices.GetMinorControlViewGrid(configuretView, minorStandardID, standardID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationApplyID"></param>
- /// <returns></returns>
- //public ActionResult CopyAdd(Guid minorStandardSettingID)
- //{
- // MinorStandardSettingView minorStandardSettingView = new MinorStandardSettingView();
- // minorStandardSettingView = minorStandardSettingServices.GetMinorStandardSettingView(minorStandardSettingID);
- // return View("Edit", minorStandardSettingView);
- //}
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationApplyView"></param>
- /// <returns></returns>
- //[HttpPost]
- //public ActionResult CopyAdd(MinorStandardSettingView minorStandardSettingView)
- //{
- // minorStandardSettingView.MinorStandardSettingID = Guid.Empty;
- // return this.Edit(minorStandardSettingView);
- //}
- [HttpGet]
- public ActionResult Edit(Guid? minorStandardSettingID)
- {
- MinorStandardSettingView minorStandardSettingView = new MinorStandardSettingView();
- //if (minorStandardSettingID.HasValue)
- //{
- // minorStandardSettingView = minorStandardSettingServices.GetMinorStandardSettingView(minorStandardSettingID);
- //}
- return View(minorStandardSettingView);
- }
- /// <summary>
- /// 新增
- /// </summary>
- /// <param name="graduationApplyView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(MinorStandardSettingView minorStandardSettingView)
- {
- try
- {
- var minorStandardString = Request.Form["selectMinorStandardIDs"];
- if (minorStandardString == "" || minorStandardString == null)
- {
- throw new Exception("请选择辅修专业信息");
- }
- var minorStandardIDList = minorStandardString.Split(',').Select(x => int.Parse(x)).ToList();
- foreach (int id in minorStandardIDList)
- {
- minorStandardSettingView.MinorStandardID = id;
- minorStandardSettingServices.MinorStandardSettingEdit(minorStandardSettingView);
- }
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="graduationApplyIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string minorStandardSettingIDs)
- {
- try
- {
- List<Guid?> list = minorStandardSettingIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- minorStandardSettingServices.MinorStandardSettingDelete(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 minorStandardID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
- var minorStandardSettingIDString = Request.Form["SelectedID"];
- var minorStandardSettingIDList = minorStandardSettingIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dt = minorStandardSettingServices.GetMinorControlViewList(configuretView, minorStandardID, standardID, minorStandardSettingIDList).Select(x => new
- {
- x.StandardName,
- x.MinorStandardName
- }).ToTable();
- string[] liststring = { "专业名称", "辅修专业名称" };
- neh.Export(dt, liststring, "辅修专业设置");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult GetStandardNotSelectID(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- int? selectstandardID = pararms.getExtraInt("StandardID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardID");
- return base.Json(minorStandardSettingServices.GetStandardNotSelectID(selectstandardID, (int)pararms.page, (int)pararms.rows));
- }
- }
- }
|