123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.SelectCourse.SelectCourseResult;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.SelectCourseManage.SelectCourseResult
- {
- [Authorization]
- public class SelectCourseListController : Controller
- {
- public ISelectCourseListServices SelectCourseListServices { get; set; }
- /// <summary>
- /// 选课结果学生名单页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("SchoolYear");
- var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
- var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == -1 ? null : pararms.getExtraInt("DictionaryCourseType");
- var selectCourseTypeID = pararms.getExtraInt("DictionarySelectCourseType") == -1 ? null : pararms.getExtraInt("DictionarySelectCourseType");
- var isCreated = pararms.getExtraInt("DictionaryIsCreated") == -1 ? null : pararms.getExtraInt("DictionaryIsCreated");
- var isOpen = pararms.getExtraInt("DictionaryIsOpen") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsOpen");
- var result = SelectCourseListServices.GetSelectCourseViewList(configuretView, schoolyearID, collegeID, coursematerialID, courseTypeID, selectCourseTypeID, isCreated, isOpen, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- [HttpPost]
- public ActionResult Excel()
- {
- //return View();
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- //避开全选值
- if (configuretView.Attribute == DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
- var schoolyearID = Request.Form["SchoolYear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
- var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
- var selectCourseTypeID = Request.Form["DictionarySelectCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySelectCourseType"].ParseStrTo<int>();
- var isCreated = Request.Form["DictionaryIsCreated"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsCreated"].ParseStrTo<int>();
- var isOpen = Request.Form["DictionaryIsOpen"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIsOpen"].ParseStrTo<int>();
- var dt = SelectCourseListServices.GetSelectCourseList(configuretView, schoolyearID, collegeID, coursematerialID, courseTypeID, selectCourseTypeID, isCreated, isOpen)
- .Select(x => new
- {
- x.SchoolYearCode,
- x.DefaultClassName,
- x.CourseCode,
- //x.CourseName,
- x.CourseTypeName,
- //x.CourseCategoryName,
- //x.CourseQualityName,
- //x.Credit,
- //x.Totalhours,
- //x.PeopleNumlower,
- //x.PeopleNumlimit,
- //x.StudentTotalNum,
- //x.SelectCourseTypeName,
- x.LoginID,
- x.UserName,
- x.ClassMajorName,
- //x.TeachingModeName,
- //x.SchoolcodeName,
- //x.TeacherName,
- //x.IsOpenedDesc
- x.RecordStatusName
- }).ToTable();
- string[] liststring = { "学年学期",
- "选修任务班名称",
- "课程代码",
- //"课程名称",
- "课程类型",
- "选修类型",
- //"课程性质",
- //"学分",
- //"总学时", "人数下限", "人数上限",
- //"已选人数",
- "学号","姓名","学籍班",
-
- //"教研室", RSL.Get("College"),
- //"授课方式",
- //"开课学期",
- //"教师姓名",
- //"是否开放"
- "状态"
- };
- neh.Export(dt, liststring, "选课结果学生名单");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/SelectCourseList/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="ExecutableFreeSelectionCouseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string IDs, string Types, string UserIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < IDs.Split(',').Length; i++)
- {
- string id = IDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid ID = new Guid(id);
- list.Add(ID);
- }
- }
- List<int?> list1 = new List<int?>();
- for (int i = 0; i < Types.Split(',').Length; i++)
- {
- string type = Types.Split(',')[i];
- if (!string.IsNullOrEmpty(type))
- {
- int Type = Convert.ToInt32(type);
- list1.Add(Type);
- }
- }
- List<Guid?> list2 = new List<Guid?>();
- for (int i = 0; i < UserIDs.Split(',').Length; i++)
- {
- string id = UserIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid ID = new Guid(id);
- list2.Add(ID);
- }
- }
- SelectCourseListServices.SelectCourseListDelete(list, list1, list2);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除成功!"
- });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除失败,原因:" + mge
- });
- }
- }
- }
- }
|