123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- 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.SelectCourse;
- using EMIS.ViewModel.SelectCourse;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.SelectCourseManage
- {
- [Authorization]
- public class FreeSelectionCourseApproveController : Controller
- {
- public IFreeSelectionCourseServices FreeSelectionCourseServices { get; set; }
- public IFreeSelectionCourseApplyServices FreeSelectionCourseApplyServices { 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 campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- var schoolyear = pararms.getExtraGuid("SchoolyearDropdown").ToString() == DropdownList.SELECT_ALL.ToString() ? null : pararms.getExtraGuid("SchoolyearDropdown");
- var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
- return this.Json(FreeSelectionCourseApplyServices.GetFreeSelectionCoursePlanApprovalViewGrid(configuretView,
- schoolyear, campusID, collegeID, departmentID, approvalStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 明细
- /// </summary>
- /// <param name="freeSelectionCourseApplyID"></param>
- /// <returns></returns>
- public ActionResult Details(Guid? freeSelectionCourseApplyID)
- {
- FreeSelectionCourseApplyView freeSelectCourseApplyView = new FreeSelectionCourseApplyView();
- if (freeSelectionCourseApplyID.HasValue)
- freeSelectCourseApplyView = FreeSelectionCourseApplyServices.GetFreeSelectionCourseApplyView(freeSelectionCourseApplyID);
- return View(freeSelectCourseApplyView);
- }
- /// <summary>
- /// 审核
- /// </summary>
- /// <param name="formIDs"></param>
- /// <param name="actionID"></param>
- /// <param name="comment"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Approve(string formIDs, Guid actionID, string comment)
- {
- try
- {
- var formIDList = formIDs.Split(',').Select(x => new Guid(x)).ToList();
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- FreeSelectionCourseApplyServices.Approve(formIDList, user.UserID, actionID, comment);
- return Json(new ReturnMessage
- {
- IsSuccess = true,
- Message = "审核成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage
- {
- IsSuccess = false,
- Message = "审核失败!" + ex.Message
- });
- }
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
- var schoolyear = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- var approvalStatus = Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryApprovalStatus"].ParseStrTo<int>();
- var dt = FreeSelectionCourseApplyServices.GetFreeSelectionCoursePlanViewList(configuretView, schoolyear, campusID, collegeID, departmentID, approvalStatus).Select(x => new
- {
- x.SchoolyearCode,
- x.DepartmentName,
- x.DefaultClassName,
- x.CourseName,
- x.TeacherNames,
- x.PeopleNumlimit,
- x.PeopleNumlower,
- x.HandleModeName,
- x.IsNeedMaterialName,
- x.ApprovalStatusName
- }).ToTable();
- string[] liststring = { "学年学期", "教研室", "选修任务班名称",
- "课程名称",
- "授课教师", "人数下限", "人数上限", "选修类型","是否需要教材","审批状态"};
- neh.Export(dt, liststring, "开课审核信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/FreeSelectionCourseApprove/List").AddMenuParameter()
- });
- }
- public ActionResult GetFreeSelectionCourseView(Guid? freeSelectionCourseID)
- {
- FreeSelectionCourseView freeSelectionCourseView = new FreeSelectionCourseView();
- if (freeSelectionCourseID.HasValue)
- freeSelectionCourseView = FreeSelectionCourseServices.GetFreeSelectionCourseView(freeSelectionCourseID);
- return base.Json(freeSelectionCourseView);
- }
- }
- }
|