123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.MinorGraduation.MinorGraduationSetting;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Common.Data;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.MinorGraduation.MinorGraduationSetting;
- using Bowin.Common.Exceptions;
- using Bowin.Common.Utility;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.MinorGraduation.MinorGraduationSetting
- {
- [Authorization]
- public class MinorGraduationStandardController : Controller
- {
- //
- // GET: /MinorGraduationStandard/
- public IMinorGraduationStandardServices minorGraduationStandardServices { 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("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- return base.Json(minorGraduationStandardServices.GetMinorGraduationStandardViewGrid(configuretView, collegeID, yearID,
- standardID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 生成
- /// </summary>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Generate()
- {
- return View();
- }
- /// <summary>
- /// 生成
- /// </summary>
- /// <param name="graduationStandard"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Generate(QueryParamsModel pararms)
- {
- try
- {
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var yearID = Request.Form["YearDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["YearDropDown"].ParseStrTo<int>();
- minorGraduationStandardServices.MinorGraduationStandardGenerate(yearID, collegeID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="GraduationStandardID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? minorGraduationStandardID)
- {
- MinorGraduationStandardView minorGraduationStandardView = new MinorGraduationStandardView();
- if (minorGraduationStandardID.HasValue && minorGraduationStandardID != Guid.Empty)
- {
- minorGraduationStandardView = minorGraduationStandardServices.GetMinorGraduationStandardView(minorGraduationStandardID);
- }
- return View(minorGraduationStandardView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="graduationStandardView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(MinorGraduationStandardView minorGraduationStandardView)
- {
- try
- {
- minorGraduationStandardServices.MinorGraduationStandardEdit(minorGraduationStandardView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- [HttpPost]
- public ActionResult Delete(string minorGraduationStandardIDs)
- {
- try
- {
- List<Guid?> list = minorGraduationStandardIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- minorGraduationStandardServices.MinorGraduationStandardDelete(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 gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo<Guid>();
- 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["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var minorGraduationStandardIDString = Request.Form["SelectedID"];
- var minorGraduationStandardIDList = minorGraduationStandardIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dt = minorGraduationStandardServices.GetMinorGraduationStandardViewList(configuretView, collegeID, yearID,
- standardID, minorGraduationStandardIDList)
- .Select(x => new
- {
- x.YearID,
- x.CollegeName,
- x.StandardName,
- x.GraduationCredit
- }).ToTable();
- string[] liststring = {
- "年级", "院系所", "专业名称", "毕业学分"
- };
- neh.Export(dt, liststring, "辅修毕业标准信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|