123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.ExaminationManage;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Data;
- using Bowin.Common.Utility;
- namespace EMIS.Web.Controllers.ExaminationManage
- {
- [Authorization]
- public class ExaminationRoomSettingController : Controller
- {
- public IRoomSettingServices RoomSettingServices { get; set; }
- 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 campusID = pararms.getExtraGuid("CampusDropdown");
- var buildingID = pararms.getExtraGuid("BuildingsDropdown");
- var isSpecial = (!pararms.getExtraInt("IsSpecialDictionaryDropDown").HasValue || pararms.getExtraInt("IsSpecialDictionaryDropDown") == DropdownList.SELECT_ALL) ? null : (bool?)(pararms.getExtraInt("IsSpecialDictionaryDropDown") == (int)CF_GeneralPurpose.IsYes);
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(RoomSettingServices.GetClassroomViewList(configuretView, campusID, buildingID, isSpecial, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult AvailableList(Guid examinationPlanID, Guid? examinationRoomLayoutID, QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(RoomSettingServices.GetAvailableClassroomViewList(configuretView, examinationPlanID, examinationRoomLayoutID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult AvailableListGdss(Guid examinationPlanID, Guid? buildingsInfoID, DateTime examinationDate,
- TimeSpan startTime, TimeSpan endTime, int studentCount, QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(RoomSettingServices.GetAvailableClassroomViewGdssList(configuretView, examinationPlanID, buildingsInfoID, examinationDate, startTime, endTime,
- studentCount, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult AddAvailableList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- return base.Json(RoomSettingServices.GetAddAvailableClassroomViewList(configuretView, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var buildingID = Request.Form["BuildingsDropdown"].ParseStrTo<Guid>();
- var isSpecial = Request.Form["IsSpecialDictionaryDropDown"] == DropdownList.SELECT_ALL.ToString() ? null : (bool?)(Request.Form["IsSpecialDictionaryDropDown"] == ((int)CF_GeneralPurpose.IsYes).ToString());
- if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- var dt = RoomSettingServices.GetClassroomViewList(configuretView, campusID, buildingID, isSpecial).Select(x => new
- {
- x.Name,
- x.IsAvailableName,
- x.ClassroomTypeName,
- x.Totalseating,
- x.Effectiveseating,
- x.Examinationseating,
- x.IsWrittenExamName,
- x.IsMachinetestName,
- x.BuildingsInfoName
- }).ToTable();
- string[] liststring = { "教室", "是否可用", "教室类型", "总座位数", "有效座位数", "考试座位数", "笔试考试", "机试考试", "所在建筑物" };
- neh.Export(dt, liststring, "考场信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/ExaminationRoomSetting/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 添加
- /// </summary>
- /// <param name="roleID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Add(string classroomIDs)
- {
- try
- {
- var classroomIDList = classroomIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- RoomSettingServices.Add(classroomIDList);
- return base.Json("添加成功");
- }
- catch (Exception ex)
- {
- return base.Json("添加失败,原因:" + ex.Message + "!");
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="roleID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string classroomIDs)
- {
- try
- {
- var classroomIDList = classroomIDs.Split(',').Select(x => (Guid?)new Guid(x)).ToList();
- RoomSettingServices.Delete(classroomIDList);
- return base.Json("删除成功");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message + "!");
- }
- }
- }
- }
|