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 EvaluationStudentSettingScoreController : Controller { public Lazy EvaluationStudentSettingScoreServices { get; set; } /// /// 学评评分页面 /// /// public ActionResult List() { return View(); } /// /// 学评评分列表查询 /// /// /// [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 handleModeID = pararms.getExtraInt("DictionaryHandleMode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryHandleMode"); 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 openState = pararms.getExtraInt("OpenStateDropdown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("OpenStateDropdown"); return base.Json(EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreViewGrid(configuretView, schoolyearID, campusID, collegeID, departmentID, coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, openState, (int)pararms.page, (int)pararms.rows)); } /// /// 评分生成 /// /// public ActionResult Create() { return View(); } /// /// 评分生成 /// /// /// [HttpPost] public ActionResult Create(EvaluationStudentSettingScoreView evaluationStudentSettingScoreView) { try { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var campusID = Request.Form["CampusDropdown"].ParseStrTo(); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo(); var gradeID = Request.Form["DictionaryGrade"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo(); var standardID = Request.Form["DictionaryStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo(); var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo(); var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo(); var handleModeID = Request.Form["DictionaryHandleMode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryHandleMode"].ParseStrTo(); var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo(); var staffID = Request.Form["StaffComboGrid"].ParseStrTo(); var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo(); string result = EvaluationStudentSettingScoreServices.Value.EvaluationStudentSettingScoreCreate(campusID, collegeID, departmentID, gradeID, standardID, coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationStudentSettingScoreView.SchoolyearID); return Json(new ReturnMessage() { IsSuccess = true, Message = "生成成功" + result + "。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "生成失败,原因:" + ex.Message }); } } /// /// 复制新增 /// /// /// public ActionResult CopyAdd(Guid evaluationStudentSettingScoreID) { var evaluationStudentSettingScoreView = new EvaluationStudentSettingScoreView(); evaluationStudentSettingScoreView = EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreView(evaluationStudentSettingScoreID); return View("Edit", evaluationStudentSettingScoreView); } /// /// 复制新增 /// /// /// [HttpPost] public ActionResult CopyAdd(EvaluationStudentSettingScoreView evaluationStudentSettingScoreView) { evaluationStudentSettingScoreView.EvaluationStudentSettingScoreID = Guid.Empty; return this.Edit(evaluationStudentSettingScoreView); } /// /// 编辑 /// /// /// [HttpGet] public ActionResult Edit(Guid? evaluationStudentSettingScoreID) { var evaluationStudentSettingScoreView = new EvaluationStudentSettingScoreView(); if (evaluationStudentSettingScoreID.HasValue && evaluationStudentSettingScoreID != Guid.Empty) { evaluationStudentSettingScoreView = EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreView(evaluationStudentSettingScoreID); } else { evaluationStudentSettingScoreView.TotalScore = 0; } return View(evaluationStudentSettingScoreView); } /// /// 编辑 /// /// /// [HttpPost] public ActionResult Edit(EvaluationStudentSettingScoreView evaluationStudentSettingScoreView) { try { EvaluationStudentSettingScoreServices.Value.EvaluationStudentSettingScoreEdit(evaluationStudentSettingScoreView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败,原因:" + ex.Message }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string evaluationStudentSettingScoreIDs) { try { List list = evaluationStudentSettingScoreIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); EvaluationStudentSettingScoreServices.Value.EvaluationStudentSettingScoreDelete(list); return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" }); } catch (Exception ex) { return base.Json(new ReturnMessage() { IsSuccess = false, Message = "删除失败,原因:" + ex.Message }); } } /// /// Excel导出 /// /// [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(); var campusID = Request.Form["CampusDropdown"].ParseStrTo(); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo(); var coursematerialID = Request.Form["CourseComboGrid"].ParseStrTo(); var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo(); var handleModeID = Request.Form["DictionaryHandleMode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryHandleMode"].ParseStrTo(); var teachingModeID = Request.Form["DictionaryTeachingMode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMode"].ParseStrTo(); var staffID = Request.Form["StaffComboGrid"].ParseStrTo(); var teachingMethodID = Request.Form["DictionaryTeachingMethod"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryTeachingMethod"].ParseStrTo(); var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo(); var openState = Request.Form["OpenStateDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["OpenStateDropdown"].ParseStrTo(); var dt = EvaluationStudentSettingScoreServices.Value.GetEvaluationStudentSettingScoreViewList(configuretView, schoolyearID, campusID, collegeID, departmentID, coursematerialID, courseTypeID, handleModeID, teachingModeID, staffID, teachingMethodID, evaluationTableID, openState) .Select(x => new { x.SchoolyearCode, x.MissionName, x.MissionClassName, x.CollegeNo, x.CollegeName, x.CampusNo, x.CampusName, 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.ParticipateCount, x.NoParticipateCount, x.ValidityParticipateCount, ValidityParticipateRate = x.ValidityParticipateRate.HasValue ? x.ValidityParticipateRate.Value.ToString("#.#") : "0", x.OpenStateName, x.TotalScore, x.Remark }).ToTable(); string[] liststring = { "学年学期", "任务名称", "任务班名称", RSL.Get("CollegeCode"), RSL.Get("College"), RSL.Get("CampusCode"), RSL.Get("CampusName"), "课程代码", "课程名称", "课程结构", "课程属性", "课程类型", "课程性质", "课程学分", "开课教研室代码", "开课教研室", "处理方式", "授课方式", "任务状态", "评价表编号", "评价表名", "参评类型", "评价类型编号", "评价类型", "教师工号", "任课教师", "职称", "任课方式", "参评人数", "未评人数", "有效评数", "有效评率%", "开放状态", "评分", "备注" }; neh.Export(dt, liststring, "学评评分信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }