using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.CommonLogic.ScoreManage; using EMIS.ViewModel.ScoreManage; using Bowin.Common.Utility; using EMIS.Utility; using Bowin.Common.Data; using EMIS.Utility.FormValidate; namespace EMIS.Web.Controllers.ScoreManage { [Authorization] public partial class ScoreConvertController : Controller { // // GET: /ScoreConvertByApply/ public IScoreConvertByApplyServices scoreConvertByApplyServices { get; set; } public ActionResult ByApplyList() { ViewBag.StartStatusID = scoreConvertByApplyServices.GetStartStatus(); return View(); } [HttpPost] public ActionResult ByApplyList(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(scoreConvertByApplyServices.GetScoreConvertByApplyViewGrid(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerial, recordStatus, pararms.page, pararms.rows)); } public ActionResult StudentByApplyList() { ViewBag.StartStatusID = scoreConvertByApplyServices.GetStartStatus(); return View(); } [HttpPost] public ActionResult StudentByApplyList(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(scoreConvertByApplyServices.GetScoreConvertByApplyViewGrid(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerial, recordStatus, pararms.page, pararms.rows)); } public ActionResult ByApplyEdit(Guid? scoreConvertByApplyID) { ScoreConvertByApplyView scoreConvertByApplyView = new ScoreConvertByApplyView(); if (scoreConvertByApplyID.HasValue) { scoreConvertByApplyView = scoreConvertByApplyServices.GetScoreConvertByApplyView(scoreConvertByApplyID); } else { scoreConvertByApplyView.ScoreConvertByApplyID = Guid.NewGuid(); } return View(scoreConvertByApplyView); } [HttpPost] public ActionResult ByApplyEdit(ScoreConvertByApplyView scoreConvertByApplyView) { try { var sessionName = FileUploadHelper.GetFileUploadSessionName(scoreConvertByApplyView.ScoreConvertByApplyID); var fileList = (List)Session[sessionName]; scoreConvertByApplyServices.Save(scoreConvertByApplyView, fileList); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败," + ex.Message }); } } public ActionResult StudentByApplyEdit(Guid? scoreConvertByApplyID) { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; ScoreConvertByApplyView scoreConvertByApplyView = new ScoreConvertByApplyView(); if (scoreConvertByApplyID.HasValue) { scoreConvertByApplyView = scoreConvertByApplyServices.GetScoreConvertByApplyView(scoreConvertByApplyID); } else { scoreConvertByApplyView.ScoreConvertByApplyID = Guid.NewGuid(); scoreConvertByApplyView.UserID = curUser.UserID; } return View(scoreConvertByApplyView); } [HttpPost] public ActionResult StudentByApplyEdit(ScoreConvertByApplyView scoreConvertByApplyView) { try { var sessionName = FileUploadHelper.GetFileUploadSessionName(scoreConvertByApplyView.ScoreConvertByApplyID); var fileList = (List)Session[sessionName]; scoreConvertByApplyServices.Save(scoreConvertByApplyView, fileList); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败," + ex.Message }); } } [HttpPost] public ActionResult ByApplySubmit(string scoreConvertByApplyIDs) { try { var scoreConvertByApplyIDList = scoreConvertByApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); scoreConvertByApplyServices.Submit(scoreConvertByApplyIDList, 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 ByApplyApprove(string scoreConvertByApplyIDs, Guid actionID, string comment) { try { var scoreConvertByApplyIDList = scoreConvertByApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList(); scoreConvertByApplyServices.ScoreConvertByApplyApprove(scoreConvertByApplyIDList, 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 }); } } [HttpPost] public ActionResult ByApplyExcel() { 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 scoreConvertByApplyIDString = Request.Form["SelectedID"]; var scoreConvertByApplyIDList = scoreConvertByApplyIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); var dt = scoreConvertByApplyServices.GetScoreConvertByApplyViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerial, recordStatus, scoreConvertByApplyIDList) .Select(x => new { x.SchoolyearCode, x.CollegeName, x.StandardDesc, x.ClassmajorName, x.LoginID, x.Name, x.CourseCode, x.CourseName, x.TotalScore, //x.SchoolyearNumName, //x.SchoolcodeName, 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 StudentByApplyExcel() { 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 scoreConvertByApplyIDString = Request.Form["SelectedID"]; var scoreConvertByApplyIDList = scoreConvertByApplyIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); var dt = scoreConvertByApplyServices.GetScoreConvertByApplyViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerial, recordStatus, scoreConvertByApplyIDList) .Select(x => new { x.SchoolyearCode, x.CollegeName, x.StandardDesc, x.ClassmajorName, x.LoginID, x.Name, x.CourseCode, x.CourseName, x.TotalScore, x.SchoolyearNumName, x.SchoolcodeName, 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 ByApplyDelete(string scoreConvertByApplyIDs) { try { var scoreConvertByApplyIDList = scoreConvertByApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); scoreConvertByApplyServices.Delete(scoreConvertByApplyIDList); return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败," + ex.Message }); } } [HttpGet] public ActionResult Attachment(Guid? scoreConvertByApplyID) { return View(); } [HttpPost] public ActionResult Attachment(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var scoreConvertByApplyID = pararms.getExtraGuid("hidScoreConvertByApplyID"); var attachment = scoreConvertByApplyServices.GetAttachment(scoreConvertByApplyID, pararms.page, pararms.rows); return Json(attachment); } [HttpGet] public ActionResult Upload(Guid? scoreConvertByApplyID) { ScoreConvertByApplyView scoreConvertByApplyView = new ScoreConvertByApplyView(); scoreConvertByApplyView.ScoreConvertByApplyID = scoreConvertByApplyID.Value; return View(scoreConvertByApplyView); } [HttpPost] public ActionResult Upload() { return Json("上传成功"); } [HttpPost] public ActionResult GetFileListByConvertID(Guid? scoreConvertByApplyID) { //var convertByApplyID = scoreConvertByApplyID.ParseStrTo(); var sessionName = FileUploadHelper.GetFileUploadSessionName(scoreConvertByApplyID ?? Guid.Empty); var fileList = (List)Session[sessionName]; return Json(fileList); } } }