123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.CommonLogic.DegreeManage.DegreeSetting;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.DegreeManage.DegreeSetting;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.DegreeManage.DegreeSetting
- {
- [Authorization]
- public class DegreeOpenControlController : Controller
- {
- public IDegreeOpenControlServices DegreeOpenControlServices { 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 gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown");
- var degreeBatchID = pararms.getExtraInt("DictionaryDegreeBatch") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryDegreeBatch");
- return base.Json(DegreeOpenControlServices.GetDegreeOpenControlViewGrid(configuretView, gradSchoolyearID, degreeBatchID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="degreeOpenControlID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid degreeOpenControlID)
- {
- DegreeOpenControlView degreeOpenControlView = new DegreeOpenControlView();
- degreeOpenControlView = DegreeOpenControlServices.GetDegreeOpenControlView(degreeOpenControlID);
- return View("Edit", degreeOpenControlView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="degreeOpenControlView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(DegreeOpenControlView degreeOpenControlView)
- {
- degreeOpenControlView.DegreeOpenControlID = Guid.Empty;
- return this.Edit(degreeOpenControlView);
- }
-
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="degreeOpenControlID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? degreeOpenControlID)
- {
- DegreeOpenControlView degreeOpenControlView = new DegreeOpenControlView();
- if (degreeOpenControlID.HasValue)
- {
- degreeOpenControlView = DegreeOpenControlServices.GetDegreeOpenControlView(degreeOpenControlID);
- }
- else
- {
- degreeOpenControlView.StartDate = DateTime.Now;
- degreeOpenControlView.EndDate = DateTime.Now.AddMonths(+1);
- }
- return View(degreeOpenControlView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="degreeOpenControlView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(DegreeOpenControlView degreeOpenControlView)
- {
- try
- {
- DegreeOpenControlServices.DegreeOpenControlViewEdit(degreeOpenControlView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="degreeOpenControlIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string degreeOpenControlIDs)
- {
- try
- {
- List<Guid?> list = degreeOpenControlIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- DegreeOpenControlServices.DegreeOpenControlDelete(list);
- return base.Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除成功。"
- });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
- var degreeBatchID = Request.Form["DictionaryDegreeBatch"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryDegreeBatch"].ParseStrTo<int>();
- var dt = DegreeOpenControlServices.GetDegreeOpenControlViewList(configuretView, gradSchoolyearID, degreeBatchID)
- .Select(x => new
- {
- x.GraduatingSemesterCode,
- x.DegreeBatchName,
- x.StartDate,
- x.EndDate
- }).ToTable();
- string[] liststring = {
- "毕业学期", "学位批次", "开始时间", "结束时间"
- };
- neh.Export(dt, liststring, "学位控制信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|