123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- using EMIS.CommonLogic.SelectCourse.SelectCourseResult;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Utility;
- using EMIS.ViewModel.SelectCourse;
- using EMIS.CommonLogic.SelectCourse;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.Data;
- using EMIS.ViewModel.Students;
- using EMIS.ViewModel.SelectCourse.SelectCourseResult;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.SelectCourseManage.SelectCourseResult
- {
- [Authorization]
- public class SelectCourseResultController : Controller
- {
- public ISelectCourseResultServices SelectCourseResultServices { get; set; }
- public IOptionalCourseSettingServices optionalCourseSettingServices { get; set; }
- public IExecutableFreeSelectionCouseServices ExecutableFreeSelectionCouseServices { 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 = SelectCourseResultServices.GetSelectCourseResultViewList(configuretView, schoolyearID, collegeID, coursematerialID, courseTypeID, selectCourseTypeID,isCreated,isOpen, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <returns></returns>
- public ActionResult Edit(Guid? ID,string Type)
- {
- if (Type == "0") //限选
- {
- OptionalCourseSettingView optionalCourseSettingView = new OptionalCourseSettingView();
- if (ID.HasValue && ID != Guid.Empty)
- optionalCourseSettingView = optionalCourseSettingServices.GetOptionalCourseSettingView(ID);
- return View(optionalCourseSettingView);
- }
- else //任选
- {
- OptionalCourseSettingView optionalCourseSettingView = new OptionalCourseSettingView();
- if (ID.HasValue && ID != Guid.Empty)
- optionalCourseSettingView = optionalCourseSettingServices.GetOptionalCourseSettingView(ID);
- return View(optionalCourseSettingView);
- }
- }
- /// <summary>
- /// 保存修改
- /// </summary>
- /// <param name="optionalCourseSettingView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(OptionalCourseSettingView optionalCourseSettingView)
- {
- try
- {
- var teacherList = DataGrid.GetTableData<OptionalCourseTeacherListView>("dgTeacherList");
- SelectCourseResultServices.OptionalCourseSettingUpdate(optionalCourseSettingView, teacherList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <returns></returns>
- public ActionResult EditFreeSelection(Guid? ID, string Type)
- {
- ExecutableFreeSelectionCouseView executableFreeSelectionCouseView = new ExecutableFreeSelectionCouseView();
- if (ID.HasValue && ID != Guid.Empty)
- executableFreeSelectionCouseView = ExecutableFreeSelectionCouseServices.GetExecutableFreeSelectionCouseView(ID);
- return View(executableFreeSelectionCouseView);
- }
- [HttpPost]
- public ActionResult EditFreeSelection(ExecutableFreeSelectionCouseView executableFreeSelectionCouseView)
- {
- try
- {
- var teacherList = DataGrid.GetTableData<ExecutableFreeSelectionCouseTeacherListView>("dgTeacherList");
- ExecutableFreeSelectionCouseServices.ExecutableFreeSelectionCouseUpdate(executableFreeSelectionCouseView, teacherList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
-
- /// <summary>
- /// 获取任务班授课老师
- /// </summary>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TeacherList(Guid executableOptionalCourseID)
- {
- var teacherList = optionalCourseSettingServices.GetEducationMissionClassTeacherListViewList(executableOptionalCourseID);
- return Json(new GridResultSet<OptionalCourseTeacherListView>() { rows = teacherList, total = teacherList.Count });
- }
- public ActionResult StudentList(Guid ID, string Type)
- {
- ViewBag.ID = ID;
- ViewBag.Type = Type;
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentViewList(QueryParamsModel pararms) //QueryParamsModel pararms
- {
- var ID = Request["ID"].ParseStrTo<Guid>();
- var type = Request["Type"];
- var result = SelectCourseResultServices.GetSelectCourseStudentViewGrid(ID.Value, type, 0, 0);
- return Json(result);
- }
- /// <summary>
- /// 学生名单
- /// </summary>
- /// <param name="selectCourseResult"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentList(SelectCourseResultView selectCourseResult)
- {
- try
- {
- var studentList = DataGrid.GetTableData<StudentsView>("dgStudentList");
- //// var addTeacherList = addTeacherListJson.JsonToObject<List<ExecutableFreeSelectionCouseTeacherListView>>();
- SelectCourseResultServices.EditStudent(selectCourseResult, studentList);
- return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
- }
- }
- /// <summary>
- /// 添加学生名单
- /// </summary>
- /// <returns></returns>
- public ActionResult StudentAdd()
- {
- return View();
- }
- /// <summary>
- /// 学生选课名单Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel_StudentList()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var ID = Request["ID"].ParseStrTo<Guid>();
- var type = Request["Type"];
- var dt = SelectCourseResultServices.GetSelectCourseStudentViewList(ID.Value, type)
- .Select(x => new
- {
- x.SchoolYearCode,
- x.DefaultClassName,
- x.CoursematerialCode,
- x.CoursematerialName,
- x.CourseTypeName,
- x.LoginID,
- x.UserName,
- x.SexName,
- x.ClassmajorName,
- x.InSchoolStatusName,
- x.StudentStatusName
- }).ToTable();
- string[] liststring = { "学年学期", "选修任务班名称", "课程代码", "课程名称", "课程类型",
- "学号", "姓名","性别", "班级名称","在校状态", "学籍状态" };
- neh.Export(dt, liststring, "选课结果学生名单" + DateTime.Now.ToString("yyyyMMdd"));
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/SelectCourseResult/List").AddMenuParameter()
- });
- }
- [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 = SelectCourseResultServices.GetSelectCourseResultViewList(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.WeekdayTimesSegmentName,
- x.PeopleNumlower,
- x.PeopleNumlimit,
- x.StudentTotalNum,
- x.SelectCourseTypeName,
- //x.TeachingModeName,
- //x.SchoolcodeName,
- x.ClassroomName,
- x.TeacherName,
- x.DepartmentName,
- //x.IsOpenedDesc
- x.RecordStatusName
- }).ToTable();
- string[] liststring = { "学年学期",
- "选修任务班名称",
- "课程名称", "课程类型",
- "课程性质",
- "学分",
- "总学时","上课时间", "人数下限", "人数上限",
- "已选人数", "选修类型",
- "教室信息",
- "教师姓名",
- "开课教研室",
- "状态"
- };
- neh.Export(dt, liststring, "选课结果");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Content("~/SelectCourseResult/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 生成任务班
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GenerateEducationMissionClassSubminit(string teachingPlanIDs, string Types)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < teachingPlanIDs.Split(',').Length; i++)
- {
- string id = teachingPlanIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid teachingPlanID = new Guid(id);
- list.Add(teachingPlanID);
- }
- }
- SelectCourseResultServices.ChooseEducationMissionClass(list, Types);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "开班成功,已生成教学任务班!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成任务班失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 取消开班
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CancelEducationMissionClass(string teachingPlanIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < teachingPlanIDs.Split(',').Length; i++)
- {
- string id = teachingPlanIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid teachingPlanID = new Guid(id);
- list.Add(teachingPlanID);
- }
- }
- SelectCourseResultServices.CancelEducationMissionClass(list);
- return this.Json("取消开班成功!");
- }
- catch (Exception ex)
- {
- return this.Json("取消开班失败,原因:" + ex.Message);
- }
- }
- [HttpPost]
- public ActionResult CheckEnouthNum(string IDs)
- {
- 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);
- }
- }
- var result = SelectCourseResultServices.CheckEnouthNum(list);
- return Json(new ReturnMessage<bool>()
- {
- IsSuccess = true,
- Data = result
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "检查任务班生成情况失败:" + ex.Message
- });
- }
- }
- //[HttpPost]
- //public ActionResult CheckHaveTeacherOrClassroom(string IDs)
- //{
- // 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);
- // }
- // }
- // var result = SelectCourseResultServices.CheckEnouthNum(list);
- // return Json(new ReturnMessage<bool>()
- // {
- // IsSuccess = true,
- // Data = result
- // });
- // }
- // catch (Exception ex)
- // {
- // return Json(new ReturnMessage()
- // {
- // IsSuccess = true,
- // Message = "检查任务班生成情况失败:" + ex.Message
- // });
- // }
- //}
- }
- }
|