using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Bowin.Web.Controls.Mvc; using Bowin.Common.Utility; using Bowin.Common.Data; using EMIS.CommonLogic.ScoreManage; using EMIS.ViewModel; using EMIS.Web.Controls; using EMIS.Utility; using EMIS.ViewModel.ScoreManage; using EMIS.CommonLogic.EducationManagement; using EMIS.Utility.FormValidate; using EMIS.CommonLogic.EducationManage; namespace EMIS.Web.Controllers.ScoreManage { [Authorization] public partial class ScoreConvertController : Controller { public IScoreConvertByReplaceServices ScoreConvertByReplaceServices { get; set; } public IStudentScoreServices StudentScoreServices { get; set; } public IExecutablePlanServices ExecutablePlanServices { get; set; } public ActionResult ByReplaceList() { ViewBag.StartStatusID = ScoreConvertByReplaceServices.GetStartStatus(); return View(); } public ActionResult ByReplaceEdit(Guid? scoreConvertByReplaceID) { ScoreConvertByReplaceView scoreConvertByReplaceView = new ScoreConvertByReplaceView(); if (scoreConvertByReplaceID.HasValue) { scoreConvertByReplaceView = ScoreConvertByReplaceServices.GetScoreConvertByReplaceView(scoreConvertByReplaceID); } return View(scoreConvertByReplaceView); } [HttpPost] public ActionResult ByReplaceList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var schoolyearID = pararms.getExtraGuid("ddlSchoolyear"); var collegeID = pararms.getExtraGuid("cgbCollege"); var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear"); var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard"); var classmajorID = pararms.getExtraGuid("cbgClassmajor"); var coursematerial = pararms.getExtraGuid("cbgCourse"); var recordStatus = pararms.getExtraInt("ddlRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlRecordStatus"); return base.Json(ScoreConvertByReplaceServices.GetScoreConvertByReplaceViewGrid(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerial, recordStatus, pararms.page, pararms.rows)); } [HttpPost] public ActionResult ByReplaceExcel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo(); var collegeID = Request.Form["cgbCollege"].ParseStrTo(); var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo(); var standardID = Request.Form["cbgStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo(); var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo(); var coursematerial = Request.Form["cbgCourse"].ParseStrTo(); var recordStatus = Request.Form["ddlRecordStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlRecordStatus"].ParseStrTo(); var dt = ScoreConvertByReplaceServices.GetScoreConvertByReplaceViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerial, recordStatus) .Select(x => new { x.SchoolyearCode, x.CollegeName, x.StandardDesc, x.ClassmajorName, x.LoginID, x.Name, x.TargetCourseCode, x.TargetCourseName, x.TotalScore, x.SourceCourseCode, x.SourceCourseName, x.RecordStatusDesc }).ToTable(); string[] liststring = { "学年学期", RSL.Get("College"), "专业", "班级", "学号", "姓名", "课程代码", "课程名称", "成绩", "原始课程代码", "原始课程名称", "状态" }; neh.Export(dt, liststring, "替换认定列表" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } [HttpPost] public ActionResult ByReplaceEdit(ScoreConvertByReplaceView scoreConvertByReplaceView) { try { ScoreConvertByReplaceServices.Save(scoreConvertByReplaceView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败," + ex.Message }); } } [HttpPost] public ActionResult ByReplaceDelete(string scoreConvertByReplaceIDs) { try { var scoreConvertByReplaceIDList = scoreConvertByReplaceIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); ScoreConvertByReplaceServices.Delete(scoreConvertByReplaceIDList); return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败," + ex.Message }); } } [HttpPost] public ActionResult SourceCoursematerialList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var userID = pararms.getExtraGuid("cbgUserID"); return Json(StudentScoreServices.GetFinallyScoreCoursematerialViewGrid(configuretView, userID ?? Guid.Empty, pararms.page, pararms.rows)); } [HttpPost] public ActionResult SourceCoursematerialView(Guid userID, Guid coursematerialID) { try { var sourceView = StudentScoreServices.GetFinallyScoreView(userID, coursematerialID); return Json(new ReturnMessage { IsSuccess = true, Message = "", Data = sourceView }); } catch (Exception ex) { return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message }); } } [HttpPost] public ActionResult TargetCoursematerialList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var userID = pararms.getExtraGuid("cbgUserID"); return Json(ExecutablePlanServices.GetLastCoursematerialViewGrid(configuretView, userID ?? Guid.Empty, pararms.page, pararms.rows)); } [HttpPost] public ActionResult ByReplaceSubmit(string scoreConvertByReplaceIDs) { try { var scoreConvertByReplaceIDList = scoreConvertByReplaceIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); ScoreConvertByReplaceServices.StartUp(scoreConvertByReplaceIDList, CustomPrincipal.Current.UserID); return base.Json(new ReturnMessage { IsSuccess = true, Message = "提交成功" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "提交失败," + ex.Message }); } } [HttpPost] public ActionResult ByReplaceApprove(string scoreConvertByReplaceIDs, Guid actionID, string comment) { try { var scoreConvertByReplaceIDList = scoreConvertByReplaceIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); ScoreConvertByReplaceServices.Approve(scoreConvertByReplaceIDList, CustomPrincipal.Current.UserID, actionID, comment); return base.Json(new ReturnMessage { IsSuccess = true, Message = "审核成功" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "审核失败," + ex.Message }); } } } }