123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- 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.CalendarManage;
- using EMIS.CommonLogic.EducationManage;
- using EMIS.ViewModel.EducationManage;
- using Bowin.Common.Exceptions;
- namespace EMIS.Web.Controllers.EducationManage
- {
- [Authorization]
- public class ExecutableMinorPlanController : Controller
- {
- //
- // GET: /ExecutableMinorPlan/
- public ISchoolYearServices SchoolYearServices { get; set; }
- public IExecutableMinorPlanServices ExecutableMinorPlanServices { get; set; }
- public ActionResult List()
- {
- var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
- ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
- return View();
- }
- /// <summary>
- /// 查询列表
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [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 schoolyearNum = pararms.getExtraInt("DictionarySchoolyear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolyear");
- var schoolcode = pararms.getExtraInt("DictionarySchoolcode") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySchoolcode");
- var approvalStatus = pararms.getExtraInt("ApprovalStatusDropdownList") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ApprovalStatusDropdownList");
- return Json(ExecutableMinorPlanServices.GetExecutableMinorPlanViewGrid(configuretView, schoolyearID, collegeID, yearID, standardID, coursematerialID, schoolyearNum, schoolcode, approvalStatus, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult GenerateExecutablePlan()
- {
- return View(new ExecutablePlanGenerateView());
- }
- [HttpPost]
- public ActionResult GenerateExecutablePlan(ExecutablePlanGenerateView executablePlanGenerateView)
- {
- try
- {
- ExecutableMinorPlanServices.GenerateExecutablePlan(executablePlanGenerateView.StandardID, executablePlanGenerateView.SchoolyearID, executablePlanGenerateView.IsOverwrite, executablePlanGenerateView.CampusID, executablePlanGenerateView.CollegeID, executablePlanGenerateView.YearID);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "操作成功。"
- });
- }
- catch (SuccessException ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = ex.Message
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "操作失败," + ex.Message
- });
- }
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="MinorCourseID"></param>
- /// <returns></returns>
- public ActionResult Edit(Guid? ExecutableMinorPlanID)
- {
- ExecutableMinorPlanView executableMinorPlanView = new ExecutableMinorPlanView();
- if (ExecutableMinorPlanID.HasValue)
- {
- executableMinorPlanView = ExecutableMinorPlanServices.GetExecutableMinorPlanView(ExecutableMinorPlanID);
- }
- else
- {
- executableMinorPlanView.ResultTypeID = (int)CF_ResultType.Percentage;
- executableMinorPlanView.Credit = 0;
- executableMinorPlanView.TheoryCourse = 0;
- executableMinorPlanView.Practicehours = 0;
- executableMinorPlanView.Trialhours = 0;
- executableMinorPlanView.Totalhours = 0;
- executableMinorPlanView.TheoryWeeklyNum = 0;
- executableMinorPlanView.PracticeWeeklyNum = 0;
- executableMinorPlanView.TrialWeeklyNum = 0;
- executableMinorPlanView.SchoolweeksNum = 0;
- executableMinorPlanView.WeeklyHours = 0;
- executableMinorPlanView.WeeklyNum = 0;
- }
- return View(executableMinorPlanView);
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="minorSpecialtyCourseView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Edit(ExecutableMinorPlanView executableMinorPlanView)
- {
- try
- {
- ExecutableMinorPlanServices.ExecutableMinorPlanEdit(executableMinorPlanView);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="MinorCourseIDs"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Delete(string ExecutableMinorPlanIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < ExecutableMinorPlanIDs.Split(',').Length; i++)
- {
- string id = ExecutableMinorPlanIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid ExecutableMinorPlanID = new Guid(id);
- list.Add(ExecutableMinorPlanID);
- }
- }
- ExecutableMinorPlanServices.ExecutableMinorPlanDelete(list);
- return Json(new ReturnMessage
- {
- IsSuccess = true,
- Message = "删除成功。"
- });
- }
- 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>
- /// 获取已经存在在授课方式
- /// </summary>
- /// <param name="MinorCourseID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult TeachingModeType(Guid? ExecutableMinorPlanID)
- {
- List<string> list = new List<string>();
- if (ExecutableMinorPlanID.HasValue && ExecutableMinorPlanID != Guid.Empty)
- list = ExecutableMinorPlanServices.GetTeachingModeType(ExecutableMinorPlanID);
- 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? ExecutableMinorPlanID)
- {
- List<string> list = new List<string>();
- if (ExecutableMinorPlanID.HasValue && ExecutableMinorPlanID != Guid.Empty)
- list = ExecutableMinorPlanServices.GetTeachingPlace(ExecutableMinorPlanID);
- return base.Json(list);
- }
- /// <summary>
- /// 生成任务班
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GenerateEducationMissionClassSubminit(string ExecutableMinorPlanIDs)
- {
- try
- {
- List<Guid?> list = new List<Guid?>();
- for (int i = 0; i < ExecutableMinorPlanIDs.Split(',').Length; i++)
- {
- string id = ExecutableMinorPlanIDs.Split(',')[i];
- if (!string.IsNullOrEmpty(id))
- {
- Guid ExecutableMinorPlanID = new Guid(id);
- list.Add(ExecutableMinorPlanID);
- }
- }
- ExecutableMinorPlanServices.GenerateEducationMissionClassOptionalCourse(list);
- return Json("成功");
- }
- catch (Exception ex)
- {
- return Json("生成教学任务班失败,原因:" + ex.Message);
- }
- }
- }
- }
|