123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.SelectCourse;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.ViewModel.SelectCourse;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.SelectCourseManage
- {
- [Authorization]
- public class SelectCourseOpenControlSettingController : Controller
- {
- public IOpenControlSettingServices OpenControlSettingServices { 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 schoolYearID = pararms.getExtraGuid("SchoolyearDropdown");
- var campusID = pararms.getExtraGuid("CampusDropdown");
- 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");
- if (yearID == DropdownList.SELECT_ALL) yearID = null;
- if (standardID == DropdownList.SELECT_ALL) standardID = null;
- if (configuretView.Attribute == DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(OpenControlSettingServices.GetOpenControlSettingViewList(configuretView, schoolYearID,
- campusID, collegeID, yearID, standardID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult Excel(QueryParamsModel pararms)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- //避开全选值
- var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["Year"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["Standard"].ParseStrTo<int>();
- if (configuretView.Attribute == DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- var dt = OpenControlSettingServices.GetOpenControlSettingViewList(configuretView, schoolYearID,
- campusID, collegeID, yearID, standardID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.YearName,
- x.StandardDesc,
- x.CollegeName,
- StartTime = x.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
- EndTime = x.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
- x.MaxSelectCount,
- x.MinSelectCount,
- x.MaxCredit,
- x.MinCredit
- }).ToTable();
- string[] liststring = { "学年学期", "年级", "专业名称", RSL.Get("College"), "开始时间", "结束时间", "门数上限", "门数下限", "学分上限", "学分下限" };
- neh.Export(dt, liststring, "网上选课类型设定");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/SelectCourseOpenControlSetting/List").AddMenuParameter()
- });
- }
- public ActionResult Edit(Guid? selectCourseOpenControlSettingID)
- {
- SelectCourseOpenControlSettingView openControlSettingView = new SelectCourseOpenControlSettingView();
- if (selectCourseOpenControlSettingID != null && selectCourseOpenControlSettingID != Guid.Empty)
- {
- openControlSettingView = OpenControlSettingServices.GetOpenControlSettingViewInfo(selectCourseOpenControlSettingID);
- }
- else
- {
- openControlSettingView.MaxSelectCount = 0;
- openControlSettingView.MinSelectCount = 0;
- openControlSettingView.MaxCredit = 0;
- openControlSettingView.MinCredit = 0;
- }
- return View(openControlSettingView);
- }
- /// <summary>
- /// 新增
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(SelectCourseOpenControlSettingView openControlSettingView)
- {
- try
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- OpenControlSettingServices.Save(openControlSettingView);
- return Json(new ReturnMessage
- {
- IsSuccess = true,
- Message = "保存成功"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="roleID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string openControlSettingIDs)
- {
- try
- {
- var openControlSettingIDList = openControlSettingIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- OpenControlSettingServices.Delete(openControlSettingIDList);
- return base.Json("删除成功!");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message + "。");
- }
- }
- }
- }
|