using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.GraduationManage.GraduationRequirement; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.ViewModel.GraduationManage.GraduationRequirement; using Bowin.Common.Utility; using Bowin.Common.Data; using EMIS.Utility; namespace EMIS.Web.Controllers.GraduationManage.GraduationRequirement { [Authorization] public class GrademajorRequirementController : Controller { public IGrademajorRequirementServices GrademajorRequirementServices { get; set; } /// /// 类型学分页面(课程类型学分) /// /// public ActionResult List() { return View(); } /// /// 类型学分列表查询(课程类型学分) /// /// /// [HttpPost] public ActionResult List(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var gradSchoolyearID = pararms.getExtraGuid("GradSchoolyearDropdown"); var collegeID = pararms.getExtraGuid("CollegeDropdown"); var yearID = pararms.getExtraInt("SchoolyearDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("SchoolyearDictionaryDropDown"); var standardID = pararms.getExtraInt("StandardDictionaryDropDown") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardDictionaryDropDown"); var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation"); var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform"); var learnSystem = pararms.getExtraString("DictionaryLearnSystem"); return base.Json(GrademajorRequirementServices.GetGradGrademajorRequirementViewGird(configuretView, gradSchoolyearID, collegeID, yearID, standardID, educationID, learningformID, learnSystem, (int)pararms.page, (int)pararms.rows)); } /// /// 复制新增 /// /// /// public ActionResult CopyAdd(Guid graduationRequirementID) { GrademajorRequirementView grademajorRequirementView = new GrademajorRequirementView(); grademajorRequirementView = GrademajorRequirementServices.GetGradGrademajorRequirementView(graduationRequirementID); return View("Edit", grademajorRequirementView); } /// /// 复制新增 /// /// /// [HttpPost] public ActionResult CopyAdd(GrademajorRequirementView grademajorRequirementView) { grademajorRequirementView.GraduationRequirementID = Guid.Empty; return this.Edit(grademajorRequirementView); } /// /// 编辑(新增、修改,业务主键:年级专业) /// /// /// [HttpGet] public ActionResult Edit(Guid? graduationRequirementID) { GrademajorRequirementView grademajorRequirementView = new GrademajorRequirementView(); if (graduationRequirementID.HasValue && graduationRequirementID != Guid.Empty) { grademajorRequirementView = GrademajorRequirementServices.GetGradGrademajorRequirementView(graduationRequirementID); } return View(grademajorRequirementView); } /// /// 编辑(新增、修改,业务主键:年级专业) /// /// /// [HttpPost] public ActionResult Edit(GrademajorRequirementView grademajorRequirementView) { try { GrademajorRequirementServices.GradGrademajorRequirementEdit(grademajorRequirementView); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败,原因:" + ex.Message + "。" }); } } /// /// 删除 /// /// /// [HttpPost] public ActionResult Delete(string graduationRequirementIDs) { try { List list = graduationRequirementIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)) .Select(x => (Guid?)new Guid(x)).ToList(); GrademajorRequirementServices.GradGrademajorRequirementDelete(list); return base.Json("删除成功。"); } catch (Exception ex) { return base.Json("删除失败,原因:" + ex.Message); } } /// /// Excel导出 /// /// [HttpPost] public ActionResult Excel() { NpoiExcelHelper neh = new NpoiExcelHelper(); ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null); var gradSchoolyearID = Request.Form["GradSchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["GradSchoolyearDropdown"].ParseStrTo(); var collegeID = Request.Form["CollegeDropdown"].ParseStrTo(); var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo(); var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo(); var educationID = Request.Form["DictionaryEducation"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo(); var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo(); var learnSystem = Request.Form["DictionaryLearnSystem"].ToString(); var dt = GrademajorRequirementServices.GetGradGrademajorRequirementViewList(configuretView, gradSchoolyearID, collegeID, yearID, standardID, educationID, learningformID, learnSystem) .Select(x => new { x.GraduatingSemesterCode, x.GrademajorCode, x.GrademajorName, x.FacultymajorNo, x.FacultymajorName, x.CollegeNo, x.CollegeName, x.SchoolyearID, x.SchoolcodeName, x.EnteringSchoolYearCode, x.StandardID, x.StandardCode, x.StandardName, x.EducationName, x.LearningformName, x.LearnSystem, x.OptionalCourseCredit, x.RequiredCredit, x.TotalCredit, x.SpecialCredit }).ToTable(); string[] liststring = { "毕业学期", "年级专业编号", "年级专业名称", "院系专业编号", "院系专业名称", RSL.Get("CollegeCode"), RSL.Get("CollegeName"), "年级", "学期", "入学学年学期", "专业ID(Value)", "专业代码", "专业名称", RSL.Get("EducationID"), "学习形式", "学制", "选修学分", "必修学分", "总学分", "特定学分" }; neh.Export(dt, liststring, "毕业专业学分信息" + DateTime.Now.ToString("yyyyMMdd")); return Json(new ReturnMessage() { IsSuccess = true, Message = "导出成功。" }); } } }