using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.RetakeManage; using EMIS.ViewModel; using EMIS.Utility.FormValidate; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.RetakeManage; using EMIS.ViewModel.EducationManage; using EMIS.Web.Controls; using Bowin.Common.Data; using Bowin.Web.Controls.Mvc; using Bowin.Common.Utility; namespace EMIS.Web.Controllers.RetakeManage { [Authorization] public class RetakePlanController : Controller { public IRetakePlanServices RetakePlanServices { get; set; } public IRetakePlanStudentServices RetakePlanStudentServices { get; set; } public ActionResult StudentList() { return View(); } public ActionResult ApproveList() { return View(); } public ActionResult List() { return View(); } public ActionResult SelectMission(Guid coursematerialID) { return View(); } [HttpPost] public ActionResult StudentList(QueryParamsModel pararms) { var userID = CustomPrincipal.Current.UserID; var list = RetakePlanStudentServices.GetRetakeStudentApplyViewStudentList(userID); return Json(new GridResultSet { rows = list, total = list.Count }); } [HttpPost] public ActionResult EducationMissionList(QueryParamsModel pararms, Guid coursematerialID) { var list = RetakePlanStudentServices.GetEducationMissionImportClassViewList(coursematerialID); return Json(new GridResultSet { rows = list, total = list.Count }); } [HttpPost] public ActionResult CheckCanSubmit(Guid retakePlanStudentID) { try { RetakePlanStudentServices.CheckCanSubmit(retakePlanStudentID); return Json(new ReturnMessage { IsSuccess = true, Message = "校验成功。" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "申请失败:" + ex.Message }); } } [HttpPost] public ActionResult Submit(Guid retakePlanStudentID, Guid educationMissionID) { try { RetakePlanStudentServices.Submit(retakePlanStudentID, educationMissionID); return Json(new ReturnMessage { IsSuccess = true, Message = "提交成功。" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "提交失败:" + ex.Message }); } } [HttpPost] public ActionResult ApproveList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("ddlSchoolYear"); var collegeID = pararms.getExtraGuid("cbgCollege"); 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 learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown"); var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var LearnSystem = pararms.getExtraString("DictionaryLearnSystem"); var list = RetakePlanStudentServices.GetRetakeStudentApproveViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, classmajorID, learningformID, education, LearnSystem,pararms.page.Value, pararms.rows.Value); return Json(list); } [HttpPost] public ActionResult ApproveStudent(string retakePlanStudentIDs, Guid actionID, string comment) { var retakePlanStudentIDList = retakePlanStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); var curUserID = CustomPrincipal.Current.UserID; if (retakePlanStudentIDList.Count == 0) { return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行审核。" }); } try { this.RetakePlanStudentServices.Approve(retakePlanStudentIDList, curUserID, actionID, comment); return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message }); } } /// /// 导出Excel /// /// [HttpPost] public ActionResult StudentExcel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var retakePlanStudentIDString = Request.Form["SelectedID"]; var retakePlanStudentIDList = retakePlanStudentIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo(); var collegeID = Request.Form["cbgCollege"].ParseStrTo(); var gradeYearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo(); var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo(); var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo(); var dt = RetakePlanStudentServices.GetRetakeStudentApproveViewList(configuretView, retakePlanStudentIDList, schoolyearID, collegeID, gradeYearID, standardID, classmajorID).Select(x => new { x.SchoolyearCode, x.LoginID, x.UserName, x.ClassmajorName, x.CourseCode, x.CourseName, x.ClassName, x.TeacherName, x.ScheduleDateString, x.CourseTimeDesc, x.Credit, ScheduledTimes = x.TotalHours, x.ClassroomName }).ToTable(); string[] liststring = { "学年学期", "学号", "姓名", "班级名称", "课程代码", "课程名称", "重修班级", "任课教师", "上课日期", "课时类别", "学分", "总学时", "课室" }; neh.Export(dt, liststring, "重修审核列表"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功!", url = Url.Action("AporoveList").AddMenuParameter() }); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("ddlSchoolYear"); var collegeID = pararms.getExtraGuid("cbgCollege"); 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 learningformID = pararms.getExtraInt("LearningformDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("LearningformDictionaryDropDown"); var education = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var LearnSystem = pararms.getExtraString("DictionaryLearnSystem"); var list = RetakePlanStudentServices.GetFinalRetakeStudentApproveViewList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, classmajorID, learningformID, education, LearnSystem,pararms.page.Value, pararms.rows.Value); return Json(list); } /// /// 导出Excel /// /// [HttpPost] public ActionResult StudentListExcel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var retakePlanStudentIDString = Request.Form["SelectedID"]; var retakePlanStudentIDList = retakePlanStudentIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo(); var collegeID = Request.Form["cbgCollege"].ParseStrTo(); var gradeYearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo(); var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo(); var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo(); var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo(); var education = Request.Form["DictionaryEducation"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo(); var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString(); var dt = RetakePlanStudentServices.GetFinalRetakeStudentApproveViewList(configuretView, retakePlanStudentIDList, schoolyearID, collegeID, gradeYearID, standardID, classmajorID, learningformID, education, LearnSystem).Select(x => new { x.SchoolyearCode, x.LoginID, x.UserName, x.ClassmajorName, x.CourseCode, x.CourseName, x.ClassName, x.TeacherName, x.ScheduleDateString, x.CourseTimeDesc, x.Credit, ScheduledTimes = x.TotalHours, x.ClassroomName }).ToTable(); string[] liststring = { "学年学期", "学号", "姓名", "班级名称", "课程代码", "课程名称", "重修班级", "任课教师", "上课日期", "课时类别", "学分", "总学时", "课室" }; neh.Export(dt, liststring, "重修审核列表"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功!", url = Url.Action("AporoveList").AddMenuParameter() }); } } }