123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.ScoreManage;
- using Bowin.Web.Controls.Mvc;
- using EMIS.Entities;
- using EMIS.ViewModel.ScoreManage;
- using EMIS.Utility;
- using EMIS.ViewModel.CacheManage;
- using System.Dynamic;
- using Bowin.Common.JSON;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.ViewModel.WorkflowManage;
- namespace EMIS.Web.Controllers.ScoreManage
- {
- [Authorization]
- public class ScoreAuditController : Controller
- {
- public Lazy<IScoreServices> scoreServices { get; set; }
- public Lazy<IFinalExaminationServices> finalExaminationServices { get; set; }
- public Lazy<IScoreParameterSettingServices> scoreParameterSettingServices { get; set; }
- public Lazy<ICreditFormulaServices> creditFormulaServices { get; set; }
- public Lazy<IGradePointFormulaServices> gradePointFormulaServices { get; set; }
- public Lazy<IScoreFormulaServices> scoreFormulaServices { get; set; }
- public Lazy<ISchoolYearServices> SchoolYearServices { get; set; }
- /// <summary>
- /// 报表
- /// </summary>
- /// <param name="FinalExaminationID"></param>
- /// <returns></returns>
- public ActionResult Report(Guid? FinalExaminationID)
- {
- ViewBag.FinalExaminationID = FinalExaminationID;
- return View();
- }
- /// <summary>
- /// 成绩审核页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- var schoolYear = SchoolYearServices.Value.GetSchoolYearIsCurrent(true);
- var ApprovalStatus = scoreServices.Value.ApprovalStatus();
- ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
- ViewBag.ApprovalStatus = ApprovalStatus.ToString();
- return View();
- }
- /// <summary>
- /// 列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = pararms.getExtraGuid("CollegeComboGrid");
- var departmentID = pararms.getExtraGuid("DepartmentComboGrid");
- var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
- var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
- var examsCategoryID = pararms.getExtraInt("DictionaryExamsCategory") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryExamsCategory");
- var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
- var gradeYearID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
- var approvalStatus = pararms.getExtraInt("DictionaryScoreState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryScoreState");
- return Json(scoreServices.Value.GetFinalExaminationScoreAuditViewGrid(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID, gradeYearID,approvalStatus, (int)pararms.page, (int)pararms.rows));
- }
- ///<summary>
- ///审核状态排查
- /// </summary>
- public ActionResult ApprovalStatus(string ApprovalStatus)
- {
- try
- {
- List<int?> List = new List<int?>();
- for (int i = 0; i < ApprovalStatus.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(ApprovalStatus.Split(',')[i]))
- {
- int Status = Convert.ToInt32(ApprovalStatus.Split(',')[i]);
- List.Add(Status);
- }
- }
- scoreServices.Value.CheckApprovalStatus(List);
- return Json("成功");
- }
- catch (Exception ex)
- {
- return Json(ex.Message);
- }
-
- }
- /// <summary>
- /// 审核动作
- /// </summary>
- /// <returns></returns>
- public ActionResult ApprovalHandle(string finalExaminationIDs)
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- Guid finalExaminationID = new Guid(finalExaminationIDs.Split(',')[0]);
- List<ActionView> listAction = scoreServices.Value.GetAuditingActionView(finalExaminationID, user.UserID);
- List<DropdownListItem> list = new List<DropdownListItem>();
- List<DropdownListItem> firstListAction = new List<DropdownListItem>(); //默认动作
- if (listAction.Count == 0)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- WindowID = Request["WindowID"],
- msg = "对不起,您无权限进行审核操作。"
- });
- }
- foreach (var item in listAction)
- {
- DropdownListItem dli = new DropdownListItem { Text = item.ActionName, Value = item.ToJson() };
- list.Add(dli);
- }
- var firstAction = listAction.OrderBy(x => x.Sort).FirstOrDefault(); //以排序获取第一个动作为默认动作
- firstListAction.Add(new DropdownListItem { Text = firstAction.ActionName, Value = firstAction.ToJson() });
- ViewData["firstListAction"] = firstListAction;
- ViewData["listAction"] = list;
- return View();
- }
- /// <summary>
- /// 审核动作
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApprovalHandle(string finalExaminationIDs, string opinioncomment)
- {
- try
- {
- string action = Request.Form["Action"];
- ActionView actionView = action.JsonToObject<ActionView>();
- string comment = Request.Form["txtOpinioncomment"];
- List<Guid> list = new List<Guid>();
- for (int i = 0; i < finalExaminationIDs.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(finalExaminationIDs.Split(',')[i]))
- {
- Guid FinalExaminationID = new Guid(finalExaminationIDs.Split(',')[i]);
- list.Add(FinalExaminationID);
- }
- }
- //scoreServices.Value.GetFinalExaminationApprovalStatus(list, action, opinioncomment);
- scoreServices.Value.Approve(list, EMIS.Utility.FormValidate.CustomPrincipal.Current.UserID, actionView.ActionID, opinioncomment);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "审核成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "审核失败,原因:" + ex.Message + "!"
- });
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <returns></returns>
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var collegeID = Request.Form["CollegeComboGrid"].ParseStrTo<Guid>();
- var departmentID = Request.Form["DepartmentComboGrid"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CoursematerialComboGrid"].ParseStrTo<Guid>();
- var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
- var examsCategoryID = Request.Form["DictionaryExamsCategory"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryExamsCategory"].ParseStrTo<int>();
- var schoolyearID = Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
- var gradeYearID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
- var approvalStatus = Request.Form["DictionaryScoreState"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryScoreState"].ParseStrTo<int>();
- var dt = scoreServices.Value.GetFinalExaminationScoreAuditViewList(configuretView, collegeID, departmentID, schoolyearID, coursematerialID, courseTypeID, examsCategoryID, gradeYearID, approvalStatus).Select(x => new
- {
- x.SchoolyearCode,
- x.GradeYearID,
- x.ClassName,
- x.CourseCode,
- x.CourseName,
- x.CourseTypeName,
- x.ExamsCategoryName,
- x.CreatorUserNo,
- x.CreatorUserName,
- x.EntryDeadlineTime,
- x.StudentCount,
- x.SAPunlogStudentCount,
- x.ApprovalStatusName
- }).ToTable();
- string[] liststring = { "学年学期", "年级", "录入班级名称", "课程代码", "课程名称","课程类型", "考试性质","录入人编号", "录入人姓名",
- "录入截止日期","学生数","未录入人数","状态" };
- neh.Export(dt, liststring, "成绩录入信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功!"
- });
- }
- /// <summary>
- /// 学生名单
- /// </summary>
- /// <returns></returns>
- public ActionResult StudentList(Guid? finalExaminationID, int? recordStatus)
- {
- ViewBag.FinalExaminationID = finalExaminationID;
- var IsColor = 0;
- var status = finalExaminationServices.Value.GetRebutStatus();
- if (status.Count > 0)
- {
- if (status.Any(x => x.Value == recordStatus))
- {
- IsColor = 1;
- }
- }
- ViewBag.IsColor = IsColor;
- return View();
- }
- /// <summary>
- /// 学生名单
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult FinalExaminationStudentList()
- {
- var finalExaminationID = Request["finalExaminationID"].ParseStrTo<Guid>();
- return Json(finalExaminationServices.Value.GetFinalExaminationStudent(finalExaminationID));
- }
- }
- }
|