123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- 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 EMIS.CommonLogic.MinorManage.MinorApply;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.ViewModel.MinorManage.MinorApply;
- namespace EMIS.Web.Controllers.MinorManage.MinorApply
- {
- [Authorization]
- public class MinorRegistListController : Controller
- {
- //
- // GET: /MinorRegistList/
- public IMinorApplyServices minorApplyServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
- 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");
- var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
- var minorStandardID = pararms.getExtraInt("MinorStandardDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("MinorStandardDropDown");
- var approvalStatus = minorApplyServices.GetCorrectEndStatus();
- return base.Json(minorApplyServices.MinorApplyViewGrid(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, minorStandardID, approvalStatus, (int)pararms.page, (int)pararms.rows));
- }
- [HttpGet]
- public ActionResult Edit(Guid? minorApplyID)
- {
- MinorApplyView minorApplyView = new MinorApplyView();
- if (minorApplyID.HasValue)
- {
- minorApplyView = minorApplyServices.GetMinorApplyView(minorApplyID);
- }
- return View(minorApplyView);
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="graduationApplyView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(MinorApplyView minorApplyView)
- {
- try
- {
- minorApplyServices.MinorApplyEdit(minorApplyView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message + "。"
- });
- }
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].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["StandardDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDropDown"].ParseStrTo<int>();
- var classmajorID = Request.Form["ClassmajorDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
- var minorStandardID = Request.Form["MinorStandardDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["MinorStandardDropDown"].ParseStrTo<int>();
- var approvalStatus = minorApplyServices.GetCorrectEndStatus();
- var minorApplyIDString = Request.Form["SelectedID"];
- var minorApplyIDList = minorApplyIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- var dt = minorApplyServices.GetMinorApplyViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, minorStandardID, approvalStatus, minorApplyIDList)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.GrademajorName,
- x.ClassmajorName,
- x.LoginID,
- x.UserName,
- x.GrademinorCode,
- x.GrademinorName,
- x.RecordStatusStr
- }).ToTable();
- string[] liststring = { "学年学期", "年级专业", "班级名称", "学号", "姓名", "辅修专业代码", "辅修专业名称", "状态" };
- neh.Export(dt, liststring, "辅修报名信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- [HttpPost]
- public ActionResult Delete(string minorApplyIDs)
- {
- try
- {
- List<Guid?> list = minorApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- minorApplyServices.MinorApplyDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message + "。");
- }
- }
- }
- }
|