123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666 |
- 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.RetakeManage;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.RetakeManage.General;
- using EMIS.ViewModel.RetakeManage;
- using EMIS.Utility.FormValidate;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.JSON;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.RetakeManage.General
- {
- [Authorization]
- public class RetakePlanTaskController : Controller
- {
- public IRetakePlanTaskServices RetakePlanServices { 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").ToString() == DropdownList.SELECT_ALL.ToString() ? null : pararms.getExtraGuid("SchoolYearDropdown");
- //开课院系所
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- //开课教研室
- var departmentID = pararms.getExtraGuid("DepartmentComboGrid");
- var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
- var retakeTypeID = pararms.getExtraInt("DictionaryRetakeType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryRetakeType");
- var statusID = pararms.getExtraInt("DictionaryStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStatus");
- return Json(RetakePlanServices.GetRetakePlanTaskView(configuretView, schoolyearID, collegeID, departmentID, coursematerialID,
- retakeTypeID, statusID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 重修任务分班
- /// </summary>
- /// <param name="RetakePlanID"></param>
- /// <returns></returns>
- public ActionResult DivideIntoClassesEdit(Guid? retakePlanID)
- {
- RetakeDivideIntoClassesView divideIntoClassesView = new RetakeDivideIntoClassesView();
- if (retakePlanID != Guid.Empty && retakePlanID.HasValue)
- {
- divideIntoClassesView = RetakePlanServices.GetDivideIntoClassesView(retakePlanID);
- ViewBag.StudentTotalNum = divideIntoClassesView.StudentTotalNum;
- }
- return View(divideIntoClassesView);
- }
- /// <summary>
- /// 重修任务分班
- /// </summary>
- /// <param name="divideIntoClassesView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DivideIntoClassesEdit(RetakeDivideIntoClassesView divideIntoClassesView)
- {
- try
- {
- divideIntoClassesView.GroupNum = Convert.ToInt32(Request.Form["hid_GroupNum"]);
- divideIntoClassesView.StudentNum = Convert.ToInt32(Request.Form["hid_StudentNum"]);
- divideIntoClassesView.StudentTotalNum = Convert.ToInt32(Request.Form["hid_StudentTotalNum"]);
- RetakePlanServices.DivideIntoClassesSeparate(divideIntoClassesView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "分班成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "分班失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="RetakePlanID"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? retakePlanID)
- {
- RetakePlanTaskSettingView retakePlanTaskView = new RetakePlanTaskSettingView();
- if (retakePlanID != Guid.Empty && retakePlanID.HasValue)
- {
- retakePlanTaskView = RetakePlanServices.GetRetakePlanTaskUpdateView(retakePlanID);
- //处理方式(暂时无效)
- retakePlanTaskView.HandleModeID = retakePlanTaskView.HandleModeID.HasValue ?
- retakePlanTaskView.HandleModeID : (int)EMIS.ViewModel.CF_HandleMode.RequiredCourse;
- //重修任务状态标识
- ViewBag.Status = retakePlanTaskView.RecordStatus;
- }
- else
- {
- retakePlanTaskView.ExaminationModeID = (int)CF_ExaminationMode.WrittenExam;
- retakePlanTaskView.IsRequired = true;
- retakePlanTaskView.PeopleNumlimit = 0;
- retakePlanTaskView.PeopleNumlower = 0;
- }
- return View(retakePlanTaskView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="RetakePlanTaskSetting"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(RetakePlanTaskSettingView retakePlanTaskSettingView)
- {
- int? type = 0;
- try
- {
- //排课明细列表
- var schedulingList = DataGrid.GetTableData<RetakePlanSettingSchedulingView>("dgSchedulingList");
-
- //任课教师列表
- var teacherList = DataGrid.GetTableData<RetakePlanTeacherListView>("dgTeacherList");
- RetakePlanServices.RetakePlanTaskSet(retakePlanTaskSettingView, teacherList, schedulingList, out type);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- //如果验证到排课冲突type返回1,页面js根据type弹出选择框
- //用户可选择继续保存或不保存,如果不返回1,弹出一般的错误提示框
- if (type == 1)
- {
- return Json(new ReturnMessage()
- {
- Type = 1,
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- else
- {
- return Json(new ReturnMessage()
- {
- Type = 2,
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- }
- /// <summary>
- /// 删除(需要检测是否存在对应的已报名重修计划名单,根据重修计划ID)
- /// </summary>
- /// <param name="RetakePlanIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string RetakePlanIDs)
- {
- try
- {
- List<Guid?> list = RetakePlanIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- RetakePlanServices.DeleteRetakePlanTask(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 检测是否存在对应的已报名重修计划名单(根据重修计划ID)
- /// </summary>
- /// <param name="retakePlanIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult IsExistsApplyStudentByRetakePlanID(string retakePlanIDs)
- {
- try
- {
- var result = RetakePlanServices.IsExistsApplyStudentByRetakePlanID(retakePlanIDs);
- return Json(new ReturnMessage<bool>
- {
- IsSuccess = true,
- Data = result
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage<bool>
- {
- IsSuccess = false,
- Data = false,
- Message = ex.Message
- });
- }
- }
- /// <summary>
- /// 重修计划取消开放(删除对应的重修计划报名名单)
- /// </summary>
- /// <param name="RetakePlanIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CancleOpen(string RetakePlanIDs)
- {
- try
- {
- List<Guid?> list = RetakePlanIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- RetakePlanServices.CancleRetakePlanTask(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "取消开放成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "取消开放失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 重修计划开放
- /// </summary>
- /// <param name="RetakePlanIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Open(string RetakePlanIDs)
- {
- try
- {
- List<Guid?> list = RetakePlanIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- RetakePlanServices.OpenRetakePlanTask(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "开放成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "开放失败,原因:" + ex.Message
- });
- }
- }
-
- /// <summary>
- /// 排课明细
- /// </summary>
- /// <param name="RetakePlanID"></param>
- /// <returns></returns>
- public ActionResult GetSchedulingViewList(Guid? RetakePlanID)
- {
- var schedulingViewList = RetakePlanServices.GetSchedulingView(RetakePlanID);
- return Json(new GridResultSet<RetakePlanSettingSchedulingView> { rows = schedulingViewList, total = schedulingViewList.Count });
- }
- /// <summary>
- /// 任课教师
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- public ActionResult TeacherList(Guid? RetakePlanID)
- {
- var teacherListView = RetakePlanServices.GetTeacherListView(RetakePlanID);
- return base.Json(new GridResultSet<RetakePlanTeacherListView>() { rows = teacherListView, total = teacherListView.Count });
- }
- /// <summary>
- /// 授课方式
- /// </summary>
- /// <param name="RetakePlanID"></param>
- /// <returns></returns>
- public ActionResult TeachingModeType(Guid? RetakePlanID)
- {
- List<int> list = new List<int>();
- if (RetakePlanID != Guid.Empty && RetakePlanID.HasValue)
- {
- list = RetakePlanServices.GetTeachingModeType(RetakePlanID);
- }
- else
- {
- list.Add(((int)EMIS.ViewModel.CF_TeachingMode.Theory));
- }
- return base.Json(list.ConvertAll(x => x.ToString()));
- }
- /// <summary>
- /// 授课地点
- /// </summary>
- /// <param name="RetakePlanID"></param>
- /// <returns></returns>
- public ActionResult TeachingPlace(Guid? RetakePlanID)
- {
- List<int> list = new List<int>();
- if (RetakePlanID != Guid.Empty && RetakePlanID.HasValue)
- {
- list = RetakePlanServices.GetTeachingPlace(RetakePlanID);
- }
- return base.Json(list.ConvertAll(x => x.ToString()));
- }
- /// <summary>
- /// 重修计划名单列表信息
- /// </summary>
- /// <returns></returns>
- public ActionResult StudentDetail()
- {
- return View();
- }
- /// <summary>
- /// 重修计划名单列表信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentDetail(QueryParamsModel pararms)
- {
- var retakePlanID = Request["RetakePlanID"].ParseStrTo<Guid>();
- return Json(RetakePlanServices.GetRetakePlanTaskStudentView(retakePlanID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 重修计划名单添加
- /// </summary>
- /// <returns></returns>
- public ActionResult StudentSelect()
- {
- var RetakePlanID = Request["RetakePlanID"].ParseStrTo<Guid>();
- ViewBag.RetakePlanID = RetakePlanID;
- return View();
- }
- /// <summary>
- /// 重修计划名单添加
- /// </summary>
- /// <param name="finallyScoreIDs"></param>
- /// <param name="retakePlanTaskView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentSelect(string finallyScoreIDs, RetakePlanTaskView retakePlanTaskView)
- {
- try
- {
- //最终成绩信息IDList
- var finallyScoreIDList = finallyScoreIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- RetakePlanServices.AddStudent(retakePlanTaskView.RetakePlanID, finallyScoreIDList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "添加成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "添加失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 查询对应的重修计划名单列表(不需排除已在其它相应的重修计划中存在的名单,不及格成绩,小于60分)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult BaseStudentViewList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var retakePlanID = new Guid(Request["RetakePlanID"]);
- var gradeYearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
- var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
- var classmajorID = pararms.getExtraGuid("cbgClassmajor");
- //在校状态
- var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
-
- return Json(RetakePlanServices.GetStudentView(configuretView, retakePlanID, gradeYearID, standardID,
- classmajorID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 删除(重修计划名单删除,根据重修计划名单ID)
- /// </summary>
- /// <param name="retakePlanStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DeleteStudent(string retakePlanStudentIDs)
- {
- try
- {
- List<Guid?> list = retakePlanStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- RetakePlanServices.DeleteStudent(list);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "删除成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "删除失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 检测是否存在对应的已报名重修计划名单(根据重修计划ID)
- /// </summary>
- /// <param name="retakePlanIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult IsExistsApplyStudentByRetakePlanStudentID(string retakePlanStudentIDs)
- {
- try
- {
- var result = RetakePlanServices.IsExistsApplyStudentByRetakePlanStudentID(retakePlanStudentIDs);
- return Json(new ReturnMessage<bool>
- {
- IsSuccess = true,
- Data = result
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage<bool>
- {
- IsSuccess = false,
- Data = false,
- Message = ex.Message
- });
- }
- }
- /// <summary>
- /// 重修计划名单Excel导出
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentDetail_Excel(QueryParamsModel pararms)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var retakePlanID = Request["RetakePlanID"].ParseStrTo<Guid>();
- var dt = RetakePlanServices.GetRetakePlanTaskStudentViewList(configuretView, retakePlanID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.ClassName,
- x.RecordStatusName,
- x.RetakeTypeName,
- x.LoginID,
- x.UserName,
- x.SexName,
- x.InSchoolStatusName,
- x.StudentStatusName,
- x.ClassmajorCode,
- x.ClassmajorName,
- x.GrademajorCode,
- x.GrademajorName,
- x.CourseCode,
- x.CourseName,
- x.CourseTypeDesc,
- x.CourseCredit,
- x.Totalhours,
- x.SchoolyearNumDesc,
- x.StarttermDesc,
- x.DepartmentCode,
- x.DepartmentName,
- x.ApplyStatusName
- }).ToTable();
- string[] liststring = {
- "重修学年学期", "重修班级名称", "重修任务状态", "重修类型", "学号", "姓名", "性别", "在校状态",
- "学籍状态", "班级编号", "班级名称", "年级专业编号", "年级专业名称", "课程代码", "课程名称",
- "课程类型", "课程学分", "总学时", "开课学年", "开课学期", "开课教研室代码", "开课教研室名称",
- "报名状态"
- };
-
- neh.Export(dt, liststring, "重修计划名单信息" + DateTime.Now.ToString("yyyyMMddhhmmss"));
-
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功。",
- url = Url.Content("~/RetakePlanTask/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 添加节次(排课检查)
- /// </summary>
- /// <returns></returns>
- public ActionResult CoursesTimeList()
- {
- return View();
- }
- /// <summary>
- /// 添加教室(排课检查)
- /// </summary>
- /// <returns></returns>
- public ActionResult CourseProcessClassroomList()
- {
- return View();
- }
- /// <summary>
- /// 添加教室(排课冲突检查,列出课程进度中的可选教室)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetCourseProcessClassroomList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- int? classroomType = pararms.getExtraString("ClassroomType").ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : pararms.getExtraString("ClassroomType").ParseStrTo<int>();
- string schedulingWeek = pararms.getExtraString("schedulingWeek");
- int? weekday = pararms.getExtraString("weekDay").ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : pararms.getExtraString("weekDay").ParseStrTo<int>();
- var coursesTimeID = pararms.getExtraGuid("coursesTimeID") ?? Guid.Empty;
- //int? minSeatCount = pararms.getExtraString("MinSeatCount").ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : pararms.getExtraString("MinSeatCount").ParseStrTo<int>();
- //var collegeID = pararms.getExtraGuid("CollegeDropdown") ?? Guid.Empty;
- var schoolYearID = pararms.getExtraGuid("SchoolYearID") ?? Guid.Empty;
- var buildingsID = pararms.getExtraInt("BuildingsDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraGuid("BuildingsDropdown");
-
- return base.Json(RetakePlanServices.GetAvailableClassroom(configuretView, buildingsID, schedulingWeek, weekday, coursesTimeID, classroomType, schoolYearID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["SchoolYearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- //开课院系所
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- //开课教研室
- var departmentID = Request.Form["DepartmentComboGrid"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
- var retakeTypeID = Request.Form["DictionaryRetakeType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryRetakeType"].ParseStrTo<int>();
- var statusID = Request.Form["DictionaryStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStatus"].ParseStrTo<int>();
- var dt = RetakePlanServices.GetRetakePlanTaskViewList(configuretView, schoolyearID, collegeID, departmentID,
- coursematerialID, retakeTypeID, statusID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.ClassName,
- x.RetakeTypeName,
- x.CourseCode,
- x.CourseName,
- x.CourseTypeName,
- x.Credit,
- x.Totalhours,
- x.StartEndWeeklyNum,
- x.WeekdayTimesSegmentName,
- x.ClassroomName,
- x.TeacherName,
- x.PeopleNumlower,
- x.PeopleNumlimit,
- x.DepartmentName,
- x.CourseCollegeName,
- x.PlanNumber,
- x.RecordStatusName
- }).ToTable();
- string[] liststring = {
- "重修学年学期", "重修班级名称", "重修类型", "课程代码", "课程名称", "课程类型", "课程学分",
- "总学时", "起止周次", "上课时间", "教室", "任课教师", "人数下限", "人数上限","开课教研室",
- "开课" + RSL.Get("CollegeName"), "计划人数", "重修任务状态"
- };
- neh.Export(dt, liststring, "重修任务信息" + DateTime.Now.ToString("yyyyMMddhhmmss"));
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功。",
- url = Url.Content("~/RetakePlanTask/List").AddMenuParameter()
- });
- }
- }
- }
|