123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- 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.StudentEvaluation;
- using EMIS.CommonLogic.EvaluationManage.StudentEvaluation;
- namespace EMIS.Web.Controllers.EvaluationManage.StudentEvaluation
- {
- [Authorization]
- public class EvaluationStudentController : Controller
- {
- public Lazy<IEvaluationStudentServices> EvaluationStudentServices { 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 coursematerialID = pararms.getExtraGuid("CourseComboGrid");
- var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
- var teachingModeID = pararms.getExtraInt("DictionaryTeachingMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMode");
- var staffID = pararms.getExtraGuid("StaffComboGrid");
- var teachingMethodID = pararms.getExtraInt("DictionaryTeachingMethod") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeachingMethod");
- var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown");
- var isValidity = pararms.getExtraInt("IsValidityDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsValidityDropdown");
- var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
- return base.Json(EvaluationStudentServices.Value.GetEvaluationStudentViewGrid(configuretView, schoolyearID, campusID, collegeID, departmentID,
- coursematerialID, courseTypeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, isValidity, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="evaluationStudentID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? evaluationStudentID)
- {
- var evaluationStudentView = new EvaluationStudentView();
- if (evaluationStudentID.HasValue && evaluationStudentID != Guid.Empty)
- {
- evaluationStudentView = EvaluationStudentServices.Value.GetEvaluationStudentView(evaluationStudentID);
- }
- else
- {
- evaluationStudentView.IsValidity = true;
- }
- return View(evaluationStudentView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="evaluationStudentView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(EvaluationStudentView evaluationStudentView)
- {
- try
- {
- EvaluationStudentServices.Value.EvaluationStudentEdit(evaluationStudentView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="evaluationStudentIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string evaluationStudentIDs)
- {
- try
- {
- List<Guid?> list = evaluationStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- EvaluationStudentServices.Value.EvaluationStudentDelete(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 coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo<Guid>();
- var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
- var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo<int>();
- var staffID = Request.Form["StaffComboGrid"].ParseStrTo<Guid>();
- var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo<int>();
- var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo<Guid>();
- int? isValidity = Request["IsValidityDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request["IsValidityDropdown"].ParseStrTo<int>();
- var inschoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
- var dt = EvaluationStudentServices.Value.GetEvaluationStudentViewList(configuretView, schoolyearID, campusID, collegeID, departmentID,
- coursematerialID, courseTypeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, isValidity, inschoolStatus)
- .Select(x => new
- {
- x.StudentNo,
- x.Name,
- x.SexName,
- x.ClassmajorNo,
- x.ClassmajorName,
- x.CollegeNo,
- x.CollegeName,
- x.CampusNo,
- x.CampusName,
- x.InSchoolStatusName,
- x.SchoolyearCode,
- x.MissionName,
- x.MissionClassName,
- x.CourseCode,
- x.CourseName,
- x.CourseStructureName,
- x.CourseCategoryName,
- x.CourseTypeName,
- x.CourseQualityName,
- Credit = x.Credit.HasValue ? x.Credit.Value.ToString("#.#") : null,
- x.DepartmentNo,
- x.DepartmentName,
- x.HandleModeName,
- x.TeachingModeName,
- x.MissionClassStatusName,
- x.EvaluationTableCode,
- x.EvaluationTableName,
- x.ParticipateTypeName,
- x.EvaluationTypeCode,
- x.EvaluationTypeName,
- x.StaffCode,
- x.StaffName,
- x.TitleName,
- x.TeachingMethodName,
- x.OpenStateName,
- x.Number,
- x.Numbered,
- x.IsValidityName,
- x.ProjectCount,
- x.TotalScore,
- x.Advice,
- x.Remark
- }).ToTable();
- string[] liststring = {
- "学号", "姓名", "性别", "班级编号", "班级名称", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"),
- "在校状态", "学年学期", "任务名称", "任务班名称", "课程代码", "课程名称", "课程结构", "课程属性", "课程类型", "课程性质",
- "课程学分", "开课教研室代码", "开课教研室", "处理方式", "授课方式", "任务状态", "评价表编号", "评价表名", "参评类型", "评价类型编号",
- "评价类型", "教师工号", "任课教师", "职称", "任课方式", "开放状态", "可评次数", "已评次数", "是否有效", "项目数", "总分", "评语建议", "备注"
- };
- var title = "学评明细信息";
- if (inschoolStatus == (int)CF_YesOrNoStatus.No)
- {
- title = "学评明细信息(非在校)";
- }
- if (inschoolStatus == (int)CF_YesOrNoStatus.Yes)
- {
- title = "学评明细信息(在校)";
- }
- neh.Export(dt, liststring, title + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|