123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using Bowin.Common.Data;
- using Bowin.Common.Exceptions;
- using Bowin.Common.Utility;
- using Bowin.Web.Controls.Mvc;
- using EMIS.Web.Controls;
- using EMIS.Utility;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EvaluationManage.EvaluationResult;
- using EMIS.CommonLogic.EvaluationManage.EvaluationResult;
- namespace EMIS.Web.Controllers.EvaluationManage.EvaluationResult
- {
- [Authorization]
- public class EvaluationStaffScoreController : Controller
- {
- public Lazy<IEvaluationStaffScoreServices> EvaluationStaffScoreServices { 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");
- var campusID = pararms.getExtraGuid("CampusDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- var userID = pararms.getExtraGuid("StaffComboGrid");
- var incumbencyState = pararms.getExtraInt("DictionaryIncumbencyState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIncumbencyState");
- var coursematerialID = pararms.getExtraGuid("CourseComboGrid");
- return base.Json(EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreViewGrid(configuretView, schoolyearID, campusID, collegeID,
- departmentID, userID, incumbencyState, coursematerialID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 评分生成
- /// </summary>
- /// <returns></returns>
- public ActionResult Create()
- {
- return View();
- }
- /// <summary>
- /// 评分生成
- /// </summary>
- /// <param name="evaluationStaffScoreView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Create(EvaluationStaffScoreView evaluationStaffScoreView)
- {
- try
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
- var userID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
- string result = EvaluationStaffScoreServices.Value.EvaluationStaffScoreCreate(campusID, collegeID, departmentID, coursematerialID, userID, evaluationStaffScoreView.SchoolyearID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="evaluationStaffScoreID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid evaluationStaffScoreID)
- {
- var evaluationStaffScoreView = new EvaluationStaffScoreView();
- evaluationStaffScoreView = EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreView(evaluationStaffScoreID);
- return View("Edit", evaluationStaffScoreView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="evaluationStaffScoreView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(EvaluationStaffScoreView evaluationStaffScoreView)
- {
- evaluationStaffScoreView.EvaluationStaffScoreID = Guid.Empty;
- return this.Edit(evaluationStaffScoreView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="evaluationStaffScoreID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? evaluationStaffScoreID)
- {
- var evaluationStaffScoreView = new EvaluationStaffScoreView();
- if (evaluationStaffScoreID.HasValue && evaluationStaffScoreID != Guid.Empty)
- {
- evaluationStaffScoreView = EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreView(evaluationStaffScoreID);
- }
- return View(evaluationStaffScoreView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="evaluationStaffScoreView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(EvaluationStaffScoreView evaluationStaffScoreView)
- {
- try
- {
- EvaluationStaffScoreServices.Value.EvaluationStaffScoreEdit(evaluationStaffScoreView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="evaluationStaffScoreIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string evaluationStaffScoreIDs)
- {
- try
- {
- List<Guid?> list = evaluationStaffScoreIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- EvaluationStaffScoreServices.Value.EvaluationStaffScoreDelete(list);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
- }
- catch (Exception ex)
- {
- return base.Json(new ReturnMessage() { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
- }
- }
- /// <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 campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo<Guid>();
- var userID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
- var incumbencyState = Request.Form["DictionaryIncumbencyState"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryIncumbencyState"].ParseStrTo<int>();
- var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
- var dt = EvaluationStaffScoreServices.Value.GetEvaluationStaffScoreViewList(configuretView, schoolyearID, campusID, collegeID, departmentID, userID, incumbencyState, coursematerialID)
- .Select(x => new
- {
- x.SchoolyearCode,
- x.StaffCode,
- x.StaffName,
- x.SexName,
- x.TeacherTypeName,
- x.IncumbencyStateName,
- x.TitleName,
- x.CourseCode,
- x.CourseName,
- x.DepartmentNo,
- x.DepartmentName,
- x.CollegeNo,
- x.CollegeName,
- x.CampusNo,
- x.CampusName,
- x.StudentScore,
- x.CollegeScore,
- x.TotalScore,
- x.Remark,
- ModifyTime = x.ModifyTime == null ? null : x.ModifyTime.Value.ToString("yyyy-MM-dd HH:mm:ss")
- }).ToTable();
- string[] liststring = {
- "学年学期", "教师工号", "任课教师", "性别", "教师类型", "在职状态", "职称", "课程代码", "课程名称", "所属教研室代码",
- "所属教研室", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"),
- RSL.Get("EvaluationStudentScore"), RSL.Get("EvaluationCollegeScore"), "总评分", "备注", "修改时间"
- };
- neh.Export(dt, liststring, "教师评分信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|