123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- 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 Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.GraduationManage.GraduationSetting;
- using EMIS.ViewModel.GraduationManage.GraduationSetting;
- namespace EMIS.Web.Controllers.GraduationManage.GraduationSetting
- {
- [Authorization]
- public class GraduationSchoolYearController : Controller
- {
- public IGraduationSchoolYearServices GraduationSchoolYearServices { 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 years = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
- var schoolcodeID = pararms.getExtraInt("DictionarySchoolcode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolcode");
- var isCurrent = pararms.getExtraInt("IsCurrentDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsCurrentDropDown");
- //启用状态
- var isEnable = pararms.getExtraInt("IsEnableDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsEnableDropDown");
- return base.Json(GraduationSchoolYearServices.GetGradSchoolYearViewGrid(configuretView, years, schoolcodeID, isCurrent,
- isEnable, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationSchoolYearSettingID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid graduationSchoolYearSettingID)
- {
- GraduationSchoolYearView graduationSchoolYearView = new GraduationSchoolYearView();
- graduationSchoolYearView = GraduationSchoolYearServices.GetGradSchoolYearView(graduationSchoolYearSettingID);
- return View("Edit", graduationSchoolYearView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationSchoolYearView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(GraduationSchoolYearView graduationSchoolYearView)
- {
- graduationSchoolYearView.GraduationSchoolYearSettingID = Guid.Empty;
- return this.Edit(graduationSchoolYearView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="graduationSchoolYearSettingID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? graduationSchoolYearSettingID)
- {
- GraduationSchoolYearView graduationSchoolYearView = new GraduationSchoolYearView();
- if (graduationSchoolYearSettingID.HasValue && graduationSchoolYearSettingID != Guid.Empty)
- {
- graduationSchoolYearView = GraduationSchoolYearServices.GetGradSchoolYearView(graduationSchoolYearSettingID);
- }
- else
- {
- graduationSchoolYearView.GraduatingSemesterID = BaseExtensions.GetCurrentSchoolYearID();
- graduationSchoolYearView.IsEnable = true;
- }
- return View(graduationSchoolYearView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="graduationSchoolYearView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(GraduationSchoolYearView graduationSchoolYearView)
- {
- try
- {
- GraduationSchoolYearServices.GraduationSchoolYearEdit(graduationSchoolYearView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除(注:需对设置的毕业学期进行处理)
- /// </summary>
- /// <param name="graduationSchoolYearSettingIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string graduationSchoolYearSettingIDs)
- {
- try
- {
- List<Guid?> list = graduationSchoolYearSettingIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- GraduationSchoolYearServices.GraduationSchoolYearDelete(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 years = Request.Form["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolyear"].ParseStrTo<int>();
- var schoolcodeID = Request.Form["DictionarySchoolcode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolcode"].ParseStrTo<int>();
- var isCurrent = Request.Form["IsCurrentDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsCurrentDropDown"].ParseStrTo<int>();
- var isEnable = Request.Form["IsEnableDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsEnableDropDown"].ParseStrTo<int>();
- var dt = GraduationSchoolYearServices.GetGradSchoolYearViewList(configuretView, years, schoolcodeID, isCurrent, isEnable)
- .Select(x => new
- {
- x.GraduatingSemesterCode,
- x.Years,
- x.SchoolcodeName,
- x.WeeksNum,
- GraduateDate = x.GraduateDate.HasValue ? x.GraduateDate.Value.ToLongDateString() : "",
- x.IsCurrentName,
- x.IsEnableName
- }).ToTable();
- string[] liststring = {
- "毕业学期", "学年", "学期", "周数", "毕业日期", "是否当前学期", "启用状态"
- };
- neh.Export(dt, liststring, "毕业学期信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|