123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.ScoreManage;
- using EMIS.Utility.FormValidate;
- using EMIS.ViewModel.ScoreManage;
- namespace EMIS.Web.Controllers.ScoreManage
- {
- [Authorization]
- public class ExaminationExemptionController : Controller
- {
- public IExaminationExemptionServices ExaminationExemptionServices { get; set; }
- /// <summary>
- /// 免修名单页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- ViewBag.StartStatusID = this.ExaminationExemptionServices.GetStartStatus();
- return View();
- }
- public ActionResult StudentList()
- {
- ViewBag.StartStatusID = ExaminationExemptionServices.GetStartStatus();
- return View();
- }
- public ActionResult Edit(Guid? examinationExemptionID)
- {
- ExaminationExemptionView examinationExemptionView = new ExaminationExemptionView();
- if (examinationExemptionID.HasValue)
- {
- examinationExemptionView = this.ExaminationExemptionServices.GetExaminationExemptionView(examinationExemptionID.Value);
- }
- else
- {
- //默认值
- examinationExemptionView.ExamsCategoryID = (int)EMIS.ViewModel.CF_ExamsCategory.FinalExam;
- }
- return View(examinationExemptionView);
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolyearID = pararms.getExtraGuid("ddlSchoolYear");
- var collegeID = pararms.getExtraGuid("cbgCollege");
- var yearID = 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 examsCategoryID = pararms.getExtraInt("ddlExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlExamsCategory");
- var recordstatus = pararms.getExtraInt("ddlRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlRecordStatus");
- 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(ExaminationExemptionServices.GetExaminationExemptionGridView(configuretView, schoolyearID, collegeID, yearID, standardID,
- classmajorID, examsCategoryID, recordstatus,learningformID,education,LearnSystem, (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["ddlSchoolYear"].ParseStrTo<Guid>();
- var collegeID = Request.Form["cbgCollege"].ParseStrTo<Guid>();
- var yearID = 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 classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
- var examsCategoryID = Request.Form["ddlExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlExamsCategory"].ParseStrTo<int>();
- var recordstatus = Request.Form["ddlRecordStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlRecordStatus"].ParseStrTo<int>();
- 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();
- var dt = ExaminationExemptionServices.GetExaminationExemptionViewList(configuretView, schoolyearID, collegeID, yearID, standardID,
- classmajorID, examsCategoryID, recordstatus, learningformID, education, LearnSystem).Select(x => new
- {
- x.LoginID,
- x.Name,
- x.ClassmajorName,
- x.SchoolyearCode,
- x.CourseCode,
- x.CourseName,
- x.ExamsCategoryName,
- CreateTime = x.CreateTime.ToStringEx("yyyy-MM-dd"),
- x.RecordStatusName
- }).ToTable();
- string[] liststring = { "学号", "姓名", "班级", "学年学期", "课程代码", "课程名称", "考试性质", "申请日期", "状态" };
- neh.Export(dt, liststring, "免考名单");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- [HttpPost]
- public ActionResult StudentList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- return Json(ExaminationExemptionServices.GetExaminationExemptionStudentGridView(configuretView, CustomPrincipal.Current.UserID,
- (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult GetCoursematerial(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- return Json(ExaminationExemptionServices.GetExaminationExemptionCoursematerialGridView(configuretView, (int)pararms.page, (int)pararms.rows));
- }
- [HttpPost]
- public ActionResult GetCoursematerialForTeacher(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var UserID = pararms.getExtraGuid("UserID");
- return Json(ExaminationExemptionServices.GetExaminationExemptionCoursematerialGridViewForTeacher(configuretView, UserID, (int)pararms.page, (int)pararms.rows));
-
- }
- [HttpPost]
- public ActionResult Edit(ExaminationExemptionView examinationExemptionView)
- {
- try
- {
- examinationExemptionView.UserID = CustomPrincipal.Current.UserID;
- examinationExemptionView.SchoolyearID = BaseExtensions.GetCurrentSchoolYearID();
- examinationExemptionView.ExamsCategoryID = (int)CF_ExamsCategory.FinalExam;
- this.ExaminationExemptionServices.Save(examinationExemptionView);
- return Json(new ReturnMessage { IsSuccess = true, Message = "保存成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "保存失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Approve(string examinationExemptionIDs, Guid actionID, string comment)
- {
- var examinationExemptionIDList = examinationExemptionIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var curUserID = CustomPrincipal.Current.UserID;
- if (examinationExemptionIDList.Count == 0)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行审核。" });
- }
- try
- {
- this.ExaminationExemptionServices.Approve(examinationExemptionIDList, curUserID, (Guid)actionID, comment);
- return Json(new ReturnMessage { IsSuccess = true, Message = "审核成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "审核失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Cancel(string examinationExemptionIDs, string comment)
- {
- var examinationExemptionIDList = examinationExemptionIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var curUserID = CustomPrincipal.Current.UserID;
- if (examinationExemptionIDList.Count == 0)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行撤销。" });
- }
- try
- {
- this.ExaminationExemptionServices.Cancel(examinationExemptionIDList, curUserID, comment);
- return Json(new ReturnMessage { IsSuccess = true, Message = "撤销成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "撤销失败:" + ex.Message });
- }
- }
- //[HttpPost]
- //public ActionResult Rollback(string examinationExemptionIDs, string comment)
- //{
- // var examinationExemptionIDList = examinationExemptionIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- // var curUserID = CustomPrincipal.Current.UserID;
- // if (examinationExemptionIDList.Count == 0)
- // {
- // return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行退回。" });
- // }
- // try
- // {
- // var actionViewList = this.ExaminationExemptionServices.GetActionView(examinationExemptionIDList[0], curUserID);
- // var actionView = actionViewList.FirstOrDefault(x => x.ActionName != "同意" && x.ActionName != "撤销");
- // if (actionView == null)
- // {
- // return Json(new ReturnMessage { IsSuccess = false, Message = "退回失败:当前环节不可退回。" });
- // }
- // foreach (var examinationExemptionID in examinationExemptionIDList)
- // {
- // this.ExaminationExemptionServices.Approve(examinationExemptionID, curUserID, actionView.ActionID, comment);
- // }
- // return Json(new ReturnMessage { IsSuccess = true, Message = "退回成功。" });
- // }
- // catch (Exception ex)
- // {
- // return Json(new ReturnMessage { IsSuccess = false, Message = "退回失败:" + ex.Message });
- // }
- //}
- [HttpPost]
- public ActionResult Delete(string examinationExemptionIDs)
- {
- var examinationExemptionIDList = examinationExemptionIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- try
- {
- this.ExaminationExemptionServices.Delete(examinationExemptionIDList);
- return Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "删除失败:" + ex.Message });
- }
- }
- [HttpPost]
- public ActionResult Submit(string examinationExemptionIDs)
- {
- var examinationExemptionIDList = examinationExemptionIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
- var curUserID = CustomPrincipal.Current.UserID;
- if (examinationExemptionIDList.Count == 0)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "请选择至少一条记录进行提交。" });
- }
- try
- {
- this.ExaminationExemptionServices.StartUp(examinationExemptionIDList, curUserID);
- return Json(new ReturnMessage { IsSuccess = true, Message = "提交成功。" });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "提交失败:" + ex.Message });
- }
- }
- public ActionResult applyEdit(Guid examinationExemptionID)
- {
- var es = ExaminationExemptionServices.GetExaminationExemptionView(examinationExemptionID);
- return View(es);
- }
- public ActionResult TeacherEdit(Guid? examinationExemptionID)
- {
- ExaminationExemptionView examinationExemptionView = new ExaminationExemptionView();
- if (examinationExemptionID.HasValue)
- {
- examinationExemptionView = this.ExaminationExemptionServices.GetExaminationExemptionView(examinationExemptionID.Value);
- }
- else
- {
- //默认值
- examinationExemptionView.ExamsCategoryID = (int)EMIS.ViewModel.CF_ExamsCategory.FinalExam;
- }
- ViewBag.CoursematerialID = examinationExemptionView.CoursematerialID;
- return View(examinationExemptionView);
- }
- [HttpPost]
- public ActionResult TeacherEdit(ExaminationExemptionView examinationExemptionView)
- {
- try
- {
- examinationExemptionView.SchoolyearID = BaseExtensions.GetCurrentSchoolYearID();
- examinationExemptionView.ExamsCategoryID = (int)CF_ExamsCategory.FinalExam;
- this.ExaminationExemptionServices.Save(examinationExemptionView);
- 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 ExaminationExemptionReport()
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- ViewBag.LoginUserID = user.UserID;
- return View();
- }
- }
- }
|