123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.MinorManage.MinorPlanManage;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.ViewModel.MinorManage.MinorPlanManage;
- using Bowin.Common.Exceptions;
- using Bowin.Common.Utility;
- using EMIS.Utility;
- using Bowin.Common.Data;
- using Bowin.Common.JSON;
- namespace EMIS.Web.Controllers.MinorManage.MinorPlanManage
- {
- [Authorization]
- public class MinorSpecialtyPlanController : Controller
- {
- public IMinorSpecialtyPlanServices minorSpecialtyPlanServices { get; set; }
- //
- // GET: /MinorSpecialtyPlan/
-
- public ActionResult List()
- {
- return View();
- }
-
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var schoolYearID = pararms.getExtraGuid("SchoolyearDropdown");
- 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 coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
- var Schoolyear = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
- var schoolcodeID = pararms.getExtraInt("DictionarySchoolcode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolcode");
- var isEnable = pararms.getExtraInt("DictionaryIsEnable") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryIsEnable");
- return this.Json(minorSpecialtyPlanServices.GetMinorSpecialtyViewGrid(configuretView, schoolYearID, collegeID, yearID, standardID, coursematerialID, Schoolyear, schoolcodeID, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult Add()
- {
- return View();
- }
- /// <summary>
- /// 批量添加
- /// </summary>
- /// <param name="planApplicationView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Add(MinorSpecialtyPlanView minorSpecialtyPlanView)
- {
- try
- {
- var minorSpecialCourseViewList = Request["MinorSpecialtyCourse"].JsonToObject<List<MinorSpecialtyPlanView>>();
- if (minorSpecialCourseViewList.Count > 0)
- {
- minorSpecialtyPlanServices.MinorPlanAdd(minorSpecialtyPlanView, minorSpecialCourseViewList);
- }
- else
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败,请选择要添加的专业课程。"
- });
- }
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功!"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult MinorSpecialtyPlanStandardIDList(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var yearID = pararms.getExtraInt("YearID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("YearID");
- var list = minorSpecialtyPlanServices.GetStandardIDList(configuretView, yearID).Select(x => new
- {
- x.StandardID,
- x.SpecialtyCode,
- x.StandardName,
- x.StandardNameStr
- }).ToList();
- return Json(new { total = list.Count, rows = list });
- }
- /// <summary>
- /// 获取未申请过的辅修课程
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult StandardAndMinorSpecialtyCourseViewList(QueryParamsModel pararms)
- {
- var yearID = pararms.getExtraInt("YearID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("YearID");
- var standardID = pararms.getExtraInt("StandardID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardID");
- return this.Json(minorSpecialtyPlanServices.StandardAndMinorSpecialtyCourseViewGrid(yearID, standardID, (int)pararms.page, (int)pararms.rows));
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="MinorCourseID"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? MinorPlanID)
- {
- MinorSpecialtyPlanView minorSpecialtyPlanView = new MinorSpecialtyPlanView();
- if (MinorPlanID.HasValue)
- {
- minorSpecialtyPlanView = minorSpecialtyPlanServices.GetMinorSpecialtyView(MinorPlanID);
- }
- else
- {
- minorSpecialtyPlanView.ResultTypeID = (int)CF_ResultType.Percentage;
- minorSpecialtyPlanView.Credit = 0;
- minorSpecialtyPlanView.TheoryCourse = 0;
- minorSpecialtyPlanView.Practicehours = 0;
- minorSpecialtyPlanView.Trialhours = 0;
- minorSpecialtyPlanView.Totalhours = 0;
- minorSpecialtyPlanView.TheoryWeeklyNum = 0;
- minorSpecialtyPlanView.PracticeWeeklyNum = 0;
- minorSpecialtyPlanView.TrialWeeklyNum = 0;
- minorSpecialtyPlanView.SchoolweeksNum = 0;
- minorSpecialtyPlanView.WeeklyHours = 0;
- minorSpecialtyPlanView.WeeklyNum = 0;
- minorSpecialtyPlanView.IsEnable = true;
- }
- return View(minorSpecialtyPlanView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="minorSpecialtyCourseView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(MinorSpecialtyPlanView minorSpecialtyPlanView)
- {
- try
- {
- minorSpecialtyPlanServices.MinorSpecialtyCourseEdit(minorSpecialtyPlanView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 获取已经存在在授课方式
- /// </summary>
- /// <param name="MinorCourseID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TeachingModeType(Guid? MinorPlanID)
- {
- List<string> list = new List<string>();
- if (MinorPlanID.HasValue && MinorPlanID != Guid.Empty)
- list = minorSpecialtyPlanServices.GetTeachingModeType(MinorPlanID);
- else
- list.Add(((int)EMIS.ViewModel.CF_TeachingMode.Theory).ToString());
- return base.Json(list);
- }
- /// <summary>
- /// 获取已经存在在授课地点
- /// </summary>
- /// <param name="MinorCourseID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TeachingPlace(Guid? MinorPlanID)
- {
- List<string> list = new List<string>();
- if (MinorPlanID.HasValue && MinorPlanID != Guid.Empty)
- list = minorSpecialtyPlanServices.GetTeachingPlace(MinorPlanID);
- return base.Json(list);
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="MinorCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string MinorPlanIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < MinorPlanIDs.Split(',').Length; i++)
- {
- string id = MinorPlanIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid MinorPlanID = new Guid(id);
- list.Add(MinorPlanID);
- }
- }
- minorSpecialtyPlanServices.MinorPlanDelete(list);
- return base.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 base.Json("删除失败,原因:" + mge);
- }
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- var MinorPlanID = Request.Form["MinorPlanID"];
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- var schoolYearID = Request.Form["SchoolyearDropdown"].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 coursematerialID = Request.Form["CoursematerialIDDropdownGridBo"].ParseStrTo<Guid>();
- var Schoolyear = Request.Form["DictionarySchoolyear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolyear"].ParseStrTo<int>();
- var schoolcodeID = Request.Form["DictionarySchoolcode"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySchoolcode"].ParseStrTo<int>();
- List<Guid?> MinorPlanIDList = new List<Guid?>();
- if (MinorPlanID != "")
- {
- MinorPlanIDList = MinorPlanID.SplitIDString();
- }
- else
- {
- MinorPlanIDList = null;
- }
- var dt = minorSpecialtyPlanServices.GetMinorSpecialtyViewList(configuretView, schoolYearID, collegeID, yearID, standardID, coursematerialID, Schoolyear, schoolcodeID, MinorPlanIDList).Select(x => new
- {
- x.SchoolcodeStr,
- x.YearID,
- x.SpecialtyCode,
- x.StandardName,
- x.CourseCode,
- x.CourseName,
- x.CourseTypeName,
- x.Credit,
- x.TheoryCourse,
- x.Practicehours,
- x.Trialhours,
- x.Totalhours,
- x.SchoolyearNumName,
- x.SchoolcodeName,
- x.DepartmentName,
- x.CollegeName
- }).ToTable();
- string[] liststring = { "学年学期", "年级", "专业代码", "专业名称", "课程代码","课程名称",
- "课程类型","学分","理论学时","实践学时","实验学时","总学时","开课学年","开课学期","开课教研室","开课"+RSL.Get("College")};
- neh.Export(dt, liststring, "辅修计划信息");
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "导出成功。"
- });
- }
- [HttpPost]
- public ActionResult GetListByMinorSpecialtyID(QueryParamsModel pararms)
- {
- var MinorSpecialtyID = Request["MinorSpecialtyID"].ParseStrTo<Guid>();
- return this.Json(minorSpecialtyPlanServices.GetMinorSpecialtyViewByMinorSpecialtyIDGrid(MinorSpecialtyID, (int)pararms.page, (int)pararms.rows));
- }
- }
- }
|