123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- 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.Exceptions;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- namespace EMIS.Web.Controllers.ScoreManage
- {
- public partial class ScoreConvertController
- {
- public IScoreConvertByLevelServices ScoreConvertByLevelServices { get; set; }
- public ActionResult ByLevelList()
- {
- return View();
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- [HttpPost]
- public ActionResult ByLevelList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- //避开全选值
- var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown");
- var collegeID = pararms.getExtraGuid("CollegeDropdown");
- var classmajorID = pararms.getExtraGuid("ClassmajorDropdown");
- var coursematerialID = pararms.getExtraGuid("CourseDropdown");
- var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown");
- var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown");
- return base.Json(ScoreConvertByLevelServices.GetUniteMaintainViewGrid(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerialID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="finalExaminationID"></param>
- /// <returns></returns>
- public ActionResult ByLevelEdit()
- {
- ScoreConvertByLevelView scoreConvertByLevelView = new ScoreConvertByLevelView();
- return View(scoreConvertByLevelView);
- }
- [HttpPost]
- public ActionResult ByLevelEdit(ScoreConvertByLevelView scoreConvertByLevelView)
- {
- try
- {
- var success= ScoreConvertByLevelServices.Save(scoreConvertByLevelView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = success
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="finalExaminationIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ByLevelDelete(string ScoreConvertByLevelScoreIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < ScoreConvertByLevelScoreIDs.Split(',').Length; i++)
- {
- if (!string.IsNullOrEmpty(ScoreConvertByLevelScoreIDs.Split(',')[i]))
- {
- Guid ScoreConvertByLevelScoreID = new Guid(ScoreConvertByLevelScoreIDs.Split(',')[i]);
- list.Add(ScoreConvertByLevelScoreID);
- }
- }
- ScoreConvertByLevelServices.Delete(list);
- return this.Json("删除成功!");
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- System.Data.SqlClient.SqlException num = ExceptionHelper.GetSqlException(ex);
- if (num != null)
- {
- if (num.Number == 547)
- mge = "请先删除所有关联的数据!";
- }
- return this.Json("删除失败,原因:" + mge);
- }
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ByLevelExcel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var ScoreConvertByLevelScoreIDs = Request.Form["ScoreConvertByLevelScoreIDs"];
- var schoolyearID = Request.Form["SchoolYearDropdown"].ParseStrTo<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var classmajorID = Request.Form["ClassmajorDropdown"].ParseStrTo<Guid>();
- var coursematerialID = Request.Form["CourseDropdown"].ParseStrTo<Guid>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- List<Guid?> ScoreConvertByLevelScoreIDList = new List<Guid?>();
- if (ScoreConvertByLevelScoreIDs != "")
- {
- ScoreConvertByLevelScoreIDList = ScoreConvertByLevelScoreIDs.SplitIDString();
- }
- else
- {
- ScoreConvertByLevelScoreIDList = null;
- }
- var dt = ScoreConvertByLevelServices.GetScoreConvertByLevelView_Excel(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID, coursematerialID, ScoreConvertByLevelScoreIDList).Select(x => new
- {
- x.SchoolyearCode,
- x.CollegeName,
- x.Year,
- x.StandardStr,
- x.ClassmajorName,
- x.LoginID,
- x.UserName,
- x.CourseCode,
- x.CourseName,
- x.ExaminationSubjectName,
- x.Score
- }).ToTable();
- string[] liststring = { "学年学期", EMIS.Utility.RSL.Get("College"),"年级", "专业", "班级名称", "学号","姓名","课程代码", "课程名称","科目名称", "成绩" };
- neh.Export(dt, liststring, "统一认定信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- }
|