using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Data; using EMIS.CommonLogic.ScoreManage; using Bowin.Common.Utility; using Bowin.Web.Controls.Mvc; using EMIS.Web.Controls; using Bowin.Common.JSON; using System.Dynamic; using EMIS.Utility; using EMIS.ViewModel; using System.Text.RegularExpressions; using System.Web.Script.Serialization; using System.Text; using EMIS.CommonLogic.CalendarManage; namespace EMIS.Web.Controllers.ScoreManage { [Authorization] public class SpecialityScoreSumController : Controller { public Lazy specialityScoreSumServices { get; set; } public Lazy specialityScoreByFinalScoreServices { get; set; } public Lazy schoolYearServices { get; set; } /// /// 专业成绩汇总 /// /// public ActionResult List() { return View(); } /// /// 个人成绩报表(适用于松山、工大、科大等) /// /// public ActionResult StudentScoreReport() { return View(); } /// /// 广体版本专业成绩汇总 /// /// [HttpGet] public ActionResult NewList() { var schoolYear = schoolYearServices.Value.GetSchoolYearIsCurrent(true); ViewBag.Years = schoolYear == null ? "-1" : schoolYear.Years.ToString();//默认当前学年 return View(); } /// /// 学生个人成绩报表(适用于广体等) /// /// public ActionResult StudentScoreNewReport() { return View(); } [HttpPost] public ActionResult SpecialityScoreSumList() { var collegeID = Request["collegeID"].ParseStrTo(); var standardID = Request["standardID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["standardID"].ParseStrTo(); var classmajorID = Request["classmajorID"].ParseStrTo(); var yearID = Request["yearID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["yearID"].ParseStrTo(); var schoolyearNumID = Request["schoolyearNumID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["schoolyearNumID"].ParseStrTo(); var schoolcodeID = Request["schoolcodeID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["schoolcodeID"].ParseStrTo(); var inSchoolStatus = Request["InSchoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["InSchoolStatus"].ParseStrTo(); var specialtyScoreSummaryView = specialityScoreSumServices.Value.SpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, inSchoolStatus); return Json(specialtyScoreSummaryView); } protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior) { return new ConfigurableJsonResult { Data = data, ContentType = contentType, ContentEncoding = contentEncoding, JsonRequestBehavior = behavior }; } [HttpPost] public ActionResult SpecialityScoreByScoreList(string CourseTypeID) { //var courseType = pararms.getExtraInt("CourseTypeID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("CourseTypeID"); var collegeID = Request["collegeID"].ParseStrTo(); var standardID = Request["standardID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["standardID"].ParseStrTo(); var classmajorID = Request["classmajorID"].ParseStrTo(); var yearID = Request["yearID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["yearID"].ParseStrTo(); var schoolyearNumID = Request["schoolyearNumID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["schoolyearNumID"].ParseStrTo(); var schoolcodeID = Request["schoolcodeID"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["schoolcodeID"].ParseStrTo(); var inSchoolStatus = Request["InSchoolStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["InSchoolStatus"].ParseStrTo(); int count = Regex.Matches(CourseTypeID, ",").Count; List CourseTypeIDList = new List(); for (int i = 0; i < count; i++) { string courseType = CourseTypeID.Split(',')[i]; CourseTypeIDList.Add(int.Parse(courseType)); } var specialtyScoreSummaryView = specialityScoreByFinalScoreServices.Value.SpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, CourseTypeIDList); return Json(specialtyScoreSummaryView, "text/json", Encoding.UTF8, JsonRequestBehavior.AllowGet); } /// /// 导出Excel /// /// /// [HttpPost] public ActionResult Excel() { try { var collegeID = Request["CollegeDropdown"].ParseStrTo(); var standardID = Request["DictionaryStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionaryStandard"].ParseStrTo(); var classmajorID = Request["ClassmajorDropdown"].ParseStrTo(); var yearID = Request["DictionarySchoolyear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyear"].ParseStrTo(); var schoolyearNumID = Request["DictionarySchoolyearNum"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyearNum"].ParseStrTo(); var schoolcodeID = Request["DictionarySchoolcode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolcode"].ParseStrTo(); var inSchoolStatus = Request["InSchoolStatusDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["InSchoolStatusDictionaryDropDown"].ParseStrTo(); specialityScoreSumServices.Value.ExportSpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, inSchoolStatus); } catch (Exception) { throw; } return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功!" }); } /// /// 广体导出Excel /// /// /// [HttpPost] public ActionResult GTExcel(string CourseTypeIDs, bool IsCredit) { try { var collegeID = Request["CollegeDropdown"].ParseStrTo(); var standardID = Request["DictionaryStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionaryStandard"].ParseStrTo(); var classmajorID = Request["ClassmajorDropdown"].ParseStrTo(); var yearID = Request["DictionarySchoolyear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyear"].ParseStrTo(); var schoolyearNumID = Request["DictionarySchoolyearNum"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolyearNum"].ParseStrTo(); var schoolcodeID = Request["DictionarySchoolcode"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request["DictionarySchoolcode"].ParseStrTo(); var courseTypeIDList = CourseTypeIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => int.Parse(x)).ToList(); specialityScoreByFinalScoreServices.Value.ExportSpecialityScoreSumTable(collegeID, yearID, standardID, schoolyearNumID, schoolcodeID, classmajorID, courseTypeIDList, IsCredit); } catch (Exception) { throw; } return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功!" }); } /// /// /// /// [HttpPost] public ActionResult GetCourseType() { List list = new List(); list = specialityScoreByFinalScoreServices.Value.GetCourseTypeID().Select(x => x.ToString()).ToList(); return base.Json(list); } } }