123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- 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.EvaluationTable;
- using EMIS.CommonLogic.EvaluationManage.EvaluationTable;
- namespace EMIS.Web.Controllers.EvaluationManage.EvaluationTable
- {
- [Authorization]
- public class EvaluationTableController : Controller
- {
- public Lazy<IEvaluationTableServices> EvaluationTableServices { 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 evaluationParticipateTypeID = pararms.getExtraGuid("EvaluationParticipateTypeDropdown");
- var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown");
- var isStudent = pararms.getExtraInt("IsStudentDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsStudentDropdown");
- var isEnabled = pararms.getExtraInt("IsEnabledDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsEnabledDropdown");
- return base.Json(EvaluationTableServices.Value.GetEvaluationTableViewGrid(configuretView, evaluationParticipateTypeID, evaluationTypeID, isStudent, isEnabled, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 评价表名列表查询(启用状态为是或已使用)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetEvaluationTableEnabledAndUseList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var evaluationTableID = Request["evaluationTableID"].ParseStrTo<Guid>();
- var evaluationParticipateTypeID = pararms.getExtraGuid("EvaluationParticipateTypeDropdown");
- var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown");
- return base.Json(EvaluationTableServices.Value.GetEnabledAndUseEvaluationTableViewGrid(configuretView, evaluationTableID, evaluationParticipateTypeID, evaluationTypeID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="evaluationTableID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid evaluationTableID)
- {
- var evaluationTableView = new EvaluationTableView();
- evaluationTableView = EvaluationTableServices.Value.GetEvaluationTableView(evaluationTableID);
- return View("Edit", evaluationTableView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="evaluationTableView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(EvaluationTableView evaluationTableView)
- {
- evaluationTableView.EvaluationTableID = Guid.Empty;
- return this.Edit(evaluationTableView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="evaluationTableID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? evaluationTableID)
- {
- var evaluationTableView = new EvaluationTableView();
- if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty)
- {
- evaluationTableView = EvaluationTableServices.Value.GetEvaluationTableView(evaluationTableID);
- }
- else
- {
- evaluationTableView.IsEnabled = true;
- }
- return View(evaluationTableView);
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="evaluationTableView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(EvaluationTableView evaluationTableView)
- {
- try
- {
- EvaluationTableServices.Value.EvaluationTableEdit(evaluationTableView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="evaluationTableIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string evaluationTableIDs)
- {
- try
- {
- List<Guid?> list = evaluationTableIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- EvaluationTableServices.Value.EvaluationTableDelete(list);
- return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- {
- mge = "请先删除所有关联的数据,如:评价设定、评价项目、评价指标等。";
- }
- }
- return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + mge });
- }
- }
- /// <summary>
- /// 评价表对应的评价指标
- /// </summary>
- /// <returns></returns>
- public ActionResult TargetList()
- {
- return View();
- }
- /// <summary>
- /// 评价表对应的评价指标
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TargetList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = Request["collegeID"].ParseStrTo<Guid>();
- return null;
- //return Json(CollegeServices.GetDepartmentListViewGrid(configuretView, collegeID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 评价表对应的评价指标信息Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TargetListExcel()
- {
- return null;
- }
- /// <summary>
- /// 评价表对应的评价项目
- /// </summary>
- /// <returns></returns>
- public ActionResult ProjectList()
- {
- return View();
- }
- /// <summary>
- /// 评价表对应的评价项目
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ProjectList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = Request["collegeID"].ParseStrTo<Guid>();
- var departmentID = pararms.getExtraGuid("DepartmentDropdown");
- var isPhotoUrl = pararms.getExtraInt("IsPhotoUrlDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsPhotoUrlDropdown");
- var teacherTypeID = pararms.getExtraInt("DictionaryTeacherType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTeacherType");
- var incumbencyState = pararms.getExtraInt("DictionaryIncumbencyState") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIncumbencyState");
- var titleID = pararms.getExtraInt("DictionaryTitle") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryTitle");
- var isDualTeacher = pararms.getExtraInt("IsDualTeacherDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsDualTeacherDropdown");
- return null;
- //return base.Json(CollegeServices.GetStaffListViewGrid(configuretView, collegeID, departmentID, isPhotoUrl, teacherTypeID, incumbencyState, titleID, isDualTeacher, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 评价表对应的评价项目信息Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ProjectListExcel()
- {
- return null;
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var evaluationParticipateTypeID = Request.Form["EvaluationParticipateTypeDropdown"].ParseStrTo<Guid>();
- var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo<Guid>();
- var isStudent = Request.Form["IsStudentDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsStudentDropdown"].ParseStrTo<int>();
- var isEnabled = Request.Form["IsEnabledDropdown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsEnabledDropdown"].ParseStrTo<int>();
- var dt = EvaluationTableServices.Value.GetEvaluationTableViewList(configuretView, evaluationParticipateTypeID, evaluationTypeID, isStudent, isEnabled)
- .Select(x => new
- {
- x.Code,
- x.Name,
- x.ParticipateTypeCode,
- x.ParticipateTypeName,
- x.IsStudentName,
- x.EvaluationTypeCode,
- x.EvaluationTypeName,
- x.TeachingModeIDListName,
- x.Weight,
- x.TargetCount,
- x.ProjectCount,
- x.IsEnabledName,
- x.Remark,
- x.CreateUserName,
- x.ModifyUserName,
- ModifyTime = x.ModifyTime == null ? null : x.ModifyTime.Value.ToString("yyyy-MM-dd HH:mm:ss")
- }).ToTable();
- string[] liststring = {
- "编号", "评价表名", "参评代码", "参评类型", "学生用", "评价类型编号", "评价类型", "授课方式",
- "权重", "指标个数", "项目个数", "是否启用", "备注", "创建人", "修改人", "修改时间"
- };
- neh.Export(dt, liststring, "评价表名信息" + DateTime.Now.ToString("yyyyMMdd"));
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- }
- }
|