123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.Web.Controls;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EvaluationManage;
- using Bowin.Common.Exceptions;
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.EvaluationManage;
- namespace EMIS.Web.Controllers.EvaluationManage
- {
- /// <summary>
- /// 教师评价
- /// </summary>
- [Authorization]
- public class TeacherEvaluationController : Controller
- {
- public ITeacherEvaluationServices TeacherEvaluationServices { get; set; }
- public IEvaluationTypeServices EvaluationTypeServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- var configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期
- var campusID = pararms.getExtraGuid("CampusDropdown"); //校区
- var collegeID = pararms.getExtraGuid("CollegeDropdown"); //院系所
- var openStatus = CheckIsSelectAll(pararms.getExtraInt("DictionaryOpenStatus")); //开放状态
- var result = TeacherEvaluationServices.GetTeacherEvaluationViewGrid(configuretView, schoolYearID, campusID, collegeID, openStatus, (int)pararms.page, (int)pararms.rows);
- return Json(result);
- }
- public ActionResult Edit(Guid? id)
- {
- var vm = new TeacherEvaluationView();
- if (id != null && id != Guid.Empty)
- vm = TeacherEvaluationServices.GetTeacherEvaluationView(id);
- var evaluationType = EvaluationTypeServices.GetEvaluationType("学生评");
- //var isView = (vm.EntityApprovalStatus.HasValue && vm.EntityApprovalStatus != (int)CF_DifferentDynamicStatus.NotSubmitted) ? true : false;
- //ViewBag.IsView = isView;
- ViewBag.EvaluationTypeId = evaluationType.EvaluationTypeID;
- return View(vm);
- }
- /// <summary>
- /// 新增或更新
- /// </summary>
- /// <param name="vm"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(TeacherEvaluationView vm)
- {
- try
- {
- TeacherEvaluationServices.AddOrUpdateTeacherEvaluation(vm);
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "保存成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- catch (Exception ex)
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "保存失败!" + ex.Message,
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string ids)
- {
- try
- {
- var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList();
- TeacherEvaluationServices.DeleteTeacherEvaluation(list);
- return base.Json("删除成功");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- //mge = "请先删除所有关联的数据,如:专业计划、选修计划等!";
- mge = "请先删除所有关联的数据!";
- }
- return base.Json("删除失败,原因:" + mge);
- }
- }
- /// <summary>
- /// 添加更新前验证
- /// </summary>
- /// <param name="activitiesID"></param>
- /// <param name="Name"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Verification(Guid? id, Guid? educationMissionClassID, Guid? tableID)
- {
- if (id.HasValue && id != Guid.Empty) //编辑状态
- {
- }
- else //新增状态
- {
- }
- return Json("成功");
- }
- protected static int? CheckIsSelectAll(int? argment)
- {
- return argment == DropdownList.SELECT_ALL ? null : argment;
- }
- }
- }
|