123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- 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.Common.Utility;
- using EMIS.CommonLogic.RetakeManage;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.RetakeManage
- {
- [Authorization]
- public class RetakePlanPrescanController : Controller
- {
- public IRetakePlanServices RetakePlanServices { get; set; }
- public IRetakePlanStudentServices RetakePlanStudentServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- public ActionResult Add()
- {
- return View();
- }
- [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 isNoAssears = pararms.getExtraInt("ddlIsNoAssears") == DropdownList.SELECT_ALL ? (bool?)null : (pararms.getExtraInt("ddlIsNoAssears") == (int)CF_GeneralPurpose.IsYes);
- 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");
- return Json(RetakePlanStudentServices.GetRetakeStudentListViewList(configuretView, schoolyearID, collegeID,
- gradeYearID, standardID, classmajorID, isNoAssears,learningformID,education,LearnSystem, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult StudentDetail()
- {
- var userID = Request["userID"].ParseStrTo<Guid>();
- var schoolyearID = Request["schoolyearID"].ParseStrTo<Guid>();
- ViewBag.userID = userID;
- ViewBag.schoolyearID = schoolyearID;
- return View();
- }
- [HttpPost]
- public ActionResult StudentDetail(QueryParamsModel pararms)
- {
- var userID = Request["userID"].ParseStrTo<Guid>() ;
- var schoolyearID = Request["schoolyearID"].ParseStrTo<Guid>();
- ViewBag.userID = userID;
- ViewBag.schoolyearID = schoolyearID;
- return Json(RetakePlanStudentServices.GetRetakeStudentDetailListView(userID, schoolyearID, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult Generate()
- {
- try
- {
- RetakePlanServices.Generate();
- return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Charge(string planStudentIDs)
- {
- List<Guid?> list = planStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- try
- {
- RetakePlanStudentServices.ChargePush(list);
- return Json(new ReturnMessage { IsSuccess = true, Message = "推送成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "推送失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Delete(string planStudentIDs)
- {
- List<Guid?> list = planStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- try
- {
- RetakePlanStudentServices.DeleteStudent(list);
- return Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Add(Guid userID)
- {
- try
- {
- RetakePlanStudentServices.AddStudent(userID);
- return Json(new ReturnMessage { IsSuccess = true, Message = "添加成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "添加失败:" + ex.Message });
- }
- }
- //导出
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolyearID = Request.Form["ddlSchoolYear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>();
- var gradeYearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
- var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
- var isNoAssears = Request.Form["ddlIsNoAssears"];
- var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
- var learningformID = Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["LearningformDictionaryDropDown"].ParseStrTo<int>();
- var education = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- var LearnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- bool? isAssears = null;
- if (Convert.ToInt32(isNoAssears) == (int)CF_GeneralPurpose.IsYes)
- {
- isAssears = true;
- }
- if (Convert.ToInt32(isNoAssears) == (int)CF_GeneralPurpose.IsNo)
- {
- isAssears = false;
- }
- var dt = RetakePlanStudentServices.GetRetakeExcelList(configuretView, schoolyearID, collegeID, gradeYearID, standardID, classmajorID, isAssears, learningformID, education, LearnSystem).Select(x => new
- {
- x.SchoolyearCode,
- x.LoginID,
- x.UserName,
- x.CollegeName,
- x.Gradeyear,
- x.StandardDesc,
- x.ClassName,
- x.NoPassCount,
- x.IsNoArrearsDesc
- }).ToTable();
- string[] liststring = { "学年学期", "学号","姓名", "教学点", "年级", "专业",
- "班级名称", "不及格门数", "是否已缴费"};
- neh.Export(dt, liststring, "补考重修名单");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功!"
- });
- }
- }
- }
|