123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500 |
- 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 RetakePlanResultTaskController : Controller
- {
- public IRetakePlanTaskServices RetakePlanTaskServices { get; set; }
- public IRetakePlanResultServices RetakePlanResultTaskServices { 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(RetakePlanResultTaskServices.GetRetakePlanResultTaskView(configuretView, schoolyearID, collegeID, departmentID,
- coursematerialID, retakeTypeID, statusID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="RetakePlanID"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? retakePlanID)
- {
- RetakePlanTaskSettingView retakePlanTaskView = new RetakePlanTaskSettingView();
- if (retakePlanID != Guid.Empty && retakePlanID.HasValue)
- {
- retakePlanTaskView = RetakePlanTaskServices.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");
- RetakePlanTaskServices.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>
- /// 开班(重修计划)
- /// </summary>
- /// <param name="RetakePlanIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Generate(string RetakePlanIDs)
- {
- try
- {
- string result = RetakePlanResultTaskServices.RetakePlanResultGenerate(RetakePlanIDs);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "开班失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 重修计划名单列表信息
- /// </summary>
- /// <returns></returns>
- public ActionResult StudentPlanDetail()
- {
- return View();
- }
- /// <summary>
- /// 重修计划名单列表信息
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentPlanDetail(QueryParamsModel pararms)
- {
- var retakePlanID = Request["RetakePlanID"].ParseStrTo<Guid>();
- return Json(RetakePlanTaskServices.GetRetakePlanTaskStudentView(retakePlanID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 重修计划名单Excel导出
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentPlanDetail_Excel(QueryParamsModel pararms)
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var retakePlanID = Request["RetakePlanID"].ParseStrTo<Guid>();
- var dt = RetakePlanTaskServices.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("~/RetakePlanResultTask/List").AddMenuParameter()
- });
- }
- /// <summary>
- /// 检测重修报名人数是否超过人数下限和人数上限范围
- /// </summary>
- /// <param name="retakePlanIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult IsOverRange(string retakePlanIDs)
- {
- try
- {
- var result = RetakePlanResultTaskServices.IsOverRange(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>
- /// <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(RetakePlanResultTaskServices.GetRetakePlanResultTaskStudentView(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="retakePlanTaskView"></param>
- /// <param name="UserIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StudentSelect(RetakePlanTaskView retakePlanTaskView, string UserIDs)
- {
- try
- {
- string result = RetakePlanResultTaskServices.AddStudent(retakePlanTaskView.RetakePlanID, retakePlanTaskView.UserIDs);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "报名成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "报名失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 查询对应的重修班级未报名名单列表(未报名名单)
- /// </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(RetakePlanResultTaskServices.GetStudentView(configuretView, retakePlanID, gradeYearID, standardID,
- classmajorID, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 删除(重修报名名单删除,取消报名)
- /// </summary>
- /// <param name="retakePlanID"></param>
- /// <param name="UserIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DeleteStudent(string retakePlanID, string UserIDs)
- {
- try
- {
- Guid ID = new Guid(retakePlanID);
- RetakePlanResultTaskServices.DeleteStudent(ID, UserIDs);
- 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 StudentDetailt_Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var retakePlanID = Request["RetakePlanID"].ParseStrTo<Guid>();
- var dt = RetakePlanResultTaskServices.GetRetakePlanResultTaskStudentViewList(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>
- /// 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 = RetakePlanResultTaskServices.GetRetakePlanResultTaskViewList(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.ApplyNumber,
- 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()
- });
- }
- }
- }
|