123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- 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 Bowin.Common.JSON;
- using EMIS.Utility;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using EMIS.CommonLogic.CalendarManage;
- using EMIS.ViewModel.GraduationManage.GraduationRequirement;
- using EMIS.CommonLogic.GraduationManage.GraduationRequirement;
- namespace EMIS.Web.Controllers.GraduationManage.GraduationRequirement
- {
- [Authorization]
- public class GraduationCourseController : Controller
- {
- public IGraduationCourseServices GraduationCourseServices { get; set; }
- /// <summary>
- /// 毕业课程(毕业课程组)页面
- /// </summary>
- /// <returns></returns>
- public ActionResult List()
- {
- return View();
- }
- /// <summary>
- /// 毕业课程列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [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");
- //课程类型
- var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
- return base.Json(GraduationCourseServices.GetGraduationCourseViewGird(configuretView, gradSchoolyearID, collegeID, yearID,
- standardID, educationID, learningformID, learnSystem, courseTypeID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 计划生成(专业计划)
- /// </summary>
- /// <returns></returns>
- public ActionResult PlanCreate()
- {
- GraduationCourseView graduationCourseView = new GraduationCourseView();
- return View(graduationCourseView);
- }
- /// <summary>
- /// 计划生成(专业计划)
- /// </summary>
- /// <param name="graduationCourseView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult PlanCreate(GraduationCourseView graduationCourseView)
- {
- try
- {
- var gradSpecialtyPlanViewList = Request["SpecialtyPlan"].JsonToObject<List<GradSpecialtyPlanView>>();
- string result = GraduationCourseServices.GraduationCourseBatchAdd(graduationCourseView, gradSpecialtyPlanViewList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "生成成功" + result + "。"
- });
- }
- catch (Exception ex)
- {
- string mge = ex.Message;
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "生成失败,原因:" + ex.Message + "。"
- });
- }
- }
- /// <summary>
- /// 查询对应的专业计划信息(需与毕业课程信息进行对比)
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GraduationSpecialtyPlanList(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");
- var coursematerialID = pararms.getExtraGuid("CoursematerialComboGrid");
- //课程类型
- var courseTypeID = pararms.getExtraInt("DictionaryCourseType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryCourseType");
- return base.Json(GraduationCourseServices.GetGradSpecialtyPlanViewGrid(configuretView, gradSchoolyearID, collegeID, yearID,
- standardID, educationID, learningformID, learnSystem, coursematerialID, courseTypeID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="GraduationConditionPackageID"></param>
- /// <returns></returns>
- public ActionResult CopyAdd(Guid graduationCourseID)
- {
- GraduationCourseView graduationCourseView = new GraduationCourseView();
- graduationCourseView = GraduationCourseServices.GetGraduationCourseView(graduationCourseID);
- return View("Edit", graduationCourseView);
- }
- /// <summary>
- /// 复制新增
- /// </summary>
- /// <param name="graduationConditionPackageView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult CopyAdd(GraduationCourseView graduationCourseView)
- {
- graduationCourseView.GraduationCourseID = Guid.Empty;
- return this.Edit(graduationCourseView);
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:年级专业、课程信息、课程类型、课程学分)
- /// </summary>
- /// <param name="graduationCourseID"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult Edit(Guid? graduationCourseID)
- {
- GraduationCourseView graduationCourseView = new GraduationCourseView();
- if (graduationCourseID.HasValue && graduationCourseID != Guid.Empty)
- {
- graduationCourseView = GraduationCourseServices.GetGraduationCourseView(graduationCourseID);
- }
- return View(graduationCourseView);
- }
- /// <summary>
- /// 编辑(新增、修改,业务主键:年级专业、课程信息、课程类型、课程学分)
- /// </summary>
- /// <param name="graduationCourseView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(GraduationCourseView graduationCourseView)
- {
- try
- {
- GraduationCourseServices.GraduationCourseEdit(graduationCourseView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,原因:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="graduationCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string graduationCourseIDs)
- {
- try
- {
- List<Guid?> list = graduationCourseIDs.Split(',').Where(x => !string.IsNullOrEmpty(x))
- .Select(x => (Guid?)new Guid(x)).ToList();
- GraduationCourseServices.GraduationCourseDelete(list);
- return base.Json("删除成功。");
- }
- catch (Exception ex)
- {
- return base.Json("删除失败,原因:" + ex.Message);
- }
- }
- /// <summary>
- /// Excel导出
- /// </summary>
- /// <returns></returns>
- [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<Guid>();
- var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
- var yearID = Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["SchoolyearDictionaryDropDown"].ParseStrTo<int>();
- var standardID = Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["StandardDictionaryDropDown"].ParseStrTo<int>();
- var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
- var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
- var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
- //课程类型
- var courseTypeID = Request.Form["DictionaryCourseType"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryCourseType"].ParseStrTo<int>();
- var dt = GraduationCourseServices.GetGraduationCourseViewList(configuretView, gradSchoolyearID, collegeID, yearID,
- standardID, educationID, learningformID, learnSystem, courseTypeID)
- .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.CourseCode,
- x.CourseName,
- x.CourseTypeName,
- x.CourseCredit
- }).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 = "导出成功。"
- });
- }
-
- }
- }
|