using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Bowin.Common.Exceptions; using Bowin.Common.Utility; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.EvaluationManage; using EMIS.ViewModel; using EMIS.ViewModel.EvaluationManage; using EMIS.Web.Controls; using Bowin.Common.Data; using EMIS.CommonLogic.CalendarManage; using EMIS.CommonLogic.EducationManagement; using EMIS.ViewModel.EvaluationManage.EvaluationEnter; using System.Text; using System.Collections; using EMIS.Utility; using Bowin.Common.JSON; using EMIS.Entities; using System.Text.RegularExpressions; using EMIS.Utility.FormValidate; namespace EMIS.Web.Controllers.EvaluationManage.EvaluationAdvise { [Authorization] public class EvaluationAdviseController : Controller { public IEvaluationRecordServices EvaluationRecordServices { get; set; } public IEvaluationAdviseServices EvaluationAdviseServices { get; set; } public IEvaluationEnterServices EvaluationEnterServices { get; set; } public IEvaluationTargetServices EvaluationTargetServices { get; set; } public IEvaluationProjectServices EvaluationProjectServices { get; set; } public IEvaluationTableServices EvaluationTableServices { get; set; } public IEvaluationNormServices EvaluationNormServices { get; set; } //public IEvaluationNeedServices EvaluationNeedServices { get; set; } public IEvaluationTypeServices EvaluationTypeServices { get; set; } public IEvaluationSettingServices EvaluationSettingServices { get; set; } public ISchoolYearServices SchoolYearServices { get; set; } Guid? educationMissionID = Guid.Empty; /// /// 评语建议页面 /// /// [HttpGet] public ActionResult List() { var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true); ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString(); return View(); } [HttpPost] public ActionResult List(QueryParamsModel pararms) { var schoolYearID = pararms.getExtraGuid("SchoolYearDropdown"); //学年学期 var evaluationTableID = pararms.getExtraGuid("EvaluationTableDropdown"); //评价表 var evaluationTypeID = pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型 var collegeID = pararms.getExtraGuid("CollegeDropdown");//院系所 var departmentID = pararms.getExtraGuid("DepartmentDropdown");//教研室 var staffID = pararms.getExtraGuid("StaffDropdown");//教师 ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var result = EvaluationAdviseServices.GetEvaluationAdviseViewGrid(configuretView, schoolYearID, collegeID, departmentID, evaluationTableID, evaluationTypeID, staffID, (int)pararms.page, (int)pararms.rows);//, collegeID, departmentID return Json(result); } /// /// Excel导出 /// /// [HttpPost] public ActionResult Excel() { try { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var schoolYearID = Request.Form["SchoolyearDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDropdown"].ParseStrTo(); //学年学期 var evaluationTableID = Request.Form["EvaluationTableDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTableDropdown"].ParseStrTo();//pararms.getExtraGuid("EvaluationTableDropdown"); //评价表 var evaluationTypeID = Request.Form["EvaluationTypeDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["EvaluationTypeDropdown"].ParseStrTo();//pararms.getExtraGuid("EvaluationTypeDropdown"); //评价类型 var collegeID = Request.Form["CollegeDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["CollegeDropdown"].ParseStrTo();//pararms.getExtraGuid("CollegeDropdown");//院系所 var departmentID = Request.Form["DepartmentDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DepartmentDropdown"].ParseStrTo();//pararms.getExtraGuid("DepartmentDropdown");//教研室 var staffID = Request.Form["StaffDropdown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StaffDropdown"].ParseStrTo();//pararms.getExtraGuid("StaffDropdown");//教师 var dt = EvaluationAdviseServices.GetEvaluationAdviseViewList(configuretView, schoolYearID, collegeID, departmentID, evaluationTableID, evaluationTypeID, staffID).Select(x => new { x.UserCodes, x.UserNames, x.CourseName, x.EducationMissionClassName, x.EvaluationTypeName, x.EvaluationTableName, x.Remark }).ToTable(); string[] liststring = { "教师编号", "教师名称", "课程名称", "任务班名称", "参评类型", "评价表名", "评语建议" }; //string[] liststring = { "评价编号", "课程名称", "评价类型 ", "被评教师号", "被评教师", "任务班名称", "参评类型 ", "已评次数" }; neh.Export(dt, liststring, "评语建议"); return RedirectToAction("MsgShow", "Common", new { msg = "导出成功!", url = Url.Content("~/EvaluationAdvise/List").AddMenuParameter() }); } catch (Exception ex) { return RedirectToAction("MsgShow", "Common", new { msg = "导出失败,原因:" + ex.Message + "!", url = Url.Content("~/EvaluationAdvise/List").AddMenuParameter() }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string ids) { try { var list = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Guid.Parse(s)).ToList(); EvaluationRecordServices.Delete(list); return base.Json("删除成功。"); } catch (Exception ex) { return base.Json("删除失败,原因:" + ex.Message); } } } }